dsh-builtin-browser 1.0.3 → 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/README.en.md +89 -0
- package/browser-extension/constants.mjs +20 -0
- package/browser-extension/controller.mjs +293 -0
- package/browser-extension/locales.mjs +15 -0
- package/browser-extension/manifest.json +12 -0
- package/browser-extension/options.html +14 -0
- package/browser-extension/options.mjs +9 -0
- package/browser-extension/permission-guard.mjs +13 -0
- package/browser-extension/worker.mjs +74 -0
- package/package.json +20 -2
- package/scripts/build-client.mjs +305 -0
- package/scripts/build.mjs +69 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +40 -0
- package/scripts/install-electron.mjs +101 -0
- package/scripts/pack.mjs +99 -0
- package/scripts/publish-manifest.mjs +56 -0
- package/scripts/verify-exports.mjs +58 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +98 -0
- package/skills/dsh-builtin-browser/references/batch.md +68 -0
- package/skills/dsh-builtin-browser/references/deliver.md +31 -0
- package/skills/dsh-builtin-browser/references/locate.md +11 -0
- package/skills/dsh-builtin-browser/references/recover.md +11 -0
- package/skills/dsh-builtin-browser/references/verify.md +13 -0
- package/skills/dsh-debug-host/SKILL.md +56 -0
- package/skills/dsh-debug-self/SKILL.md +50 -0
- package/src/bridge-compatibility.ts +39 -0
- package/src/browser/anti-bot.ts +251 -0
- package/src/browser/deep-dom.ts +40 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +578 -0
- package/src/browser/takeover-target.ts +45 -0
- package/src/browser/types.ts +870 -0
- package/src/browser-electron/authenticated-route.ts +109 -0
- package/src/browser-electron/automatic-maintenance.ts +736 -0
- package/src/browser-electron/bridge-auto.ts +159 -0
- package/src/browser-electron/bridge-connection.ts +386 -0
- package/src/browser-electron/bridge-endpoint.ts +129 -0
- package/src/browser-electron/bridge-install.ts +290 -0
- package/src/browser-electron/bridge-maintenance.ts +189 -0
- package/src/browser-electron/bridge-status.ts +386 -0
- package/src/browser-electron/desktop-bridge-host.ts +253 -0
- package/src/browser-electron/desktop-identity.ts +353 -0
- package/src/browser-electron/desktop-shell.ts +100 -0
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +347 -0
- package/src/browser-electron/entry.ts +1378 -0
- package/src/browser-electron/ephemeral-profile.ts +189 -0
- package/src/browser-electron/extension-browser.ts +230 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/file-write.ts +31 -0
- package/src/browser-electron/foreground-watch.ts +142 -0
- package/src/browser-electron/guest-cookie-jar.ts +177 -0
- package/src/browser-electron/guest-cookie-store.ts +59 -0
- package/src/browser-electron/guest-css-runtime.ts +76 -0
- package/src/browser-electron/guest-css.ts +68 -0
- package/src/browser-electron/guest-route.ts +716 -0
- package/src/browser-electron/guest-runtime.ts +408 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +120 -0
- package/src/browser-electron/history-store.ts +224 -0
- package/src/browser-electron/host-main.ts +1385 -0
- package/src/browser-electron/host-patch-maintenance.ts +121 -0
- package/src/browser-electron/http-body.ts +65 -0
- package/src/browser-electron/json-reply.ts +47 -0
- package/src/browser-electron/maintenance-broker.ts +166 -0
- package/src/browser-electron/maintenance-lifecycle.ts +91 -0
- package/src/browser-electron/maintenance-route.ts +68 -0
- package/src/browser-electron/missing-system-browser.ts +114 -0
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +25 -0
- package/src/browser-electron/preferred-browser.ts +130 -0
- package/src/browser-electron/preview-route.ts +215 -0
- package/src/browser-electron/process-ownership.ts +174 -0
- package/src/browser-electron/process.ts +23 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +47 -0
- package/src/browser-electron/profile-extension.ts +129 -0
- package/src/browser-electron/profile-lease.ts +211 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider-core.ts +1107 -0
- package/src/browser-electron/provider-interaction.ts +1034 -0
- package/src/browser-electron/provider-media.ts +589 -0
- package/src/browser-electron/provider-navigation.ts +323 -0
- package/src/browser-electron/provider-observation.ts +664 -0
- package/src/browser-electron/provider-tabs.ts +372 -0
- package/src/browser-electron/provider.ts +666 -0
- package/src/browser-electron/reference-route.ts +598 -0
- package/src/browser-electron/remote-host.ts +1538 -0
- package/src/browser-electron/rpc-input.ts +13 -0
- package/src/browser-electron/rpc-ops.ts +41 -0
- package/src/browser-electron/runtime-diagnostics.ts +38 -0
- package/src/browser-electron/runtime-route.ts +105 -0
- package/src/browser-electron/runtime-status.ts +309 -0
- package/src/browser-electron/settings-route.ts +64 -0
- package/src/browser-electron/settings-store.ts +593 -0
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +300 -0
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +1850 -0
- package/src/browser-electron/tauri-host.ts +194 -0
- package/src/browser-electron/timing.ts +16 -0
- package/src/browser-electron/virtual-cursor.ts +162 -0
- package/src/browser-electron/windows-system.ts +24 -0
- package/src/browser-reference/delivery.ts +384 -0
- package/src/browser-reference/entry.ts +631 -0
- package/src/browser-reference/export.ts +339 -0
- package/src/browser-reference/import.ts +303 -0
- package/src/browser-reference/page-script.ts +1537 -0
- package/src/browser-reference/service.ts +1346 -0
- package/src/browser-reference/store.ts +172 -0
- package/src/browser-reference/text-quote.ts +219 -0
- package/src/browser-reference/types.ts +195 -0
- package/src/browser-reference/visible.ts +367 -0
- package/src/browser-reference/web-sources.ts +106 -0
- package/src/client/apply-guard.ts +22 -0
- package/src/client/browser/BrowserController.ts +693 -0
- package/src/client/browser/BrowserFrame.ts +78 -0
- package/src/client/browser/BrowserNavigation.ts +169 -0
- package/src/client/browser/BrowserPage.ts +23 -0
- package/src/client/browser/BrowserPersistence.ts +44 -0
- package/src/client/browser/IframeImpl.ts +182 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/frame-history.ts +125 -0
- package/src/client/browser/frame-state.ts +27 -0
- package/src/client/browser/iframe-reference.ts +67 -0
- package/src/client/browser/initialization.ts +262 -0
- package/src/client/browser/omnibox.ts +243 -0
- package/src/client/browser/store.ts +38 -0
- package/src/client/browser/takeover-channel.ts +72 -0
- package/src/client/browser/url.ts +46 -0
- package/src/client/browser/web-reference-source.ts +56 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +36 -0
- package/src/client/electron/ElectronWebViewImpl.ts +371 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +140 -0
- package/src/client/electron/NativeChildPresentation.ts +53 -0
- package/src/client/electron/NativeViewPage.ts +265 -0
- package/src/client/electron/pages.ts +23 -0
- package/src/client/electron/reference-overlay.ts +53 -0
- package/src/client/electron/workspace.ts +33 -0
- package/src/client/index.ts +333 -0
- package/src/client/locales.ts +860 -0
- package/src/client/pages.ts +28 -0
- package/src/client/reference/client/BrowserRefLink.tsx +142 -0
- package/src/client/reference/client/draft-reference.ts +167 -0
- package/src/client/reference/client/index.ts +7 -0
- package/src/client/reference/client/ordered-submission.ts +108 -0
- package/src/client/reference/client/pending-delivery.ts +216 -0
- package/src/client/reference/client/plugin.ts +208 -0
- package/src/client/reference/client/production/ReferenceCapsules.tsx +345 -0
- package/src/client/reference/client/production/ReferenceDock.module.css +193 -0
- package/src/client/reference/client/production/ReferenceDock.tsx +6 -0
- package/src/client/reference/client/production/ReferenceFeedback.tsx +15 -0
- package/src/client/reference/client/production/ReferenceMath.tsx +44 -0
- package/src/client/reference/client/production/ReferenceText.tsx +36 -0
- package/src/client/reference/client/production/assembly.ts +447 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +72 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/composer-attachments.ts +44 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +512 -0
- package/src/client/reference/client/production/http-transport.ts +212 -0
- package/src/client/reference/client/production/production-submission.ts +70 -0
- package/src/client/reference/client/production/protocol.ts +234 -0
- package/src/client/reference/client/production/reference-card.ts +240 -0
- package/src/client/reference/client/production/reference-labels.ts +29 -0
- package/src/client/reference/client/production/reply-link-bridge.ts +222 -0
- package/src/client/reference/client/production/reveal.ts +215 -0
- package/src/client/reference/client/production/runtime.ts +1056 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +99 -0
- package/src/client/reference/client/production/source-opener.ts +55 -0
- package/src/client/reference/client/production/styles.ts +104 -0
- package/src/client/reference/client/production/user-text-rule.ts +67 -0
- package/src/client/reference/client/reveal.ts +109 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/session-schedule.ts +36 -0
- package/src/client/reference/client/types.ts +168 -0
- package/src/client/reference/css-modules.d.ts +4 -0
- package/src/client/reference/index.ts +11 -0
- package/src/client/reference-capture-owner.ts +162 -0
- package/src/client/reference-intents.ts +36 -0
- package/src/client/settings/index.ts +42 -0
- package/src/client/settings/mount-guard.ts +31 -0
- package/src/client/settings/panel.ts +2768 -0
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +300 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +315 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +365 -0
- package/src/client/view/StartPage.tsx +598 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/compat/host-features.ts +92 -0
- package/src/index.ts +110 -0
- package/src/reference-owner.ts +5 -0
- package/src/reference-page.ts +9 -0
- package/src/reference-source.ts +3 -0
- package/src/reference-text.ts +219 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +28 -0
- package/src/tool-browser/block-recovery.ts +85 -0
- package/src/tool-browser/code-tool.ts +555 -0
- package/src/tool-browser/code-worker.ts +725 -0
- package/src/tool-browser/element-fields.ts +167 -0
- package/src/tool-browser/errors.ts +40 -0
- package/src/tool-browser/index.ts +265 -0
- package/src/tool-browser/page-probe.ts +675 -0
- package/src/tool-browser/panel-page.ts +126 -0
- package/src/tool-browser/probe-client.ts +183 -0
- package/src/tool-browser/screenshot-annotations.ts +131 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/state.ts +375 -0
- package/src/tool-browser/takeover.ts +199 -0
- package/src/tool-browser/tools-debug.ts +806 -0
- package/src/tool-browser/tools-interaction.ts +956 -0
- package/src/tool-browser/tools-navigation.ts +786 -0
- package/src/tool-browser/tools-observation.ts +474 -0
- package/src/tool-browser/tools-reference.ts +294 -0
- package/src/types/electron-shim.d.ts +144 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +35 -0
- package/tools/accept-desktop.mjs +148 -0
- package/dist/client.d.cts +0 -516
- package/dist/client.d.mts +0 -516
- package/dist/index.cjs +0 -92
- package/dist/index.d.mts +0 -2960
- package/dist/index.mjs +0 -24
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +0 -218
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +0 -260
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { getDomain } from 'tldts'
|
|
2
|
+
import { isIP } from 'node:net'
|
|
3
|
+
import { domainToASCII } from 'node:url'
|
|
4
|
+
|
|
5
|
+
/** Guest cookies scoped by host/domain, path, expiry and Secure, separate from host cookies. */
|
|
6
|
+
export interface StoredCookie {
|
|
7
|
+
readonly origin: string
|
|
8
|
+
readonly domain?: string
|
|
9
|
+
readonly hostOnly?: boolean
|
|
10
|
+
readonly name: string
|
|
11
|
+
readonly value: string
|
|
12
|
+
readonly path: string
|
|
13
|
+
readonly secure: boolean
|
|
14
|
+
readonly httpOnly?: boolean
|
|
15
|
+
readonly sameSite?: 'strict' | 'lax' | 'none'
|
|
16
|
+
readonly expiresAt?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type ScopedCookie = StoredCookie & { readonly domain: string; readonly hostOnly: boolean }
|
|
20
|
+
|
|
21
|
+
function domainMatches(host: string, domain: string): boolean {
|
|
22
|
+
return host === domain || (isIP(host.replace(/^\[|\]$/gu, '')) === 0 && host.endsWith('.' + domain))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function canonicalDomain(value: string): string | undefined {
|
|
26
|
+
if (value === '' || value.endsWith('.') || /[\s/\\:?#@\[\]%]/u.test(value)) return undefined
|
|
27
|
+
return domainToASCII(value).toLowerCase() || undefined
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function trimCookieWhitespace(value: string): string {
|
|
31
|
+
return value.replace(/^[ \t]+|[ \t]+$/gu, '')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function validCookiePair(name: string, value: string): boolean {
|
|
35
|
+
return name.length + value.length > 0 && name.length + value.length <= 4096
|
|
36
|
+
&& !/[^\x20-\xff]|[\x7f;=]/u.test(name)
|
|
37
|
+
&& !/[^\x20-\xff]|[\x7f;]/u.test(value)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function normalizeStoredCookie(input: unknown): ScopedCookie | undefined {
|
|
41
|
+
if (input === null || typeof input !== 'object') return undefined
|
|
42
|
+
const c = input as Record<string, unknown>
|
|
43
|
+
if (typeof c.origin !== 'string' || typeof c.name !== 'string' || typeof c.value !== 'string'
|
|
44
|
+
|| typeof c.path !== 'string' || typeof c.secure !== 'boolean'
|
|
45
|
+
|| (c.httpOnly !== undefined && typeof c.httpOnly !== 'boolean')
|
|
46
|
+
|| (c.sameSite !== undefined && !['strict', 'lax', 'none'].includes(String(c.sameSite)))
|
|
47
|
+
|| (c.expiresAt !== undefined && (typeof c.expiresAt !== 'number' || !Number.isFinite(c.expiresAt)))
|
|
48
|
+
|| !c.path.startsWith('/') || /[\x00-\x1f\x7f]/u.test(c.path)) return undefined
|
|
49
|
+
const name = trimCookieWhitespace(c.name), value = trimCookieWhitespace(c.value)
|
|
50
|
+
if (!validCookiePair(name, value) || (name === '' && /^(?:__Secure-|__Host-|__Http-)/iu.test(value))) return undefined
|
|
51
|
+
try {
|
|
52
|
+
const url = new URL(c.origin)
|
|
53
|
+
const legacy = c.domain === undefined && c.hostOnly === undefined
|
|
54
|
+
if (!legacy && (typeof c.domain !== 'string' || typeof c.hostOnly !== 'boolean')) return undefined
|
|
55
|
+
const domain = legacy || (c.hostOnly === true && c.domain === url.hostname) ? url.hostname : canonicalDomain(c.domain as string)
|
|
56
|
+
if (domain === undefined || !domainMatches(url.hostname, domain)) return undefined
|
|
57
|
+
const hostOnly = legacy || c.hostOnly === true || getDomain(domain, { allowPrivateDomains: true }) === null
|
|
58
|
+
if (hostOnly && domain !== url.hostname) return undefined
|
|
59
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password
|
|
60
|
+
|| url.pathname !== '/' || url.search || url.hash || (c.secure && url.protocol !== 'https:')
|
|
61
|
+
|| (/^__Secure-/iu.test(name) && !c.secure)
|
|
62
|
+
|| (/^__Host-/iu.test(name) && (!c.secure || c.path !== '/' || !hostOnly || c.hostOnly === false))
|
|
63
|
+
|| (/^__(?:Host-)?Http-/iu.test(name) && (!c.secure || !c.httpOnly))
|
|
64
|
+
|| (c.sameSite === 'none' && !c.secure)) return undefined
|
|
65
|
+
return { origin: url.origin, domain, hostOnly, name, value, path: c.path, secure: c.secure,
|
|
66
|
+
httpOnly: c.httpOnly !== false, sameSite: c.sameSite as StoredCookie['sameSite'],
|
|
67
|
+
expiresAt: c.expiresAt as number | undefined }
|
|
68
|
+
} catch { return undefined }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function defaultPath(pathname: string): string {
|
|
72
|
+
const lastSlash = pathname.lastIndexOf('/')
|
|
73
|
+
return lastSlash <= 0 ? '/' : pathname.slice(0, lastSlash)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function pathMatches(pathname: string, path: string): boolean {
|
|
77
|
+
return pathname === path || (pathname.startsWith(path) && (path.endsWith('/') || pathname[path.length] === '/'))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class GuestCookieJar {
|
|
81
|
+
private readonly store = new Map<string, ScopedCookie>()
|
|
82
|
+
private readonly changed?: (cookies: readonly StoredCookie[]) => void
|
|
83
|
+
constructor(changed?: (cookies: readonly StoredCookie[]) => void, saved: readonly StoredCookie[] = []) {
|
|
84
|
+
this.changed = changed
|
|
85
|
+
for (const value of saved) {
|
|
86
|
+
const cookie = normalizeStoredCookie(value)
|
|
87
|
+
if (cookie !== undefined && (cookie.expiresAt === undefined || cookie.expiresAt > Date.now())) {
|
|
88
|
+
this.store.set(String(this.store.size), cookie)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private save(): void {
|
|
94
|
+
this.changed?.([...this.store.values()].filter(cookie => cookie.expiresAt === undefined || cookie.expiresAt > Date.now()))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setCookies(target: URL, values: readonly string[], script = false): void {
|
|
98
|
+
const now = Date.now()
|
|
99
|
+
for (const raw of values) {
|
|
100
|
+
if (/[\x00-\x08\x0a-\x1f\x7f]/u.test(raw)) continue
|
|
101
|
+
const [pair = '', ...attributes] = raw.split(';').map(trimCookieWhitespace)
|
|
102
|
+
const index = pair.indexOf('=')
|
|
103
|
+
const name = index === -1 ? '' : trimCookieWhitespace(pair.slice(0, index))
|
|
104
|
+
const value = trimCookieWhitespace(index === -1 ? pair : pair.slice(index + 1))
|
|
105
|
+
if (!validCookiePair(name, value)) continue
|
|
106
|
+
let path = defaultPath(target.pathname), secure = false, httpOnly = false, domain: string | undefined
|
|
107
|
+
let sameSite: StoredCookie['sameSite'], explicitRoot = false
|
|
108
|
+
let expires: number | undefined, maxAge: number | undefined
|
|
109
|
+
let validAttributes = true
|
|
110
|
+
for (const attribute of attributes) {
|
|
111
|
+
const equals = attribute.indexOf('=')
|
|
112
|
+
const key = trimCookieWhitespace(equals === -1 ? attribute : attribute.slice(0, equals)).toLowerCase()
|
|
113
|
+
const content = equals === -1 ? '' : trimCookieWhitespace(attribute.slice(equals + 1))
|
|
114
|
+
if (/[\x00-\x1f\x7f]/u.test(key + content)) { validAttributes = false; break }
|
|
115
|
+
if (key === 'domain' && content !== '') domain = content.replace(/^\./u, '').toLowerCase()
|
|
116
|
+
else if (key === 'path') { path = content.startsWith('/') ? content : defaultPath(target.pathname); explicitRoot = content === '/' }
|
|
117
|
+
else if (key === 'secure') secure = true
|
|
118
|
+
else if (key === 'httponly') httpOnly = true
|
|
119
|
+
else if (key === 'samesite') sameSite = ['strict', 'lax', 'none'].includes(content.toLowerCase()) ? content.toLowerCase() as StoredCookie['sameSite'] : undefined
|
|
120
|
+
else if (key === 'max-age' && /^-?\d+$/u.test(content)) maxAge = Math.min(Number(content), 400 * 86400)
|
|
121
|
+
else if (key === 'expires' && Number.isFinite(Date.parse(content))) expires = Date.parse(content)
|
|
122
|
+
}
|
|
123
|
+
const scopedDomain = domain === undefined ? target.hostname : canonicalDomain(domain)
|
|
124
|
+
if (!validAttributes || scopedDomain === undefined || !domainMatches(target.hostname, scopedDomain)) continue
|
|
125
|
+
const hostOnly = domain === undefined || getDomain(scopedDomain, { allowPrivateDomains: true }) === null
|
|
126
|
+
if (hostOnly && scopedDomain !== target.hostname) continue
|
|
127
|
+
if (script && httpOnly) continue
|
|
128
|
+
if (secure && target.protocol !== 'https:') continue
|
|
129
|
+
if (/^__Secure-/iu.test(name) && !secure) continue
|
|
130
|
+
if (/^__Host-/iu.test(name) && (!secure || domain !== undefined || !explicitRoot)) continue
|
|
131
|
+
if (/^__(?:Host-)?Http-/iu.test(name) && (!secure || !httpOnly)) continue
|
|
132
|
+
const cookie = normalizeStoredCookie({ origin: target.origin, domain: scopedDomain, hostOnly, name, value, path, secure, httpOnly, sameSite,
|
|
133
|
+
expiresAt: maxAge === undefined ? expires : maxAge <= 0 ? 0 : now + maxAge * 1000 })
|
|
134
|
+
if (cookie === undefined) continue
|
|
135
|
+
const matching = [...this.store].filter(([, entry]) => entry.domain === cookie.domain && entry.path === path && entry.name === name)
|
|
136
|
+
if (script && matching.some(([, entry]) => entry.httpOnly && (entry.expiresAt === undefined || entry.expiresAt > now))) continue
|
|
137
|
+
if (target.protocol !== 'https:' && [...this.store.values()].some(entry => entry.secure && entry.name === name
|
|
138
|
+
&& (entry.expiresAt === undefined || entry.expiresAt > now)
|
|
139
|
+
&& (domainMatches(cookie.domain, entry.domain) || domainMatches(entry.domain, cookie.domain))
|
|
140
|
+
&& pathMatches(path, entry.path))) continue
|
|
141
|
+
const key = matching[0]?.[0] ?? cookie.domain + '\0' + path + '\0' + name
|
|
142
|
+
for (const [other] of matching) if (other !== key) this.store.delete(other)
|
|
143
|
+
if (cookie.expiresAt !== undefined && cookie.expiresAt <= now) this.store.delete(key)
|
|
144
|
+
else this.store.set(key, cookie)
|
|
145
|
+
}
|
|
146
|
+
if (values.length > 0) this.save()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
getDocumentCookie(target: URL): string { return this.getCookieHeader(target, true) ?? '' }
|
|
150
|
+
|
|
151
|
+
setDocumentCookie(target: URL, value: string): void { this.setCookies(target, [value], true) }
|
|
152
|
+
|
|
153
|
+
getCookieHeader(target: URL, script = false, context?: { readonly site: URL; readonly topLevel: boolean; readonly method: string }): string | undefined {
|
|
154
|
+
const now = Date.now()
|
|
155
|
+
const matched: StoredCookie[] = []
|
|
156
|
+
for (const [key, value] of this.store) {
|
|
157
|
+
const cookie = normalizeStoredCookie(value)
|
|
158
|
+
if (cookie === undefined || (cookie.expiresAt !== undefined && cookie.expiresAt <= now)) {
|
|
159
|
+
this.store.delete(key)
|
|
160
|
+
continue
|
|
161
|
+
}
|
|
162
|
+
if ((cookie.hostOnly ? cookie.domain !== target.hostname : !domainMatches(target.hostname, cookie.domain))
|
|
163
|
+
|| (cookie.secure && target.protocol !== 'https:')
|
|
164
|
+
|| (script && cookie.httpOnly)
|
|
165
|
+
|| !pathMatches(target.pathname, cookie.path)) continue
|
|
166
|
+
if (!script && context !== undefined) {
|
|
167
|
+
const site = (url: URL): string => url.protocol + '//' + (getDomain(url.hostname, { allowPrivateDomains: true }) ?? url.hostname)
|
|
168
|
+
const crossSite = site(context.site) !== site(target)
|
|
169
|
+
if (crossSite && cookie.sameSite !== 'none'
|
|
170
|
+
&& (cookie.sameSite === 'strict' || !context.topLevel || !['GET', 'HEAD', 'OPTIONS', 'TRACE'].includes(context.method))) continue
|
|
171
|
+
}
|
|
172
|
+
matched.push(cookie)
|
|
173
|
+
}
|
|
174
|
+
matched.sort((a, b) => b.path.length - a.path.length)
|
|
175
|
+
return matched.length === 0 ? undefined : matched.map(cookie => cookie.name === '' ? cookie.value : cookie.name + '=' + cookie.value).join('; ')
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BROWSER_PROFILE_DIR } from '../../assets/browser-policy.mjs'
|
|
2
|
+
import { randomUUID } from 'node:crypto'
|
|
3
|
+
import { closeSync, constants, fchmodSync, fstatSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { GuestCookieJar, normalizeStoredCookie, type StoredCookie } from './guest-cookie-jar.ts'
|
|
6
|
+
import { dshHome } from './paths.ts'
|
|
7
|
+
|
|
8
|
+
export function loadGuestCookies(directory: string): GuestCookieJar {
|
|
9
|
+
const file = join(directory, 'cookies.json')
|
|
10
|
+
let saved: StoredCookie[] = []
|
|
11
|
+
try {
|
|
12
|
+
let fd: number | undefined
|
|
13
|
+
try {
|
|
14
|
+
fd = openSync(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0))
|
|
15
|
+
if (!fstatSync(fd).isFile()) throw new Error()
|
|
16
|
+
fchmodSync(fd, 0o600)
|
|
17
|
+
const data: unknown = JSON.parse(readFileSync(fd, 'utf8'))
|
|
18
|
+
if (data === null || typeof data !== 'object') throw new Error()
|
|
19
|
+
const record = data as Record<string, unknown>
|
|
20
|
+
if (record.version !== 1 || !Array.isArray(record.cookies)) throw new Error()
|
|
21
|
+
saved = record.cookies.flatMap(value => {
|
|
22
|
+
const cookie = normalizeStoredCookie(value)
|
|
23
|
+
return cookie !== undefined && (cookie.expiresAt === undefined || cookie.expiresAt > Date.now()) ? [cookie] : []
|
|
24
|
+
})
|
|
25
|
+
} finally { if (fd !== undefined) closeSync(fd) }
|
|
26
|
+
} catch {}
|
|
27
|
+
const persist = (cookies: readonly StoredCookie[]) => {
|
|
28
|
+
const temporary = file + '.' + randomUUID() + '.tmp'
|
|
29
|
+
let fd: number | undefined
|
|
30
|
+
try {
|
|
31
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 })
|
|
32
|
+
fd = openSync(temporary, 'wx', 0o600)
|
|
33
|
+
fchmodSync(fd, 0o600)
|
|
34
|
+
writeFileSync(fd, JSON.stringify({ version: 1, cookies }))
|
|
35
|
+
fsyncSync(fd)
|
|
36
|
+
closeSync(fd)
|
|
37
|
+
fd = undefined
|
|
38
|
+
renameSync(temporary, file)
|
|
39
|
+
} catch {} finally {
|
|
40
|
+
if (fd !== undefined) { try { closeSync(fd) } catch {} }
|
|
41
|
+
try { rmSync(temporary, { force: true }) } catch { /* A failed write may leave an owner-only temporary file. */ }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const jar = new GuestCookieJar(persist, saved)
|
|
45
|
+
persist(saved)
|
|
46
|
+
return jar
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const stores = new Map<string, GuestCookieJar>()
|
|
50
|
+
|
|
51
|
+
export function localGuestCookies(): GuestCookieJar {
|
|
52
|
+
const directory = join(dshHome(), BROWSER_PROFILE_DIR, 'web-cookies')
|
|
53
|
+
let store = stores.get(directory)
|
|
54
|
+
if (store === undefined) {
|
|
55
|
+
store = loadGuestCookies(directory)
|
|
56
|
+
stores.set(directory, store)
|
|
57
|
+
}
|
|
58
|
+
return store
|
|
59
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { rewriteCss } from './guest-css.ts'
|
|
2
|
+
|
|
3
|
+
export function guestCssRuntimeScript(): string {
|
|
4
|
+
return `
|
|
5
|
+
const cssBase = sheet => {
|
|
6
|
+
for (let current = sheet; current; current = current.parentStyleSheet) {
|
|
7
|
+
if (current.href) return realURL(current.href).href;
|
|
8
|
+
}
|
|
9
|
+
return document.baseURI ? realURL(document.baseURI).href : real;
|
|
10
|
+
};
|
|
11
|
+
const proxyCss = (value, base = cssBase()) => (${rewriteCss.toString()})(String(value), raw => {
|
|
12
|
+
if (!raw.trim() || raw.trim().startsWith('#')) return undefined;
|
|
13
|
+
try {
|
|
14
|
+
const existing = new URL(raw, location.href);
|
|
15
|
+
if (existing.origin === location.origin && existing.pathname === route) return undefined;
|
|
16
|
+
const resolved = new URL(raw, base);
|
|
17
|
+
return /^https?:$/.test(resolved.protocol) ? toProxy(resolved.href) : undefined;
|
|
18
|
+
} catch { return undefined; }
|
|
19
|
+
});
|
|
20
|
+
const isStyle = node => node && node.nodeType === 1 && node.tagName === 'STYLE';
|
|
21
|
+
const rewriteStyleText = node => {
|
|
22
|
+
if (!isStyle(node)) return;
|
|
23
|
+
const before = node.textContent, after = proxyCss(before);
|
|
24
|
+
if (after !== before) node.textContent = after;
|
|
25
|
+
};
|
|
26
|
+
for (const [name, property] of [['Node', 'textContent'], ['Node', 'nodeValue'], ['CharacterData', 'data']]) attempt(() => {
|
|
27
|
+
const proto = window[name].prototype;
|
|
28
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, property);
|
|
29
|
+
if (!descriptor || !descriptor.set) return;
|
|
30
|
+
Object.defineProperty(proto, property, Object.assign({}, descriptor, {
|
|
31
|
+
set(value) {
|
|
32
|
+
const css = isStyle(this) || (this.nodeType === 3 && isStyle(this.parentNode));
|
|
33
|
+
descriptor.set.call(this, css && value != null ? proxyCss(value) : value);
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
for (const name of ['CSSStyleSheet', 'CSSGroupingRule', 'CSSKeyframesRule']) attempt(() => {
|
|
38
|
+
const proto = window[name].prototype;
|
|
39
|
+
for (const method of ['insertRule', 'replace', 'replaceSync', 'appendRule', 'addRule']) {
|
|
40
|
+
const original = proto[method];
|
|
41
|
+
if (typeof original !== 'function') continue;
|
|
42
|
+
proto[method] = function(...args) {
|
|
43
|
+
const index = method === 'addRule' ? 1 : 0;
|
|
44
|
+
if (args.length > index) args[index] = proxyCss(args[index], cssBase(this.parentStyleSheet || this));
|
|
45
|
+
return original.apply(this, args);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
attempt(() => {
|
|
50
|
+
const proto = CSSStyleDeclaration.prototype, original = proto.setProperty;
|
|
51
|
+
proto.setProperty = function(name, value, priority) {
|
|
52
|
+
return original.call(this, name, value == null ? value : proxyCss(value, cssBase(this.parentRule?.parentStyleSheet)), priority);
|
|
53
|
+
};
|
|
54
|
+
for (const property of Object.getOwnPropertyNames(proto)) {
|
|
55
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, property);
|
|
56
|
+
if (!descriptor?.set) continue;
|
|
57
|
+
Object.defineProperty(proto, property, Object.assign({}, descriptor, {
|
|
58
|
+
set(value) { descriptor.set.call(this, value == null ? value : proxyCss(value, cssBase(this.parentRule?.parentStyleSheet))); }
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
for (const name of ['HTMLElement', 'SVGElement']) attempt(() => {
|
|
63
|
+
const proto = window[name].prototype, descriptor = Object.getOwnPropertyDescriptor(proto, 'style');
|
|
64
|
+
if (!descriptor?.set) return;
|
|
65
|
+
Object.defineProperty(proto, 'style', Object.assign({}, descriptor, {
|
|
66
|
+
set(value) { descriptor.set.call(this, value == null ? value : proxyCss(value)); }
|
|
67
|
+
}));
|
|
68
|
+
});
|
|
69
|
+
attempt(() => {
|
|
70
|
+
const original = Element.prototype.insertAdjacentText;
|
|
71
|
+
Element.prototype.insertAdjacentText = function(position, value) {
|
|
72
|
+
return original.call(this, position, isStyle(this) ? proxyCss(value) : value);
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
`
|
|
76
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function rewriteCss(css: string, proxy: (url: string) => string | undefined): string {
|
|
2
|
+
const scanner = {
|
|
3
|
+
decode(value: string): string { return value.replace(/\\(?:([\da-f]{1,6})(?:\r\n|[ \t\r\n\f])?|(\r\n|[\r\n\f])|([\s\S]))/giu,
|
|
4
|
+
(_match, hex: string | undefined, newline: string | undefined, literal: string) => {
|
|
5
|
+
if (hex === undefined) return newline === undefined ? literal : ''
|
|
6
|
+
const point = Number.parseInt(hex, 16)
|
|
7
|
+
return point === 0 || point > 0x10ffff || (point >= 0xd800 && point <= 0xdfff) ? '\ufffd' : String.fromCodePoint(point)
|
|
8
|
+
}) },
|
|
9
|
+
stringEnd(start: number): number {
|
|
10
|
+
const quote = css[start]
|
|
11
|
+
let end = start + 1
|
|
12
|
+
while (end < css.length) {
|
|
13
|
+
if (css[end] === '\\') { end += 2; continue }
|
|
14
|
+
if (css[end++] === quote) return end
|
|
15
|
+
}
|
|
16
|
+
return end
|
|
17
|
+
},
|
|
18
|
+
replacement(raw: string): string | undefined { return proxy(this.decode(raw)) },
|
|
19
|
+
}
|
|
20
|
+
const functions: string[] = []
|
|
21
|
+
let result = '', position = 0, importing = false
|
|
22
|
+
while (position < css.length) {
|
|
23
|
+
if (css.startsWith('/*', position)) {
|
|
24
|
+
const close = css.indexOf('*/', position + 2)
|
|
25
|
+
const end = close === -1 ? css.length : close + 2
|
|
26
|
+
result += css.slice(position, end); position = end; continue
|
|
27
|
+
}
|
|
28
|
+
const character = css[position]!
|
|
29
|
+
if (/\s/u.test(character)) { result += character; position++; continue }
|
|
30
|
+
if (character === '"' || character === "'") {
|
|
31
|
+
const end = scanner.stringEnd(position)
|
|
32
|
+
const next = css[end - 1] === character && (importing || /^(?:-webkit-)?image-set$/iu.test(functions.at(-1) ?? ''))
|
|
33
|
+
? scanner.replacement(css.slice(position + 1, end - 1)) : undefined
|
|
34
|
+
result += next === undefined ? css.slice(position, end) : `"${next}"`
|
|
35
|
+
importing = false; position = end; continue
|
|
36
|
+
}
|
|
37
|
+
const identifier = /^[-\w]+/u.exec(css.slice(position))?.[0]
|
|
38
|
+
if (character === '@' && /^@import\b/iu.test(css.slice(position))) {
|
|
39
|
+
result += css.slice(position, position + 7); position += 7; importing = true; continue
|
|
40
|
+
}
|
|
41
|
+
if (identifier !== undefined) {
|
|
42
|
+
const start = position
|
|
43
|
+
position += identifier.length
|
|
44
|
+
if (css[position] !== '(') { result += identifier; importing = false; continue }
|
|
45
|
+
position++
|
|
46
|
+
if (identifier.toLowerCase() !== 'url') {
|
|
47
|
+
functions.push(identifier); result += css.slice(start, position); importing = false; continue
|
|
48
|
+
}
|
|
49
|
+
while (/\s/u.test(css[position] ?? '') && position < css.length) position++
|
|
50
|
+
const quoted = css[position] === '"' || css[position] === "'"
|
|
51
|
+
const valueStart = position
|
|
52
|
+
if (quoted) position = scanner.stringEnd(position)
|
|
53
|
+
else while (position < css.length && css[position] !== ')') position += css[position] === '\\' ? 2 : 1
|
|
54
|
+
const valueEnd = position
|
|
55
|
+
while (/\s/u.test(css[position] ?? '') && position < css.length) position++
|
|
56
|
+
if (css[position] !== ')') { result += css.slice(start, position); importing = false; continue }
|
|
57
|
+
const raw = quoted ? css.slice(valueStart + 1, valueEnd - 1) : css.slice(valueStart, valueEnd).trim()
|
|
58
|
+
const next = scanner.replacement(raw)
|
|
59
|
+
position++
|
|
60
|
+
result += next === undefined ? css.slice(start, position) : `url("${next}")`
|
|
61
|
+
importing = false; continue
|
|
62
|
+
}
|
|
63
|
+
if (character === ')') functions.pop()
|
|
64
|
+
else if (character === '(') functions.push('')
|
|
65
|
+
result += character; position++; importing = false
|
|
66
|
+
}
|
|
67
|
+
return result
|
|
68
|
+
}
|