generated from MuiseDestiny/zotero-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 49
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
1 parent
1c7aaf9
commit 1404dcd
Showing
21 changed files
with
30,948 additions
and
614 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
**/builds | ||
node_modules | ||
package-lock.json | ||
zotero-cmd.json | ||
zotero-cmd.json | ||
*-ignore.ts |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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
30,801 changes: 30,599 additions & 202 deletions
30,801
build/addon/chrome/content/scripts/zoteroreference.js
Large diffs are not rendered by default.
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
Binary file not shown.
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,44 @@ | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var { zip } = require("compressing"); | ||
const data = require('../package.json') | ||
var JavaScriptObfuscator = require('javascript-obfuscator'); | ||
|
||
const buildDir = __dirname.replace("scripts", "build") | ||
const outfile = path.join(buildDir, `addon/chrome/content/scripts/${data.config.addonRef}.js`) | ||
const option = { | ||
stringArray: true, | ||
stringArrayCallsTransform: true, | ||
stringArrayCallsTransformThreshold: 0.5, | ||
stringArrayEncoding: [], | ||
stringArrayIndexesType: [ | ||
'hexadecimal-number' | ||
], | ||
stringArrayIndexShift: true, | ||
stringArrayRotate: true, | ||
stringArrayShuffle: true, | ||
stringArrayWrappersCount: 1, | ||
stringArrayWrappersChainedCalls: true, | ||
stringArrayWrappersParametersMaxCount: 2, | ||
stringArrayWrappersType: 'variable', | ||
stringArrayThreshold: 0.75, | ||
disableConsoleOutput: true | ||
} | ||
setTimeout(async () => { | ||
setTimeout(() => fs.unlink(path.join(buildDir, `${data.name}.xpi`), (e) => { })) | ||
console.log("[1/4] Reading") | ||
const code = await fs.readFileSync(outfile, 'utf-8'); | ||
console.log("[2/4] Obfuscating") | ||
const obfuscatedCode = JavaScriptObfuscator.obfuscate(code, option).getObfuscatedCode() | ||
console.log("[3/4] Writing") | ||
await fs.writeFileSync(outfile, obfuscatedCode, 'utf-8'); | ||
console.log("[4/4] Compressing") | ||
await zip.compressDir( | ||
path.join(buildDir, "addon"), | ||
path.join(buildDir, `${data.name}-for-user.xpi`), | ||
{ | ||
ignoreBase: true, | ||
}, | ||
); | ||
console.log("Done") | ||
}) |
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
Oops, something went wrong.