From 18f5872be1f26ee829914d46f274a989fb956632 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 24 Feb 2023 22:00:48 -0800 Subject: [PATCH] core: fix oauth on rehosted urls --- plugins/core/package-lock.json | 4 ++-- plugins/core/package.json | 2 +- plugins/core/ui/src/interfaces/OauthClient.vue | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/core/package-lock.json b/plugins/core/package-lock.json index 1f65bf721e..8c21e1b055 100644 --- a/plugins/core/package-lock.json +++ b/plugins/core/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/core", - "version": "0.1.93", + "version": "0.1.94", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/core", - "version": "0.1.93", + "version": "0.1.94", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/core/package.json b/plugins/core/package.json index 5cce01683a..30638f6185 100644 --- a/plugins/core/package.json +++ b/plugins/core/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/core", - "version": "0.1.93", + "version": "0.1.94", "description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/core/ui/src/interfaces/OauthClient.vue b/plugins/core/ui/src/interfaces/OauthClient.vue index f30987319b..4c37729024 100644 --- a/plugins/core/ui/src/interfaces/OauthClient.vue +++ b/plugins/core/ui/src/interfaces/OauthClient.vue @@ -31,7 +31,9 @@ export default { u = new URL(redirect_uri); } catch (e) { - u = new URL(redirect_uri, window.location.href); + const baseURI = new URL(document.baseURI); + const scryptedRootURI = new URL('../../../../', baseURI); + u = new URL('.' + redirect_uri, scryptedRootURI); u.hostname = 'localhost'; } if (u.hostname === 'localhost') {