Add JRPC API, reworked Login and User pages
This commit is contained in:
@ -84,9 +84,25 @@ async function onMessage(msg: MessageEvent<any>) {
|
||||
const url = new URL(msg.origin);
|
||||
setAppName(url.hostname);
|
||||
|
||||
if (!msg.data.client_id) {
|
||||
alert("The site requesting the login is not valid");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!msg.data.type || msg.data.type === "jwt") {
|
||||
console.log("JWT Request");
|
||||
|
||||
await request(
|
||||
"/api/user/oauth/permissions",
|
||||
{
|
||||
client_id: msg.data.client_id,
|
||||
origin: url.hostname,
|
||||
permissions: permissions.join(","),
|
||||
}
|
||||
); // Will fail if client does not exist
|
||||
|
||||
await new Promise<void>((yes) => {
|
||||
console.log("Await user acceptance");
|
||||
setLoading(false);
|
||||
|
Reference in New Issue
Block a user