release: dsh-infstarapi 0.2.0
CI / test (push) Canceled after 0s

This commit is contained in:
Coldsmile_7 committed 2026-11-26 08:24:56 +08:00
1 parent a8f689e39c
commit c340aec110
59 files changed
+1108 -1590

No files matched your search

+6 -6
View File
@@ -14,21 +14,21 @@ export async function readStoredKey({
try {
const doc = parseDocument(readFileSync(filePath, 'utf8'), { prettyErrors: false, logLevel: 'silent' })
if (doc.errors.length) throw new Error('invalid credential document')
record = doc.toJS()?.records?.['geek2api/keys']
record = doc.toJS()?.records?.['infstarapi/keys']
} catch {
// YAML diagnostics can quote source lines containing secrets.
throw new Error('Geek2API plugin credentials could not be read safely')
throw new Error('InfStarAPI plugin credentials could not be read safely')
}
const ring = new Geek2APIKeyRing({
readRecord: async id => id === 'geek2api/keys' ? record : undefined,
modifyRecord: async () => { throw new Error('Geek2API live checks cannot change stored credentials') },
readRecord: async id => id === 'infstarapi/keys' ? record : undefined,
modifyRecord: async () => { throw new Error('InfStarAPI live checks cannot change stored credentials') },
})
if (label !== undefined) {
const matches = (await ring.secrets()).filter(entry => entry.label === label && !entry.disabled)
if (matches.length !== 1) throw new Error('Geek2API live check needs one usable key with that label')
if (matches.length !== 1) throw new Error('InfStarAPI live check needs one usable key with that label')
return matches[0].key
}
const active = await ring.activeKey()
if (active === undefined) throw new Error('Geek2API live check needs a usable key added under Settings → Geek2API')
if (active === undefined) throw new Error('InfStarAPI live check needs a usable key added under Settings → InfStarAPI')
return active.key
}