Skip to content

Commit 5935525

Browse files
committed
revert(auth): remove RefreshWorker integration and URL override
1 parent c9ab4d9 commit 5935525

4 files changed

Lines changed: 3 additions & 72 deletions

File tree

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,6 @@ import {
113113
} from 'solid-logic';
114114
```
115115

116-
## Worker Asset and Runtime Configuration
117-
118-
solid-logic publishes the OIDC refresh worker as a package export so host apps can serve it from the same origin.
119-
120-
### Worker export
121-
122-
- Package export: `solid-logic/RefreshWorker`
123-
- Built file: `dist/RefreshWorker.js`
124-
125-
Host applications should copy or serve this file so the browser can load it with a same-origin URL.
126-
127-
### Worker URL override
128-
129-
Before solid-logic initializes, applications can set:
130-
131-
```js
132-
window.__SOLID_LOGIC_WORKER_URL__ = 'https://app.example.com/RefreshWorker.js'
133-
```
134-
135-
If this override is not set, solid-logic resolves the worker URL to `./RefreshWorker.js` against `window.location.href`.
136-
137-
### Session fallback behavior
138-
139-
When worker session initialization fails, solid-logic falls back in this order:
140-
141-
1. `SessionCore` with IndexedDB-backed session database
142-
2. `SessionCore` with in-memory session database
143-
144116
# How to develop
145117

146118
Check the scripts in the `package.json` for build, watch, lint and test.

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
"import": "./dist/solid-logic.esm.js",
1212
"require": "./dist/solid-logic.js",
1313
"types": "./dist/index.d.ts"
14-
},
15-
"./RefreshWorker": {
16-
"import": "./dist/RefreshWorker.js",
17-
"default": "./dist/RefreshWorker.js"
1814
}
1915
},
2016
"sideEffects": false,
@@ -25,11 +21,10 @@
2521
],
2622
"scripts": {
2723
"clean": "rm -rf dist src/versionInfo.ts",
28-
"build": "npm run clean && npm run typecheck && npm run build-version && npm run build-js && npm run build-dist && npm run copy-worker && npm run postbuild-js",
24+
"build": "npm run clean && npm run typecheck && npm run build-version && npm run build-js && npm run build-dist && npm run postbuild-js",
2925
"build-version": "./timestamp.sh > src/versionInfo.ts && eslint 'src/versionInfo.ts' --fix",
3026
"build-js": "tsc",
3127
"build-dist": "webpack --progress",
32-
"copy-worker": "node -e \"const fs=require('fs');const path=require('path');const src=path.resolve('node_modules/@uvdsl/solid-oidc-client-browser/dist/esm/web/RefreshWorker.js');const dst=path.resolve('dist/RefreshWorker.js');fs.copyFileSync(src,dst);\"",
3328
"postbuild-js": "rm -f dist/versionInfo.d.ts dist/versionInfo.d.ts.map",
3429
"lint": "eslint",
3530
"lint-fix": "eslint --fix",

src/authSession/authSession.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,31 +147,9 @@ class IndexedDbSessionDatabase implements SessionDatabase {
147147
}
148148
}
149149

150-
function resolveWorkerUrl (): string | URL | undefined {
151-
if (typeof window === 'undefined') return undefined
152-
153-
const explicitWorkerUrl = (window as any).__SOLID_LOGIC_WORKER_URL__
154-
if (typeof explicitWorkerUrl === 'string' && explicitWorkerUrl.trim().length > 0) {
155-
return explicitWorkerUrl
156-
}
157-
if (explicitWorkerUrl instanceof URL) {
158-
return explicitWorkerUrl
159-
}
160-
161-
try {
162-
// Default to same-origin sibling asset next to the current page URL.
163-
new URL('/RefreshWorker.js', window.location.origin).toString()
164-
} catch {
165-
return undefined
166-
}
167-
}
168-
169150
function createSession (): OidcSession {
170151
try {
171-
const workerUrl = resolveWorkerUrl()
172-
return workerUrl
173-
? new WebSession(undefined, { workerUrl })
174-
: new WebSession()
152+
return new WebSession()
175153
} catch (error) {
176154
// In some deployments, worker URL resolution can become file:// and fail cross-origin.
177155
// Fall back to SessionCore so auth still works without background refresh worker.
@@ -205,4 +183,4 @@ if (typeof (_session as unknown as EventTarget).addEventListener === 'function')
205183

206184
export const authSession: SessionWithLegacyEvents = Object.assign(_session, { events })
207185

208-
186+

test/packageExports.test.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)