add some initial support

This commit is contained in:
Mathium05 committed 2026-10-01 14:12:04 -05:00
1 parent 1d3523b603
commit 838d0dc1f8
3 files changed
+13 -2

No files matched your search

+11 -1
View File
@@ -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())) {
+1 -1
View File
@@ -2353,7 +2353,7 @@ class Form implements OptionsElement<object> {
}
}
preprocessor: (obj: Object) => void = () => {};
addPreprocessor(func: (obj: Object) => void) {
addPreprocessor(func: (obj: object) => void) {
this.preprocessor = func;
}
onFormError = (_: FormError) => {};
+1
View File
@@ -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",