-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
148 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,3 @@ dist | |
*.map | ||
test-vault | ||
|
||
# tools | ||
src/tools/offline-decrypt.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,24 @@ | ||
import esbuild from "esbuild"; | ||
import process from "process"; | ||
//import builtins from 'builtin-modules'; | ||
import copyStaticFiles from 'esbuild-copy-static-files'; | ||
|
||
const prod = (process.argv[2] === 'production'); | ||
|
||
esbuild.build({ | ||
entryPoints: ['src/tools/offline-decrypt.ts'], | ||
bundle: true, | ||
external: [ | ||
// 'obsidian', | ||
// 'electron', | ||
// '@codemirror/autocomplete', | ||
// '@codemirror/collab', | ||
// '@codemirror/commands', | ||
// '@codemirror/language', | ||
// '@codemirror/lint', | ||
// '@codemirror/search', | ||
// '@codemirror/state', | ||
// '@codemirror/view', | ||
// '@lezer/common', | ||
// '@lezer/highlight', | ||
// '@lezer/lr', | ||
//...builtins | ||
], | ||
format: 'iife', | ||
watch: !prod, | ||
target: 'es2018', | ||
logLevel: "info", | ||
sourcemap: 'inline', | ||
treeShaking: false, | ||
minify: false, | ||
outfile: './src/tools/offline-decrypt.js', | ||
sourcemap: prod ? false : 'inline', | ||
treeShaking: prod, | ||
minify: prod, | ||
outfile: './tools/offline-decrypt.js', | ||
plugins:[ | ||
copyStaticFiles({ | ||
src: './src/tools/offline-decrypt.js', | ||
dest: './dist/tools/offline-decrypt.js', | ||
}), | ||
copyStaticFiles({ | ||
src: './src/tools/decrypt.html', | ||
dest: './dist/tools/decrypt.html', | ||
dest: './tools/decrypt.html', | ||
}), | ||
] | ||
}).catch(() => process.exit(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Decrypt Tool for Obsidian Meld Encrypt Plugin</title> | ||
<script src="offline-decrypt.js"></script> | ||
<style> | ||
:root{ | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
body{ | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
background-color: #eee; | ||
} | ||
|
||
h1{ | ||
text-align: center; | ||
} | ||
|
||
.row-500{ | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 500px; | ||
} | ||
|
||
.col{ | ||
display: flex; | ||
flex-direction: row; | ||
align-items: baseline; | ||
} | ||
|
||
label{ | ||
color: blue; | ||
margin-top: 1em; | ||
} | ||
|
||
textarea{ | ||
height: 5em; | ||
resize: vertical; | ||
padding: 0.5em; | ||
} | ||
|
||
button, input{ | ||
padding: 0.5em; | ||
} | ||
|
||
#pw{ | ||
margin-right: 1em; | ||
} | ||
|
||
#m{ | ||
margin-left: 1em; | ||
} | ||
|
||
.footnote{ | ||
margin-top: 4em; | ||
font-size: 0.8em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="row-500"> | ||
<h1>🔐 Decrypt Tool for Obsidian Meld Encrypt Plugin 🔐</h1> | ||
|
||
<p>Use this tool to decrypt notes without using the Obsidian Meld Encrypt Plugin.</p> | ||
|
||
<label for="et">Encrypted Text</label> | ||
<textarea id="et"></textarea> | ||
|
||
<label for="pw">Password</label> | ||
<div class="col"> | ||
<input id="pw" type="password"> | ||
<button id="btnDecrypt" type="button">🔓 Decrypt</button> | ||
<span id="m"></span> | ||
</div> | ||
|
||
<label for="dt">Decrypted Text</label> | ||
<textarea id="dt" readonly=""></textarea> | ||
|
||
<p class="footnote"><b>Note:</b> As an offline backup, you can save your own copy of this tool. Right click and choose 'Save link as' for: <a href="decrypt.html" download>this page</a> and the <a href="crypto-helper.js">decryptor code</a></p> | ||
|
||
</div> | ||
|
||
<script> | ||
document.getElementById('btnDecrypt').onclick = (ev) => decryptHandler(); | ||
|
||
async function decryptHandler(){ | ||
const eTextEncrypted = document.querySelector('#et'); | ||
const ePassword = document.querySelector('#pw'); | ||
const eTextDecrypted = document.querySelector('#dt'); | ||
const eMessage = document.querySelector('#m'); | ||
|
||
eMessage.innerHTML = ''; | ||
|
||
const result = await $.decrypt(eTextEncrypted.value, ePassword.value); | ||
|
||
if (result === null){ | ||
eMessage.innerHTML = '👎 Decryption failed'; | ||
eTextDecrypted.value = ''; | ||
}else{ | ||
eMessage.innerHTML = '👍 Decrypted'; | ||
eTextDecrypted.value = result | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,6 @@ | |
"2.1.1": "1.0.3", | ||
"2.1.2": "1.0.3", | ||
"2.1.3": "1.0.3", | ||
"2.2.0": "1.0.3" | ||
"2.2.0": "1.0.3", | ||
"2.3.0": "1.0.3" | ||
} |