fix: allow multiple accounts on same server (#1092)
parent
190caf0437
commit
88ac29ea14
|
@ -11,6 +11,8 @@ let knownServers = $ref<string[]>([])
|
||||||
let autocompleteIndex = $ref(0)
|
let autocompleteIndex = $ref(0)
|
||||||
let autocompleteShow = $ref(false)
|
let autocompleteShow = $ref(false)
|
||||||
|
|
||||||
|
const users = useUsers()
|
||||||
|
|
||||||
async function oauth() {
|
async function oauth() {
|
||||||
if (busy)
|
if (busy)
|
||||||
return
|
return
|
||||||
|
@ -28,6 +30,7 @@ async function oauth() {
|
||||||
location.href = await (globalThis.$fetch as any)(`/api/${server || publicServer.value}/login`, {
|
location.href = await (globalThis.$fetch as any)(`/api/${server || publicServer.value}/login`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: {
|
body: {
|
||||||
|
force_login: users.value.some(u => u.server === server),
|
||||||
origin: location.origin,
|
origin: location.origin,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { getApp, getRedirectURI } from '~/server/shared'
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
let { server } = getRouterParams(event)
|
let { server } = getRouterParams(event)
|
||||||
const { origin } = await readBody(event)
|
const { origin, force_login } = await readBody(event)
|
||||||
server = server.toLocaleLowerCase().trim()
|
server = server.toLocaleLowerCase().trim()
|
||||||
const app = await getApp(origin, server)
|
const app = await getApp(origin, server)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ export default defineEventHandler(async (event) => {
|
||||||
|
|
||||||
const query = stringifyQuery({
|
const query = stringifyQuery({
|
||||||
client_id: app.client_id,
|
client_id: app.client_id,
|
||||||
|
force_login: force_login === true ? 'true' : 'false',
|
||||||
scope: 'read write follow push',
|
scope: 'read write follow push',
|
||||||
redirect_uri: getRedirectURI(origin, server),
|
redirect_uri: getRedirectURI(origin, server),
|
||||||
response_type: 'code',
|
response_type: 'code',
|
||||||
|
|
Loading…
Reference in New Issue