feat: basic oauth
This commit is contained in:
parent
72b13f5265
commit
7ab17001f0
16 changed files with 199 additions and 106 deletions
|
@ -1,19 +1,17 @@
|
|||
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
|
||||
}
|
||||
import type { AppInfo } from '~/types'
|
||||
|
||||
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))
|
||||
.catch((e) => {
|
||||
if (process.dev)
|
||||
console.error('Failed to fetch registered apps,\nyou may need to run `nr register-apps` first')
|
||||
else
|
||||
console.error('Failed to fetch registered apps')
|
||||
console.error(e)
|
||||
})
|
||||
|
||||
export async function getApp(server: string) {
|
||||
await promise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue