From 64e94a280df7f4df29c7299b4657d329d8a0a484 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Wed, 3 Dec 2025 16:56:40 -0600 Subject: [PATCH] instance info --- src/webpage/localuser.ts | 40 +++++++++++++++++++++++++++++++++++++--- translations/en.json | 7 +++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index 90a414e..d58ff4c 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -3004,9 +3004,6 @@ class Localuser { undefined, ), ); - jankInfo.addButtonInput("", I18n.instInfo(), () => { - this.instanceStats(); - }); })(); const installP = installPGet(); if (installP) { @@ -3204,6 +3201,43 @@ class Localuser { }; updateInfo(); } + { + const instanceInfo = settings.addButton(I18n.instanceInfo.name()); + fetch(this.info.api + "/policies/instance/") + .then((_) => _.json()) + .then((body) => { + const json = body as { + instanceName: string; + instanceDescription: string | null; + frontPage: string | null; + tosPage: string | null; + correspondenceEmail: string | null; + correspondenceUserID: string | null; + image: string | null; + instanceId: string; + autoCreateBotUsers: false; + publicUrl: string | null; + }; + instanceInfo.addTitle(json.instanceName); + if (json.correspondenceEmail) { + const a = document.createElement("a"); + a.target = "_blank"; + a.rel = "noreferrer"; + a.href = "mailto:" + json.correspondenceEmail; + a.textContent = I18n.instanceInfo.contact(); + instanceInfo.addHTMLArea(a); + } + if (json.tosPage) + instanceInfo.addMDText(new MarkDown(I18n.instanceInfo.tosPage(json.tosPage))); + if (json.publicUrl) + instanceInfo.addMDText(new MarkDown(I18n.instanceInfo.publicUrl(json.publicUrl))); + if (json.frontPage) + instanceInfo.addMDText(new MarkDown(I18n.instanceInfo.frontPage(json.frontPage))); + instanceInfo.addButtonInput("", I18n.instInfo(), () => { + this.instanceStats(); + }); + }); + } settings.show(); } readonly botTokens: Map = new Map(); diff --git a/translations/en.json b/translations/en.json index dee8ef2..defdcb8 100644 --- a/translations/en.json +++ b/translations/en.json @@ -618,6 +618,13 @@ "messages": "Messages: $1", "members": "Members: $1" }, + "instanceInfo":{ + "name":"Instance Info", + "contact":"Email Instance Admins", + "tosPage":"[TOS Page]($1)", + "frontPage":"[Front Page]($1)", + "publicUrl":"[Public Url]($1)" + }, "inviteOptions": { "title": "Invite People", "30m": "30 Minutes",