dsh-peak-status 1.0.2 → 1.0.3
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 +22 -5
- package/package.json +1 -1
- package/src/client.js +22 -5
package/lib/client.js
CHANGED
|
@@ -22,15 +22,32 @@
|
|
|
22
22
|
// The host client-modules expects a bundle to register the id of the entry
|
|
23
23
|
// it is mounted as — the package name ("@local/dsh-peak-status" for a
|
|
24
24
|
// profile @local install, "dsh-peak-status" when installed from npm).
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
25
|
+
//
|
|
26
|
+
// Single-file loads use /plugins/<id>/client.js, so the id is derivable
|
|
27
|
+
// from document.currentScript.src. Since dsh 0.1.2-alpha.3 the web shell
|
|
28
|
+
// may serve plugin bundles as one shared combo script
|
|
29
|
+
// (/plugins/??<id>/client.js,<id2>/client.js&rev=...) — currentScript.src
|
|
30
|
+
// then names every bundle in the batch, not this one. Fall back to
|
|
31
|
+
// scanning the combo URL for our own package leaf, which is present in
|
|
32
|
+
// both install shapes.
|
|
28
33
|
var MODULE_ID = (function () {
|
|
34
|
+
var OWN = 'dsh-peak-status'
|
|
29
35
|
try {
|
|
30
36
|
var el = document.currentScript
|
|
31
37
|
if (el && el.src) {
|
|
32
|
-
var
|
|
33
|
-
|
|
38
|
+
var src = el.src
|
|
39
|
+
var single = /\/plugins\/([^/]+)\/client\.js(?:\?|$)/.exec(src)
|
|
40
|
+
if (single) return decodeURIComponent(single[1])
|
|
41
|
+
var combo = /\/plugins\/\?\?([^&]+)/.exec(src)
|
|
42
|
+
if (combo) {
|
|
43
|
+
var parts = combo[1].split(',')
|
|
44
|
+
for (var i = 0; i < parts.length; i++) {
|
|
45
|
+
var m = /^(.+?)\/client\.js$/.exec(parts[i])
|
|
46
|
+
if (m && decodeURIComponent(m[1]).split('/').pop() === OWN) {
|
|
47
|
+
return decodeURIComponent(m[1])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
} catch (error) { /* ignore */ }
|
|
36
53
|
return null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-peak-status",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Peak-hour indicator for the DSH web GUI: a native header chip showing whether the current Beijing time is inside DeepSeek's API peak window (weekdays 09:00–12:00 / 14:00–18:00; weekends all-day valley price), with a live clock, countdown, and ×2/off-peak pricing hints. · DSH Web GUI 高峰指示灯:原生会话头部胶囊,实时显示当前北京时间是否处于 DeepSeek API 高峰时段(工作日 9:00-12:00 / 14:00-18:00,周末全天谷价)。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/src/client.js
CHANGED
|
@@ -22,15 +22,32 @@
|
|
|
22
22
|
// The host client-modules expects a bundle to register the id of the entry
|
|
23
23
|
// it is mounted as — the package name ("@local/dsh-peak-status" for a
|
|
24
24
|
// profile @local install, "dsh-peak-status" when installed from npm).
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
25
|
+
//
|
|
26
|
+
// Single-file loads use /plugins/<id>/client.js, so the id is derivable
|
|
27
|
+
// from document.currentScript.src. Since dsh 0.1.2-alpha.3 the web shell
|
|
28
|
+
// may serve plugin bundles as one shared combo script
|
|
29
|
+
// (/plugins/??<id>/client.js,<id2>/client.js&rev=...) — currentScript.src
|
|
30
|
+
// then names every bundle in the batch, not this one. Fall back to
|
|
31
|
+
// scanning the combo URL for our own package leaf, which is present in
|
|
32
|
+
// both install shapes.
|
|
28
33
|
var MODULE_ID = (function () {
|
|
34
|
+
var OWN = 'dsh-peak-status'
|
|
29
35
|
try {
|
|
30
36
|
var el = document.currentScript
|
|
31
37
|
if (el && el.src) {
|
|
32
|
-
var
|
|
33
|
-
|
|
38
|
+
var src = el.src
|
|
39
|
+
var single = /\/plugins\/([^/]+)\/client\.js(?:\?|$)/.exec(src)
|
|
40
|
+
if (single) return decodeURIComponent(single[1])
|
|
41
|
+
var combo = /\/plugins\/\?\?([^&]+)/.exec(src)
|
|
42
|
+
if (combo) {
|
|
43
|
+
var parts = combo[1].split(',')
|
|
44
|
+
for (var i = 0; i < parts.length; i++) {
|
|
45
|
+
var m = /^(.+?)\/client\.js$/.exec(parts[i])
|
|
46
|
+
if (m && decodeURIComponent(m[1]).split('/').pop() === OWN) {
|
|
47
|
+
return decodeURIComponent(m[1])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
} catch (error) { /* ignore */ }
|
|
36
53
|
return null
|