@goodandready/dsh-subscriptions 0.6.52 → 0.6.53
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/lib/client.js +45 -12
- package/lib/http.js +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2362,14 +2362,41 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2362
2362
|
return { label: (p.charAt(0).toUpperCase() || 'P'), cls: 'dsub-brandCodex', icon: '●' }
|
|
2363
2363
|
}
|
|
2364
2364
|
|
|
2365
|
-
const PLUGIN_LABELS = new Set(['plugins', '
|
|
2366
|
-
|
|
2365
|
+
const PLUGIN_LABELS = new Set(['plugins', '插件', 'plugin'])
|
|
2366
|
+
|
|
2367
|
+
function resolvePluginLabels(customCtx) {
|
|
2368
|
+
const labels = new Set(PLUGIN_LABELS)
|
|
2369
|
+
const loc = (customCtx && customCtx.locale) || (typeof window !== 'undefined' && window.__dshCtx && window.__dshCtx.locale)
|
|
2370
|
+
if (loc && typeof loc.bind === 'function') {
|
|
2371
|
+
try {
|
|
2372
|
+
const sp = loc.bind('settings.plugins')
|
|
2373
|
+
const nav = typeof sp === 'function' ? sp('nav') : null
|
|
2374
|
+
if (nav && typeof nav === 'string') labels.add(nav.trim().toLowerCase())
|
|
2375
|
+
} catch { /* bestEffort */ }
|
|
2376
|
+
try {
|
|
2377
|
+
const pm = loc.bind('pluginManager')
|
|
2378
|
+
const panel = typeof pm === 'function' ? (pm('panel') || pm('title')) : null
|
|
2379
|
+
if (panel && typeof panel === 'string') labels.add(panel.trim().toLowerCase())
|
|
2380
|
+
} catch { /* bestEffort */ }
|
|
2381
|
+
}
|
|
2382
|
+
return labels
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
function matchesPluginLabel(el, customLabels) {
|
|
2367
2386
|
if (!el) return false
|
|
2387
|
+
const dataTab = (el.getAttribute('data-tab') || '').trim().toLowerCase()
|
|
2388
|
+
const dataSection = (el.getAttribute('data-section') || '').trim().toLowerCase()
|
|
2389
|
+
const dataKey = (el.getAttribute('data-key') || '').trim().toLowerCase()
|
|
2390
|
+
const id = (el.getAttribute('id') || '').trim().toLowerCase()
|
|
2391
|
+
if (dataTab === 'plugins' || dataSection === 'plugins' || dataKey === 'plugins' || id === 'plugins') return true
|
|
2392
|
+
|
|
2393
|
+
if (el.querySelector && el.querySelector('path[d*="M10.3232"]')) return true
|
|
2394
|
+
|
|
2368
2395
|
const txt = (el.textContent || '').trim().toLowerCase()
|
|
2369
2396
|
const aria = (el.getAttribute('aria-label') || '').trim().toLowerCase()
|
|
2370
2397
|
const title = (el.getAttribute('title') || '').trim().toLowerCase()
|
|
2371
|
-
const
|
|
2372
|
-
return
|
|
2398
|
+
const labels = customLabels || PLUGIN_LABELS
|
|
2399
|
+
return labels.has(txt) || labels.has(aria) || labels.has(title) || labels.has(dataTab)
|
|
2373
2400
|
}
|
|
2374
2401
|
|
|
2375
2402
|
function findAndClickCard(doc) {
|
|
@@ -2387,12 +2414,15 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2387
2414
|
return false
|
|
2388
2415
|
}
|
|
2389
2416
|
|
|
2390
|
-
function openPluginSettings(doc = document, schedule = (run, ms) => window.setTimeout(run, ms)) {
|
|
2417
|
+
function openPluginSettings(doc = document, schedule = (run, ms) => window.setTimeout(run, ms), navCtx) {
|
|
2391
2418
|
try {
|
|
2392
2419
|
if (findAndClickCard(doc)) return
|
|
2393
2420
|
|
|
2421
|
+
const activeLabels = resolvePluginLabels(navCtx)
|
|
2422
|
+
const checkEl = (el) => matchesPluginLabel(el, activeLabels)
|
|
2423
|
+
|
|
2394
2424
|
const buttons = [...doc.querySelectorAll('button, a, div[role="button"], div[role="tab"]')]
|
|
2395
|
-
const panel = buttons.find(
|
|
2425
|
+
const panel = buttons.find(checkEl)
|
|
2396
2426
|
if (panel) {
|
|
2397
2427
|
panel.click()
|
|
2398
2428
|
const poll = (left) => {
|
|
@@ -2410,7 +2440,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2410
2440
|
trigger.click()
|
|
2411
2441
|
const pollSection = (left) => {
|
|
2412
2442
|
try {
|
|
2413
|
-
const section = [...doc.querySelectorAll('button, a, div[role="tab"], [role="button"]')].find(
|
|
2443
|
+
const section = [...doc.querySelectorAll('button, a, div[role="tab"], [role="button"]')].find(checkEl)
|
|
2414
2444
|
if (section && typeof section.click === 'function') {
|
|
2415
2445
|
section.click()
|
|
2416
2446
|
const poll = (cLeft) => {
|
|
@@ -2420,13 +2450,13 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2420
2450
|
schedule(() => poll(40), 100)
|
|
2421
2451
|
return
|
|
2422
2452
|
}
|
|
2423
|
-
} catch {}
|
|
2453
|
+
} catch { /* bestEffort */ }
|
|
2424
2454
|
if (left > 0) schedule(() => pollSection(left - 1), 80)
|
|
2425
2455
|
}
|
|
2426
2456
|
schedule(() => pollSection(20), 80)
|
|
2427
2457
|
}
|
|
2428
2458
|
}
|
|
2429
|
-
} catch {}
|
|
2459
|
+
} catch { /* bestEffort */ }
|
|
2430
2460
|
}
|
|
2431
2461
|
function SubsPill(props) {
|
|
2432
2462
|
const t = (props && props.t) || ((k) => k)
|
|
@@ -2645,16 +2675,16 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2645
2675
|
if (nav && typeof nav.openBundle === 'function') {
|
|
2646
2676
|
nav.openBundle(PKG)
|
|
2647
2677
|
}
|
|
2648
|
-
} catch {}
|
|
2678
|
+
} catch { /* bestEffort */ }
|
|
2649
2679
|
|
|
2650
2680
|
try {
|
|
2651
2681
|
const layout = (clientCtx && clientCtx.layout) || (window.__dshCtx && window.__dshCtx.layout)
|
|
2652
2682
|
if (layout && typeof layout.selectPanel === 'function') {
|
|
2653
2683
|
layout.selectPanel('plugins')
|
|
2654
2684
|
}
|
|
2655
|
-
} catch {}
|
|
2685
|
+
} catch { /* bestEffort */ }
|
|
2656
2686
|
|
|
2657
|
-
openPluginSettings(document)
|
|
2687
|
+
openPluginSettings(document, undefined, clientCtx)
|
|
2658
2688
|
},
|
|
2659
2689
|
}, t('subsOpenSettings')),
|
|
2660
2690
|
),
|
|
@@ -2758,6 +2788,9 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
2758
2788
|
|
|
2759
2789
|
exports.inject = ['slots', 'locale', 'sessions']
|
|
2760
2790
|
exports.apply = function apply(ctx) {
|
|
2791
|
+
if (typeof window !== 'undefined') {
|
|
2792
|
+
window.__dshCtx = ctx
|
|
2793
|
+
}
|
|
2761
2794
|
setT(ctx.locale.bind(NS))
|
|
2762
2795
|
try {
|
|
2763
2796
|
ctx.inject(['pluginNavigation'], (navCtx) => {
|
package/lib/http.js
CHANGED
|
@@ -157,13 +157,13 @@ export function isTrustedSettingsRequest(request, targetCtx) {
|
|
|
157
157
|
try {
|
|
158
158
|
const u = new URL(origin)
|
|
159
159
|
if (u.host.toLowerCase() === host.toLowerCase()) return true
|
|
160
|
-
} catch {}
|
|
160
|
+
} catch { /* bestEffort */ }
|
|
161
161
|
}
|
|
162
162
|
if (referer && host) {
|
|
163
163
|
try {
|
|
164
164
|
const u = new URL(referer)
|
|
165
165
|
if (u.host.toLowerCase() === host.toLowerCase()) return true
|
|
166
|
-
} catch {}
|
|
166
|
+
} catch { /* bestEffort */ }
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-subscriptions",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.53",
|
|
4
4
|
"description": "Use ChatGPT Codex, Claude, Grok, Antigravity, Kimi, GLM, Cursor, Kiro, Copilot, Qwen, ERNIE, Spark, JetBrains, Perplexity, Replit, and Cody subscriptions as DeepSeek Harness LLM providers via OAuth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|