From 7fa02c57d1ffbd8b1a10c5b035fb6d971c4f441b Mon Sep 17 00:00:00 2001 From: DecDuck Date: Thu, 26 Feb 2026 22:15:19 +0000 Subject: [PATCH] OIDC & store fixes (#358) * fix: typos * fix: platform filtering * feat: fix tags and create option --- components/GameEditor/Metadata.vue | 28 +++++++++-- components/Selector/MultiItem.vue | 77 +++++++++++++++++++++++++++++- i18n/locales/en_us.json | 8 +++- server/api/v1/store/index.get.ts | 36 +++++++++----- server/internal/auth/oidc/index.ts | 4 +- server/internal/config/sys-conf.ts | 12 ++--- 6 files changed, 138 insertions(+), 27 deletions(-) diff --git a/components/GameEditor/Metadata.vue b/components/GameEditor/Metadata.vue index d4bb1657..ebb4ff30 100644 --- a/components/GameEditor/Metadata.vue +++ b/components/GameEditor/Metadata.vue @@ -30,7 +30,11 @@
- +
@@ -85,6 +129,7 @@ import { } from "@headlessui/vue"; const props = defineProps<{ items: Array; + create?: (value: string) => Promise; }>(); const model = defineModel<{ [key: string]: boolean }>(); @@ -102,7 +147,37 @@ const enabledItems = computed(() => props.items.filter((e) => model.value?.[e.param]), ); +// I do not love how this works, but it's okay for now +const CREATE_PREFIX = "CREATE"; + +const createLoading = ref(false); function add(item: string) { + if (item.startsWith(CREATE_PREFIX)) { + if (!props.create) return; + const value = item.substring(CREATE_PREFIX.length); + createLoading.value = true; + props + .create(value) + .then( + (result) => { + add(result); + }, + (err) => { + createModal( + ModalType.Notification, + { + title: "Failed to create value", + description: err, + }, + (_, c) => c(), + ); + }, + ) + .finally(() => { + createLoading.value = false; + }); + return; + } search.value = ""; model.value ??= {}; model.value[item] = true; diff --git a/i18n/locales/en_us.json b/i18n/locales/en_us.json index a56417fc..196128ed 100644 --- a/i18n/locales/en_us.json +++ b/i18n/locales/en_us.json @@ -181,7 +181,13 @@ "servers": "Servers", "srLoading": "Loading…", "tags": "Tags", - "today": "Today" + "today": "Today", + "components": { + "multiitem": { + "placeholder": "Start typing...", + "new": "Create new: \"{0}\"" + } + } }, "drop": { "desc": "An open-source game distribution platform built for speed, flexibility and beauty.", diff --git a/server/api/v1/store/index.get.ts b/server/api/v1/store/index.get.ts index 23c15e7a..5e38581d 100644 --- a/server/api/v1/store/index.get.ts +++ b/server/api/v1/store/index.get.ts @@ -53,24 +53,34 @@ export default defineEventHandler(async (h3) => { : undefined; const platformFilter = filterPlatforms ? ({ - versions: { - some: { - launches: { + OR: [ + { + versions: { some: { - platform: { - in: filterPlatforms, - }, - }, - }, - setups: { - some: { - platform: { - in: filterPlatforms, + setups: { + some: { + platform: { + in: filterPlatforms, + }, + }, }, }, }, }, - }, + { + versions: { + some: { + launches: { + some: { + platform: { + in: filterPlatforms, + }, + }, + }, + }, + }, + }, + ], } satisfies Prisma.GameWhereInput) : undefined; diff --git a/server/internal/auth/oidc/index.ts b/server/internal/auth/oidc/index.ts index 32750f1a..b8cd8eb6 100644 --- a/server/internal/auth/oidc/index.ts +++ b/server/internal/auth/oidc/index.ts @@ -153,14 +153,14 @@ export class OIDCManager { this.JWKS = jose.createRemoteJWKSet(this.oidcConfiguration.jwks_uri); this.redirectUrl = new URL( - `${this.externalUrl.toString()}api/v1/auth/odic/callback`, + `${this.externalUrl.toString()}api/v1/auth/oidc/callback`, ); } static async create() { if (!systemConfig.shouldOidcRequireHttps()) { console.warn( - "Disabling HTTPS requirement for ODIC provider, not recommened in production enviroments", + "Disabling HTTPS requirement for OIDC provider, not recommened in production enviroments", ); } diff --git a/server/internal/config/sys-conf.ts b/server/internal/config/sys-conf.ts index 72cb980d..75ddbdde 100644 --- a/server/internal/config/sys-conf.ts +++ b/server/internal/config/sys-conf.ts @@ -12,7 +12,7 @@ class SystemConfig { ); private dropVersion: string; private gitRef: string; - private odicRequireHttps; + private oidcRequireHttps; private checkForUpdates = getUpdateCheckConfig(); @@ -22,14 +22,14 @@ class SystemConfig { this.dropVersion = config.dropVersion; this.gitRef = config.gitRef; - const odicRequireHttps = process.env.OIDC_REQUIRE_HTTPS as + const oidcRequireHttps = process.env.OIDC_REQUIRE_HTTPS as | string | undefined; // default to true if not set - this.odicRequireHttps = - odicRequireHttps !== undefined && - odicRequireHttps.toLocaleLowerCase() === "false" + this.oidcRequireHttps = + oidcRequireHttps !== undefined && + oidcRequireHttps.toLocaleLowerCase() === "false" ? false : true; } @@ -64,7 +64,7 @@ class SystemConfig { // if oidc should require https for endpoints shouldOidcRequireHttps() { - return this.odicRequireHttps; + return this.oidcRequireHttps; } }