metadidomi-builder 1.5.2411250404 → 1.7.3101261533
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -776
- package/build_tools_py/build_nsis_installer.py +1054 -19
- package/build_tools_py/builder.py +3 -3
- package/build_tools_py/compile_launcher_with_entry.py +19 -271
- package/build_tools_py/launcher_integration.py +19 -189
- package/build_tools_py/pyMetadidomi/__pycache__/pyMetadidomi.cpython-311.pyc +0 -0
- package/build_tools_py/pyMetadidomi/pyMetadidomi.py +3 -3
- package/package.json +7 -5
- package/build_tools/backup-manager.js +0 -3
- package/build_tools/build_apk.js +0 -3
- package/build_tools/builder.js +0 -2
- package/build_tools/certs/cert-65198130.key +0 -1
- package/build_tools/certs/cert-65198130.pfx +0 -0
- package/build_tools/certs/cert-f1fad9b5.key +0 -1
- package/build_tools/certs/cert-f1fad9b5.pfx +0 -0
- package/build_tools/commands-help.js +0 -465
- package/build_tools/create-example-app.js +0 -73
- package/build_tools/decrypt_pfx_password.js +0 -26
- package/build_tools/diagnose-apk.js +0 -61
- package/build_tools/generate-icons.js +0 -3
- package/build_tools/generate-resources.js +0 -3
- package/build_tools/prune_modules.js +0 -147
- package/build_tools/restore-resources.js +0 -3
- package/build_tools/signing.js +0 -20
- package/build_tools/templates/bootstrap.template.js +0 -78
- package/build_tools/templates/default.ico +0 -1
- package/build_tools/templates/nsis_template.nsi +0 -380
- package/build_tools/templates/security_addons.js +0 -60
- package/build_tools/templates/sfx_config.txt.tpl +0 -5
- package/build_tools/test_sign_with_vendor.js +0 -35
- package/build_tools/upx_advanced.js +0 -68
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const _0x410fe2=_0x19eb;(function(_0x3ebdbc,_0x4b6369){const _0x37767b=_0x19eb,_0x4919df=_0x3ebdbc();while(!![]){try{const _0x1a5cb9=-parseInt(_0x37767b(0x153))/0x1+-parseInt(_0x37767b(0x13a))/0x2+-parseInt(_0x37767b(0x161))/0x3+parseInt(_0x37767b(0x15c))/0x4+parseInt(_0x37767b(0x150))/0x5*(parseInt(_0x37767b(0x172))/0x6)+parseInt(_0x37767b(0x188))/0x7+-parseInt(_0x37767b(0x154))/0x8;if(_0x1a5cb9===_0x4b6369)break;else _0x4919df['push'](_0x4919df['shift']());}catch(_0x174956){_0x4919df['push'](_0x4919df['shift']());}}}(_0x357e,0x80f9f));const fs=require('fs'),path=require(_0x410fe2(0x166)),readline=require(_0x410fe2(0x17c));let projectDir=null;if(process[_0x410fe2(0x15a)][0x2])projectDir=path[_0x410fe2(0x167)](process[_0x410fe2(0x15a)][0x2]);else{if(process[_0x410fe2(0x16d)][_0x410fe2(0x18a)])projectDir=path['resolve'](process[_0x410fe2(0x16d)]['PROJECT_PATH']);else{const defaultPaths=[path['join'](__dirname,'..','..',_0x410fe2(0x13e)),path[_0x410fe2(0x167)](_0x410fe2(0x13e))];for(const checkPath of defaultPaths){if(checkPath&&fs[_0x410fe2(0x14c)](checkPath)&&fs[_0x410fe2(0x14c)](path[_0x410fe2(0x182)](checkPath,'app-config.json'))){projectDir=checkPath;break;}}}}(!projectDir||!fs[_0x410fe2(0x14c)](projectDir))&&(console[_0x410fe2(0x184)](_0x410fe2(0x15e)),process[_0x410fe2(0x151)](0x1));const BACKUP_DIR=path[_0x410fe2(0x182)](projectDir,_0x410fe2(0x13d)),rl=readline['createInterface']({'input':process[_0x410fe2(0x179)],'output':process[_0x410fe2(0x17e)]});!fs[_0x410fe2(0x14c)](BACKUP_DIR)&&fs['mkdirSync'](BACKUP_DIR,{'recursive':!![]});function listBackups(){const _0x249f7=_0x410fe2;if(!fs[_0x249f7(0x14c)](BACKUP_DIR))return console[_0x249f7(0x177)](_0x249f7(0x185)),[];const _0x50a416=fs['readdirSync'](BACKUP_DIR)[_0x249f7(0x162)](_0x5e1a69=>fs[_0x249f7(0x13b)](path['join'](BACKUP_DIR,_0x5e1a69))[_0x249f7(0x178)]())[_0x249f7(0x14b)]()['reverse']()[_0x249f7(0x186)](_0x33d2e5=>{const _0x3e4296=_0x249f7,_0x4826ef=path[_0x3e4296(0x182)](BACKUP_DIR,_0x33d2e5),_0x9d05c5=path[_0x3e4296(0x182)](_0x4826ef,_0x3e4296(0x14a));let _0x321281={'timestamp':_0x33d2e5,'files':[],'app':{}};if(fs[_0x3e4296(0x14c)](_0x9d05c5))try{_0x321281=JSON[_0x3e4296(0x148)](fs['readFileSync'](_0x9d05c5,_0x3e4296(0x137)));}catch(_0x3534ae){}return{'folder':_0x33d2e5,'timestamp':_0x321281[_0x3e4296(0x155)],'date':new Date(_0x321281['timestamp'])[_0x3e4296(0x16b)](_0x3e4296(0x18f)),'app':_0x321281[_0x3e4296(0x13f)]||{},'files':_0x321281['files']||[],'size':getDirectorySize(_0x4826ef)};});return _0x50a416;}function getDirectorySize(_0x134ec8){const _0x5c6b1a=_0x410fe2;let _0x369a0e=0x0;const _0x335ad5=fs[_0x5c6b1a(0x14d)](_0x134ec8);for(const _0x4e6df6 of _0x335ad5){const _0x2b42e5=path[_0x5c6b1a(0x182)](_0x134ec8,_0x4e6df6),_0x150b1a=fs['statSync'](_0x2b42e5);_0x150b1a[_0x5c6b1a(0x178)]()?_0x369a0e+=getDirectorySize(_0x2b42e5):_0x369a0e+=_0x150b1a[_0x5c6b1a(0x16f)];}return _0x369a0e;}function _0x19eb(_0x4e98ac,_0x3147df){const _0x357e25=_0x357e();return _0x19eb=function(_0x19eb0a,_0x59b763){_0x19eb0a=_0x19eb0a-0x136;let _0x2a8099=_0x357e25[_0x19eb0a];return _0x2a8099;},_0x19eb(_0x4e98ac,_0x3147df);}function formatSize(_0x3d689e){const _0x5071f1=_0x410fe2;if(_0x3d689e===0x0)return'0\x20B';const _0x5d109a=0x400,_0x35f941=['B','KB','MB','GB'],_0x517863=Math[_0x5071f1(0x173)](Math[_0x5071f1(0x177)](_0x3d689e)/Math['log'](_0x5d109a));return parseFloat((_0x3d689e/Math[_0x5071f1(0x187)](_0x5d109a,_0x517863))[_0x5071f1(0x175)](0x2))+'\x20'+_0x35f941[_0x517863];}function _0x357e(){const _0x417712=['toUpperCase','date','path','resolve','\x0a⚠\x20ATTENTION:\x20Supprimer\x20TOUS\x20les\x20backups?\x20(OUI/non):\x20','OUI','close','toLocaleString','files','env','readFileSync','size','\x0a✗\x20Erreur\x20lors\x20de\x20la\x20suppression:\x20','\x20\x20[L]\x20Rafraîchir\x20la\x20liste','12qKGxOQ','floor','\x0aNuméro\x20invalide!\x0a','toFixed','\x0a✗\x20Erreur\x20lors\x20de\x20la\x20restauration:\x20','log','isDirectory','stdin','dirname','message','readline','\x0aSuppression\x20annulée.\x0a','stdout','\x0aNuméro\x20du\x20backup\x20à\x20restaurer\x20(ou\x20Q\x20pour\x20annuler):\x20','length','description','join','═══════════════════════════════════════════════════════════════\x0a','error','Aucun\x20backup\x20trouvé.','map','pow','1072169YCdBOP','packageName','PROJECT_PATH','forEach','name','folder','\x20\x20[D]\x20Supprimer\x20un\x20backup','fr-FR','\x0aNuméro\x20du\x20backup\x20à\x20supprimer\x20(ou\x20Q\x20pour\x20annuler):\x20','utf-8','Choisir\x20une\x20option\x20(R/D/C/L/Q):\x20','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20║','406628UkivQy','statSync','\x0a✓\x20Tous\x20les\x20backups\x20ont\x20été\x20supprimés!\x0a','.backup','MyApp','app','basename','question','version','\x0a✓\x20Backup\x20supprimé\x20avec\x20succès!\x0a','\x0aAucun\x20backup\x20à\x20supprimer.\x0a','split','Options:','mkdirSync','parse','\x20\x20\x20\x20Taille:\x20','metadata.json','sort','existsSync','readdirSync','\x0aConfirmer\x20la\x20suppression\x20de\x20','Aucun\x20backup\x20disponible.\x0a','9155WHDZXI','exit','\x20\x20[Q]\x20Quitter','258111QQowKW','425344NgSwdS','timestamp','\x20\x20\x20\x20Fichiers:\x20','clear','╔════════════════════════════════════════════════════════════════╗','\x20\x20\x20\x20Dossier:\x20','argv','?\x20(OUI/non):\x20','3831580QoneZc','Backups\x20disponibles\x20(du\x20plus\x20récent\x20au\x20plus\x20ancien):\x0a','ERREUR:\x20Dossier\x20du\x20projet\x20non\x20trouvé!','═══════════════════════════════════════════════════════════════','\x0aAu\x20revoir!','215532eJyJrs','filter','rmSync'];_0x357e=function(){return _0x417712;};return _0x357e();}function displayBackups(){const _0x5a3488=_0x410fe2;console[_0x5a3488(0x157)](),console['log'](_0x5a3488(0x158)),console[_0x5a3488(0x177)]('║\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20GESTIONNAIRE\x20DE\x20BACKUPS\x20-\x20'+projectDir[_0x5a3488(0x145)]('\x5c')['pop']()+_0x5a3488(0x139)),console[_0x5a3488(0x177)]('╚════════════════════════════════════════════════════════════════╝\x0a');const _0x512909=listBackups();if(_0x512909['length']===0x0){console[_0x5a3488(0x177)](_0x5a3488(0x14f)),showMenu();return;}console[_0x5a3488(0x177)](_0x5a3488(0x15d)),_0x512909[_0x5a3488(0x18b)]((_0x1c72a4,_0x1d7298)=>{const _0x26d617=_0x5a3488;console[_0x26d617(0x177)]('['+_0x1d7298+']\x20'+_0x1c72a4[_0x26d617(0x165)]),console[_0x26d617(0x177)](_0x26d617(0x159)+_0x1c72a4[_0x26d617(0x18d)]),_0x1c72a4[_0x26d617(0x13f)]&&_0x1c72a4[_0x26d617(0x13f)][_0x26d617(0x18c)]&&(console[_0x26d617(0x177)]('\x20\x20\x20\x20App:\x20'+_0x1c72a4[_0x26d617(0x13f)][_0x26d617(0x18c)]+'\x20v'+_0x1c72a4[_0x26d617(0x13f)][_0x26d617(0x142)]),console[_0x26d617(0x177)]('\x20\x20\x20\x20Description:\x20'+_0x1c72a4['app'][_0x26d617(0x181)]),console['log']('\x20\x20\x20\x20Package:\x20'+_0x1c72a4['app'][_0x26d617(0x189)])),console[_0x26d617(0x177)](_0x26d617(0x149)+formatSize(_0x1c72a4[_0x26d617(0x16f)])),_0x1c72a4[_0x26d617(0x16c)][_0x26d617(0x180)]>0x0&&console[_0x26d617(0x177)](_0x26d617(0x156)+_0x1c72a4[_0x26d617(0x16c)][_0x26d617(0x182)](',\x20')),console[_0x26d617(0x177)]();}),showMenu(_0x512909);}function showMenu(_0x5886ae=[]){const _0x24ee9f=_0x410fe2;console['log'](_0x24ee9f(0x15f)),console[_0x24ee9f(0x177)](_0x24ee9f(0x146)),console[_0x24ee9f(0x177)]('\x20\x20[R]\x20Restaurer\x20un\x20backup'),console[_0x24ee9f(0x177)](_0x24ee9f(0x18e)),console[_0x24ee9f(0x177)]('\x20\x20[C]\x20Tout\x20supprimer\x20(ATTENTION!)'),console['log'](_0x24ee9f(0x171)),console[_0x24ee9f(0x177)](_0x24ee9f(0x152)),console[_0x24ee9f(0x177)](_0x24ee9f(0x183)),rl[_0x24ee9f(0x141)](_0x24ee9f(0x138),_0x541873=>{const _0x56be2e=_0x24ee9f,_0x100e2f=_0x541873[_0x56be2e(0x164)]();switch(_0x100e2f){case'R':restoreBackup(_0x5886ae);break;case'D':deleteBackup(_0x5886ae);break;case'C':deleteAllBackups();break;case'L':displayBackups();break;case'Q':console[_0x56be2e(0x177)](_0x56be2e(0x160)),rl[_0x56be2e(0x16a)]();break;default:console[_0x56be2e(0x177)]('\x0aOption\x20invalide!\x0a'),displayBackups();}});}function restoreBackup(_0x80a798){const _0x8d271b=_0x410fe2;if(_0x80a798[_0x8d271b(0x180)]===0x0){console[_0x8d271b(0x177)]('\x0aAucun\x20backup\x20à\x20restaurer.\x0a'),displayBackups();return;}rl[_0x8d271b(0x141)](_0x8d271b(0x17f),_0x3b0d62=>{const _0x33eb38=_0x8d271b;if(_0x3b0d62['toUpperCase']()==='Q'){displayBackups();return;}const _0x5b99c6=parseInt(_0x3b0d62);if(isNaN(_0x5b99c6)||_0x5b99c6<0x0||_0x5b99c6>=_0x80a798[_0x33eb38(0x180)]){console[_0x33eb38(0x177)](_0x33eb38(0x174)),displayBackups();return;}const _0xb692a5=_0x80a798[_0x5b99c6];rl[_0x33eb38(0x141)]('\x0aConfirmer\x20la\x20restauration\x20de\x20'+_0xb692a5['date']+_0x33eb38(0x15b),_0x397804=>{const _0x4af7fa=_0x33eb38;if(_0x397804[_0x4af7fa(0x164)]()!==_0x4af7fa(0x169)&&_0x397804[_0x4af7fa(0x164)]()!=='O'){console[_0x4af7fa(0x177)]('\x0aRestauration\x20annulée.\x0a'),displayBackups();return;}try{const _0x426d2f=path[_0x4af7fa(0x182)](BACKUP_DIR,_0xb692a5[_0x4af7fa(0x18d)]),_0x515887=path['join'](_0x426d2f,'meta.json'),_0x28813e=JSON[_0x4af7fa(0x148)](fs[_0x4af7fa(0x16e)](_0x515887,'utf-8'));for(const _0x41409a of _0x28813e[_0x4af7fa(0x16c)]){const _0x1e97a4=path[_0x4af7fa(0x182)](_0x426d2f,path[_0x4af7fa(0x140)](_0x41409a));if(fs['existsSync'](_0x1e97a4)){const _0x29b4fb=path[_0x4af7fa(0x182)](projectDir,_0x41409a),_0x29d9ad=path[_0x4af7fa(0x17a)](_0x29b4fb);!fs[_0x4af7fa(0x14c)](_0x29d9ad)&&fs[_0x4af7fa(0x147)](_0x29d9ad,{'recursive':!![]}),fs['copyFileSync'](_0x1e97a4,_0x29b4fb),console[_0x4af7fa(0x177)]('✓\x20Restauré:\x20'+_0x41409a);}}console[_0x4af7fa(0x177)]('\x0a✓\x20Backup\x20restauré\x20avec\x20succès!\x0a'),displayBackups();}catch(_0x53ed51){console[_0x4af7fa(0x184)](_0x4af7fa(0x176)+_0x53ed51[_0x4af7fa(0x17b)]+'\x0a'),displayBackups();}});});}function deleteBackup(_0x7559e1){const _0x299f37=_0x410fe2;if(_0x7559e1[_0x299f37(0x180)]===0x0){console[_0x299f37(0x177)](_0x299f37(0x144)),displayBackups();return;}rl['question'](_0x299f37(0x136),_0x34a50d=>{const _0x22806c=_0x299f37;if(_0x34a50d['toUpperCase']()==='Q'){displayBackups();return;}const _0x47d32d=parseInt(_0x34a50d);if(isNaN(_0x47d32d)||_0x47d32d<0x0||_0x47d32d>=_0x7559e1['length']){console['log']('\x0aNuméro\x20invalide!\x0a'),displayBackups();return;}const _0x44a7d9=_0x7559e1[_0x47d32d];rl[_0x22806c(0x141)](_0x22806c(0x14e)+_0x44a7d9['date']+_0x22806c(0x15b),_0x38acc4=>{const _0x5a447a=_0x22806c;if(_0x38acc4['toUpperCase']()!==_0x5a447a(0x169)&&_0x38acc4['toUpperCase']()!=='O'){console['log'](_0x5a447a(0x17d)),displayBackups();return;}try{const _0x319efc=path[_0x5a447a(0x182)](BACKUP_DIR,_0x44a7d9[_0x5a447a(0x18d)]);fs[_0x5a447a(0x163)](_0x319efc,{'recursive':!![],'force':!![]}),console[_0x5a447a(0x177)](_0x5a447a(0x143)),displayBackups();}catch(_0x369ec1){console[_0x5a447a(0x184)](_0x5a447a(0x170)+_0x369ec1[_0x5a447a(0x17b)]+'\x0a'),displayBackups();}});});}function deleteAllBackups(){const _0x3933fc=_0x410fe2;rl[_0x3933fc(0x141)](_0x3933fc(0x168),_0x5d8659=>{const _0xb67208=_0x3933fc;if(_0x5d8659['toUpperCase']()!==_0xb67208(0x169)&&_0x5d8659[_0xb67208(0x164)]()!=='O'){console[_0xb67208(0x177)]('\x0aSuppression\x20annulée.\x0a'),displayBackups();return;}rl[_0xb67208(0x141)]('CONFIRMER:\x20Taper\x20\x22JE\x20SUIS\x20SÛR\x22\x20pour\x20continuer:\x20',_0x5ebc15=>{const _0x150371=_0xb67208;if(_0x5ebc15!=='JE\x20SUIS\x20SÛR'){console['log'](_0x150371(0x17d)),displayBackups();return;}try{fs['existsSync'](BACKUP_DIR)&&(fs[_0x150371(0x163)](BACKUP_DIR,{'recursive':!![],'force':!![]}),fs[_0x150371(0x147)](BACKUP_DIR,{'recursive':!![]})),console[_0x150371(0x177)](_0x150371(0x13c)),displayBackups();}catch(_0x81f3d5){console[_0x150371(0x184)](_0x150371(0x170)+_0x81f3d5[_0x150371(0x17b)]+'\x0a'),displayBackups();}});});}displayBackups();
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// (cherche dépendances inutilisées et modifie package.json pour exclure avant packaging
|
|
2
|
-
// Usage: node build_tools/prune_modules.js --path=./app_src
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const depcheck = require('depcheck');
|
|
6
|
-
const argv = require('minimist')(process.argv.slice(2));
|
|
7
|
-
const appPath = path.resolve(argv.path || './app_src');
|
|
8
|
-
const projectRoot = path.resolve('.');
|
|
9
|
-
|
|
10
|
-
(async function(){
|
|
11
|
-
console.log('Running depcheck on', appPath);
|
|
12
|
-
// Modules Electron essentiels (toujours conservés)
|
|
13
|
-
const electronCoreModules = [
|
|
14
|
-
'electron',
|
|
15
|
-
'@electron/remote',
|
|
16
|
-
'electron-store' // Pour la persistance des données
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
// Modules Node.js essentiels
|
|
20
|
-
const nodeCoreModules = [
|
|
21
|
-
'crypto',
|
|
22
|
-
'fs',
|
|
23
|
-
'path',
|
|
24
|
-
'child_process',
|
|
25
|
-
'os',
|
|
26
|
-
'events',
|
|
27
|
-
'stream',
|
|
28
|
-
'util'
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
// Modules Electron optionnels (à vérifier usage réel)
|
|
32
|
-
const electronOptionalModules = [
|
|
33
|
-
'electron-log', // Logging
|
|
34
|
-
'electron-updater', // Auto-update
|
|
35
|
-
'electron-window-state', // Gestion état fenêtre
|
|
36
|
-
'electron-reload', // Hot reload
|
|
37
|
-
'electron-devtools-installer',
|
|
38
|
-
'electron-debug',
|
|
39
|
-
'electron-context-menu',
|
|
40
|
-
'electron-localshortcut'
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
// Fonction pour vérifier si un module est utilisé dans le code
|
|
44
|
-
const checkModuleUsage = (content, moduleName) => {
|
|
45
|
-
const patterns = [
|
|
46
|
-
new RegExp(`require\\(['"]${moduleName}['"]\\)`),
|
|
47
|
-
new RegExp(`import .* from ['"]${moduleName}['"]`),
|
|
48
|
-
new RegExp(`require\\.resolve\\(['"]${moduleName}['"]\\)`),
|
|
49
|
-
// Cherche aussi les sous-modules (ex: electron.app, electron.BrowserWindow)
|
|
50
|
-
new RegExp(`(?:require\\(['"]${moduleName}['"]\\)|import .* from ['"]${moduleName}['"]).*\\.(\\w+)`)
|
|
51
|
-
];
|
|
52
|
-
return patterns.some(pattern => pattern.test(content));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const dynamicModules = [
|
|
56
|
-
...electronCoreModules,
|
|
57
|
-
...nodeCoreModules,
|
|
58
|
-
'bytenode' // Pour la compilation en bytecode
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
const options = {
|
|
62
|
-
ignoreDirs: ['test', 'tests', 'vendor'],
|
|
63
|
-
detectors: [
|
|
64
|
-
depcheck.detector.requireCallExpression,
|
|
65
|
-
depcheck.detector.importDeclaration,
|
|
66
|
-
depcheck.detector.exportDeclaration,
|
|
67
|
-
// Détecteur personnalisé pour electron et ses sous-modules
|
|
68
|
-
content => {
|
|
69
|
-
const electronApis = new Set();
|
|
70
|
-
const electronApiPattern = /(?:require\(['"]electron['"]\)|import .* from ['"]electron['"]).*\.([\w]+)/g;
|
|
71
|
-
let match;
|
|
72
|
-
|
|
73
|
-
// Collecter tous les APIs Electron utilisés
|
|
74
|
-
while ((match = electronApiPattern.exec(content)) !== null) {
|
|
75
|
-
electronApis.add(match[1]);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Logger les APIs Electron trouvés
|
|
79
|
-
if (electronApis.size > 0) {
|
|
80
|
-
console.log('APIs Electron utilisés:', Array.from(electronApis));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Vérifier l'utilisation des modules optionnels
|
|
84
|
-
const usedOptional = electronOptionalModules.filter(module =>
|
|
85
|
-
checkModuleUsage(content, module)
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
if (usedOptional.length > 0) {
|
|
89
|
-
console.log('Modules Electron optionnels utilisés:', usedOptional);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return [...electronApis, ...usedOptional];
|
|
93
|
-
},
|
|
94
|
-
// Détecteur pour require.resolve()
|
|
95
|
-
content => {
|
|
96
|
-
const requires = [];
|
|
97
|
-
const regex = /require\.resolve\(['"]([^'"]+)['"]\)/g;
|
|
98
|
-
let match;
|
|
99
|
-
while ((match = regex.exec(content)) !== null) {
|
|
100
|
-
requires.push(match[1]);
|
|
101
|
-
}
|
|
102
|
-
return requires;
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
ignorePatterns: ['*.jsc', '*.obf.js']
|
|
106
|
-
};
|
|
107
|
-
depcheck(projectRoot, options, (unused) => {
|
|
108
|
-
console.log('Dependencies used:', Object.keys(unused.using).length);
|
|
109
|
-
if (unused.dependencies && unused.dependencies.length) {
|
|
110
|
-
console.log('Unused dependencies found:', unused.dependencies);
|
|
111
|
-
// Générer un rapport détaillé sans supprimer
|
|
112
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot,'package.json'),'utf8'));
|
|
113
|
-
const actuallyUnused = unused.dependencies.filter(dep => {
|
|
114
|
-
if (dynamicModules.includes(dep)) return false;
|
|
115
|
-
if (electronOptionalModules.includes(dep)) {
|
|
116
|
-
const isUsed = Object.keys(unused.using).some(file =>
|
|
117
|
-
checkModuleUsage(fs.readFileSync(file, 'utf8'), dep)
|
|
118
|
-
);
|
|
119
|
-
if (isUsed) return false;
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
return true;
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const report = [];
|
|
126
|
-
report.push('=== Rapport d\'analyse des dépendances (Electron Lite) ===\n');
|
|
127
|
-
report.push('Modules inclus (utilisés ou essentiels):');
|
|
128
|
-
const included = Object.keys(pkg.dependencies).filter(dep => !actuallyUnused.includes(dep));
|
|
129
|
-
included.forEach(dep => report.push(` - ${dep}`));
|
|
130
|
-
report.push('\nModules exclus (non utilisés, à ignorer pour un build lite):');
|
|
131
|
-
actuallyUnused.forEach(dep => report.push(` - ${dep}`));
|
|
132
|
-
report.push('\nDétail:');
|
|
133
|
-
report.push(' Modules Electron essentiels: ' + electronCoreModules.join(', '));
|
|
134
|
-
report.push(' Modules Node.js essentiels: ' + nodeCoreModules.join(', '));
|
|
135
|
-
report.push(' Modules Electron optionnels: ' + electronOptionalModules.join(', '));
|
|
136
|
-
report.push('\nCe rapport est informatif. Aucun module n\'a été supprimé automatiquement.');
|
|
137
|
-
const reportPath = path.join(projectRoot, 'electron-lite-deps-report.txt');
|
|
138
|
-
fs.writeFileSync(reportPath, report.join('\n'));
|
|
139
|
-
console.log(`\n[prune_modules] Rapport généré: ${reportPath}`);
|
|
140
|
-
} else {
|
|
141
|
-
console.log('No unused dependencies found by depcheck.');
|
|
142
|
-
const reportPath = path.join(projectRoot, 'electron-lite-deps-report.txt');
|
|
143
|
-
fs.writeFileSync(reportPath, 'Aucune dépendance inutilisée détectée.');
|
|
144
|
-
console.log(`[prune_modules] Rapport généré: ${reportPath}`);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
})();
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const _0x2e84c0=_0x28fe;(function(_0xa781a0,_0x45b67d){const _0x294bac=_0x28fe,_0x599fa9=_0xa781a0();while(!![]){try{const _0x169017=-parseInt(_0x294bac(0x143))/0x1*(parseInt(_0x294bac(0x18c))/0x2)+-parseInt(_0x294bac(0x157))/0x3*(parseInt(_0x294bac(0x175))/0x4)+-parseInt(_0x294bac(0x15e))/0x5+parseInt(_0x294bac(0x184))/0x6+parseInt(_0x294bac(0x14e))/0x7*(parseInt(_0x294bac(0x17b))/0x8)+-parseInt(_0x294bac(0x15b))/0x9+-parseInt(_0x294bac(0x164))/0xa*(-parseInt(_0x294bac(0x178))/0xb);if(_0x169017===_0x45b67d)break;else _0x599fa9['push'](_0x599fa9['shift']());}catch(_0x10282c){_0x599fa9['push'](_0x599fa9['shift']());}}}(_0x2718,0x788e8));const fs=require('fs'),path=require(_0x2e84c0(0x13d)),readline=require('readline');let projectDir=null;if(process[_0x2e84c0(0x18a)][0x2])projectDir=path[_0x2e84c0(0x132)](process[_0x2e84c0(0x18a)][0x2]);else{if(process['env'][_0x2e84c0(0x133)])projectDir=path['resolve'](process['env'][_0x2e84c0(0x133)]);else{const defaultPaths=[path[_0x2e84c0(0x14c)](__dirname,'..','..',_0x2e84c0(0x166)),path[_0x2e84c0(0x132)]('MyApp')];for(const checkPath of defaultPaths){if(checkPath&&fs[_0x2e84c0(0x17f)](checkPath)&&fs[_0x2e84c0(0x17f)](path[_0x2e84c0(0x14c)](checkPath,_0x2e84c0(0x189)))){projectDir=checkPath;break;}}}}(!projectDir||!fs[_0x2e84c0(0x17f)](projectDir))&&(console['error'](_0x2e84c0(0x137)),process[_0x2e84c0(0x17d)](0x1));function _0x2718(){const _0x265fd4=['floor','8260731qQgSVI','mkdirSync','CONFIRMER:\x20Taper\x20\x22JE\x20SUIS\x20SÛR\x22\x20pour\x20continuer:\x20','3814480FpRKXG','readFileSync','Aucun\x20backup\x20disponible.\x0a','filter','\x0a✓\x20Backup\x20restauré\x20avec\x20succès!\x0a','\x0a✓\x20Tous\x20les\x20backups\x20ont\x20été\x20supprimés!\x0a','20aHMULl','size','MyApp','\x0aAucun\x20backup\x20à\x20supprimer.\x0a','close','stdout','OUI','isDirectory','JE\x20SUIS\x20SÛR','fr-FR','folder','\x0aSuppression\x20annulée.\x0a','═══════════════════════════════════════════════════════════════','\x0a✓\x20Backup\x20supprimé\x20avec\x20succès!\x0a','\x0aConfirmer\x20la\x20restauration\x20de\x20','version','pop','17164dECQbB','packageName','meta.json','8638861pmRpHW','\x20\x20[D]\x20Supprimer\x20un\x20backup','copyFileSync','523144JsKRDy','✓\x20Restauré:\x20','exit','description','existsSync','message','\x20\x20\x20\x20Taille:\x20','error','stdin','4535952NPUizX','toUpperCase','statSync','\x20\x20\x20\x20Fichiers:\x20','\x20\x20\x20\x20Dossier:\x20','app-config.json','argv','question','604ZSgIKJ','╔════════════════════════════════════════════════════════════════╗','\x20\x20\x20\x20Description:\x20','Aucun\x20backup\x20trouvé.','length','clear','rmSync','date','\x20\x20[Q]\x20Quitter','utf-8','═══════════════════════════════════════════════════════════════\x0a','readdirSync','resolve','PROJECT_PATH','╚════════════════════════════════════════════════════════════════╝\x0a','toLocaleString','\x0a⚠\x20ATTENTION:\x20Supprimer\x20TOUS\x20les\x20backups?\x20(OUI/non):\x20','ERREUR:\x20Dossier\x20du\x20projet\x20non\x20trouvé!','0\x20B','parse','toFixed','name','\x0aNuméro\x20du\x20backup\x20à\x20supprimer\x20(ou\x20Q\x20pour\x20annuler):\x20','path','\x20\x20[C]\x20Tout\x20supprimer\x20(ATTENTION!)','createInterface','\x0aOption\x20invalide!\x0a','split','\x0aNuméro\x20invalide!\x0a','1849OIWUrD','files','reverse','\x20\x20[L]\x20Rafraîchir\x20la\x20liste','\x0a✗\x20Erreur\x20lors\x20de\x20la\x20suppression:\x20','basename','Backups\x20disponibles\x20(du\x20plus\x20récent\x20au\x20plus\x20ancien):\x0a','log','timestamp','join','\x0aAucun\x20backup\x20à\x20restaurer.\x0a','49iYFNoI','\x20\x20\x20\x20App:\x20','\x0a✗\x20Erreur\x20lors\x20de\x20la\x20restauration:\x20','\x0aRestauration\x20annulée.\x0a','sort','?\x20(OUI/non):\x20','\x0aConfirmer\x20la\x20suppression\x20de\x20','Options:','\x0aNuméro\x20du\x20backup\x20à\x20restaurer\x20(ou\x20Q\x20pour\x20annuler):\x20','36gOgvad','app','║\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20GESTIONNAIRE\x20DE\x20BACKUPS\x20-\x20'];_0x2718=function(){return _0x265fd4;};return _0x2718();}const BACKUP_DIR=path['join'](projectDir,'.backup'),rl=readline[_0x2e84c0(0x13f)]({'input':process[_0x2e84c0(0x183)],'output':process[_0x2e84c0(0x169)]});function _0x28fe(_0x14e42b,_0x2cc6e7){const _0x2718ca=_0x2718();return _0x28fe=function(_0x28fe8e,_0x1bc6d9){_0x28fe8e=_0x28fe8e-0x12e;let _0x440503=_0x2718ca[_0x28fe8e];return _0x440503;},_0x28fe(_0x14e42b,_0x2cc6e7);}!fs[_0x2e84c0(0x17f)](BACKUP_DIR)&&fs[_0x2e84c0(0x15c)](BACKUP_DIR,{'recursive':!![]});function listBackups(){const _0x1c448e=_0x2e84c0;if(!fs['existsSync'](BACKUP_DIR))return console[_0x1c448e(0x14a)](_0x1c448e(0x18f)),[];const _0x1fd5b1=fs[_0x1c448e(0x131)](BACKUP_DIR)[_0x1c448e(0x161)](_0x3045ae=>fs['statSync'](path[_0x1c448e(0x14c)](BACKUP_DIR,_0x3045ae))[_0x1c448e(0x16b)]())[_0x1c448e(0x152)]()[_0x1c448e(0x145)]()['map'](_0x12aba9=>{const _0x48a299=_0x1c448e,_0x3a22ea=path[_0x48a299(0x14c)](BACKUP_DIR,_0x12aba9),_0x432543=path[_0x48a299(0x14c)](_0x3a22ea,'metadata.json');let _0x53d7a0={'timestamp':_0x12aba9,'files':[],'app':{}};if(fs[_0x48a299(0x17f)](_0x432543))try{_0x53d7a0=JSON[_0x48a299(0x139)](fs['readFileSync'](_0x432543,_0x48a299(0x12f)));}catch(_0x356340){}return{'folder':_0x12aba9,'timestamp':_0x53d7a0[_0x48a299(0x14b)],'date':new Date(_0x53d7a0['timestamp'])[_0x48a299(0x135)](_0x48a299(0x16d)),'app':_0x53d7a0[_0x48a299(0x158)]||{},'files':_0x53d7a0[_0x48a299(0x144)]||[],'size':getDirectorySize(_0x3a22ea)};});return _0x1fd5b1;}function getDirectorySize(_0x250a21){const _0x3d0897=_0x2e84c0;let _0x31dc96=0x0;const _0x1f3193=fs[_0x3d0897(0x131)](_0x250a21);for(const _0x2ed36b of _0x1f3193){const _0x502e1a=path[_0x3d0897(0x14c)](_0x250a21,_0x2ed36b),_0x5abaa2=fs[_0x3d0897(0x186)](_0x502e1a);_0x5abaa2['isDirectory']()?_0x31dc96+=getDirectorySize(_0x502e1a):_0x31dc96+=_0x5abaa2[_0x3d0897(0x165)];}return _0x31dc96;}function formatSize(_0x4118bd){const _0x37be15=_0x2e84c0;if(_0x4118bd===0x0)return _0x37be15(0x138);const _0x496eca=0x400,_0x455c47=['B','KB','MB','GB'],_0x5dfc30=Math[_0x37be15(0x15a)](Math[_0x37be15(0x14a)](_0x4118bd)/Math[_0x37be15(0x14a)](_0x496eca));return parseFloat((_0x4118bd/Math['pow'](_0x496eca,_0x5dfc30))[_0x37be15(0x13a)](0x2))+'\x20'+_0x455c47[_0x5dfc30];}function displayBackups(){const _0x3aa3f0=_0x2e84c0;console[_0x3aa3f0(0x191)](),console['log'](_0x3aa3f0(0x18d)),console[_0x3aa3f0(0x14a)](_0x3aa3f0(0x159)+projectDir[_0x3aa3f0(0x141)]('\x5c')[_0x3aa3f0(0x174)]()+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20║'),console[_0x3aa3f0(0x14a)](_0x3aa3f0(0x134));const _0x1bdbf2=listBackups();if(_0x1bdbf2[_0x3aa3f0(0x190)]===0x0){console[_0x3aa3f0(0x14a)](_0x3aa3f0(0x160)),showMenu();return;}console['log'](_0x3aa3f0(0x149)),_0x1bdbf2['forEach']((_0x322477,_0x2c86c5)=>{const _0x5d71a0=_0x3aa3f0;console[_0x5d71a0(0x14a)]('['+_0x2c86c5+']\x20'+_0x322477['date']),console[_0x5d71a0(0x14a)](_0x5d71a0(0x188)+_0x322477[_0x5d71a0(0x16e)]),_0x322477[_0x5d71a0(0x158)]&&_0x322477['app'][_0x5d71a0(0x13b)]&&(console[_0x5d71a0(0x14a)](_0x5d71a0(0x14f)+_0x322477[_0x5d71a0(0x158)][_0x5d71a0(0x13b)]+'\x20v'+_0x322477[_0x5d71a0(0x158)][_0x5d71a0(0x173)]),console[_0x5d71a0(0x14a)](_0x5d71a0(0x18e)+_0x322477[_0x5d71a0(0x158)][_0x5d71a0(0x17e)]),console[_0x5d71a0(0x14a)]('\x20\x20\x20\x20Package:\x20'+_0x322477[_0x5d71a0(0x158)][_0x5d71a0(0x176)])),console[_0x5d71a0(0x14a)](_0x5d71a0(0x181)+formatSize(_0x322477[_0x5d71a0(0x165)])),_0x322477['files'][_0x5d71a0(0x190)]>0x0&&console[_0x5d71a0(0x14a)](_0x5d71a0(0x187)+_0x322477['files']['join'](',\x20')),console[_0x5d71a0(0x14a)]();}),showMenu(_0x1bdbf2);}function showMenu(_0x491dfa=[]){const _0x55a9a0=_0x2e84c0;console['log'](_0x55a9a0(0x170)),console[_0x55a9a0(0x14a)](_0x55a9a0(0x155)),console[_0x55a9a0(0x14a)]('\x20\x20[R]\x20Restaurer\x20un\x20backup'),console[_0x55a9a0(0x14a)](_0x55a9a0(0x179)),console['log'](_0x55a9a0(0x13e)),console[_0x55a9a0(0x14a)](_0x55a9a0(0x146)),console[_0x55a9a0(0x14a)](_0x55a9a0(0x12e)),console[_0x55a9a0(0x14a)](_0x55a9a0(0x130)),rl[_0x55a9a0(0x18b)]('Choisir\x20une\x20option\x20(R/D/C/L/Q):\x20',_0x56f7ee=>{const _0x2146cf=_0x55a9a0,_0x50f5c6=_0x56f7ee['toUpperCase']();switch(_0x50f5c6){case'R':restoreBackup(_0x491dfa);break;case'D':deleteBackup(_0x491dfa);break;case'C':deleteAllBackups();break;case'L':displayBackups();break;case'Q':console['log']('\x0aAu\x20revoir!'),rl[_0x2146cf(0x168)]();break;default:console['log'](_0x2146cf(0x140)),displayBackups();}});}function restoreBackup(_0x3818e8){const _0x244323=_0x2e84c0;if(_0x3818e8['length']===0x0){console[_0x244323(0x14a)](_0x244323(0x14d)),displayBackups();return;}rl[_0x244323(0x18b)](_0x244323(0x156),_0x7cbff8=>{const _0x5dec7a=_0x244323;if(_0x7cbff8[_0x5dec7a(0x185)]()==='Q'){displayBackups();return;}const _0x16bfb4=parseInt(_0x7cbff8);if(isNaN(_0x16bfb4)||_0x16bfb4<0x0||_0x16bfb4>=_0x3818e8[_0x5dec7a(0x190)]){console[_0x5dec7a(0x14a)](_0x5dec7a(0x142)),displayBackups();return;}const _0x19eaca=_0x3818e8[_0x16bfb4];rl[_0x5dec7a(0x18b)](_0x5dec7a(0x172)+_0x19eaca['date']+_0x5dec7a(0x153),_0x4d9c8e=>{const _0x4e8804=_0x5dec7a;if(_0x4d9c8e['toUpperCase']()!==_0x4e8804(0x16a)&&_0x4d9c8e[_0x4e8804(0x185)]()!=='O'){console[_0x4e8804(0x14a)](_0x4e8804(0x151)),displayBackups();return;}try{const _0x2d32ea=path[_0x4e8804(0x14c)](BACKUP_DIR,_0x19eaca[_0x4e8804(0x16e)]),_0xda1ba4=path['join'](_0x2d32ea,_0x4e8804(0x177)),_0x4a61f7=JSON[_0x4e8804(0x139)](fs[_0x4e8804(0x15f)](_0xda1ba4,_0x4e8804(0x12f)));for(const _0x453646 of _0x4a61f7[_0x4e8804(0x144)]){const _0x31df90=path['join'](_0x2d32ea,path[_0x4e8804(0x148)](_0x453646));if(fs[_0x4e8804(0x17f)](_0x31df90)){const _0x2ae452=path[_0x4e8804(0x14c)](projectDir,_0x453646),_0x207608=path['dirname'](_0x2ae452);!fs['existsSync'](_0x207608)&&fs['mkdirSync'](_0x207608,{'recursive':!![]}),fs[_0x4e8804(0x17a)](_0x31df90,_0x2ae452),console['log'](_0x4e8804(0x17c)+_0x453646);}}console[_0x4e8804(0x14a)](_0x4e8804(0x162)),displayBackups();}catch(_0x4ecd18){console[_0x4e8804(0x182)](_0x4e8804(0x150)+_0x4ecd18['message']+'\x0a'),displayBackups();}});});}function deleteBackup(_0x497a8c){const _0x540472=_0x2e84c0;if(_0x497a8c[_0x540472(0x190)]===0x0){console['log'](_0x540472(0x167)),displayBackups();return;}rl[_0x540472(0x18b)](_0x540472(0x13c),_0x255411=>{const _0x3f123=_0x540472;if(_0x255411[_0x3f123(0x185)]()==='Q'){displayBackups();return;}const _0x50778f=parseInt(_0x255411);if(isNaN(_0x50778f)||_0x50778f<0x0||_0x50778f>=_0x497a8c['length']){console[_0x3f123(0x14a)](_0x3f123(0x142)),displayBackups();return;}const _0x2b9807=_0x497a8c[_0x50778f];rl[_0x3f123(0x18b)](_0x3f123(0x154)+_0x2b9807[_0x3f123(0x193)]+_0x3f123(0x153),_0x1cbb5c=>{const _0x28e4e0=_0x3f123;if(_0x1cbb5c[_0x28e4e0(0x185)]()!==_0x28e4e0(0x16a)&&_0x1cbb5c['toUpperCase']()!=='O'){console[_0x28e4e0(0x14a)](_0x28e4e0(0x16f)),displayBackups();return;}try{const _0xa299e9=path[_0x28e4e0(0x14c)](BACKUP_DIR,_0x2b9807['folder']);fs['rmSync'](_0xa299e9,{'recursive':!![],'force':!![]}),console[_0x28e4e0(0x14a)](_0x28e4e0(0x171)),displayBackups();}catch(_0x5e6197){console[_0x28e4e0(0x182)](_0x28e4e0(0x147)+_0x5e6197[_0x28e4e0(0x180)]+'\x0a'),displayBackups();}});});}function deleteAllBackups(){const _0x47fc1c=_0x2e84c0;rl['question'](_0x47fc1c(0x136),_0xd612e5=>{const _0x360f45=_0x47fc1c;if(_0xd612e5['toUpperCase']()!==_0x360f45(0x16a)&&_0xd612e5[_0x360f45(0x185)]()!=='O'){console[_0x360f45(0x14a)]('\x0aSuppression\x20annulée.\x0a'),displayBackups();return;}rl[_0x360f45(0x18b)](_0x360f45(0x15d),_0x2ddfb5=>{const _0xfdaa22=_0x360f45;if(_0x2ddfb5!==_0xfdaa22(0x16c)){console[_0xfdaa22(0x14a)]('\x0aSuppression\x20annulée.\x0a'),displayBackups();return;}try{fs[_0xfdaa22(0x17f)](BACKUP_DIR)&&(fs[_0xfdaa22(0x192)](BACKUP_DIR,{'recursive':!![],'force':!![]}),fs[_0xfdaa22(0x15c)](BACKUP_DIR,{'recursive':!![]})),console[_0xfdaa22(0x14a)](_0xfdaa22(0x163)),displayBackups();}catch(_0x244b58){console[_0xfdaa22(0x182)](_0xfdaa22(0x147)+_0x244b58[_0xfdaa22(0x180)]+'\x0a'),displayBackups();}});});}displayBackups();
|
package/build_tools/signing.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const {execFileSync} = require("child_process");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
function signExe(exePath, certPath, password) {
|
|
5
|
-
const signtool = path.join(__dirname, "vendor", "signtool", "signtool.exe");
|
|
6
|
-
|
|
7
|
-
const args = [
|
|
8
|
-
"sign",
|
|
9
|
-
"/f", certPath, // .pfx
|
|
10
|
-
"/p", password,
|
|
11
|
-
"/fd", "SHA256",
|
|
12
|
-
"/tr", "http://timestamp.sectigo.com", // timestamping
|
|
13
|
-
"/td", "SHA256",
|
|
14
|
-
exePath
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
execFileSync(signtool, args, {stdio: "inherit"});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = { signExe };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// (to be obfuscated and used as bootstrap.obf.js at runtime)
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const { spawnSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
(function(){
|
|
9
|
-
try {
|
|
10
|
-
const KEY = process.env.KEY || ''; // runtime key — ideally obtained via server
|
|
11
|
-
if (!KEY) {
|
|
12
|
-
console.error('KEY missing at runtime. Exiting.');
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Anti-debug basic checks
|
|
17
|
-
const execArgs = process.execArgv.join(' ');
|
|
18
|
-
if (execArgs.includes('--inspect') || execArgs.includes('--inspect-brk')) {
|
|
19
|
-
console.error('Debugger detected. Exiting.');
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
const envFlags = process.env.ELECTRON_ENABLE_LOGGING || process.env.ELECTRON_ENABLE_STACK_DUMPING;
|
|
23
|
-
if (envFlags) { console.error('Unsafe env flags detected. Exiting.'); process.exit(1); }
|
|
24
|
-
|
|
25
|
-
const base = process.resourcesPath || __dirname;
|
|
26
|
-
const resPath = path.join(base, 'resources', 'app', 'resources.bin');
|
|
27
|
-
const hmacPath = path.join(base, 'resources', 'app', 'resources.bin.hmac');
|
|
28
|
-
|
|
29
|
-
if (!fs.existsSync(resPath) || !fs.existsSync(hmacPath)) {
|
|
30
|
-
console.error('resources or hmac not found. Exiting.');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
const payload = fs.readFileSync(resPath);
|
|
34
|
-
const hmacStored = fs.readFileSync(hmacPath);
|
|
35
|
-
|
|
36
|
-
// Verify HMAC (same derivation as build)
|
|
37
|
-
const hm = crypto.createHmac('sha256', crypto.createHash('sha256').update(KEY).digest());
|
|
38
|
-
hm.update(payload);
|
|
39
|
-
const computed = hm.digest();
|
|
40
|
-
|
|
41
|
-
if (!crypto.timingSafeEqual(computed, hmacStored)) {
|
|
42
|
-
console.error('HMAC verification failed - possible tampering. Exiting.');
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// parse watermark header (optional extract)
|
|
47
|
-
if (payload.slice(0,4).toString('ascii') === 'WMKT') {
|
|
48
|
-
const len = payload.readUInt32BE(4);
|
|
49
|
-
const jsonBuf = payload.slice(8, 8 + len);
|
|
50
|
-
try {
|
|
51
|
-
const meta = JSON.parse(jsonBuf.toString('utf8'));
|
|
52
|
-
// you can report meta to analytics server or use it in runtime policy
|
|
53
|
-
} catch(e) {}
|
|
54
|
-
// actual encrypted content starts after 8+len
|
|
55
|
-
const encrypted = payload.slice(8 + len);
|
|
56
|
-
// proceed to decrypt `encrypted` (AES-256-CBC) as in current bootstrap logic
|
|
57
|
-
const iv = encrypted.slice(0,16);
|
|
58
|
-
const derived = crypto.createHash('sha256').update(KEY).digest();
|
|
59
|
-
const decipher = crypto.createDecipheriv('aes-256-cbc', derived, iv);
|
|
60
|
-
const dec = Buffer.concat([decipher.update(encrypted.slice(16)), decipher.final()]);
|
|
61
|
-
|
|
62
|
-
// write dec to tmp app.asar and then extract/launch as before
|
|
63
|
-
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'monapp-'));
|
|
64
|
-
const asarPath = path.join(tmp, 'app.asar');
|
|
65
|
-
fs.writeFileSync(asarPath, dec);
|
|
66
|
-
|
|
67
|
-
// Load app from the temp directory directly
|
|
68
|
-
require(asarPath);
|
|
69
|
-
// Ne pas quitter - laisser l'application s'exécuter
|
|
70
|
-
} else {
|
|
71
|
-
console.error('Watermark header missing. Exiting.');
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
} catch (err) {
|
|
75
|
-
console.error('Bootstrap verify error', err);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAMMOAADDDgAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A
|