From 9edfd5ac2db4b4bbab1abf809ef0161e180a7232 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Thu, 18 Apr 2024 07:53:37 -1000 Subject: [PATCH] feat: :sparkles: Edit site to support Lysand's OIDC/OAuth2 --- nuxt.config.ts | 2 +- pages/oauth/redirect.vue | 65 +++++++++++++++++++++------------------- pages/register/index.vue | 4 ++- 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 02edc6a..c5e0f68 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -42,7 +42,7 @@ export default defineNuxtConfig({ titleSeparator: "ยท", siteName: "Lysand", trailingSlash: true, - apiHost: "localhost:8080", + apiHost: "https://lysand.localhost", }, }, site: { diff --git a/pages/oauth/redirect.vue b/pages/oauth/redirect.vue index 1647834..10b75c2 100644 --- a/pages/oauth/redirect.vue +++ b/pages/oauth/redirect.vue @@ -6,8 +6,8 @@ style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)" />
-
+ +

Allow this application to access your account?

@@ -50,32 +50,36 @@
-

Invalid access - parameters -

-

This page should be accessed - through a valid OAuth2 authorization request. Please use a Mastodon API client to access this page. -

-

Here are some recommended clients:

- -

- Many other clients exist, but they have not been tested for compatibility. Bug reports are nevertheless welcome. -

- -

- Found a problem? Report it on the issue tracker. -

-
+

Invalid access + parameters +

+

This page should be accessed + through a valid OAuth2 authorization request. Please use a Mastodon + API client to access this page. +

+

Here are some recommended clients:

+ +

+ Many other clients exist, but they have not been tested for + compatibility. Bug reports are nevertheless welcome. +

+ +

+ Found a problem? Report it on the issue tracker. +

+
@@ -83,6 +87,7 @@ import { useRoute } from "vue-router"; import { recommendedClients } from "../../constants"; +const url = useRequestURL(); const query = useRoute().query; const application = query.application; @@ -93,7 +98,7 @@ const scope = decodeURIComponent((query.scope as string) || ""); const code = query.code; const validUrlParameters = - application && website && redirect_uri && client_id && scope && code; + application && website && redirect_uri && client_id && scope; const oauthScopeText: Record = { "rw:accounts": "$VERB your account information", @@ -172,4 +177,4 @@ const getScopeText = (fullScopes: string[]) => { } return scopeTexts; }; - \ No newline at end of file + diff --git a/pages/register/index.vue b/pages/register/index.vue index 7ea49b7..1d23859 100644 --- a/pages/register/index.vue +++ b/pages/register/index.vue @@ -112,7 +112,9 @@ if (!config) { const instanceInfo = (await fetch(new URL("/api/v1/instance", config.http.base_url)).then( (data) => data.json(), -)); +)).catch((e: Error) => { + console.error(e); +}); const errors = ref<{ [key: string]: {