add instance info button

This commit is contained in:
MathMan05 2025-04-13 14:44:17 -05:00
parent 7bc34ae038
commit 5798e83fb0
2 changed files with 7 additions and 3 deletions

View file

@ -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();

View file

@ -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...",