1 parent
a8f689e39c
commit
c340aec110
59 files changed
+1108
-1590
No files matched your search
@@ -42,10 +42,10 @@ import {
|
||||
createRouteAdapter,
|
||||
} from '../lib/index.js'
|
||||
|
||||
const PROVIDER = 'geek2api'
|
||||
const PROVIDER = 'infstarapi'
|
||||
const SESSION_ID = 'live-check-session'
|
||||
const HOSTS = createHostPool()
|
||||
const HTTP_MODELS = ['deepseek-v4.1-flash', 'gpt-6.1-sol', 'gpt-6-astra', 'grok-4.6', 'claude-opus-5-5', 'gemini-3.8-flash', 'glm-5.3']
|
||||
const HTTP_MODELS = ['deepseek-v4.1-flash', 'deepseek-v4-pro', 'gpt-6.1-sol', 'gpt-6.2-sol', 'gpt-6.2-astra']
|
||||
|
||||
/** In-memory stand-in for the DSH credential-record service. */
|
||||
function fakeCredentials() {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import {
|
||||
createRouteAdapter,
|
||||
} from '../lib/index.js'
|
||||
|
||||
const PROVIDER = 'geek2api'
|
||||
const PROVIDER = 'infstarapi'
|
||||
const SESSION_ID = 'smoke-session'
|
||||
|
||||
function fakeCredentials() {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user