From 838d0dc1f8cf8c11862582f2df5f1c8b96e7b3ed Mon Sep 17 00:00:00 2001 From: Mathium05 Date: Thu, 1 Oct 2026 14:12:04 -0500 Subject: [PATCH] add some initial support --- src/webpage/localuser.ts | 12 +++++++++++- src/webpage/settings.ts | 2 +- translations/en.json | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index f89be01..7221ff0 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -18,6 +18,7 @@ import { startTypingjson, wsjson, pollUpdateJson, + applicationJson, } from "./jsontypes.js"; import {Member} from "./member.js"; import {Dialog, Form, FormError, Options} from "./settings.js"; @@ -2626,7 +2627,6 @@ class Localuser { headers: this.headers, }); const json = await res.json(); - console.error(json); const form = container.addSubForm(json.name, () => {}, { fetchURL: this.info.api + "/applications/" + appId, method: "PATCH", @@ -2670,6 +2670,16 @@ class Localuser { form.addCheckboxInput(I18n.localuser.requireCode(), "bot_require_code_grant", { initState: json.bot_require_code_grant, }); + //TODO remove this conditional once https://codeberg.org/MelodyChat/Harmony/pulls/278 is merged + if (false as boolean) + form.addMDInput(I18n.localuser.redirURIs(), "redirect_uris", { + initText: json.redirect_uris.join("\n"), + }); + form.addPreprocessor((_) => { + if ("redirect_uris" in _ && typeof _.redirect_uris === "string") { + _.redirect_uris = _.redirect_uris.split("\n"); + } + }); form.addButtonInput("", I18n.localuser[json.bot ? "manageBot" : "addBot"](), async () => { if (!json.bot) { if (!confirm(I18n.localuser.confirmAddBot())) { diff --git a/src/webpage/settings.ts b/src/webpage/settings.ts index 5ac6edf..7433894 100644 --- a/src/webpage/settings.ts +++ b/src/webpage/settings.ts @@ -2353,7 +2353,7 @@ class Form implements OptionsElement { } } preprocessor: (obj: Object) => void = () => {}; - addPreprocessor(func: (obj: Object) => void) { + addPreprocessor(func: (obj: object) => void) { this.preprocessor = func; } onFormError = (_: FormError) => {}; diff --git a/translations/en.json b/translations/en.json index 7f7d5e0..e7f125a 100644 --- a/translations/en.json +++ b/translations/en.json @@ -593,6 +593,7 @@ "publicAvaliable": "Make bot publicly inviteable?", "refreshPage": "Refresh to apply", "requireCode": "Require code grant to invite the bot?", + "redirURIs": "Redirect URIs:", "resetToken": "Reset token", "saveToken": "Save token to local storage", "setUp2fa": "2FA Setup",