@web-to-figma/desktop 1.0.1 → 1.0.3
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 +1 -1
- package/dist/auth/captureSession.js +1 -1
- package/dist/auth/jwtSecret.d.ts +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 +7 -1
- package/dist/index.js +11 -9
- package/dist/server/middleware/desktopJwt.js +1 -1
- package/dist/terminal/banner.js +3 -3
- package/dist/updater/installer.js +1 -25
- package/dist/updater/runtime.d.ts +1 -0
- package/dist/updater/runtime.js +13 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x1724(_0x11e508,_0x542f50){_0x11e508=_0x11e508-0x19b;const _0x3dbc58=_0x3dbc();let _0x1724f7=_0x3dbc58[_0x11e508];if(_0x1724['VWIkDe']===undefined){var _0x3deeb4=function(_0x3ee671){const _0x327b4a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x190151='',_0x5391a0='';for(let _0x3d0d25=0x0,_0x3bfb8e,_0x3baac7,_0x55da38=0x0;_0x3baac7=_0x3ee671['charAt'](_0x55da38++);~_0x3baac7&&(_0x3bfb8e=_0x3d0d25%0x4?_0x3bfb8e*0x40+_0x3baac7:_0x3baac7,_0x3d0d25++%0x4)?_0x190151+=String['fromCharCode'](0xff&_0x3bfb8e>>(-0x2*_0x3d0d25&0x6)):0x0){_0x3baac7=_0x327b4a['indexOf'](_0x3baac7);}for(let _0xf20610=0x0,_0xf2f787=_0x190151['length'];_0xf20610<_0xf2f787;_0xf20610++){_0x5391a0+='%'+('00'+_0x190151['charCodeAt'](_0xf20610)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5391a0);};_0x1724['joUgxm']=_0x3deeb4,_0x1724['kAUGzS']={},_0x1724['VWIkDe']=!![];}const _0x523f68=_0x3dbc58[0x0],_0x5f38f1=_0x11e508+_0x523f68,_0x394eca=_0x1724['kAUGzS'][_0x5f38f1];return!_0x394eca?(_0x1724f7=_0x1724['joUgxm'](_0x1724f7),_0x1724['kAUGzS'][_0x5f38f1]=_0x1724f7):_0x1724f7=_0x394eca,_0x1724f7;}(function(_0x382e19,_0x4cc11d){const _0x17a6c1=_0x1724,_0x26251c=_0x382e19();while(!![]){try{const _0x45d085=-parseInt(_0x17a6c1(0x1c4))/0x1+-parseInt(_0x17a6c1(0x1af))/0x2+parseInt(_0x17a6c1(0x1b2))/0x3*(parseInt(_0x17a6c1(0x1ab))/0x4)+parseInt(_0x17a6c1(0x1b6))/0x5+-parseInt(_0x17a6c1(0x1a9))/0x6+-parseInt(_0x17a6c1(0x1bf))/0x7*(parseInt(_0x17a6c1(0x1b7))/0x8)+parseInt(_0x17a6c1(0x1be))/0x9*(parseInt(_0x17a6c1(0x1bd))/0xa);if(_0x45d085===_0x4cc11d)break;else _0x26251c['push'](_0x26251c['shift']());}catch(_0x5c6451){_0x26251c['push'](_0x26251c['shift']());}}}(_0x3dbc,0x373d4));import _0x190151 from'crypto';import _0x5391a0 from'fs';import _0x3d0d25 from'path';import{parseJsonSafe}from'../utils.js';function asChromiumDriver(_0x3bfb8e){return _0x3bfb8e;}export function cleanupOrphanSessionDirs(_0x3baac7){const _0x1586ef=_0x1724;if(!_0x5391a0['existsSync'](_0x3baac7))return;for(const _0x55da38 of _0x5391a0[_0x1586ef(0x1c3)](_0x3baac7,{'withFileTypes':!![]})){if(!_0x55da38['isDirectory']())continue;removeSessionDir(_0x3d0d25[_0x1586ef(0x1c5)](_0x3baac7,_0x55da38[_0x1586ef(0x1a8)]));}}export function createHeadedSessionDir(_0xf20610){const _0x40e000=_0x1724;_0x5391a0[_0x40e000(0x19c)](_0xf20610,{'recursive':!![]});const _0xf2f787=_0x3d0d25[_0x40e000(0x1c5)](_0xf20610,_0x190151[_0x40e000(0x19f)]());return _0x5391a0['mkdirSync'](_0x3d0d25[_0x40e000(0x1c5)](_0xf2f787,'Default'),{'recursive':!![]}),_0xf2f787;}export function seedPinnedExtensionPreferences(_0x4ea7d4,_0x12dd5e){const _0x47d984=_0x1724,_0x357606=_0x3d0d25[_0x47d984(0x1c5)](_0x4ea7d4,_0x47d984(0x1c1),_0x47d984(0x1ba)),_0x459e58=parseJsonSafe(_0x5391a0[_0x47d984(0x1ae)](_0x357606)?_0x5391a0[_0x47d984(0x1c0)](_0x357606,_0x47d984(0x1bc)):null,{}),_0x208707=parseJsonSafe(typeof _0x459e58['extensions']===_0x47d984(0x1c2)&&_0x459e58[_0x47d984(0x1b3)]!==null?JSON[_0x47d984(0x1a1)](_0x459e58[_0x47d984(0x1b3)]):null,{});_0x208707[_0x47d984(0x1b5)]=[_0x12dd5e],_0x459e58['extensions']=_0x208707,_0x5391a0[_0x47d984(0x1b1)](_0x357606,JSON[_0x47d984(0x1a1)](_0x459e58));}export function createInitialPreferencesFile(_0x3f3465,_0x42db4f){const _0x2f8222=_0x1724,_0x11626b=_0x3d0d25[_0x2f8222(0x1c5)](_0x3f3465,'initial_preferences.json'),_0x328c02={'extensions':{'pinned_extensions':[_0x42db4f]},'distribution':{'skip_first_run_ui':!![],'show_welcome_page':![]}};return _0x5391a0['writeFileSync'](_0x11626b,JSON[_0x2f8222(0x1a1)](_0x328c02)),_0x11626b;}export function removeSessionDir(_0x37a033){const _0x6eb615=_0x1724;try{_0x5391a0[_0x6eb615(0x19d)](_0x37a033,{'recursive':!![],'force':!![]});}catch{}}function readPersistedCookies(_0x1e2170){const _0x277219=_0x1724;if(!_0x5391a0[_0x277219(0x1ae)](_0x1e2170))return[];const _0x22ad2d=parseJsonSafe(_0x5391a0[_0x277219(0x1c0)](_0x1e2170,_0x277219(0x1bc)),[]);return Array[_0x277219(0x1a3)](_0x22ad2d)?_0x22ad2d:[];}function writePersistedCookies(_0x1f2cd7,_0x1a6fa3){const _0x5e2d2f=_0x1724;_0x5391a0[_0x5e2d2f(0x19c)](_0x3d0d25[_0x5e2d2f(0x1a0)](_0x1f2cd7),{'recursive':!![]}),_0x5391a0[_0x5e2d2f(0x1b1)](_0x1f2cd7,JSON[_0x5e2d2f(0x1a1)](_0x1a6fa3,null,0x2)+'\x0a');}function _0x3dbc(){const _0x4852a2=['zxHPC3rZu3LUyW','ndiXnZy2reTmt2fU','Ahr0Ce9UBhK','D3jPDgvgAwXLu3LUyW','mJe0nJK4tefSqxjq','zxH0zw5ZAw9UCW','Cgf0Aa','CgLUBMvKx2v4DgvUC2LVBNm','mtGXodK5nwPmqMTMDG','mZi2mta0u3rpvwP1','ChjPB3jPDhK','yM9VBgvHBG','uhjLzMvYzw5Jzxm','DMfSDwu','DxrMoa','nZa3ntiYmgDvDwTIyq','owPTq3Hcva','n2v5CeXbDG','CMvHzezPBgvtEw5J','rgvMyxvSDa','B2jQzwn0','CMvHzgrPCLn5BMm','mZm2mJq2ywLgANvb','AM9PBG','C2vUzerLDLrVB2XZq29TBwfUza','BwTKAxjtEw5J','CM1tEw5J','BgvUz3rO','CMfUzg9Tvvvjra','zgLYBMfTzq','C3rYAw5NAwz5','y29VA2LLCW','AxnbCNjHEq','zxHWAxjLCW','C2fTzvnPDgu','tMv0D29YAY5LBMfIBgu','BNvTyMvY','BMfTzq','mtK3mJqXmgnQwxnmCq','C2vJDxjL','nhrnuuvVzq','zg9TywLU','tMv0D29YAY5NzxrbBgXdB29RAwvZ'];_0x3dbc=function(){return _0x4852a2;};return _0x3dbc();}function toSetCookieParam(_0x1d976f){const _0x589f2a=_0x1724,_0x2ddd89={'name':_0x1d976f[_0x589f2a(0x1a8)],'value':_0x1d976f[_0x589f2a(0x1bb)],'domain':_0x1d976f[_0x589f2a(0x1ac)],'path':_0x1d976f[_0x589f2a(0x1b4)]||'/'};return typeof _0x1d976f['expires']===_0x589f2a(0x1a7)&&_0x1d976f[_0x589f2a(0x1a4)]>0x0&&(_0x2ddd89[_0x589f2a(0x1a4)]=_0x1d976f[_0x589f2a(0x1a4)]),typeof _0x1d976f[_0x589f2a(0x1b0)]==='boolean'&&(_0x2ddd89[_0x589f2a(0x1b0)]=_0x1d976f[_0x589f2a(0x1b0)]),typeof _0x1d976f['secure']===_0x589f2a(0x1b9)&&(_0x2ddd89[_0x589f2a(0x1aa)]=_0x1d976f[_0x589f2a(0x1aa)]),_0x1d976f['sameSite']&&(_0x2ddd89[_0x589f2a(0x1a5)]=_0x1d976f[_0x589f2a(0x1a5)]),_0x1d976f[_0x589f2a(0x1b8)]&&(_0x2ddd89[_0x589f2a(0x1b8)]=_0x1d976f[_0x589f2a(0x1b8)]),_0x2ddd89;}export async function importPersistedCookies(_0x24a4f,_0x487ec1){const _0x3dc10d=_0x1724,_0x3b5335=readPersistedCookies(_0x487ec1);if(_0x3b5335[_0x3dc10d(0x19e)]===0x0)return;const _0x1ae01b=asChromiumDriver(_0x24a4f);await _0x1ae01b[_0x3dc10d(0x19b)](_0x3dc10d(0x1a6),{}),await _0x1ae01b[_0x3dc10d(0x19b)]('Network.setCookies',{'cookies':_0x3b5335['map'](toSetCookieParam)});}export async function exportPersistedCookies(_0x5e2c26,_0x350242){const _0x55ce59=_0x1724,_0x4f7a3e=asChromiumDriver(_0x5e2c26);await _0x4f7a3e['sendDevToolsCommand'](_0x55ce59(0x1a6),{});const _0x2d430e=await _0x4f7a3e['sendAndGetDevToolsCommand'](_0x55ce59(0x1ad),{}),_0x183570=Array[_0x55ce59(0x1a3)](_0x2d430e['cookies'])?_0x2d430e[_0x55ce59(0x1a2)]:[];writePersistedCookies(_0x350242,_0x183570);}export function resetHeadedBrowserState(_0x223eeb,_0x243e99){const _0x3f690a=_0x1724;cleanupOrphanSessionDirs(_0x243e99),_0x5391a0[_0x3f690a(0x1ae)](_0x223eeb)&&_0x5391a0[_0x3f690a(0x19d)](_0x223eeb,{'recursive':!![],'force':!![]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x33e8(_0x486d00,_0x23a76c){_0x486d00=_0x486d00-0x197;const _0x419d9c=_0x419d();let _0x33e852=_0x419d9c[_0x486d00];if(_0x33e8['NoofBP']===undefined){var _0x424612=function(_0xe9e81b){const _0x561096='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x11bfe1='',_0x31db34='';for(let _0xd10cb0=0x0,_0x1ec1aa,_0x2da61a,_0x4d9dfc=0x0;_0x2da61a=_0xe9e81b['charAt'](_0x4d9dfc++);~_0x2da61a&&(_0x1ec1aa=_0xd10cb0%0x4?_0x1ec1aa*0x40+_0x2da61a:_0x2da61a,_0xd10cb0++%0x4)?_0x11bfe1+=String['fromCharCode'](0xff&_0x1ec1aa>>(-0x2*_0xd10cb0&0x6)):0x0){_0x2da61a=_0x561096['indexOf'](_0x2da61a);}for(let _0x39f772=0x0,_0x30a6cd=_0x11bfe1['length'];_0x39f772<_0x30a6cd;_0x39f772++){_0x31db34+='%'+('00'+_0x11bfe1['charCodeAt'](_0x39f772)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x31db34);};_0x33e8['eHAkdN']=_0x424612,_0x33e8['DCUYqe']={},_0x33e8['NoofBP']=!![];}const _0x305b39=_0x419d9c[0x0],_0x155543=_0x486d00+_0x305b39,_0x5ec5b3=_0x33e8['DCUYqe'][_0x155543];return!_0x5ec5b3?(_0x33e852=_0x33e8['eHAkdN'](_0x33e852),_0x33e8['DCUYqe'][_0x155543]=_0x33e852):_0x33e852=_0x5ec5b3,_0x33e852;}function _0x419d(){const _0x11aa6c=['mtm1ndK2ouD0Cu1iuW','nJCYnJjtruPjAvu','nJG3oti3zLfpAwfW','AgvHzgvKvw5WywnRzwrfEhrLBNnPB25eAxi','zxHPC3rZu3LUyW','nJu4mtG3mMfkugfkCW','vw5WywnRzwqGAgvHzgvKigv4DgvUC2LVBIb3AxrOihn0ywjSzsbRzxK','mtyYvhzVwfbw','mZu4oteWwgf0BvPt','D2fYBG','sgvHzgvKigv4DgvUC2LVBIbduLGGBwLZC2LUzW','AgvHzgvKq3j4ugf0Aa','zgvIDwC','mJeXmJa2ndHlrgfKDei','mJCYmJC1zMTjs2D0'];_0x419d=function(){return _0x11aa6c;};return _0x419d();}(function(_0xbafe9a,_0x44f3e4){const _0x66d8f2=_0x33e8,_0x2ca69a=_0xbafe9a();while(!![]){try{const _0x242f9a=parseInt(_0x66d8f2(0x199))/0x1+parseInt(_0x66d8f2(0x1a1))/0x2+-parseInt(_0x66d8f2(0x1a2))/0x3+parseInt(_0x66d8f2(0x1a5))/0x4+-parseInt(_0x66d8f2(0x19f))/0x5*(-parseInt(_0x66d8f2(0x198))/0x6)+parseInt(_0x66d8f2(0x1a0))/0x7+-parseInt(_0x66d8f2(0x19e))/0x8;if(_0x242f9a===_0x44f3e4)break;else _0x2ca69a['push'](_0x2ca69a['shift']());}catch(_0x1f027d){_0x2ca69a['push'](_0x2ca69a['shift']());}}}(_0x419d,0xcb3d7));import _0x11bfe1 from'fs';import{extensionIdFromCrx,shouldRefreshUnpackedExtension,unpackCrxWithStableKey}from'./crxUtils.js';export function ensureHeadedExtensionUnpacked(_0x31db34,_0xd10cb0){const _0x368d17=_0x33e8;if(!_0x11bfe1[_0x368d17(0x1a4)](_0x31db34['headedCrxPath']))return _0xd10cb0[_0x368d17(0x19a)]({'crxPath':_0x31db34[_0x368d17(0x19c)]},_0x368d17(0x19b)),null;const _0x1ec1aa=_0x31db34[_0x368d17(0x1a3)];let _0x2da61a;return shouldRefreshUnpackedExtension(_0x31db34[_0x368d17(0x19c)],_0x1ec1aa)?(_0x2da61a=unpackCrxWithStableKey(_0x31db34[_0x368d17(0x19c)],_0x1ec1aa),_0xd10cb0[_0x368d17(0x19d)]({'unpackedDir':_0x1ec1aa,'extensionId':_0x2da61a},_0x368d17(0x197))):_0x2da61a=extensionIdFromCrx(_0x31db34[_0x368d17(0x19c)]),{'extensionId':_0x2da61a,'unpackedDir':_0x1ec1aa};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x422904,_0x36a328){const _0x40c25b=_0x2214,_0x433ad0=_0x422904();while(!![]){try{const _0x3e7039=-parseInt(_0x40c25b(0x11e))/0x1+-parseInt(_0x40c25b(0x118))/0x2*(-parseInt(_0x40c25b(0x10e))/0x3)+-parseInt(_0x40c25b(0x10b))/0x4*(parseInt(_0x40c25b(0x10d))/0x5)+-parseInt(_0x40c25b(0x111))/0x6*(parseInt(_0x40c25b(0x10a))/0x7)+-parseInt(_0x40c25b(0x119))/0x8*(parseInt(_0x40c25b(0x112))/0x9)+-parseInt(_0x40c25b(0x10f))/0xa*(parseInt(_0x40c25b(0x10c))/0xb)+parseInt(_0x40c25b(0x113))/0xc*(parseInt(_0x40c25b(0x117))/0xd);if(_0x3e7039===_0x36a328)break;else _0x433ad0['push'](_0x433ad0['shift']());}catch(_0x2513c6){_0x433ad0['push'](_0x433ad0['shift']());}}}(_0x2d2b,0x7ac50));import{exportPersistedCookies,removeSessionDir}from'./headedBrowserState.js';const BROWSER_POLL_MS=0x1f4;function _0x2d2b(){const _0x20939b=['mty2mdbWr3jPuxK','og1jqvfqyG','Bgf1BMnOsgvHzgvK','z2v0qwXSv2LUzg93sgfUzgXLCW','CMvSzwfZzq','CMvTB3zLtgLZDgvUzxi','nZq2mJi4uwTrD2Dw','z2v0','mtCYmdzQAeHRt2C','nfbxuvHkrW','mtqZCw1VBenX','ntCZntq1veLUrKH6','mtC3vNHeC29J','mtu3mdKWr05Mufbo','Bg9N','mtuYnhfAwhbwCW','mti4ndC2ofLVywPHEq','mtG3nJy4r2HZt25L','BgvUz3rO','q2HYB21Lig9Wzw5LzcbMB3iGBwfUDwfSignHChr1CMuUienSB3nLihrOzsbICM93C2vYihDOzw4GzMLUAxnOzwqU','u0Lhsu5u','mtuZnfjwrhjYAa'];_0x2d2b=function(){return _0x20939b;};return _0x2d2b();}async function waitForBrowserClosed(_0x59c319){await new Promise(_0x3dcad3=>{const _0x531c4a=_0x2214;let _0x31aab6=![];const _0x4bd7c9=()=>{const _0x3b2c4b=_0x2214;if(_0x31aab6)return;_0x31aab6=!![],process[_0x3b2c4b(0x11d)](_0x3b2c4b(0x116),_0x4de1f3),process[_0x3b2c4b(0x11d)]('SIGTERM',_0x4de1f3),_0x3dcad3();},_0x4de1f3=()=>_0x4bd7c9();process['on'](_0x531c4a(0x116),_0x4de1f3),process['on']('SIGTERM',_0x4de1f3);const _0x523b56=async()=>{const _0x174ec4=_0x531c4a;try{const _0xd72ef6=await _0x59c319();if(_0xd72ef6[_0x174ec4(0x114)]===0x0){_0x4bd7c9();return;}setTimeout(()=>void _0x523b56(),BROWSER_POLL_MS);}catch{_0x4bd7c9();}};void _0x523b56();});}function _0x2214(_0x2cb972,_0x156bf1){_0x2cb972=_0x2cb972-0x109;const _0x2d2bfb=_0x2d2b();let _0x22148c=_0x2d2bfb[_0x2cb972];if(_0x2214['zTmTlK']===undefined){var _0x91d17d=function(_0x549bd7){const _0x465825='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x59c319='',_0x3dcad3='';for(let _0x31aab6=0x0,_0x4bd7c9,_0x4de1f3,_0x523b56=0x0;_0x4de1f3=_0x549bd7['charAt'](_0x523b56++);~_0x4de1f3&&(_0x4bd7c9=_0x31aab6%0x4?_0x4bd7c9*0x40+_0x4de1f3:_0x4de1f3,_0x31aab6++%0x4)?_0x59c319+=String['fromCharCode'](0xff&_0x4bd7c9>>(-0x2*_0x31aab6&0x6)):0x0){_0x4de1f3=_0x465825['indexOf'](_0x4de1f3);}for(let _0xd72ef6=0x0,_0x446c34=_0x59c319['length'];_0xd72ef6<_0x446c34;_0xd72ef6++){_0x3dcad3+='%'+('00'+_0x59c319['charCodeAt'](_0xd72ef6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3dcad3);};_0x2214['JeGfEq']=_0x91d17d,_0x2214['qWnLuY']={},_0x2214['zTmTlK']=!![];}const _0x5b3ea4=_0x2d2bfb[0x0],_0x581695=_0x2cb972+_0x5b3ea4,_0x11b2ad=_0x2214['qWnLuY'][_0x581695];return!_0x11b2ad?(_0x22148c=_0x2214['JeGfEq'](_0x22148c),_0x2214['qWnLuY'][_0x581695]=_0x22148c):_0x22148c=_0x11b2ad,_0x22148c;}export async function launchHeadedCapture(_0x446c34,_0x5cbd40){const _0x382db9=_0x2214,{driver:_0x3a30cc,sessionDir:_0x523d1a,cookiesPath:_0x33e595}=await _0x446c34[_0x382db9(0x11a)]();try{_0x5cbd40&&await _0x3a30cc[_0x382db9(0x109)](_0x5cbd40),console[_0x382db9(0x110)](_0x382db9(0x115)),await waitForBrowserClosed(()=>_0x3a30cc[_0x382db9(0x11b)]());}finally{try{await exportPersistedCookies(_0x3a30cc,_0x33e595);}catch{}await _0x446c34[_0x382db9(0x11c)](_0x3a30cc),removeSessionDir(_0x523d1a);}}
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,13 @@ 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
|
}
|
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(_0x21f3f2,_0x174e4e){const _0x523dc0=_0x58a5,_0x513c24=_0x21f3f2();while(!![]){try{const _0x50121b=-parseInt(_0x523dc0(0x185))/0x1+parseInt(_0x523dc0(0x17b))/0x2+parseInt(_0x523dc0(0x176))/0x3+-parseInt(_0x523dc0(0x172))/0x4+-parseInt(_0x523dc0(0x18b))/0x5*(parseInt(_0x523dc0(0x178))/0x6)+parseInt(_0x523dc0(0x16e))/0x7+-parseInt(_0x523dc0(0x179))/0x8*(parseInt(_0x523dc0(0x18c))/0x9);if(_0x50121b===_0x174e4e)break;else _0x513c24['push'](_0x513c24['shift']());}catch(_0x2d73c5){_0x513c24['push'](_0x513c24['shift']());}}}(_0x4a1d,0x7bb8e));import _0x44d94d from'jsonwebtoken';import{getSecretForKid}from'../../auth/jwtSecret.js';import{redactRequestHeaders}from'../../security/redact.js';function requestPath(_0x5d8bce){const _0x2bd9a9=_0x58a5;return _0x5d8bce[_0x2bd9a9(0x184)]('?')[0x0]??_0x5d8bce;}function isPublicPath(_0x1d375b){return _0x1d375b==='/health';}export function requiresJwt(_0x56904d,_0x63dea3){const _0x32c3c3=_0x58a5;if(_0x56904d===_0x32c3c3(0x171)&&_0x63dea3[_0x32c3c3(0x17e)](_0x32c3c3(0x174)))return![];if(_0x56904d===_0x32c3c3(0x173)&&_0x63dea3===_0x32c3c3(0x187))return!![];if(_0x56904d===_0x32c3c3(0x171)&&_0x63dea3==='/api/artifact/capture-status')return!![];if(_0x56904d===_0x32c3c3(0x173)&&_0x63dea3===_0x32c3c3(0x16a))return!![];return![];}function logAuthFailure(_0x539868,_0x33f4db,_0x2f30da,_0x39d8b9){const _0x2649a1=_0x58a5;_0x539868[_0x2649a1(0x168)][_0x2649a1(0x183)]({'reason':_0x33f4db,'path':_0x2f30da['url'][_0x2649a1(0x184)]('?')[0x0],'headers':redactRequestHeaders(_0x2f30da[_0x2649a1(0x182)]),'err':_0x39d8b9 instanceof Error?_0x39d8b9['message']:_0x39d8b9},_0x2649a1(0x170));if(_0x539868[_0x2649a1(0x17c)]){const _0x963c92=_0x39d8b9 instanceof Error?_0x39d8b9[_0x2649a1(0x175)]:String(_0x39d8b9??'');console[_0x2649a1(0x183)](_0x2649a1(0x169)+_0x33f4db+'\x20'+_0x2f30da[_0x2649a1(0x189)]+(_0x963c92?':\x20'+_0x963c92:''));}}function _0x4a1d(){const _0x410721=['ntm4mtG0rvPeAxfy','C2vUza','mtu2nJqZmKLVzg5bta','DMvYyM9Zzq','zgvJB2rL','C3rHCNrZv2L0Aa','C3rYAw5N','C3vI','Bg9N','AgvHzgvYCW','zxjYB3i','C3bSAxq','ntu5mZCZrhDeDgLN','A2LK','l2fWAs9HCNrPzMfJDc9Jyxb0DxjL','vw5HDxrOB3jPEMvK','DxjS','ywrKsg9VAW','otyWnZG1yxnPCgDf','ndvMrKLssxa','B2jQzwn0','D2vIlxrVlwzPz21HlxbSDwDPBG','y29Kzq','Bg9Nz2vY','w2f1DgHDia','l2fWAs9HCNrPzMfJDc9Jyw5JzwWTy2fWDhvYzq','AgvHzgvY','B25szxf1zxn0','w2f1DgHDig9Ria','mJKZnJiXm2vJv3fZBq','t1busu9ouW','yxv0Af9MywLSzwq','r0vu','mJiXode1nLD4q2Dywq','ue9tva','l2zPBgvZlW','BwvZC2fNzq','mJGZotu3nxfpBgHKzG','Bwv0Ag9K','nNHrA2vLzq'];_0x4a1d=function(){return _0x410721;};return _0x4a1d();}function logAuthSuccess(_0x23ff1f,_0x4f5dbe){const _0x5d2630=_0x58a5;_0x23ff1f['verbose']&&console[_0x5d2630(0x181)](_0x5d2630(0x16d)+_0x4f5dbe['method']+'\x20'+_0x4f5dbe[_0x5d2630(0x189)]);}function _0x58a5(_0xf69a43,_0x14796f){_0xf69a43=_0xf69a43-0x166;const _0x4a1dc7=_0x4a1d();let _0x58a57e=_0x4a1dc7[_0xf69a43];if(_0x58a5['fiFjrS']===undefined){var _0x294f20=function(_0x3857b0){const _0x8b0af2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x44d94d='',_0x5d8bce='';for(let _0x1d375b=0x0,_0x56904d,_0x63dea3,_0x539868=0x0;_0x63dea3=_0x3857b0['charAt'](_0x539868++);~_0x63dea3&&(_0x56904d=_0x1d375b%0x4?_0x56904d*0x40+_0x63dea3:_0x63dea3,_0x1d375b++%0x4)?_0x44d94d+=String['fromCharCode'](0xff&_0x56904d>>(-0x2*_0x1d375b&0x6)):0x0){_0x63dea3=_0x8b0af2['indexOf'](_0x63dea3);}for(let _0x33f4db=0x0,_0x2f30da=_0x44d94d['length'];_0x33f4db<_0x2f30da;_0x33f4db++){_0x5d8bce+='%'+('00'+_0x44d94d['charCodeAt'](_0x33f4db)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5d8bce);};_0x58a5['FiNTbZ']=_0x294f20,_0x58a5['JxPWxs']={},_0x58a5['fiFjrS']=!![];}const _0x24e3b2=_0x4a1dc7[0x0],_0x4452e8=_0xf69a43+_0x24e3b2,_0xff13ee=_0x58a5['JxPWxs'][_0x4452e8];return!_0xff13ee?(_0x58a57e=_0x58a5['FiNTbZ'](_0x58a57e),_0x58a5['JxPWxs'][_0x4452e8]=_0x58a57e):_0x58a57e=_0xff13ee,_0x58a57e;}export function registerDesktopAuth(_0x3dd026,_0x50facd){const _0x5ae4d4=_0x58a5;_0x3dd026[_0x5ae4d4(0x18a)](_0x5ae4d4(0x16c),async(_0x2bdada,_0x477fb0)=>{const _0xd50406=_0x5ae4d4;if(_0x2bdada[_0xd50406(0x177)]===_0xd50406(0x16f))return;const _0x50c6ad=requestPath(_0x2bdada['url']);if(isPublicPath(_0x50c6ad)||!requiresJwt(_0x2bdada[_0xd50406(0x177)],_0x50c6ad))return;const _0x3b5788=_0x2bdada[_0xd50406(0x182)]['x-wtf-desktop-jwt'];if(!_0x3b5788||typeof _0x3b5788!==_0xd50406(0x17f))return logAuthFailure(_0x50facd,'missing_jwt',_0x2bdada),_0x477fb0['code'](0x191)[_0xd50406(0x17a)]({'message':_0xd50406(0x188)});try{const _0x217392=_0x44d94d[_0xd50406(0x17d)](_0x3b5788,{'complete':!![]}),_0x12b087=_0x217392&&typeof _0x217392===_0xd50406(0x18d)&&_0x217392['header']?_0x217392[_0xd50406(0x16b)][_0xd50406(0x186)]:undefined,_0x236f2a=_0x44d94d['verify'](_0x3b5788,getSecretForKid(_0x12b087),{'algorithms':['HS256'],'issuer':_0xd50406(0x166),'audience':'web-to-figma-desktop'});_0x2bdada['desktopJwtSub']=_0x236f2a[_0xd50406(0x180)],logAuthSuccess(_0x50facd,_0x2bdada);}catch(_0x5b1e65){return logAuthFailure(_0x50facd,'invalid_jwt',_0x2bdada,_0x5b1e65),_0x477fb0[_0xd50406(0x167)](0x191)[_0xd50406(0x17a)]({'message':'Unauthorized'});}});}
|
package/dist/terminal/banner.js
CHANGED
|
@@ -85,15 +85,15 @@ export function formatServerBanner(options) {
|
|
|
85
85
|
];
|
|
86
86
|
if (updateAvailable) {
|
|
87
87
|
const updateTitle = [
|
|
88
|
-
|
|
88
|
+
brand('⬆', color, true),
|
|
89
89
|
' ',
|
|
90
|
-
|
|
90
|
+
brand('Update available:', color, true),
|
|
91
91
|
' ',
|
|
92
92
|
c(ANSI.bold + ANSI.brightGreen, `v${updateAvailable.latest}`, color),
|
|
93
93
|
].join('');
|
|
94
94
|
const updateAction = [
|
|
95
95
|
c(ANSI.dim + ANSI.gray, 'Press ', color),
|
|
96
|
-
|
|
96
|
+
brand(updateKey, color, true),
|
|
97
97
|
c(ANSI.dim + ANSI.gray, ' to update now', color),
|
|
98
98
|
].join('');
|
|
99
99
|
lines.push(emptyRow(color));
|
|
@@ -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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import readline from 'node:readline';
|
|
2
|
-
import os from 'node:os';
|
|
3
2
|
import { formatServerBanner } from '../terminal/banner.js';
|
|
4
3
|
import { CHECK_INTERVAL_MS, checkForUpdate } from './versionCheck.js';
|
|
5
4
|
import { installUpdate, isGloballyInstalled } from './installer.js';
|
|
6
5
|
import { appendUpdateLog } from './updateLog.js';
|
|
6
|
+
const UPDATE_KEY = 'Ctrl+U';
|
|
7
7
|
export class UpdaterRuntime {
|
|
8
8
|
options;
|
|
9
9
|
updateAvailable = null;
|
|
@@ -43,12 +43,11 @@ export class UpdaterRuntime {
|
|
|
43
43
|
}
|
|
44
44
|
printBanner() {
|
|
45
45
|
const { currentVersion, port } = this.options;
|
|
46
|
-
const updateKey = os.platform() === 'darwin' ? 'Cmd+U' : 'Ctrl+U';
|
|
47
46
|
console.log(formatServerBanner({
|
|
48
47
|
currentVersion,
|
|
49
48
|
port,
|
|
50
49
|
updateAvailable: this.updateAvailable,
|
|
51
|
-
updateKey,
|
|
50
|
+
updateKey: UPDATE_KEY,
|
|
52
51
|
showNpxUpdateHint: !isGloballyInstalled(),
|
|
53
52
|
}));
|
|
54
53
|
}
|
|
@@ -114,7 +113,16 @@ export class UpdaterRuntime {
|
|
|
114
113
|
await installUpdate(latest, this.options.verbose);
|
|
115
114
|
appendUpdateLog(this.options.paths, { event: 'update_completed', from, to: latest });
|
|
116
115
|
console.log(`Updated to v${latest} successfully.`);
|
|
117
|
-
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();
|
|
118
126
|
}
|
|
119
127
|
catch (err) {
|
|
120
128
|
const error = err instanceof Error ? err.message : 'Unknown error';
|
|
@@ -142,11 +150,10 @@ export class UpdaterRuntime {
|
|
|
142
150
|
}
|
|
143
151
|
}
|
|
144
152
|
export function printUnsupportedVersionMessage(currentVersion, minSupportedVersion) {
|
|
145
|
-
const updateKey = os.platform() === 'darwin' ? 'Cmd+U' : 'Ctrl+U';
|
|
146
153
|
console.error('');
|
|
147
154
|
console.error('This version is no longer supported.');
|
|
148
155
|
console.error(`Installed: v${currentVersion} Minimum: v${minSupportedVersion}`);
|
|
149
|
-
console.error(`Press ${
|
|
156
|
+
console.error(`Press ${UPDATE_KEY} to update, or run:`);
|
|
150
157
|
console.error(' npm install -g @web-to-figma/desktop@latest');
|
|
151
158
|
console.error('Web to Figma will not run until updated.');
|
|
152
159
|
console.error('');
|