mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-09 18:39:58 +00:00
23 lines
583 B
TypeScript
23 lines
583 B
TypeScript
export default defineNuxtPlugin(() => {
|
|
const { params, query } = useRoute()
|
|
|
|
publicServer.value = params.server as string || useRuntimeConfig().public.defaultServer
|
|
|
|
const masto = createMasto()
|
|
const user = (typeof query.server === 'string' && typeof query.token === 'string')
|
|
? {
|
|
server: query.server,
|
|
token: query.token,
|
|
vapidKey: typeof query.vapid_key === 'string' ? query.vapid_key : undefined,
|
|
}
|
|
: (currentUser.value || { server: publicServer.value })
|
|
|
|
loginTo(masto, user)
|
|
|
|
return {
|
|
provide: {
|
|
masto,
|
|
},
|
|
}
|
|
})
|