From 5798e83fb02f909e09a43466d06bc9d5fc4987dc Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Sun, 13 Apr 2025 14:44:17 -0500 Subject: [PATCH] add instance info button --- src/webpage/localuser.ts | 9 ++++++--- translations/en.json | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index 5587007..0bad77e 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -2134,6 +2134,9 @@ class Localuser { img.height = 128; const ver = await (await fetch("/getupdates")).text(); jankInfo.addMDText(I18n.clientDesc(ver, window.location.origin, this.rights.allow + "")); + jankInfo.addButtonInput("", I18n.instInfo(), () => { + this.instanceStats(); + }); })(); settings.show(); } @@ -3023,17 +3026,17 @@ class Localuser { " | Jank Client"; } async instanceStats() { + const dialog = new Dialog(""); + dialog.show(); + dialog.options.addTitle(I18n.getTranslation("instanceStats.name", this.instancePing.name)); const res = await fetch(this.info.api + "/policies/stats", { headers: this.headers, }); const json = await res.json(); - const dialog = new Dialog(""); - dialog.options.addTitle(I18n.getTranslation("instanceStats.name", this.instancePing.name)); dialog.options.addText(I18n.getTranslation("instanceStats.users", json.counts.user)); dialog.options.addText(I18n.getTranslation("instanceStats.servers", json.counts.guild)); dialog.options.addText(I18n.getTranslation("instanceStats.messages", json.counts.message)); dialog.options.addText(I18n.getTranslation("instanceStats.members", json.counts.members)); - dialog.show(); } setNotificationSound(sound: string) { const userinfos = getBulkInfo(); diff --git a/translations/en.json b/translations/en.json index 4033bf1..26f6df3 100644 --- a/translations/en.json +++ b/translations/en.json @@ -569,6 +569,7 @@ "widgetEnabled": "Widget enabled", "incorrectURLS": "## This instance has likely sent the incorrect URLs.\n### If you're the instance owner please see [here](https://docs.spacebar.chat/setup/server/) under *Connecting from remote machines* to correct the issue.\n Would you like Jank Client to automatically try to fix this error to let you connect to the instance?", "jankInfo": "Client Information", + "instInfo": "Instance Information", "clientDesc": "Client version: $1\n\n[Join the official Jank Client guild]($2/invite/USgYJo?instance=https%3A%2F%2Fspacebar.chat)\n\n[Help translate Jank Client](https://translatewiki.net/wiki/Translating:JankClient#sortable:3=desc) \n\n[Help create Jank client](https://github.com/MathMan05/JankClient)\n\n[Help maintain the server jank client relies on](https://github.com/spacebarchat/server)\n\nCalculated rights: $3", "uploadFilesText": "Upload your files here!", "errorReconnect": "Unable to connect to the server, retrying in **$1** seconds...",