wip: oauth

This commit is contained in:
Anthony Fu 2022-11-15 22:29:46 +08:00
parent 0dac7b9785
commit 72b13f5265
7 changed files with 115 additions and 4 deletions

21
server/shared.ts Normal file
View file

@ -0,0 +1,21 @@
import { $fetch } from 'ohmyfetch'
export interface AppInfo {
id: string
name: string
website: string | null
redirect_uri: string
client_id: string
client_secret: string
vapid_key: string
}
export const registeredApps: Record<string, AppInfo> = {}
const promise = $fetch(process.env.APPS_JSON_URL || 'http://localhost:3000/registered-apps.json')
.then(r => Object.assign(registeredApps, r))
export async function getApp(server: string) {
await promise
return registeredApps[server]
}