From 59afd96551ebd2cc6ba791a1471845470d5ff91c Mon Sep 17 00:00:00 2001 From: Martin Varmuza Date: Mon, 4 Nov 2024 18:24:38 +0100 Subject: [PATCH] wip --- .../connect-init/src/connectInitThunks.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/suite-common/connect-init/src/connectInitThunks.ts b/suite-common/connect-init/src/connectInitThunks.ts index 5b91795c12f..09cc842c098 100644 --- a/suite-common/connect-init/src/connectInitThunks.ts +++ b/suite-common/connect-init/src/connectInitThunks.ts @@ -127,9 +127,20 @@ export const connectInitThunk = createThunk( if (window.location.origin.includes('localhost')) { _sessionsBackgroundUrl = null; } else if (window.location.origin.endsWith('dev.suite.sldev.cz')) { - //https://dev.suite.sldev.cz/suite-web/fix-sharing-of-sharedworker/web/static/connect/workers/sessions-background-sharedworker.js + //dev.suite.sldev.cz/connect/fix-sharing-of-sharedworker/workers/sessions-background-sharedwor… // we are expecting accompanying connect build at specified location - _sessionsBackgroundUrl = `${window.location.origin}${process.env.ASSET_PREFIX || ''}/static/connect/workers/sessions-background-sharedworker.js`; + const a = (process.env.ASSET_PREFIX || '').split('/').filter(Boolean); + const b = a + .map((segment, index) => { + const first = index === 0; + const last = index === a.length - 1; + if (segment === 'suite-web' && first) return 'connect'; + if (segment === 'web' && last) return null; + return segment; + }) + .filter(Boolean); + + _sessionsBackgroundUrl = `${window.location.origin}/${b.join('/')}/workers/sessions-background-sharedworker.js`; } else { _sessionsBackgroundUrl = 'https://connect.trezor.io/9/workers/sessions-background-sharedworker.js';