chore(runtime): upgrade DSH and bundled plugins for runtime-7.10

This commit is contained in:
2026-10-26 11:22:36 +08:00
parent 9961d42a2f
commit 0389555d76
18 changed files with 118 additions and 50 deletions
+14 -4
View File
@@ -25,10 +25,20 @@ test('non-JSON errors report HTTP status without exposing response content', asy
assert.equal(body.error.code, 'forbidden');
});
test('patch rejects unsupported or changed clients and double patching', () => {
const source = Array(3).fill("await fetch('/plugins/dsh-session-delete/delete'); await response.json()").join(';');
const patched = patchClient(source, '1.5.16');
const source = [
"await fetch('/plugins/dsh-session-delete/delete', options); await response.json()",
'await fetch(`/plugins/dsh-session-delete/${action}`, options); await response.json()',
"await fetch('/plugins/dsh-session-delete/archive-search', options); await response.json()",
].join(';');
const patched = patchClient(source, '1.5.18');
assert.equal(patched.split('await dshChatFetch(').length, 4);
assert.equal(patched.slice(clientHelpers.length).replaceAll('await dshChatFetch(', 'await fetch(')
.replaceAll('await dshChatJson(response)', 'await response.json()'), source);
assert.throws(() => patchClient(source, '1.5.16'), /unsupported/);
assert.throws(() => patchClient(source, '1.5.13'), /unsupported/);
assert.throws(() => patchClient('', '1.5.16'), /unexpected/);
assert.throws(() => patchClient(patched, '1.5.16'), /unexpected/);
assert.throws(() => patchClient('', '1.5.18'), /unexpected/);
assert.throws(() => patchClient(source.replace('await fetch(', 'fetch('), '1.5.18'), /unexpected/);
assert.throws(() => patchClient(source.replace('await response.json()', 'response.json()'), '1.5.18'), /unexpected/);
assert.throws(() => patchClient(source.replace('/plugins/dsh-session-delete/', '/plugins/changed/'), '1.5.18'), /unexpected/);
assert.throws(() => patchClient(patched, '1.5.18'), /unexpected/);
});