30bb6a942d
- Corrected manifest (Jobbjakt branding, matching green theme, maskable icons, description/categories/scope/id). - share_target (GET) maps a shared url/link into the same /?add= capture flow the bookmarklet uses, so mobile 'Share -> Jobbjakt' pre-fills Add Job. - resolveCaptureUrl helper (tested) extracts the link from add or from a link embedded in shared text; App uses it and strips the params. - Deliberately no offline service worker: the app deploys frequently and an aggressive cache would risk stale builds (documented in README). - 4 unit tests; build compiles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
11 lines
462 B
TypeScript
11 lines
462 B
TypeScript
// Resolves the quick-capture URL from query params produced by the bookmarklet (`add`)
|
|
// or the PWA share-target (a link in `add`, or embedded in shared `addtext`).
|
|
export function resolveCaptureUrl(search: string): string | null {
|
|
const params = new URLSearchParams(search);
|
|
const add = params.get("add");
|
|
if (add) return add;
|
|
const addText = params.get("addtext");
|
|
if (addText) return addText.match(/https?:\/\/\S+/)?.[0] ?? null;
|
|
return null;
|
|
}
|