wip: zen
This commit is contained in:
@@ -74,8 +74,9 @@ export async function handler(
|
|||||||
const dict = i18n(localeFromRequest(input.request))
|
const dict = i18n(localeFromRequest(input.request))
|
||||||
const t = (key: Key, params?: Record<string, string | number>) => resolve(dict[key], params)
|
const t = (key: Key, params?: Record<string, string | number>) => resolve(dict[key], params)
|
||||||
const ADMIN_WORKSPACES = [
|
const ADMIN_WORKSPACES = [
|
||||||
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // frank
|
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // anomaly
|
||||||
"wrk_01K6W1A3VE0KMNVSCQT43BG2SX", // opencode bench
|
"wrk_01K6W1A3VE0KMNVSCQT43BG2SX", // benchmark
|
||||||
|
"wrk_01KKZDKDWCS1VTJF8QTX62DD50", // contributors
|
||||||
]
|
]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (!identifier) {
|
|||||||
if (identifier.startsWith("wrk_")) {
|
if (identifier.startsWith("wrk_")) {
|
||||||
await printWorkspace(identifier)
|
await printWorkspace(identifier)
|
||||||
}
|
}
|
||||||
// lookup by API key
|
// lookup by API key ID
|
||||||
else if (identifier.startsWith("key_")) {
|
else if (identifier.startsWith("key_")) {
|
||||||
const key = await Database.use((tx) =>
|
const key = await Database.use((tx) =>
|
||||||
tx
|
tx
|
||||||
@@ -34,6 +34,21 @@ else if (identifier.startsWith("key_")) {
|
|||||||
}
|
}
|
||||||
await printWorkspace(key.workspaceID)
|
await printWorkspace(key.workspaceID)
|
||||||
}
|
}
|
||||||
|
// lookup by API key value
|
||||||
|
else if (identifier.startsWith("sk-")) {
|
||||||
|
const key = await Database.use((tx) =>
|
||||||
|
tx
|
||||||
|
.select()
|
||||||
|
.from(KeyTable)
|
||||||
|
.where(eq(KeyTable.key, identifier))
|
||||||
|
.then((rows) => rows[0]),
|
||||||
|
)
|
||||||
|
if (!key) {
|
||||||
|
console.error("API key not found")
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
await printWorkspace(key.workspaceID)
|
||||||
|
}
|
||||||
// lookup by email
|
// lookup by email
|
||||||
else {
|
else {
|
||||||
const authData = await Database.use(async (tx) =>
|
const authData = await Database.use(async (tx) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user