dsh-remote-plugin 0.8.2 → 0.8.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/README.md +1 -1
- package/apk/dsh-remote.apk +0 -0
- package/gateway.cjs +66 -54
- package/insights.mjs +5 -3
- package/market.mjs +4 -1
- package/package.json +1 -1
- package/plugin-center.mjs +120 -7
- package/plugin-transaction.mjs +10 -3
- package/public/admin.html +11 -14
- package/public/admin.js +11 -23
- package/public/app.js +63 -37
- package/public/build.json +2 -2
- package/public/chat-copy.js +46 -0
- package/public/desktop/desktop.css +10 -0
- package/public/desktop/desktop.html +24 -11
- package/public/desktop/desktop.js +57 -13
- package/public/history.js +41 -6
- package/public/image-cache.js +141 -0
- package/public/image-preview.js +48 -5
- package/public/index.html +22 -21
- package/public/md.js +8 -2
- package/public/plugin-center.js +1 -1
- package/public/plugin.html +8 -2
- package/public/relay-settings.js +7 -6
- package/public/skins/blue-fish/DESIGN.md +24 -0
- package/public/skins/blue-fish/preview.html +11 -289
- package/public/skins/blue-fish/skin.css +95 -585
- package/public/skins/blue-fish/sparkles.svg +18 -0
- package/public/skins/bocchi/DESIGN.md +99 -0
- package/public/skins/bocchi/face.png +0 -0
- package/public/skins/bocchi/grain.png +0 -0
- package/public/skins/bocchi/icon-blush.png +0 -0
- package/public/skins/bocchi/icon-sleep.png +0 -0
- package/public/skins/bocchi/icon-smile.png +0 -0
- package/public/skins/bocchi/icon-star.png +0 -0
- package/public/skins/bocchi/icon-wink.png +0 -0
- package/public/skins/bocchi/icon.png +0 -0
- package/public/skins/bocchi/pattern-soft.png +0 -0
- package/public/skins/bocchi/pattern.png +0 -0
- package/public/skins/bocchi/preview.html +54 -0
- package/public/skins/bocchi/skin.css +233 -0
- package/public/skins/bocchi/stage-bg.png +0 -0
- package/public/skins/bocchi/stage-soft.png +0 -0
- package/public/skins/bocchi/stand.png +0 -0
- package/public/skins/bocchi/sticker-guitar.png +0 -0
- package/public/skins/kessoku/DESIGN.md +38 -0
- package/public/skins/kessoku/grain.png +0 -0
- package/public/skins/kessoku/skin.css +212 -0
- package/public/skins/kita/SOURCES.json +51 -0
- package/public/skins/kita/face.png +0 -0
- package/public/skins/kita/icon-live.png +0 -0
- package/public/skins/kita/icon-reddress.png +0 -0
- package/public/skins/kita/icon-seifuku.png +0 -0
- package/public/skins/kita/pattern.png +0 -0
- package/public/skins/kita/preview.html +55 -0
- package/public/skins/kita/skin.css +26 -0
- package/public/skins/kita/stand.png +0 -0
- package/public/skins/kita/sticker-live.png +0 -0
- package/public/skins/nijika/SOURCES.json +51 -0
- package/public/skins/nijika/face.png +0 -0
- package/public/skins/nijika/icon-live.png +0 -0
- package/public/skins/nijika/icon-reddress.png +0 -0
- package/public/skins/nijika/icon-seifuku.png +0 -0
- package/public/skins/nijika/pattern.png +0 -0
- package/public/skins/nijika/preview.html +55 -0
- package/public/skins/nijika/skin.css +25 -0
- package/public/skins/nijika/stand.png +0 -0
- package/public/skins/nijika/sticker-live.png +0 -0
- package/public/skins/penguin/DESIGN.md +33 -0
- package/public/skins/penguin/SOURCES.json +22 -0
- package/public/skins/penguin/aic-blueprint.svg +24 -0
- package/public/skins/penguin/endfield-triangles.svg +4 -0
- package/public/skins/penguin/face.png +0 -0
- package/public/skins/penguin/icon-blush.png +0 -0
- package/public/skins/penguin/icon-dizzy.png +0 -0
- package/public/skins/penguin/icon-laugh.png +0 -0
- package/public/skins/penguin/icon-sleep.png +0 -0
- package/public/skins/penguin/icon-smile.png +0 -0
- package/public/skins/penguin/icon-star.png +0 -0
- package/public/skins/penguin/icon-wink.png +0 -0
- package/public/skins/penguin/icon.png +0 -0
- package/public/skins/penguin/mascot.png +0 -0
- package/public/skins/penguin/pattern-night.png +0 -0
- package/public/skins/penguin/pattern.png +0 -0
- package/public/skins/penguin/preview.html +11 -0
- package/public/skins/penguin/skin.css +212 -0
- package/public/skins/ryo/SOURCES.json +51 -0
- package/public/skins/ryo/face.png +0 -0
- package/public/skins/ryo/icon-live.png +0 -0
- package/public/skins/ryo/icon-reddress.png +0 -0
- package/public/skins/ryo/icon-seifuku.png +0 -0
- package/public/skins/ryo/pattern.png +0 -0
- package/public/skins/ryo/preview.html +55 -0
- package/public/skins/ryo/skin.css +25 -0
- package/public/skins/ryo/stand.png +0 -0
- package/public/skins/ryo/sticker-live.png +0 -0
- package/public/sponsor-entry.js +22 -0
- package/public/styles.css +10 -0
- package/public/theme-picker.css +58 -0
- package/public/theme-vars.css +532 -5
- package/public/theme.js +111 -3
- package/public/update.json +8 -8
- package/public/version.json +1 -1
- package/public/workflow.css +2 -1
- package/public/workflow.js +24 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ dsh plugin --profile web list --depth 0
|
|
|
24
24
|
- mux/host 下行、独立长轮询、弱网设置与历史缓存。
|
|
25
25
|
- 文件多根、分块续传、校验、预览/下载与图片附件。
|
|
26
26
|
- 当前主机插件管理与可选上下文/费用洞察。
|
|
27
|
-
-
|
|
27
|
+
- 手机导航:会话、文件、更多;十二套 Web 主题(含孤独摇滚四人、企鹅女管·白昼/极夜角色皮肤),默认蓝色大肥鱼,保留已有主题选择。
|
|
28
28
|
- 手机端八步新手引导;完成或整体跳过后移除首页入口,在「更多 → 偏好与维护 → 新手引导」重新学习。
|
|
29
29
|
- rc.9 补充冷会话恢复与错误归属修复、发送结果诊断、文件上传与分支恢复验证;具体范围见候选版说明。
|
|
30
30
|
- Android APK 在已有构建产物时随包分发,通知与后台需设备权限。
|
package/apk/dsh-remote.apk
CHANGED
|
Binary file
|
package/gateway.cjs
CHANGED
|
@@ -66,6 +66,17 @@ function publicKey(value) {
|
|
|
66
66
|
const digest = value => crypto.createHash('sha256').update(value).digest('hex')
|
|
67
67
|
const live = (grant, now = Date.now()) => grant && !grant.revokedAt && grant.expiresAt > now
|
|
68
68
|
const signingText = (nonce, id, role, session = '') => Buffer.from(JSON.stringify(['dsh-relay-v1', nonce, id, role, session]))
|
|
69
|
+
function issueInState(state, { label = '', domain, expiresAt, plan } = {}) {
|
|
70
|
+
if (state.grants.filter(g => live(g)).length >= state.maxUsers) throw fault('PILOT_FULL', 409)
|
|
71
|
+
const id = crypto.randomBytes(8).toString('hex')
|
|
72
|
+
const assigned = hostname(domain || `r-${id}.${state.baseDomain}`)
|
|
73
|
+
if (!assigned.endsWith('.' + state.baseDomain) || assigned === new URL(state.origin).hostname || assigned === state.tunnelHost) throw fault('INVALID_TENANT_DOMAIN')
|
|
74
|
+
if (state.grants.some(g => g.domain === assigned)) throw fault('DOMAIN_ALREADY_ASSIGNED', 409)
|
|
75
|
+
const code = `dsrp_${id}.${crypto.randomBytes(32).toString('base64url')}`
|
|
76
|
+
const grant = { id, label: String(label).slice(0, 80), domain: assigned, expiresAt, createdAt: Date.now(), codeHash: digest(code), publicKey: null, revokedAt: null, ...(plan ? { plan } : {}) }
|
|
77
|
+
state.grants.push(grant)
|
|
78
|
+
return { code, grant }
|
|
79
|
+
}
|
|
69
80
|
|
|
70
81
|
class Registry {
|
|
71
82
|
constructor(file) { this.file = path.resolve(file) }
|
|
@@ -83,8 +94,10 @@ class Registry {
|
|
|
83
94
|
const result = fn(state)
|
|
84
95
|
const temp = this.file + '.' + crypto.randomBytes(8).toString('hex') + '.tmp'
|
|
85
96
|
try {
|
|
86
|
-
fs.
|
|
97
|
+
const output = fs.openSync(temp, 'wx', 0o600)
|
|
98
|
+
try { fs.writeFileSync(output, JSON.stringify(state, null, 2) + '\n'); fs.fsyncSync(output) } finally { fs.closeSync(output) }
|
|
87
99
|
fs.renameSync(temp, this.file)
|
|
100
|
+
if (process.platform !== 'win32') { const dir = fs.openSync(path.dirname(this.file), 'r'); try { fs.fsyncSync(dir) } finally { fs.closeSync(dir) } }
|
|
88
101
|
} finally { try { fs.unlinkSync(temp) } catch {} }
|
|
89
102
|
return result
|
|
90
103
|
} finally { fs.closeSync(fd); fs.unlinkSync(lock) }
|
|
@@ -105,14 +118,9 @@ class Registry {
|
|
|
105
118
|
const expires = Number(expiresAt)
|
|
106
119
|
if (!Number.isFinite(expires) || expires <= Date.now() || expires > Date.now() + 90 * 86400000) throw fault('INVALID_EXPIRY')
|
|
107
120
|
return this.change(state => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
if (!assigned.endsWith('.' + state.baseDomain) || assigned === new URL(state.origin).hostname || assigned === state.tunnelHost) throw fault('INVALID_TENANT_DOMAIN')
|
|
112
|
-
if (state.grants.some(g => g.domain === assigned)) throw fault('DOMAIN_ALREADY_ASSIGNED', 409)
|
|
113
|
-
const code = `dsrp_${id}.${crypto.randomBytes(32).toString('base64url')}`
|
|
114
|
-
const grant = { id, label: String(label).slice(0, 80), domain: assigned, expiresAt: expires, createdAt: Date.now(), codeHash: digest(code), publicKey: null, revokedAt: null }
|
|
115
|
-
state.grants.push(grant)
|
|
121
|
+
const reserved = (state.sponsorship?.applications || []).filter(a => a.status === 'submitted' || a.status === 'draft' && a.reservedUntil > Date.now()).length
|
|
122
|
+
if (state.grants.filter(g => live(g)).length + reserved >= state.maxUsers) throw fault('PILOT_FULL', 409)
|
|
123
|
+
const { code, grant } = issueInState(state, { label, domain, expiresAt: expires })
|
|
116
124
|
return { code, grant: this.view(grant) }
|
|
117
125
|
})
|
|
118
126
|
}
|
|
@@ -135,13 +143,13 @@ class Registry {
|
|
|
135
143
|
if (!live(grant) || !crypto.timingSafeEqual(Buffer.from(grant.codeHash, 'hex'), Buffer.from(digest(code), 'hex'))) throw fault('INVALID_AUTHORIZATION', 403)
|
|
136
144
|
if (grant.publicKey && grant.publicKey !== normalized) throw fault('HOST_ALREADY_BOUND', 409)
|
|
137
145
|
grant.publicKey = normalized
|
|
138
|
-
return { grantId: grant.id, domain: grant.domain, expiresAt: grant.expiresAt, publicUrl: `https://${grant.domain}`, dailyLimitBytes: 5_000_000_000, timezone: 'Asia/Shanghai', transport: 'https-upgrade', tunnelOrigin: state.origin, tunnelHost: state.tunnelHost, tunnelPort: state.tunnelPort }
|
|
146
|
+
return { grantId: grant.id, domain: grant.domain, expiresAt: grant.expiresAt, publicUrl: `https://${grant.domain}`, ...(grant.plan === 'sponsor-basic' ? { quotaPeriod: 'month', monthlyLimitBytes: 5_000_000_000, fileTransfer: false } : { dailyLimitBytes: 5_000_000_000 }), timezone: 'Asia/Shanghai', transport: 'https-upgrade', tunnelOrigin: state.origin, tunnelHost: state.tunnelHost, tunnelPort: state.tunnelPort }
|
|
139
147
|
})
|
|
140
148
|
}
|
|
141
149
|
get(id) { return this.read().grants.find(g => g.id === id) }
|
|
142
150
|
}
|
|
143
151
|
|
|
144
|
-
module.exports = { Registry, fault, hostname, publicKey, digest, live, signingText }
|
|
152
|
+
module.exports = { Registry, fault, hostname, publicKey, digest, live, signingText, issueInState }
|
|
145
153
|
},
|
|
146
154
|
"./wire.cjs": function(require, module, exports) {
|
|
147
155
|
'use strict'
|
|
@@ -1985,7 +1993,8 @@ function cors(res, req = res.req) {
|
|
|
1985
1993
|
}
|
|
1986
1994
|
if (allowed) res.setHeader('access-control-allow-origin', origin || '*')
|
|
1987
1995
|
res.setHeader('vary', 'Origin')
|
|
1988
|
-
res.setHeader('access-control-allow-headers', 'authorization, content-type, x-dsh-remote-client, x-dsh-remote-client-id, x-dsh-remote-inbox-key')
|
|
1996
|
+
res.setHeader('access-control-allow-headers', 'authorization, content-type, x-dsh-remote-client, x-dsh-remote-client-id, x-dsh-remote-inbox-key, if-none-match, if-modified-since')
|
|
1997
|
+
res.setHeader('access-control-expose-headers', 'etag, last-modified')
|
|
1989
1998
|
res.setHeader('access-control-allow-methods', 'GET, POST, OPTIONS')
|
|
1990
1999
|
res.setHeader('access-control-max-age', '600')
|
|
1991
2000
|
}
|
|
@@ -2032,6 +2041,16 @@ function withRequestBody(req, res, limit, callback) {
|
|
|
2032
2041
|
})
|
|
2033
2042
|
}
|
|
2034
2043
|
|
|
2044
|
+
async function readResponseText(response, maxBytes) {
|
|
2045
|
+
const chunks = []; let bytes = 0
|
|
2046
|
+
for await (const chunk of response.body) {
|
|
2047
|
+
bytes += chunk.length
|
|
2048
|
+
if (bytes > maxBytes) throw Object.assign(new Error('response too large'), { status: 413 })
|
|
2049
|
+
chunks.push(chunk)
|
|
2050
|
+
}
|
|
2051
|
+
return Buffer.concat(chunks).toString('utf8')
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2035
2054
|
function execFileResult(file, args, timeout = 5000) {
|
|
2036
2055
|
return new Promise((resolvePromise) => {
|
|
2037
2056
|
execFile(file, args, { timeout, windowsHide: true }, (error, stdout, stderr) => {
|
|
@@ -2862,7 +2881,7 @@ async function serveDshControl(req, res, url) {
|
|
|
2862
2881
|
// 阻断时改走 GET /api/events.poll 增量拉取。
|
|
2863
2882
|
const EVENT_BUFFER_MAX = durationEnv('GATEWAY_EVENT_BUFFER_MAX', 1000, 100, 10000)
|
|
2864
2883
|
const EVENT_POLL_WAIT_MAX = durationEnv('GATEWAY_EVENT_POLL_WAIT_MS', 25000, 0, 60000)
|
|
2865
|
-
const
|
|
2884
|
+
const EVENT_BUFFER_MAX_BYTES = durationEnv('GATEWAY_EVENT_BUFFER_MAX_BYTES', 8 * 1024 * 1024, 65536, 64 * 1024 * 1024)
|
|
2866
2885
|
const WS_GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
|
|
2867
2886
|
const eventBuffers = { mux: [], host: [] }
|
|
2868
2887
|
const eventNextSeq = { mux: 1, host: 1 }
|
|
@@ -3294,21 +3313,6 @@ async function translateModernRpc(method, payload, rpcId, strictReceipt = false)
|
|
|
3294
3313
|
return legacyEnvelope(rpcId, { ok: true, value: transform(response.body.result.value) })
|
|
3295
3314
|
}
|
|
3296
3315
|
|
|
3297
|
-
/** 递归截断超大字段,避免单条超大事件撑爆环形缓冲。 */
|
|
3298
|
-
function truncateEventValue(v, depth = 0) {
|
|
3299
|
-
if (typeof v === 'string') return v.length > EVENT_MAX_STRING ? v.slice(0, EVENT_MAX_STRING) + '…[truncated]' : v
|
|
3300
|
-
if (Array.isArray(v)) {
|
|
3301
|
-
if (depth > 3 || v.length > 200) return v.slice(0, 200)
|
|
3302
|
-
return v.map(x => truncateEventValue(x, depth + 1))
|
|
3303
|
-
}
|
|
3304
|
-
if (v && typeof v === 'object' && depth <= 3) {
|
|
3305
|
-
const out = {}
|
|
3306
|
-
for (const k of Object.keys(v)) out[k] = truncateEventValue(v[k], depth + 1)
|
|
3307
|
-
return out
|
|
3308
|
-
}
|
|
3309
|
-
return v
|
|
3310
|
-
}
|
|
3311
|
-
|
|
3312
3316
|
function wsAccept(key) {
|
|
3313
3317
|
return crypto.createHash('sha1').update(String(key || '') + WS_GUID).digest('base64')
|
|
3314
3318
|
}
|
|
@@ -3382,8 +3386,12 @@ function pushEvent(kind, full, raw = JSON.stringify(full)) {
|
|
|
3382
3386
|
}
|
|
3383
3387
|
if (eventCollectorState[kind]) eventCollectorState[kind].lastEventAt = Date.now()
|
|
3384
3388
|
const buf = eventBuffers[kind]
|
|
3385
|
-
|
|
3386
|
-
|
|
3389
|
+
const size = Buffer.byteLength(raw), record = { seq: eventNextSeq[kind]++, ts: Date.now(), event: JSON.parse(raw) }
|
|
3390
|
+
Object.defineProperty(record, 'bytes', { value: size })
|
|
3391
|
+
buf.push(record); buf.retainedBytes = (buf.retainedBytes || 0) + size
|
|
3392
|
+
// Evict whole records, never alter message content. Keep the newest complete
|
|
3393
|
+
// event even if it alone exceeds the target budget; cursor gaps trigger reset.
|
|
3394
|
+
while (buf.length > 1 && (buf.length > EVENT_BUFFER_MAX || buf.retainedBytes > EVENT_BUFFER_MAX_BYTES)) buf.retainedBytes -= buf.shift().bytes
|
|
3387
3395
|
rememberCollectorReplay(kind, full, raw)
|
|
3388
3396
|
broadcastCollectorFrame(kind, raw)
|
|
3389
3397
|
flushEventPollWaiters(kind)
|
|
@@ -4188,6 +4196,9 @@ function serveStats(req, res, url) {
|
|
|
4188
4196
|
// ---------- 反馈提交 ----------
|
|
4189
4197
|
const feedbackThrottle = new Map() // ip -> 上次受理时间戳
|
|
4190
4198
|
const FEEDBACK_WINDOW_MS = 60 * 1000
|
|
4199
|
+
// A full diagnostic upload can outlast the former eight-second budget on Funnel.
|
|
4200
|
+
// Share one deadline with the explicit legacy-size fallback; never retry timeouts.
|
|
4201
|
+
const FEEDBACK_FORWARD_TIMEOUT_MS = 30 * 1000
|
|
4191
4202
|
// 反馈收集器: 环境变量可覆盖, 默认使用 Tailscale Funnel 提供的公网 HTTPS
|
|
4192
4203
|
// 入口。这里是公开的 ts.net 域名,不要求提交反馈的用户加入 tailnet。
|
|
4193
4204
|
const FEEDBACK_URL = process.env.DSH_REMOTE_FEEDBACK_URL || 'https://vm-0-2-ubuntu.tail1f6fc4.ts.net/submit'
|
|
@@ -4259,8 +4270,8 @@ async function loadCentralAnnouncements(force = false) {
|
|
|
4259
4270
|
}
|
|
4260
4271
|
if (!res.ok) throw new Error(`central announcements HTTP ${res.status}`)
|
|
4261
4272
|
const declared = Number(res.headers.get('content-length') || 0)
|
|
4262
|
-
if (declared > ANNOUNCEMENTS_MAX_BYTES) throw new Error('announcements too large')
|
|
4263
|
-
const raw = await res
|
|
4273
|
+
if (declared > ANNOUNCEMENTS_MAX_BYTES) { await res.body?.cancel(); throw new Error('announcements too large') }
|
|
4274
|
+
const raw = await readResponseText(res, ANNOUNCEMENTS_MAX_BYTES)
|
|
4264
4275
|
const parsed = parseAnnouncements(raw)
|
|
4265
4276
|
announcementsCache = {
|
|
4266
4277
|
...parsed,
|
|
@@ -4554,7 +4565,7 @@ function serveFeedback(req, res, url) {
|
|
|
4554
4565
|
}
|
|
4555
4566
|
touchDevice(req)
|
|
4556
4567
|
|
|
4557
|
-
withRequestBody(req, res,
|
|
4568
|
+
withRequestBody(req, res, 256 * 1024, async body => {
|
|
4558
4569
|
let payload
|
|
4559
4570
|
try {
|
|
4560
4571
|
payload = JSON.parse(body || '{}')
|
|
@@ -4602,9 +4613,10 @@ function serveFeedback(req, res, url) {
|
|
|
4602
4613
|
res.end(JSON.stringify({ error: 'message required' }))
|
|
4603
4614
|
return
|
|
4604
4615
|
}
|
|
4605
|
-
|
|
4616
|
+
const messageLimit = type === 'poll' ? 2000 : 20000
|
|
4617
|
+
if (message.length > messageLimit) {
|
|
4606
4618
|
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
4607
|
-
res.end(JSON.stringify({ error: 'message too long', max:
|
|
4619
|
+
res.end(JSON.stringify({ error: 'message too long', max: messageLimit }))
|
|
4608
4620
|
return
|
|
4609
4621
|
}
|
|
4610
4622
|
if (contact.length > 200) {
|
|
@@ -4637,7 +4649,8 @@ function serveFeedback(req, res, url) {
|
|
|
4637
4649
|
...(includeDiagnostics ? {serverInfo:feedbackDiagnosticSummary(clientDiagnostics,gatewayDiagnostics,crashes)} : crashes?{serverInfo:JSON.stringify(crashes)}:{}),
|
|
4638
4650
|
...(pollVote || {})
|
|
4639
4651
|
}
|
|
4640
|
-
const
|
|
4652
|
+
const deadline = Date.now() + FEEDBACK_FORWARD_TIMEOUT_MS
|
|
4653
|
+
const send=body=>fetch(FEEDBACK_URL,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(body),signal:AbortSignal.timeout(Math.max(1, deadline - Date.now()))})
|
|
4641
4654
|
send(outbound).then(async (r) => {
|
|
4642
4655
|
let data = await r.json().catch(() => ({}))
|
|
4643
4656
|
// A size rejection happens before acceptance. Retry only this explicit
|
|
@@ -4649,6 +4662,15 @@ function serveFeedback(req, res, url) {
|
|
|
4649
4662
|
if (r.status === 429) {
|
|
4650
4663
|
res.writeHead(429, { 'content-type': 'application/json; charset=utf-8' })
|
|
4651
4664
|
res.end(JSON.stringify({ error: 'rate_limited' }))
|
|
4665
|
+
} else if (r.status === 413 || r.status === 400 && data.error === 'bad body size') {
|
|
4666
|
+
res.writeHead(413, { 'content-type': 'application/json; charset=utf-8' })
|
|
4667
|
+
res.end(JSON.stringify({ error: 'collector-body-limit' }))
|
|
4668
|
+
} else if (r.status === 400 && (/message.*(?:<=|≤)\s*2000/i.test(String(data.error || '')) || Number.isSafeInteger(data.max) && data.max > 0 && data.max < message.length)) {
|
|
4669
|
+
res.writeHead(413, { 'content-type': 'application/json; charset=utf-8' })
|
|
4670
|
+
res.end(JSON.stringify({ error: 'collector-message-limit', max: Number.isSafeInteger(data.max) ? data.max : 2000 }))
|
|
4671
|
+
} else if (r.ok && data.ok && data.messageSha256 && data.messageSha256 !== crypto.createHash('sha256').update(message).digest('hex')) {
|
|
4672
|
+
res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
4673
|
+
res.end(JSON.stringify({ error: 'feedback-content-unconfirmed' }))
|
|
4652
4674
|
} else if (r.ok && data.ok) {
|
|
4653
4675
|
feedbackThrottle.set(ip, now)
|
|
4654
4676
|
res.writeHead(200, { 'content-type': 'application/json; charset=utf-8' })
|
|
@@ -4659,7 +4681,7 @@ function serveFeedback(req, res, url) {
|
|
|
4659
4681
|
}
|
|
4660
4682
|
}).catch(() => {
|
|
4661
4683
|
res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
4662
|
-
res.end(JSON.stringify({ error: 'feedback_service_unavailable' }))
|
|
4684
|
+
res.end(JSON.stringify({ error: 'feedback_service_unavailable', uncertain: true }))
|
|
4663
4685
|
})
|
|
4664
4686
|
})
|
|
4665
4687
|
}
|
|
@@ -6237,17 +6259,7 @@ const ADAPTIVE_RPC_METHODS = new Set([
|
|
|
6237
6259
|
])
|
|
6238
6260
|
|
|
6239
6261
|
function readApiRequest(req, maxBytes = 4 * 1024 * 1024) {
|
|
6240
|
-
return
|
|
6241
|
-
let raw = ''
|
|
6242
|
-
req.setEncoding('utf8')
|
|
6243
|
-
req.on('data', chunk => {
|
|
6244
|
-
raw += chunk
|
|
6245
|
-
if (Buffer.byteLength(raw) > maxBytes) reject(new Error('request body too large'))
|
|
6246
|
-
})
|
|
6247
|
-
req.once('end', () => resolve(raw))
|
|
6248
|
-
req.once('error', reject)
|
|
6249
|
-
req.once('aborted', () => reject(new Error('request aborted')))
|
|
6250
|
-
})
|
|
6262
|
+
return readBody(req, maxBytes)
|
|
6251
6263
|
}
|
|
6252
6264
|
|
|
6253
6265
|
// Only the explicit pre-admission image rejection is safe to retry. Never retry
|
|
@@ -6463,7 +6475,7 @@ async function serveOperations(req, res, url) {
|
|
|
6463
6475
|
let old = loadOperation(key)
|
|
6464
6476
|
if (req.method === 'GET') return old ? reply(200, operationSnapshot(old)) : reply(404, { error: 'operation-not-found' })
|
|
6465
6477
|
let body
|
|
6466
|
-
try { body = JSON.parse(await readApiRequest(req)) } catch { return reply(400, { error: 'bad-operation' }) }
|
|
6478
|
+
try { body = JSON.parse(await readApiRequest(req)) } catch (error) { return reply(error.status === 413 ? 413 : 400, { error: error.status === 413 ? 'body-too-large' : 'bad-operation' }) }
|
|
6467
6479
|
if (!OPERATION_METHODS.has(body?.method) || !body.payload || typeof body.payload !== 'object' || Array.isArray(body.payload)) {
|
|
6468
6480
|
return reply(400, { error: 'unsupported-operation' })
|
|
6469
6481
|
}
|
|
@@ -6579,9 +6591,9 @@ async function proxyModernApi(req, res, url) {
|
|
|
6579
6591
|
} catch (error) {
|
|
6580
6592
|
if (!res.headersSent) {
|
|
6581
6593
|
cors(res)
|
|
6582
|
-
res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
6594
|
+
res.writeHead(error.status === 413 ? 413 : 502, { 'content-type': 'application/json; charset=utf-8' })
|
|
6583
6595
|
}
|
|
6584
|
-
if (!res.writableEnded) res.end(JSON.stringify({ error: 'upstream-incompatible', detail: String(error?.message || error) }))
|
|
6596
|
+
if (!res.writableEnded) res.end(JSON.stringify(error.status === 413 ? { error: 'body-too-large', max: 4 * 1024 * 1024 } : { error: 'upstream-incompatible', detail: String(error?.message || error) }))
|
|
6585
6597
|
return true
|
|
6586
6598
|
}
|
|
6587
6599
|
}
|
|
@@ -6629,7 +6641,7 @@ async function proxyLegacyApi(req, res, url) {
|
|
|
6629
6641
|
upstreamRes.pipe(res)
|
|
6630
6642
|
})
|
|
6631
6643
|
|
|
6632
|
-
const requestTimeout = ['/api/session.export', '/remote/api/command'].includes(url.pathname)
|
|
6644
|
+
const requestTimeout = ['/api/session.export', '/remote/api/command', '/remote/api/plugins/preflight'].includes(url.pathname)
|
|
6633
6645
|
? Math.max(UPSTREAM_REQUEST_TIMEOUT_MS, 130000) : UPSTREAM_REQUEST_TIMEOUT_MS
|
|
6634
6646
|
upstreamReq.setTimeout(requestTimeout, () => {
|
|
6635
6647
|
upstreamReq.destroy(new Error('upstream request timeout'))
|
|
@@ -6682,8 +6694,8 @@ function proxyApi(req, res, url) {
|
|
|
6682
6694
|
if (!handled) return proxyLegacyApi(req, res, url)
|
|
6683
6695
|
}).catch(error => {
|
|
6684
6696
|
cors(res)
|
|
6685
|
-
if (!res.headersSent) res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
6686
|
-
if (!res.writableEnded) res.end(JSON.stringify({ error: 'upstream-unreachable', detail: String(error?.message || error) }))
|
|
6697
|
+
if (!res.headersSent) res.writeHead(error.status === 413 ? 413 : 502, { 'content-type': 'application/json; charset=utf-8' })
|
|
6698
|
+
if (!res.writableEnded) res.end(JSON.stringify(error.status === 413 ? { error: 'body-too-large', max: 4 * 1024 * 1024 } : { error: 'upstream-unreachable', detail: String(error?.message || error) }))
|
|
6687
6699
|
})
|
|
6688
6700
|
}
|
|
6689
6701
|
|
package/insights.mjs
CHANGED
|
@@ -98,9 +98,11 @@ export async function readCostInsights(ctx, sessionId = '') {
|
|
|
98
98
|
cache.value = value; cache.at = Date.now(); return value
|
|
99
99
|
}).finally(() => { cache.task = null })
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
// Independent reads share one wait window; serial 20s waits can exceed both
|
|
102
|
+
// the gateway's 30s and the insights client's 25s request budgets.
|
|
103
|
+
const [raw, session] = await Promise.all([cache.task || cache.value,
|
|
104
|
+
sessionId && typeof service.getSessionCost === 'function'
|
|
105
|
+
? bounded(Promise.resolve().then(() => service.getSessionCost(sessionId))) : null])
|
|
104
106
|
return { status: 200, body: { ok: true, ...summarizeCost(raw, session, sessionId) } }
|
|
105
107
|
} catch {
|
|
106
108
|
// Plugin failures may mention credentials, URLs or paths. Return a fixed code.
|
package/market.mjs
CHANGED
|
@@ -42,13 +42,16 @@ export function createMarketAdapter(ctx, { timeoutMs = 20000 } = {}) {
|
|
|
42
42
|
async function search(url, query) {
|
|
43
43
|
const empty = { ok: true, available: false, source: 'official', items: [], total: 0, nextOffset: null }
|
|
44
44
|
if (!validQuery(query)) return { ...empty, ok: false, code: 'invalid-query' }
|
|
45
|
+
const deadline = Date.now() + timeoutMs
|
|
45
46
|
const state = await indexes()
|
|
46
47
|
if (!state.available) return { ...empty, code: state.code }
|
|
47
48
|
const index = url ? state.indexes.find(row => row.url === url) : state.indexes.find(row => !row.code)
|
|
48
49
|
if (!index) return { ...empty, code: state.indexes.length ? 'unknown-index' : 'no-indexes' }
|
|
49
50
|
if (index.code) return { ...empty, code: 'index-unavailable' }
|
|
50
51
|
try {
|
|
51
|
-
const
|
|
52
|
+
const remaining = deadline - Date.now()
|
|
53
|
+
if (remaining <= 0) return { ...empty, code: 'market-unavailable' }
|
|
54
|
+
const result = await bounded(Promise.resolve().then(() => service().search(index.url, query)), remaining)
|
|
52
55
|
if (!Array.isArray(result.entries)) throw Error('invalid response')
|
|
53
56
|
const categories = Object.entries(result.metadata?.categories || {}).slice(0, 100).map(([id, row]) => ({ id: text(id, 100), title: localized(row.title) }))
|
|
54
57
|
const items = result.entries.slice(0, query.limit).filter(row => packageName.test(row.name)).map(row => {
|
package/package.json
CHANGED
package/plugin-center.mjs
CHANGED
|
@@ -174,12 +174,12 @@ export function detectProfile(ctx, cli = process.argv[1], runtime = process) {
|
|
|
174
174
|
|
|
175
175
|
async function registryJson(path, signal = AbortSignal.timeout(20000)) {
|
|
176
176
|
const response = await fetch(REGISTRY + path, { signal, redirect: 'error' })
|
|
177
|
-
if (!response.ok) throw fail('npm registry: HTTP ' + response.status, 502)
|
|
177
|
+
if (!response.ok) { await response.body?.cancel(); throw fail('npm registry ' + path + ': HTTP ' + response.status, 502) }
|
|
178
178
|
let raw = '', bytes = 0
|
|
179
179
|
const decoder = new TextDecoder()
|
|
180
180
|
for await (const chunk of response.body) {
|
|
181
181
|
bytes += chunk.length
|
|
182
|
-
if (bytes > 8 * 1024 * 1024) throw fail('Registry response too large', 502)
|
|
182
|
+
if (bytes > 8 * 1024 * 1024) throw fail('Registry response too large: ' + path + ' (' + bytes + ' bytes; limit ' + 8 * 1024 * 1024 + ')', 502)
|
|
183
183
|
raw += decoder.decode(chunk, { stream: true })
|
|
184
184
|
}
|
|
185
185
|
raw += decoder.decode()
|
|
@@ -201,18 +201,131 @@ export async function pluginDetails(name, version = 'latest') {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
const publicationCache = new Map()
|
|
204
|
-
|
|
204
|
+
// Validate full package JSON without accumulating all-version manifests. Only
|
|
205
|
+
// requested string/string-map fields are retained; unrelated content is skipped.
|
|
206
|
+
function registryProjection(fields) {
|
|
207
|
+
const stack = [], result = Object.create(null)
|
|
208
|
+
let root = false, done = false, token = '', mode = '', escaped = false, unicode = 0, capture = false, retained = 0
|
|
209
|
+
let prefixLimit = Infinity, decodedChars = 0, truncatedString = false
|
|
210
|
+
const invalid = () => { throw fail('Invalid npm publication metadata', 502) }
|
|
211
|
+
const wanted = frame => frame.keep || stack.length === 1 && Object.hasOwn(fields, frame.key)
|
|
212
|
+
function accept(kind, value) {
|
|
213
|
+
const frame = stack.at(-1)
|
|
214
|
+
if (kind === '}' || kind === ']') {
|
|
215
|
+
if (!frame || frame.kind !== (kind === '}' ? '{' : '[') || !['first', 'end'].includes(frame.state)) invalid()
|
|
216
|
+
stack.pop(); if (!stack.length) done = true
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
if (kind === ':') { if (frame?.state !== 'colon') invalid(); frame.state = 'value'; return }
|
|
220
|
+
if (kind === ',') { if (frame?.state !== 'end') invalid(); frame.state = frame.kind === '{' ? 'key' : 'value'; return }
|
|
221
|
+
if (frame?.kind === '{' && ['first', 'key'].includes(frame.state)) {
|
|
222
|
+
if (kind !== 'string') invalid()
|
|
223
|
+
frame.key = value; frame.state = 'colon'; return
|
|
224
|
+
}
|
|
225
|
+
if (frame && !(frame.state === 'value' || frame.kind === '[' && frame.state === 'first')) invalid()
|
|
226
|
+
if (!frame && (root || kind !== '{')) invalid()
|
|
227
|
+
const keep = frame ? wanted(frame) : false
|
|
228
|
+
if (keep && (stack.length === 1 && fields[frame.key] === 'map' ? kind !== '{' : kind !== 'string')) invalid()
|
|
229
|
+
const container = kind === '{' || kind === '['
|
|
230
|
+
const next = container ? kind === '{' ? Object.create(null) : [] : value
|
|
231
|
+
if (!frame) root = true
|
|
232
|
+
else {
|
|
233
|
+
if (keep) {
|
|
234
|
+
const target = stack.length === 1 ? result : frame.value
|
|
235
|
+
if (frame.kind === '[') target.push(next)
|
|
236
|
+
else { if (Object.hasOwn(target, frame.key)) invalid(); target[frame.key] = next }
|
|
237
|
+
}
|
|
238
|
+
frame.state = 'end'
|
|
239
|
+
}
|
|
240
|
+
if (container) {
|
|
241
|
+
if (stack.length >= 64) invalid()
|
|
242
|
+
stack.push({ kind, state: 'first', keep, value: next, key: '' })
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function append(char) {
|
|
246
|
+
if (capture) {
|
|
247
|
+
if (++retained > 1024 * 1024) throw fail('npm publication fields exceed 1048576 characters', 502)
|
|
248
|
+
token += char
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function stringUnit() {
|
|
252
|
+
// Stop at a complete decoded UTF-16 unit, never in a JSON escape. Keep one
|
|
253
|
+
// extra character so the existing README adapter reports truncation.
|
|
254
|
+
if (capture && ++decodedChars >= prefixLimit) { capture = false; truncatedString = true }
|
|
255
|
+
}
|
|
256
|
+
function push(raw) {
|
|
257
|
+
for (let i = 0; i < raw.length; i++) {
|
|
258
|
+
const char = raw[i]
|
|
259
|
+
if (mode === 'string') {
|
|
260
|
+
append(char)
|
|
261
|
+
if (unicode) { if (!/[a-fA-F0-9]/.test(char)) invalid(); unicode--; if (!unicode) stringUnit(); continue }
|
|
262
|
+
if (escaped) { if (char === 'u') unicode = 4; else if (!'"\\/bfnrt'.includes(char)) invalid(); escaped = false; if (char !== 'u') stringUnit(); continue }
|
|
263
|
+
if (char === '\\') { escaped = true; continue }
|
|
264
|
+
if (char === '"') { accept('string', capture ? JSON.parse(token) : truncatedString ? JSON.parse(token + '"') : undefined); mode = ''; token = ''; continue }
|
|
265
|
+
if (char.charCodeAt(0) < 32) invalid()
|
|
266
|
+
stringUnit()
|
|
267
|
+
continue
|
|
268
|
+
}
|
|
269
|
+
if (mode === 'scalar') {
|
|
270
|
+
if (!/[\s,}\]]/.test(char)) { if (token.length >= 128) invalid(); token += char; continue }
|
|
271
|
+
if (!/^(?:true|false|null|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)$/.test(token)) invalid()
|
|
272
|
+
accept('scalar', JSON.parse(token)); mode = ''; token = ''; i--; continue
|
|
273
|
+
}
|
|
274
|
+
if (/^[ \r\n\t]$/.test(char)) continue
|
|
275
|
+
if (done) invalid()
|
|
276
|
+
if ('{}[]:,'.includes(char)) { accept(char); continue }
|
|
277
|
+
if (char === '"') {
|
|
278
|
+
const frame = stack.at(-1)
|
|
279
|
+
capture = !!frame && (frame.kind === '{' && ['first', 'key'].includes(frame.state) ? frame.keep || stack.length === 1 : wanted(frame))
|
|
280
|
+
prefixLimit = stack.length === 1 && frame?.state === 'value' && frame.key === 'readme' ? 100001 : Infinity
|
|
281
|
+
decodedChars = 0; truncatedString = false
|
|
282
|
+
token = ''; mode = 'string'; append(char); continue
|
|
283
|
+
}
|
|
284
|
+
if (!/[tfn\d-]/.test(char)) invalid()
|
|
285
|
+
token = char; mode = 'scalar'
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return { push, finish() { if (!done || mode || stack.length) invalid(); return result } }
|
|
289
|
+
}
|
|
290
|
+
async function registryMetadata(name, signal, fields) {
|
|
291
|
+
if (!packagePattern.test(name)) throw fail('Invalid package')
|
|
292
|
+
const requestSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(20000)]) : AbortSignal.timeout(20000)
|
|
293
|
+
let data, bytes = 0
|
|
294
|
+
try {
|
|
295
|
+
const response = await fetch(REGISTRY + '/' + encodeURIComponent(name), { signal: requestSignal, redirect: 'error', headers: { accept: 'application/json' } })
|
|
296
|
+
if (!response.ok) { await response.body?.cancel(); throw fail('HTTP ' + response.status, 502) }
|
|
297
|
+
const projection = registryProjection(fields), decoder = new TextDecoder('utf-8', { fatal: true })
|
|
298
|
+
for await (const chunk of response.body) {
|
|
299
|
+
bytes += chunk.length
|
|
300
|
+
if (bytes > 64 * 1024 * 1024) throw fail('Registry response too large (' + bytes + ' bytes; limit 67108864)', 502)
|
|
301
|
+
projection.push(decoder.decode(chunk, { stream: true }))
|
|
302
|
+
}
|
|
303
|
+
projection.push(decoder.decode()); data = projection.finish()
|
|
304
|
+
if (data.name !== name) throw fail('Invalid npm package identity', 502)
|
|
305
|
+
} catch (error) {
|
|
306
|
+
const reason = requestSignal.aborted ? 'npm 元数据读取超时或已取消' : error.status ? error.message : 'Registry response failed or invalid'
|
|
307
|
+
throw fail('npm ' + name + ': ' + reason + ' (received ' + bytes + ' bytes)', 502)
|
|
308
|
+
}
|
|
309
|
+
return data
|
|
310
|
+
}
|
|
311
|
+
// install-v1 metadata omits `time`; keep full-format publication evidence.
|
|
312
|
+
export async function publicationTimes(name, signal, versions = []) {
|
|
313
|
+
if (!packagePattern.test(name)) throw fail('Invalid package')
|
|
205
314
|
const cached = publicationCache.get(name)
|
|
206
|
-
if (cached?.until > Date.now()) return cached.value
|
|
207
|
-
const data = await
|
|
208
|
-
if (
|
|
315
|
+
if (cached?.until > Date.now() && versions.every(version => Object.hasOwn(cached.value, version))) return cached.value
|
|
316
|
+
const data = await registryMetadata(name, signal, { name: 'string', time: 'map' })
|
|
317
|
+
if (!data.time) throw fail('npm ' + name + ': npm 未提供可核验的发布时间', 502)
|
|
209
318
|
publicationCache.set(name, { value: data.time, until: Date.now() + 5 * 60000 })
|
|
210
319
|
if (publicationCache.size > 1500) publicationCache.delete(publicationCache.keys().next().value)
|
|
211
320
|
return data.time
|
|
212
321
|
}
|
|
322
|
+
async function readmeRegistryJson(path, signal) {
|
|
323
|
+
const name = decodeURIComponent(path.slice(1))
|
|
324
|
+
return registryMetadata(name, signal, { name: 'string', readme: 'string', 'dist-tags': 'map' })
|
|
325
|
+
}
|
|
213
326
|
|
|
214
327
|
export function createPluginCenter(ctx, options = {}) {
|
|
215
|
-
const market = createMarketAdapter(ctx), readme = createReadmeReader(options.registryJson ||
|
|
328
|
+
const market = createMarketAdapter(ctx), readme = createReadmeReader(options.registryJson || readmeRegistryJson)
|
|
216
329
|
const profile = options.profile === undefined ? detectProfile(ctx) : options.profile
|
|
217
330
|
const details = options.details || pluginDetails
|
|
218
331
|
const probe = options.probeProcesses || probeProcesses
|
package/plugin-transaction.mjs
CHANGED
|
@@ -119,7 +119,9 @@ export async function prepareReleasePlan(dir, operation, publishedTimes, env = p
|
|
|
119
119
|
const pairs = [...new Map(packages.map(row => [row.name + '@' + row.version, row])).values()]
|
|
120
120
|
const blockers = [], now = Date.now(), names = [...new Set(pairs.map(row => row.name))]
|
|
121
121
|
let cursor = 0
|
|
122
|
-
|
|
122
|
+
// Give large lockfiles multiple request batches, within the client/proxy budget.
|
|
123
|
+
const budget = Math.min(120000, Math.max(20000, Math.ceil(names.length / 6) * 20000))
|
|
124
|
+
const controller = new AbortController(), timeout = setTimeout(() => controller.abort(), budget)
|
|
123
125
|
try { if (policy.minutes > 0) await Promise.all(Array.from({ length: Math.min(6, names.length) }, async () => {
|
|
124
126
|
while (cursor < names.length) {
|
|
125
127
|
if (controller.signal.aborted) throw error('发布时间预检超时,请重试;不会执行安装。')
|
|
@@ -128,14 +130,19 @@ export async function prepareReleasePlan(dir, operation, publishedTimes, env = p
|
|
|
128
130
|
const first = policy.entries.find(rule => rule.name === name)
|
|
129
131
|
const checked = pairs.filter(row => row.name === name && !(first && (!first.versions.length || first.versions.includes(row.version))))
|
|
130
132
|
if (!checked.length) continue
|
|
131
|
-
const times = await publishedTimes(name, controller.signal)
|
|
133
|
+
const times = await publishedTimes(name, controller.signal, checked.map(row => row.version))
|
|
132
134
|
for (const row of checked) {
|
|
133
135
|
const at = Date.parse(times[row.version])
|
|
134
136
|
if (!Number.isFinite(at) || at > now + 60000) throw error('无法核实 ' + name + '@' + row.version + ' 的发布时间,未放行;请稍后重试。')
|
|
135
137
|
if (at + policy.minutes * 60000 > now) blockers.push({ ...row, publishedAt: new Date(at).toISOString(), eligibleAt: new Date(at + policy.minutes * 60000).toISOString() })
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
|
-
})) } catch (failure) {
|
|
140
|
+
})) } catch (failure) {
|
|
141
|
+
const timedOut = controller.signal.aborted
|
|
142
|
+
controller.abort()
|
|
143
|
+
if (timedOut) throw error('发布时间预检超时(' + budget / 1000 + ' 秒,' + names.length + ' 个包),不会执行安装;请重试。')
|
|
144
|
+
throw failure
|
|
145
|
+
} finally { clearTimeout(timeout) }
|
|
139
146
|
blockers.sort((a, b) => (a.name + '@' + a.version).localeCompare(b.name + '@' + b.version))
|
|
140
147
|
const merged = mergeReleaseRules(workspace, blockers)
|
|
141
148
|
if (profileRevision(dir) !== before) throw error('预检期间主机配置已变化,请重新预检。')
|
package/public/admin.html
CHANGED
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
6
|
<meta name="theme-color" content="#0D1117">
|
|
7
7
|
<title>DSH Remote · 管理</title>
|
|
8
|
-
<script>/* 首帧前应用皮肤 */ (function(){try{var t=localStorage.getItem('dshTheme');if(t!=='default'&&t!=='dark'&&t!=='light'&&t!=='neutral'&&t!=='mono'&&t!=='fish'){t='fish'}}catch(e){t='fish'}document.documentElement.setAttribute('data-theme',t)})()</script>
|
|
8
|
+
<script>/* 首帧前应用皮肤 */ (function(){try{var t=localStorage.getItem('dshTheme');if(t!=='default'&&t!=='dark'&&t!=='light'&&t!=='neutral'&&t!=='mono'&&t!=='fish'&&t!=='penguin'&&t!=='penguin-night'&&t!=='bocchi'&&t!=='nijika'&&t!=='ryo'&&t!=='kita'){t='fish'}}catch(e){t='fish'}document.documentElement.setAttribute('data-theme',t)})()</script>
|
|
9
9
|
<link rel="stylesheet" href="../styles.css">
|
|
10
10
|
<link rel="stylesheet" href="../relay-settings.css">
|
|
11
11
|
<link rel="stylesheet" href="../insights.css">
|
|
12
12
|
<link rel="stylesheet" href="../setup.css">
|
|
13
13
|
<link rel="stylesheet" href="../doctor.css">
|
|
14
14
|
<link rel="stylesheet" href="../skins/blue-fish/skin.css">
|
|
15
|
+
<link rel="stylesheet" href="../skins/penguin/skin.css">
|
|
16
|
+
<link rel="stylesheet" href="../skins/bocchi/skin.css">
|
|
17
|
+
<link rel="stylesheet" href="../skins/kessoku/skin.css">
|
|
18
|
+
<link rel="stylesheet" href="../skins/nijika/skin.css">
|
|
19
|
+
<link rel="stylesheet" href="../skins/ryo/skin.css">
|
|
20
|
+
<link rel="stylesheet" href="../skins/kita/skin.css">
|
|
15
21
|
<style>
|
|
16
22
|
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px 40px; }
|
|
17
23
|
.admin-title {
|
|
@@ -342,6 +348,7 @@
|
|
|
342
348
|
}
|
|
343
349
|
</style>
|
|
344
350
|
<link rel="stylesheet" href="../remote-ui.css">
|
|
351
|
+
<link rel="stylesheet" href="../theme-picker.css">
|
|
345
352
|
</head>
|
|
346
353
|
<body>
|
|
347
354
|
<div class="admin-wrap">
|
|
@@ -536,18 +543,8 @@
|
|
|
536
543
|
</div>
|
|
537
544
|
</div>
|
|
538
545
|
|
|
539
|
-
<!-- 皮肤选择模态 -->
|
|
540
|
-
<div id="modal-theme" class="modal hidden" role="dialog" aria-modal="true">
|
|
541
|
-
<div class="modal-card">
|
|
542
|
-
<div class="modal-title" data-i18n="theme.panelTitle">选择配色</div>
|
|
543
|
-
<div id="theme-options" class="theme-panel-list"></div>
|
|
544
|
-
<div class="modal-actions">
|
|
545
|
-
<button id="theme-close" class="btn subtle" data-i18n="theme.close">关闭</button>
|
|
546
|
-
</div>
|
|
547
|
-
</div>
|
|
548
|
-
</div>
|
|
549
|
-
|
|
550
546
|
<!-- 赞赏支持模态 -->
|
|
547
|
+
<script src="../sponsor-entry.js" defer></script>
|
|
551
548
|
<div id="modal-donate" class="modal hidden" role="dialog" aria-modal="true">
|
|
552
549
|
<div class="modal-card">
|
|
553
550
|
<div class="modal-title" data-i18n="donateTitle">赞赏支持</div>
|
|
@@ -583,7 +580,7 @@
|
|
|
583
580
|
'doctor.realtime': '实时消息通道', 'doctor.realtimePass': 'mux 与 host 通道均已连接', 'doctor.realtimeFail': '实时通道未全部建立;可先使用轮询,检查 DSH 后会自动恢复',
|
|
584
581
|
'doctor.start': '启动', 'doctor.showQr': '显示二维码', 'doctor.copyAddress': '复制地址', 'doctor.copyCommand': '复制命令',
|
|
585
582
|
'doctor.reportCopied': '诊断报告已复制', 'doctor.commandCopied': '防火墙命令已复制,请确认网络范围后手动执行', 'doctor.addressCopied': '服务器地址已复制',
|
|
586
|
-
'theme.default': '默认深空', 'theme.dark': '落日', 'theme.light': '易北爱乐厅', 'theme.neutral': '草原孤塔', 'theme.mono': '黑曜白', 'theme.fish': '蓝色大肥鱼',
|
|
583
|
+
'theme.default': '默认深空', 'theme.dark': '落日', 'theme.light': '易北爱乐厅', 'theme.neutral': '草原孤塔', 'theme.mono': '黑曜白', 'theme.fish': '蓝色大肥鱼', 'theme.penguin': '企鹅女管·白昼', 'theme.penguin-night': '企鹅女管·极夜', 'theme.bocchi': '波奇酱', 'theme.nijika': '伊地知虹夏', 'theme.ryo': '山田凉', 'theme.kita': '喜多郁代',
|
|
587
584
|
'theme.panelTitle': '选择配色', 'theme.close': '关闭',
|
|
588
585
|
'repo': '仓库',
|
|
589
586
|
'donateTitle': '赞赏支持', 'donateThanks': '感谢你的支持 ☕',
|
|
@@ -702,7 +699,7 @@
|
|
|
702
699
|
'doctor.realtime': 'Realtime channels', 'doctor.realtimePass': 'Both mux and host channels are connected', 'doctor.realtimeFail': 'Realtime channels are incomplete. Polling remains available and recovery is automatic.',
|
|
703
700
|
'doctor.start': 'Start', 'doctor.showQr': 'Show QR', 'doctor.copyAddress': 'Copy address', 'doctor.copyCommand': 'Copy command',
|
|
704
701
|
'doctor.reportCopied': 'Diagnostic report copied', 'doctor.commandCopied': 'Firewall command copied. Review the network scope before running it.', 'doctor.addressCopied': 'Server address copied',
|
|
705
|
-
'theme.default': 'Default', 'theme.dark': 'Sunset', 'theme.light': 'Elbphilharmonie', 'theme.neutral': 'Prairie Tower', 'theme.mono': 'Monochrome', 'theme.fish': 'Blue Fat Fish',
|
|
702
|
+
'theme.default': 'Default', 'theme.dark': 'Sunset', 'theme.light': 'Elbphilharmonie', 'theme.neutral': 'Prairie Tower', 'theme.mono': 'Monochrome', 'theme.fish': 'Blue Fat Fish', 'theme.penguin': 'Penguin Admin Day', 'theme.penguin-night': 'Penguin Admin Night', 'theme.bocchi': 'Bocchi', 'theme.nijika': 'Nijika', 'theme.ryo': 'Ryo', 'theme.kita': 'Kita',
|
|
706
703
|
'theme.panelTitle': 'Choose theme', 'theme.close': 'Close',
|
|
707
704
|
'repo': 'Repo',
|
|
708
705
|
'donateTitle': 'Support', 'donateThanks': 'Thanks for your support ☕',
|