use custom named file for crypto-js instead of cdn (blocked by adblockers)

pull/122/head
Robin Moisson 2018-02-19 19:34:49 +01:00
rodzic c7e1b5c3b4
commit 758e12440d
4 zmienionych plików z 6006 dodań i 7 usunięć

Wyświetl plik

@ -28,7 +28,7 @@ Staticrypt is available through npm as a CLI, install with `npm install -g stati
--help Show help [boolean] --help Show help [boolean]
--version Show version number [boolean] --version Show version number [boolean]
-e, --embed Whether or not to embed crypto-js in the page (or use an -e, --embed Whether or not to embed crypto-js in the page (or use an
external CDN) [boolean] [default: false] external CDN) [boolean] [default: true]
-o, --output File name / path for generated encrypted file -o, --output File name / path for generated encrypted file
[string] [default: null] [string] [default: null]
-t, --title Title for output HTML page -t, --title Title for output HTML page
@ -46,4 +46,6 @@ Example usages:
You can use a custom template for the password prompt - just copy `cli/password_template.html` and modify it to suit your presentation style and point to your template file with the `-f` flag. Be careful to not break the encrypting javascript part, the variables replaced by staticrypt are between curly brackets: `{instructions}`. You can use a custom template for the password prompt - just copy `cli/password_template.html` and modify it to suit your presentation style and point to your template file with the `-f` flag. Be careful to not break the encrypting javascript part, the variables replaced by staticrypt are between curly brackets: `{instructions}`.
**ADBLOCKERS**: If you do not embed crypto-js and serve it from a CDN, some adblockers see the `crypto-js.min.js`, think that's a crypto miner and block it.
Thanks [Aaron Coplan](https://github.com/AaronCoplan) for bringing the CLI to life ! Thanks [Aaron Coplan](https://github.com/AaronCoplan) for bringing the CLI to life !

Wyświetl plik

@ -140,7 +140,7 @@
</footer> </footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js" integrity="sha384-lp4k1VRKPU9eBnPePjnJ9M2RF3i7PC30gXs70+elCVfgwLwx1tv5+ctxdtwxqZa7" crossorigin="anonymous"></script> <script src="kryptojs-3.1.9-1-lib.js"></script>
<script> <script>
document.getElementById('staticrypt-form').addEventListener('submit', function(e) { document.getElementById('staticrypt-form').addEventListener('submit', function(e) {

Wyświetl plik

@ -122,7 +122,8 @@
<label class="no-style"> <label class="no-style">
<input type="checkbox" id="embed-crypto" checked> <input type="checkbox" id="embed-crypto" checked>
Embed crypto-js into your file Embed crypto-js into your file
<abbr title="Leave checked to include crypto-js into your file so you can decrypt it offline. Uncheck to load crypto-js from a CDN.">?</abbr> <abbr title="Leave checked to include crypto-js into your file so you can decrypt it offline.
Uncheck to load crypto-js from a CDN (some adblockers might think it's a crypto miner).">?</abbr>
</label> </label>
</div> </div>
@ -144,9 +145,12 @@ Your encrypted string</pre>
</div> </div>
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js" <!--
integrity="sha384-lp4k1VRKPU9eBnPePjnJ9M2RF3i7PC30gXs70+elCVfgwLwx1tv5+ctxdtwxqZa7" Crypto JS 3.1.9-1
crossorigin="anonymous"></script> Copied as is from https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.js
Filename changed to circumvent adblockers that mistake it for a crypto miner (see https://github.com/robinmoisson/staticrypt/issues/107)
-->
<script src="kryptojs-3.1.9-1-lib.js"></script>
<script src="https://cdn.ckeditor.com/4.7.0/standard/ckeditor.js"></script> <script src="https://cdn.ckeditor.com/4.7.0/standard/ckeditor.js"></script>
@ -187,7 +191,7 @@ Your encrypted string</pre>
*/ */
var setFileToDownloadWithEmbeddedCrypto = function (data) { var setFileToDownloadWithEmbeddedCrypto = function (data) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open('GET', 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js', true); request.open('GET', 'kryptojs-3.1.9-1-lib.js', true);
request.onload = function() { request.onload = function() {
data['crypto_tag'] = '<script>' + request.responseText + '</scr' + 'ipt>'; data['crypto_tag'] = '<script>' + request.responseText + '</scr' + 'ipt>';
setFileToDownload(data); setFileToDownload(data);

Plik diff jest za duży Load Diff