fix: 修正凭据名称避免 DSH 重启失败

This commit is contained in:
cneicy committed 2026-10-05 03:58:46 +08:00
1 parent 108e957c64
commit 7e2ec28b80
4 files changed
+57 -6

No files matched your search

+3 -1
View File
@@ -12,7 +12,9 @@ const dataRoot = join(process.env.DSH_HOME || join(homedir(), '.dsh'), 'imagegen
const settingsPath = join(dataRoot, 'settings.json');
const outputs = join(dataRoot, 'outputs');
const initial = { baseUrl: 'https://api.openai.com/v1', models: ['gpt-image-2', 'gpt-image-1.5'], defaultModel: '' };
const keyFor = base => `dsh-imagegen:${createHash('sha256').update(base).digest('hex')}`;
// DSH CredentialKey requires <scope>/<id>, each matching [a-z][a-z0-9-]*.
// Use the registered plugin name as scope and prefix the digest: hex may start with a digit.
const keyFor = base => `${name}/endpoint-${createHash('sha256').update(base).digest('hex')}`;
const json = (value, status = 200) => new Response(JSON.stringify(value), { status, headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' } });
const schema = { type: 'object', additionalProperties: true };
const text = value => ({ type: 'text', text: JSON.stringify(value, null, 2) });