@web-to-figma/desktop 1.0.2 → 1.0.4
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/dist/auth/captureSession.js +1 -1
- package/dist/auth/jwtSecret.js +1 -1
- package/dist/capture/browserPool.js +1 -1
- package/dist/capture/captureService.js +1 -1
- package/dist/capture/captureStatus.js +1 -1
- package/dist/capture/chromeDownloader.js +1 -1
- package/dist/capture/crxUtils.js +1 -1
- package/dist/capture/extensionPinPolicy.js +1 -1
- package/dist/capture/headedBrowserState.js +1 -1
- package/dist/capture/headedExtension.js +1 -1
- package/dist/capture/manualLaunch.js +1 -1
- package/dist/cli.js +10 -4
- package/dist/index.js +11 -9
- package/dist/server/middleware/desktopJwt.js +1 -1
- package/dist/updater/installer.js +1 -25
- package/dist/updater/runtime.d.ts +1 -0
- package/dist/updater/runtime.js +10 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2f1547,_0x3613b8){const _0x59f941=_0x28f9,_0x2870c3=_0x2f1547();while(!![]){try{const _0x5060d4=-parseInt(_0x59f941(0xfc))/0x1+-parseInt(_0x59f941(0x11e))/0x2+-parseInt(_0x59f941(0x10c))/0x3+-parseInt(_0x59f941(0x123))/0x4*(-parseInt(_0x59f941(0x114))/0x5)+parseInt(_0x59f941(0x112))/0x6+parseInt(_0x59f941(0xf9))/0x7+-parseInt(_0x59f941(0x107))/0x8;if(_0x5060d4===_0x3613b8)break;else _0x2870c3['push'](_0x2870c3['shift']());}catch(_0xd3cee4){_0x2870c3['push'](_0x2870c3['shift']());}}}(_0x3ed4,0x79845));import _0x476467 from'crypto';import _0x23bc17 from'fs';import _0xd39aef from'path';import{parseJsonSafe}from'../utils.js';function asChromiumDriver(_0x10f496){return _0x10f496;}export function cleanupOrphanSessionDirs(_0x5ea3e9){const _0x17bce6=_0x28f9;if(!_0x23bc17[_0x17bce6(0x121)](_0x5ea3e9))return;for(const _0x34e11f of _0x23bc17[_0x17bce6(0x116)](_0x5ea3e9,{'withFileTypes':!![]})){if(!_0x34e11f[_0x17bce6(0xfd)]())continue;removeSessionDir(_0xd39aef[_0x17bce6(0xff)](_0x5ea3e9,_0x34e11f['name']));}}export function createHeadedSessionDir(_0x3d84cb){const _0x27ffae=_0x28f9;_0x23bc17[_0x27ffae(0x102)](_0x3d84cb,{'recursive':!![]});const _0x253c42=_0xd39aef[_0x27ffae(0xff)](_0x3d84cb,_0x476467[_0x27ffae(0x10b)]());return _0x23bc17['mkdirSync'](_0xd39aef[_0x27ffae(0xff)](_0x253c42,_0x27ffae(0x124)),{'recursive':!![]}),_0x253c42;}export function seedPinnedExtensionPreferences(_0x15f82c,_0x4dfb76){const _0x15c2ae=_0x28f9,_0x187b4e=_0xd39aef[_0x15c2ae(0xff)](_0x15f82c,_0x15c2ae(0x124),_0x15c2ae(0x103)),_0x5d8f4e=parseJsonSafe(_0x23bc17['existsSync'](_0x187b4e)?_0x23bc17[_0x15c2ae(0x10e)](_0x187b4e,_0x15c2ae(0x110)):null,{}),_0x52e644=parseJsonSafe(typeof _0x5d8f4e[_0x15c2ae(0x11b)]===_0x15c2ae(0x109)&&_0x5d8f4e[_0x15c2ae(0x11b)]!==null?JSON['stringify'](_0x5d8f4e['extensions']):null,{});_0x52e644[_0x15c2ae(0x100)]=[_0x4dfb76],_0x5d8f4e['extensions']=_0x52e644,_0x23bc17[_0x15c2ae(0xfe)](_0x187b4e,JSON[_0x15c2ae(0x10d)](_0x5d8f4e));}export function createInitialPreferencesFile(_0x5899ce,_0x3e9260){const _0x386cde=_0x28f9,_0x3c42b2=_0xd39aef[_0x386cde(0xff)](_0x5899ce,_0x386cde(0x111)),_0xe11292={'extensions':{'pinned_extensions':[_0x3e9260]},'distribution':{'skip_first_run_ui':!![],'show_welcome_page':![]}};return _0x23bc17['writeFileSync'](_0x3c42b2,JSON[_0x386cde(0x10d)](_0xe11292)),_0x3c42b2;}export function removeSessionDir(_0xf82ec5){try{_0x23bc17['rmSync'](_0xf82ec5,{'recursive':!![],'force':!![]});}catch{}}function readPersistedCookies(_0x2bd5db){const _0x2c777f=_0x28f9;if(!_0x23bc17[_0x2c777f(0x121)](_0x2bd5db))return[];const _0x519964=parseJsonSafe(_0x23bc17['readFileSync'](_0x2bd5db,_0x2c777f(0x110)),[]);return Array[_0x2c777f(0x11c)](_0x519964)?_0x519964:[];}function writePersistedCookies(_0x2f16d1,_0x98ace0){const _0x45866d=_0x28f9;_0x23bc17[_0x45866d(0x102)](_0xd39aef['dirname'](_0x2f16d1),{'recursive':!![]}),_0x23bc17[_0x45866d(0xfe)](_0x2f16d1,JSON['stringify'](_0x98ace0,null,0x2)+'\x0a');}function _0x28f9(_0x2f209c,_0x35e80f){_0x2f209c=_0x2f209c-0xf9;const _0x3ed436=_0x3ed4();let _0x28f93d=_0x3ed436[_0x2f209c];if(_0x28f9['MIuvvh']===undefined){var _0x48dae4=function(_0x6ca542){const _0x4e2fe9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x476467='',_0x23bc17='';for(let _0xd39aef=0x0,_0x10f496,_0x5ea3e9,_0x34e11f=0x0;_0x5ea3e9=_0x6ca542['charAt'](_0x34e11f++);~_0x5ea3e9&&(_0x10f496=_0xd39aef%0x4?_0x10f496*0x40+_0x5ea3e9:_0x5ea3e9,_0xd39aef++%0x4)?_0x476467+=String['fromCharCode'](0xff&_0x10f496>>(-0x2*_0xd39aef&0x6)):0x0){_0x5ea3e9=_0x4e2fe9['indexOf'](_0x5ea3e9);}for(let _0x3d84cb=0x0,_0x253c42=_0x476467['length'];_0x3d84cb<_0x253c42;_0x3d84cb++){_0x23bc17+='%'+('00'+_0x476467['charCodeAt'](_0x3d84cb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x23bc17);};_0x28f9['nhwGwi']=_0x48dae4,_0x28f9['tUBFJi']={},_0x28f9['MIuvvh']=!![];}const _0x3ce34f=_0x3ed436[0x0],_0xe7a331=_0x2f209c+_0x3ce34f,_0x5ca76c=_0x28f9['tUBFJi'][_0xe7a331];return!_0x5ca76c?(_0x28f93d=_0x28f9['nhwGwi'](_0x28f93d),_0x28f9['tUBFJi'][_0xe7a331]=_0x28f93d):_0x28f93d=_0x5ca76c,_0x28f93d;}function toSetCookieParam(_0x3eff2e){const _0x5e9a96=_0x28f9,_0x3524c9={'name':_0x3eff2e[_0x5e9a96(0x101)],'value':_0x3eff2e['value'],'domain':_0x3eff2e[_0x5e9a96(0x106)],'path':_0x3eff2e[_0x5e9a96(0x117)]||'/'};return typeof _0x3eff2e[_0x5e9a96(0x118)]===_0x5e9a96(0x120)&&_0x3eff2e[_0x5e9a96(0x118)]>0x0&&(_0x3524c9[_0x5e9a96(0x118)]=_0x3eff2e['expires']),typeof _0x3eff2e[_0x5e9a96(0x11a)]===_0x5e9a96(0x105)&&(_0x3524c9[_0x5e9a96(0x11a)]=_0x3eff2e[_0x5e9a96(0x11a)]),typeof _0x3eff2e[_0x5e9a96(0xfb)]===_0x5e9a96(0x105)&&(_0x3524c9[_0x5e9a96(0xfb)]=_0x3eff2e[_0x5e9a96(0xfb)]),_0x3eff2e[_0x5e9a96(0x11f)]&&(_0x3524c9[_0x5e9a96(0x11f)]=_0x3eff2e[_0x5e9a96(0x11f)]),_0x3eff2e[_0x5e9a96(0x11d)]&&(_0x3524c9['priority']=_0x3eff2e[_0x5e9a96(0x11d)]),_0x3524c9;}export async function importPersistedCookies(_0x34b884,_0x1a9804){const _0xc9ee11=_0x28f9,_0x356f79=readPersistedCookies(_0x1a9804);if(_0x356f79[_0xc9ee11(0x108)]===0x0)return;const _0x1b4a58=asChromiumDriver(_0x34b884);await _0x1b4a58[_0xc9ee11(0x119)](_0xc9ee11(0x122),{}),await _0x1b4a58['sendDevToolsCommand'](_0xc9ee11(0x113),{'cookies':_0x356f79[_0xc9ee11(0x10a)](toSetCookieParam)});}export async function exportPersistedCookies(_0x1f41b3,_0x59a59f){const _0x17b990=_0x28f9,_0xdca102=asChromiumDriver(_0x1f41b3);await _0xdca102[_0x17b990(0x119)](_0x17b990(0x122),{});const _0x4977e3=await _0xdca102[_0x17b990(0x104)](_0x17b990(0xfa),{}),_0x54deed=Array['isArray'](_0x4977e3[_0x17b990(0x10f)])?_0x4977e3[_0x17b990(0x10f)]:[];writePersistedCookies(_0x59a59f,_0x54deed);}function _0x3ed4(){const _0x4c674f=['Cgf0Aa','zxHWAxjLCW','C2vUzerLDLrVB2XZq29TBwfUza','Ahr0Ce9UBhK','zxH0zw5ZAw9UCW','AxnbCNjHEq','ChjPB3jPDhK','mJe1mtG2quTLr2Xl','C2fTzvnPDgu','BNvTyMvY','zxHPC3rZu3LUyW','tMv0D29YAY5LBMfIBgu','nfn0zvfcDW','rgvMyxvSDa','nte1mJi0nuPTuvrxra','tMv0D29YAY5NzxrbBgXdB29RAwvZ','C2vJDxjL','nde2mdu0uLvbsNrA','AxneAxjLy3rVCNK','D3jPDgvgAwXLu3LUyW','AM9PBG','CgLUBMvKx2v4DgvUC2LVBNm','BMfTzq','BwTKAxjtEw5J','uhjLzMvYzw5Jzxm','C2vUzefUzeDLDerLDLrVB2XZq29TBwfUza','yM9VBgvHBG','zg9TywLU','mtyXnZi0og1JtwnIva','BgvUz3rO','B2jQzwn0','BwfW','CMfUzg9Tvvvjra','mJu2nJCXnNnhzLvWtG','C3rYAw5NAwz5','CMvHzezPBgvtEw5J','y29VA2LLCW','DxrMoa','Aw5PDgLHBf9WCMvMzxjLBMnLCY5QC29U','ndGZntuYmejbuNfesW','tMv0D29YAY5ZzxrdB29RAwvZ','mJy4ntC2nwHysKfxDa','CM1tEw5J','CMvHzgrPCLn5BMm'];_0x3ed4=function(){return _0x4c674f;};return _0x3ed4();}export function resetHeadedBrowserState(_0x3b18f8,_0x4d3d98){const _0x56b776=_0x28f9;cleanupOrphanSessionDirs(_0x4d3d98),_0x23bc17[_0x56b776(0x121)](_0x3b18f8)&&_0x23bc17[_0x56b776(0x115)](_0x3b18f8,{'recursive':!![],'force':!![]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x526cf4,_0x5e02fc){const _0x212eaf=_0x5a70,_0x5d6a2d=_0x526cf4();while(!![]){try{const _0x5ec0b2=-parseInt(_0x212eaf(0x70))/0x1+parseInt(_0x212eaf(0x78))/0x2*(-parseInt(_0x212eaf(0x7b))/0x3)+-parseInt(_0x212eaf(0x7f))/0x4*(parseInt(_0x212eaf(0x7c))/0x5)+-parseInt(_0x212eaf(0x72))/0x6*(-parseInt(_0x212eaf(0x77))/0x7)+-parseInt(_0x212eaf(0x75))/0x8+parseInt(_0x212eaf(0x74))/0x9*(-parseInt(_0x212eaf(0x7a))/0xa)+parseInt(_0x212eaf(0x73))/0xb;if(_0x5ec0b2===_0x5e02fc)break;else _0x5d6a2d['push'](_0x5d6a2d['shift']());}catch(_0x3897bd){_0x5d6a2d['push'](_0x5d6a2d['shift']());}}}(_0x1fd6,0xc63b8));import _0x5cf86f from'fs';import{extensionIdFromCrx,shouldRefreshUnpackedExtension,unpackCrxWithStableKey}from'./crxUtils.js';export function ensureHeadedExtensionUnpacked(_0x32f470,_0x5875d4){const _0xf82101=_0x5a70;if(!_0x5cf86f[_0xf82101(0x7e)](_0x32f470[_0xf82101(0x6f)]))return _0x5875d4['warn']({'crxPath':_0x32f470[_0xf82101(0x6f)]},_0xf82101(0x76)),null;const _0x12efd0=_0x32f470[_0xf82101(0x71)];let _0x184b6a;return shouldRefreshUnpackedExtension(_0x32f470[_0xf82101(0x6f)],_0x12efd0)?(_0x184b6a=unpackCrxWithStableKey(_0x32f470[_0xf82101(0x6f)],_0x12efd0),_0x5875d4[_0xf82101(0x79)]({'unpackedDir':_0x12efd0,'extensionId':_0x184b6a},_0xf82101(0x7d))):_0x184b6a=extensionIdFromCrx(_0x32f470['headedCrxPath']),{'extensionId':_0x184b6a,'unpackedDir':_0x12efd0};}function _0x5a70(_0xa8095f,_0x42c403){_0xa8095f=_0xa8095f-0x6f;const _0x1fd6b0=_0x1fd6();let _0x5a70d4=_0x1fd6b0[_0xa8095f];if(_0x5a70['kktnCH']===undefined){var _0xd996c6=function(_0x3bec0e){const _0x560b51='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5cf86f='',_0x32f470='';for(let _0x5875d4=0x0,_0x12efd0,_0x184b6a,_0x4b71a6=0x0;_0x184b6a=_0x3bec0e['charAt'](_0x4b71a6++);~_0x184b6a&&(_0x12efd0=_0x5875d4%0x4?_0x12efd0*0x40+_0x184b6a:_0x184b6a,_0x5875d4++%0x4)?_0x5cf86f+=String['fromCharCode'](0xff&_0x12efd0>>(-0x2*_0x5875d4&0x6)):0x0){_0x184b6a=_0x560b51['indexOf'](_0x184b6a);}for(let _0xf90c82=0x0,_0x2a60bc=_0x5cf86f['length'];_0xf90c82<_0x2a60bc;_0xf90c82++){_0x32f470+='%'+('00'+_0x5cf86f['charCodeAt'](_0xf90c82)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x32f470);};_0x5a70['mAohcl']=_0xd996c6,_0x5a70['JNXtir']={},_0x5a70['kktnCH']=!![];}const _0x2036f2=_0x1fd6b0[0x0],_0x38c6cd=_0xa8095f+_0x2036f2,_0x4e2b51=_0x5a70['JNXtir'][_0x38c6cd];return!_0x4e2b51?(_0x5a70d4=_0x5a70['mAohcl'](_0x5a70d4),_0x5a70['JNXtir'][_0x38c6cd]=_0x5a70d4):_0x5a70d4=_0x4e2b51,_0x5a70d4;}function _0x1fd6(){const _0x775680=['mta5nda5mwHSBfnTBG','AgvHzgvKvw5WywnRzwrfEhrLBNnPB25eAxi','mtq1nZKXnM9ytvjpzq','ndq4nZeWmZvMwNHHuxy','nJaZA2f3wunT','otq5mJm0ng9ksefgzq','sgvHzgvKigv4DgvUC2LVBIbduLGGBwLZC2LUzW','n09pEffOva','mZGYv3vSsxbq','zgvIDwC','mZy1mgfpugTerG','mJG0mwvYCePlrW','mtG5nJC1uvLstK1x','vw5WywnRzwqGAgvHzgvKigv4DgvUC2LVBIb3AxrOihn0ywjSzsbRzxK','zxHPC3rZu3LUyW','mta4tu9Rwufz','AgvHzgvKq3j4ugf0Aa'];_0x1fd6=function(){return _0x775680;};return _0x1fd6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2a4474,_0x106f7d){const _0x44259c=_0x2eb5,_0x10c9fa=_0x2a4474();while(!![]){try{const _0x52d7e3=-parseInt(_0x44259c(0x1a0))/0x1*(parseInt(_0x44259c(0x1a2))/0x2)+parseInt(_0x44259c(0x19c))/0x3*(parseInt(_0x44259c(0x1a1))/0x4)+-parseInt(_0x44259c(0x19a))/0x5*(parseInt(_0x44259c(0x1a7))/0x6)+parseInt(_0x44259c(0x199))/0x7*(parseInt(_0x44259c(0x1a8))/0x8)+parseInt(_0x44259c(0x19e))/0x9*(parseInt(_0x44259c(0x198))/0xa)+parseInt(_0x44259c(0x1a6))/0xb+-parseInt(_0x44259c(0x1a3))/0xc*(-parseInt(_0x44259c(0x1a4))/0xd);if(_0x52d7e3===_0x106f7d)break;else _0x10c9fa['push'](_0x10c9fa['shift']());}catch(_0x716653){_0x10c9fa['push'](_0x10c9fa['shift']());}}}(_0x238c,0x76000));import{exportPersistedCookies,removeSessionDir}from'./headedBrowserState.js';function _0x2eb5(_0x4c011e,_0x15c192){_0x4c011e=_0x4c011e-0x197;const _0x238c5d=_0x238c();let _0x2eb51e=_0x238c5d[_0x4c011e];if(_0x2eb5['gPGNoL']===undefined){var _0x5e40ce=function(_0x5a2ad1){const _0x1a09ab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d08aa='',_0xe1a9ae='';for(let _0x254ba3=0x0,_0x5ce39f,_0x550273,_0x3fbe66=0x0;_0x550273=_0x5a2ad1['charAt'](_0x3fbe66++);~_0x550273&&(_0x5ce39f=_0x254ba3%0x4?_0x5ce39f*0x40+_0x550273:_0x550273,_0x254ba3++%0x4)?_0x2d08aa+=String['fromCharCode'](0xff&_0x5ce39f>>(-0x2*_0x254ba3&0x6)):0x0){_0x550273=_0x1a09ab['indexOf'](_0x550273);}for(let _0x3a169b=0x0,_0x2ae65e=_0x2d08aa['length'];_0x3a169b<_0x2ae65e;_0x3a169b++){_0xe1a9ae+='%'+('00'+_0x2d08aa['charCodeAt'](_0x3a169b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xe1a9ae);};_0x2eb5['AFPjTz']=_0x5e40ce,_0x2eb5['EsGgli']={},_0x2eb5['gPGNoL']=!![];}const _0x162ef5=_0x238c5d[0x0],_0x5df58f=_0x4c011e+_0x162ef5,_0x5f123c=_0x2eb5['EsGgli'][_0x5df58f];return!_0x5f123c?(_0x2eb51e=_0x2eb5['AFPjTz'](_0x2eb51e),_0x2eb5['EsGgli'][_0x5df58f]=_0x2eb51e):_0x2eb51e=_0x5f123c,_0x2eb51e;}function _0x238c(){const _0x1c61e8=['mtGXmJy2nhPhCK11sq','nxnmruPfvG','z2v0','m3nkBgPvAG','z2v0qwXSv2LUzg93sgfUzgXLCW','owD3CNfPDq','BgvUz3rO','ngz5BLPSta','oti2mJm2qwrSr05m','ndq1otG4u0rmENz5','otz6swLfywC','mte1odGYzxnmvMzL','Bgf1BMnOsgvHzgvK','mZeZmdy3n2f1sNPqAa','odq2mZu0q3PNCMrU','mJrAwfDVDMe','u0Lhvevstq','CMvTB3zLtgLZDgvUzxi','u0Lhsu5u','mtuYmdi5mhrxANjewa'];_0x238c=function(){return _0x1c61e8;};return _0x238c();}const BROWSER_POLL_MS=0x1f4;async function waitForBrowserClosed(_0x2d08aa){await new Promise(_0xe1a9ae=>{const _0x3b6a1a=_0x2eb5;let _0x254ba3=![];const _0x5ce39f=()=>{const _0x4b6669=_0x2eb5;if(_0x254ba3)return;_0x254ba3=!![],process[_0x4b6669(0x1aa)](_0x4b6669(0x197),_0x550273),process[_0x4b6669(0x1aa)](_0x4b6669(0x1a9),_0x550273),_0xe1a9ae();},_0x550273=()=>_0x5ce39f();process['on'](_0x3b6a1a(0x197),_0x550273),process['on'](_0x3b6a1a(0x1a9),_0x550273);const _0x3fbe66=async()=>{const _0x52142c=_0x3b6a1a;try{const _0x3a169b=await _0x2d08aa();if(_0x3a169b[_0x52142c(0x19f)]===0x0){_0x5ce39f();return;}setTimeout(()=>void _0x3fbe66(),BROWSER_POLL_MS);}catch{_0x5ce39f();}};void _0x3fbe66();});}export async function launchHeadedCapture(_0x2ae65e,_0x10e45d){const _0x323e96=_0x2eb5,{driver:_0xa85bef,sessionDir:_0x743265,cookiesPath:_0x4279b5}=await _0x2ae65e[_0x323e96(0x1a5)]();try{_0x10e45d&&await _0xa85bef[_0x323e96(0x19b)](_0x10e45d),console['log']('Chrome\x20opened\x20for\x20manual\x20capture.\x20Close\x20the\x20browser\x20when\x20finished.'),await waitForBrowserClosed(()=>_0xa85bef[_0x323e96(0x19d)]());}finally{try{await exportPersistedCookies(_0xa85bef,_0x4279b5);}catch{}await _0x2ae65e['release'](_0xa85bef),removeSessionDir(_0x743265);}}
|
package/dist/cli.js
CHANGED
|
@@ -9,14 +9,20 @@ async function runCliAction(action) {
|
|
|
9
9
|
try {
|
|
10
10
|
await action();
|
|
11
11
|
}
|
|
12
|
-
catch {
|
|
12
|
+
catch (err) {
|
|
13
|
+
if (err instanceof Error && err.message) {
|
|
14
|
+
console.error(err.message);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.error('Command failed.');
|
|
18
|
+
}
|
|
13
19
|
process.exit(process.exitCode ?? 1);
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
22
|
export function runCli() {
|
|
17
23
|
loadDesktopEnv();
|
|
18
24
|
const program = new Command();
|
|
19
|
-
program.name('web-to-figma').description('Web to Figma Desktop
|
|
25
|
+
program.name('web-to-figma').description('Web to Figma Desktop Application');
|
|
20
26
|
program
|
|
21
27
|
.command('start')
|
|
22
28
|
.description('Start the desktop HTTP server')
|
|
@@ -33,7 +39,7 @@ export function runCli() {
|
|
|
33
39
|
});
|
|
34
40
|
program
|
|
35
41
|
.command('capture')
|
|
36
|
-
.description('Open headed Chrome for manual capture
|
|
42
|
+
.description('Open headed Chrome for manual capture')
|
|
37
43
|
.argument('[url]', 'Optional URL to open on launch')
|
|
38
44
|
.option('--data-dir <path>', 'Data directory override')
|
|
39
45
|
.option('--reset-browser-state', 'Clear saved headed-browser logins and session data')
|
|
@@ -46,7 +52,7 @@ export function runCli() {
|
|
|
46
52
|
}));
|
|
47
53
|
});
|
|
48
54
|
program
|
|
49
|
-
.command('doctor')
|
|
55
|
+
.command('doctor', { hidden: true })
|
|
50
56
|
.description('Run environment diagnostics')
|
|
51
57
|
.option('--data-dir <path>', 'Data directory override')
|
|
52
58
|
.option('--update-chrome', 'Re-download Chrome for Testing binaries')
|
package/dist/index.js
CHANGED
|
@@ -86,22 +86,17 @@ export async function startServer(options = {}) {
|
|
|
86
86
|
chromePath: chrome.chromePath,
|
|
87
87
|
chromedriverPath: chrome.chromedriverPath,
|
|
88
88
|
});
|
|
89
|
+
let shuttingDown = false;
|
|
90
|
+
let shutdown;
|
|
89
91
|
const updater = new UpdaterRuntime({
|
|
90
92
|
currentVersion: PACKAGE_VERSION,
|
|
91
93
|
port,
|
|
92
94
|
paths: config.paths,
|
|
93
95
|
verbose,
|
|
94
96
|
isCaptureBusy,
|
|
97
|
+
shutdown: () => shutdown(),
|
|
95
98
|
});
|
|
96
|
-
|
|
97
|
-
updater.checkNow(),
|
|
98
|
-
new Promise((resolve) => setTimeout(resolve, 3000)),
|
|
99
|
-
]);
|
|
100
|
-
await app.listen({ port, host: 'localhost' });
|
|
101
|
-
updater.printBanner();
|
|
102
|
-
updater.startBackgroundChecks();
|
|
103
|
-
let shuttingDown = false;
|
|
104
|
-
const shutdown = async () => {
|
|
99
|
+
shutdown = async () => {
|
|
105
100
|
if (shuttingDown) {
|
|
106
101
|
process.exit(1);
|
|
107
102
|
return;
|
|
@@ -113,6 +108,13 @@ export async function startServer(options = {}) {
|
|
|
113
108
|
await flushDesktopSentry();
|
|
114
109
|
process.exit(0);
|
|
115
110
|
};
|
|
111
|
+
await Promise.race([
|
|
112
|
+
updater.checkNow(),
|
|
113
|
+
new Promise((resolve) => setTimeout(resolve, 3000)),
|
|
114
|
+
]);
|
|
115
|
+
await app.listen({ port, host: 'localhost' });
|
|
116
|
+
updater.printBanner();
|
|
117
|
+
updater.startBackgroundChecks();
|
|
116
118
|
updater.attachKeyListener(() => {
|
|
117
119
|
void shutdown();
|
|
118
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x342596,_0x1288e2){const _0x42a88d=_0x1797,_0x4614eb=_0x342596();while(!![]){try{const _0x3dbbec=-parseInt(_0x42a88d(0xbd))/0x1*(-parseInt(_0x42a88d(0xab))/0x2)+-parseInt(_0x42a88d(0xce))/0x3+parseInt(_0x42a88d(0xa9))/0x4+parseInt(_0x42a88d(0xc7))/0x5+-parseInt(_0x42a88d(0xad))/0x6+parseInt(_0x42a88d(0xae))/0x7+parseInt(_0x42a88d(0xbc))/0x8;if(_0x3dbbec===_0x1288e2)break;else _0x4614eb['push'](_0x4614eb['shift']());}catch(_0x466505){_0x4614eb['push'](_0x4614eb['shift']());}}}(_0x3bd1,0xcb562));import _0x4abf97 from'jsonwebtoken';import{getSecretForKid}from'../../auth/jwtSecret.js';import{redactRequestHeaders}from'../../security/redact.js';function requestPath(_0x25238e){return _0x25238e['split']('?')[0x0]??_0x25238e;}function isPublicPath(_0x447524){const _0x5de2f5=_0x1797;return _0x447524===_0x5de2f5(0xc8);}export function requiresJwt(_0x1681a3,_0x4c5493){const _0x24d8d8=_0x1797;if(_0x1681a3===_0x24d8d8(0xcd)&&_0x4c5493['startsWith'](_0x24d8d8(0xbb)))return![];if(_0x1681a3==='POST'&&_0x4c5493===_0x24d8d8(0xb6))return!![];if(_0x1681a3===_0x24d8d8(0xcd)&&_0x4c5493===_0x24d8d8(0xc3))return!![];if(_0x1681a3==='POST'&&_0x4c5493==='/api/artifact/cancel-capture')return!![];return![];}function logAuthFailure(_0x3c7d8f,_0x57f2cb,_0x54eb17,_0x57d124){const _0x17b62f=_0x1797;_0x3c7d8f['logger']['error']({'reason':_0x57f2cb,'path':_0x54eb17[_0x17b62f(0xb4)][_0x17b62f(0xbe)]('?')[0x0],'headers':redactRequestHeaders(_0x54eb17['headers']),'err':_0x57d124 instanceof Error?_0x57d124[_0x17b62f(0xba)]:_0x57d124},'auth_failed');if(_0x3c7d8f[_0x17b62f(0xc5)]){const _0x57fc3a=_0x57d124 instanceof Error?_0x57d124['message']:String(_0x57d124??'');console[_0x17b62f(0xaf)](_0x17b62f(0xc1)+_0x57f2cb+'\x20'+_0x54eb17[_0x17b62f(0xb4)]+(_0x57fc3a?':\x20'+_0x57fc3a:''));}}function _0x3bd1(){const _0xc62cd6=['DMvYAwz5','mKjmvLjoyG','AgvHzgvY','nJm4odK4mfrltwzfsG','mJu0nZqXow9OzKDiyW','zxjYB3i','zgvZA3rVCeP3Dfn1yG','C3vI','sfmYnty','AgvHzgvYCW','DxjS','y29Kzq','l2fWAs9HCNrPzMfJDc9Jyxb0DxjL','vw5HDxrOB3jPEMvK','w2f1DgHDig9Ria','BwLZC2LUz19QD3q','BwvZC2fNzq','l2zPBgvZlW','mtaZntK3mtjQEwvhs1e','otqWn21SsK5gAa','C3bSAxq','t1busu9ouW','B25szxf1zxn0','w2f1DgHDia','Ec13DgyTzgvZA3rVCc1QD3q','l2fWAs9HCNrPzMfJDc9Jyxb0DxjLlxn0yxr1CW','C2vUza','DMvYyM9Zzq','Bwv0Ag9K','mZq2nZiXnvDYBM5bvq','l2HLywX0Aa','A2LK','Aw52ywXPzf9QD3q','C3rYAw5N','D2vIlxrVlwzPz21HlxbSDwDPBG','r0vu','mJq4odmZohDgwhLquG','mtq2mty0nffkDxPwCq'];_0x3bd1=function(){return _0xc62cd6;};return _0x3bd1();}function logAuthSuccess(_0x318952,_0x54306f){const _0xea8068=_0x1797;_0x318952[_0xea8068(0xc5)]&&console['log'](_0xea8068(0xb8)+_0x54306f[_0xea8068(0xc6)]+'\x20'+_0x54306f['url']);}function _0x1797(_0x200226,_0x428a64){_0x200226=_0x200226-0xa9;const _0x3bd147=_0x3bd1();let _0x179793=_0x3bd147[_0x200226];if(_0x1797['BZeTQc']===undefined){var _0x31e500=function(_0x135392){const _0x11ca66='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4abf97='',_0x25238e='';for(let _0x447524=0x0,_0x1681a3,_0x4c5493,_0x3c7d8f=0x0;_0x4c5493=_0x135392['charAt'](_0x3c7d8f++);~_0x4c5493&&(_0x1681a3=_0x447524%0x4?_0x1681a3*0x40+_0x4c5493:_0x4c5493,_0x447524++%0x4)?_0x4abf97+=String['fromCharCode'](0xff&_0x1681a3>>(-0x2*_0x447524&0x6)):0x0){_0x4c5493=_0x11ca66['indexOf'](_0x4c5493);}for(let _0x57f2cb=0x0,_0x54eb17=_0x4abf97['length'];_0x57f2cb<_0x54eb17;_0x57f2cb++){_0x25238e+='%'+('00'+_0x4abf97['charCodeAt'](_0x57f2cb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x25238e);};_0x1797['vOysuf']=_0x31e500,_0x1797['IkbcQN']={},_0x1797['BZeTQc']=!![];}const _0x5010df=_0x3bd147[0x0],_0x44bcee=_0x200226+_0x5010df,_0xf05f15=_0x1797['IkbcQN'][_0x44bcee];return!_0xf05f15?(_0x179793=_0x1797['vOysuf'](_0x179793),_0x1797['IkbcQN'][_0x44bcee]=_0x179793):_0x179793=_0xf05f15,_0x179793;}export function registerDesktopAuth(_0x5ecb9b,_0x560b5d){const _0x1146a3=_0x1797;_0x5ecb9b['addHook'](_0x1146a3(0xc0),async(_0x271cce,_0x1d3ae2)=>{const _0x3878a4=_0x1146a3;if(_0x271cce[_0x3878a4(0xc6)]===_0x3878a4(0xbf))return;const _0x5e952b=requestPath(_0x271cce['url']);if(isPublicPath(_0x5e952b)||!requiresJwt(_0x271cce['method'],_0x5e952b))return;const _0x391c61=_0x271cce[_0x3878a4(0xb3)][_0x3878a4(0xc2)];if(!_0x391c61||typeof _0x391c61!==_0x3878a4(0xcb))return logAuthFailure(_0x560b5d,_0x3878a4(0xb9),_0x271cce),_0x1d3ae2[_0x3878a4(0xb5)](0x191)[_0x3878a4(0xc4)]({'message':_0x3878a4(0xb7)});try{const _0x2edbcb=_0x4abf97['decode'](_0x391c61,{'complete':!![]}),_0x39503f=_0x2edbcb&&typeof _0x2edbcb==='object'&&_0x2edbcb[_0x3878a4(0xac)]?_0x2edbcb['header'][_0x3878a4(0xc9)]:undefined,_0x52ebb3=_0x4abf97[_0x3878a4(0xaa)](_0x391c61,getSecretForKid(_0x39503f),{'algorithms':[_0x3878a4(0xb2)],'issuer':_0x3878a4(0xcc),'audience':'web-to-figma-desktop'});_0x271cce[_0x3878a4(0xb0)]=_0x52ebb3[_0x3878a4(0xb1)],logAuthSuccess(_0x560b5d,_0x271cce);}catch(_0x2e248a){return logAuthFailure(_0x560b5d,_0x3878a4(0xca),_0x271cce,_0x2e248a),_0x1d3ae2[_0x3878a4(0xb5)](0x191)[_0x3878a4(0xc4)]({'message':'Unauthorized'});}});}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promisify } from 'node:util';
|
|
1
|
+
import { execFileSync, spawn } from 'node:child_process';
|
|
3
2
|
import path from 'node:path';
|
|
4
|
-
const execFileAsync = promisify(execFile);
|
|
5
3
|
export function isGloballyInstalled() {
|
|
6
4
|
try {
|
|
7
5
|
const scriptPath = process.argv[1];
|
|
@@ -36,26 +34,4 @@ export async function installUpdate(latestVersion, verbose) {
|
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
});
|
|
39
|
-
respawnFromGlobalBin();
|
|
40
|
-
}
|
|
41
|
-
function respawnFromGlobalBin() {
|
|
42
|
-
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
43
|
-
let binPath = 'web-to-figma';
|
|
44
|
-
try {
|
|
45
|
-
const resolved = execFileSync(npmCmd, ['bin', '-g', 'web-to-figma'], { encoding: 'utf8' }).trim();
|
|
46
|
-
if (resolved) {
|
|
47
|
-
binPath = resolved;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
// fall back to PATH lookup
|
|
52
|
-
}
|
|
53
|
-
const args = process.argv.slice(2);
|
|
54
|
-
const child = spawn(binPath, args.length > 0 ? args : ['start'], {
|
|
55
|
-
stdio: 'inherit',
|
|
56
|
-
detached: true,
|
|
57
|
-
shell: process.platform === 'win32',
|
|
58
|
-
});
|
|
59
|
-
child.unref();
|
|
60
|
-
process.exit(0);
|
|
61
37
|
}
|
package/dist/updater/runtime.js
CHANGED
|
@@ -113,7 +113,16 @@ export class UpdaterRuntime {
|
|
|
113
113
|
await installUpdate(latest, this.options.verbose);
|
|
114
114
|
appendUpdateLog(this.options.paths, { event: 'update_completed', from, to: latest });
|
|
115
115
|
console.log(`Updated to v${latest} successfully.`);
|
|
116
|
-
console.log('
|
|
116
|
+
console.log('');
|
|
117
|
+
console.log('Restart the desktop server to run the new version:');
|
|
118
|
+
if (isGloballyInstalled()) {
|
|
119
|
+
console.log(' web-to-figma start');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(' npx @web-to-figma/desktop@latest start');
|
|
123
|
+
}
|
|
124
|
+
console.log('');
|
|
125
|
+
await this.options.shutdown();
|
|
117
126
|
}
|
|
118
127
|
catch (err) {
|
|
119
128
|
const error = err instanceof Error ? err.message : 'Unknown error';
|