Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sscotth committed Feb 7, 2018
0 parents commit 601c809
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 0 deletions.
Empty file added README.md
Empty file.
Binary file added images/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/19x19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/38x38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"manifest_version": 2,
"name": "Rclone decrypter",
"description": "This extension allows the user to decrypt filenames encrypted by Rclone.",
"version": "1.0",

"browser_action": {
"default_icon": {
"16": "/images/icons/16x16.png",
"19": "/images/icons/19x19.png",
"24": "/images/icons/24x24.png",
"32": "/images/icons/32x32.png",
"38": "/images/icons/38x38.png"
}
},
"options_page": "/src/options.html",
"content_scripts": [
{
"matches": ["https://drive.google.com/drive/*"],
"js": ["/lib/rclone-js/rclone.js", "/src/apps/gdrive.js"]
}
],
"icons": {
"16": "/images/icons/16x16.png",
"48": "/images/icons/48x48.png",
"128": "/images/icons/128x128.png"
},
"permissions": [
"storage"
]
}
24 changes: 24 additions & 0 deletions src/apps/gdrive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
chrome.storage.sync.get(['password', 'salt'], passwords => {

const decryptor = rclone.Rclone(passwords).then(o => o.Path.decryptName)

const decryptElement = (el) =>
decryptor.then(decrypt => {
el.innerText = decrypt(el.innerText)
el.classList.add('rclone-decrypted')
})

const FILE_NAMES = 'span[data-is-doc-name="true"]:not(.rclone-decrypted)'
const PARENT_FOLDERS = '[data-target="folder"]:not(.rclone-decrypted)'
const CURRENT_FOLDER = '[guidedhelpid="folder_path_button"] > div > div:not(.rclone-decrypted)'

const decryptAllFileAndFolderNames = () => document.querySelectorAll([FILE_NAMES, PARENT_FOLDERS, CURRENT_FOLDER].join(', ')).forEach(decryptElement)

const btn = document.createElement('button')
btn.classList.add('rclone-decrypt')
btn.innerText = 'Rclone Decrypt'
btn.addEventListener('click', decryptAllFileAndFolderNames)

document.querySelector('[aria-label="New"]').insertAdjacentElement('afterend', btn)

})
33 changes: 33 additions & 0 deletions src/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Rclone Decrypter</title>
<link rel="stylesheet" href="/lib/material-design-lite/material.light_blue-blue.min.css" />
<style>
body { margin: 0 20px; }
.mdl-textfield { width: 500px; }
</style>
</head>
<body>
<h1>Rclone file name decryptor</h1>
<h3>Enter passwords from <code>rclone.conf</code> to decrypt</h2>
<form>
<div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" id="password">
<label class="mdl-textfield__label" for="password">Password 1</label>
</div>
<div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" id="salt">
<label class="mdl-textfield__label" for="salt">Password 2 (Salt)</label>
</div>
</div>
<div class="submit">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Save</button>
</div>
</form>
<script src="/lib/material-design-lite/material.min.js"></script>
<script src="/options.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions src/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
document.addEventListener('DOMContentLoaded', () => {
restoreOptions()

document.querySelector('form').addEventListener('submit', evt => {
evt.preventDefault()
saveOptions(collectOptions(evt.target))
})
})

const collectOptions = form => ({
password: form.elements.password.value,
salt: form.elements.salt.value
})

const saveOptions = options => chrome.storage.sync.set(options)

const restoreOptions = () => chrome.storage.sync.get(['password', 'salt'],
({ password, salt }) => {
document.querySelector('#password').parentNode.MaterialTextfield.change(password)
document.querySelector('#salt').parentNode.MaterialTextfield.change(salt)
}
)

0 comments on commit 601c809

Please sign in to comment.