feat(webui): mark inbox as read (#2449)

Closes #1117

Reviewed-on: OpenWF/SpaceNinjaServer#2449
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-07-08 20:52:01 -07:00 committed by Sainan
parent 07e7c9e897
commit 65be1083ce
8 changed files with 32 additions and 0 deletions

View File

@ -831,6 +831,7 @@
<div class="card-body">
<div class="mb-2 d-flex flex-wrap gap-2">
<button class="btn btn-primary" onclick="debounce(doUnlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
<button class="btn btn-primary" onclick="debounce(markAllAsRead);" data-loc="cheats_markAllAsRead"></button>
<button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button>
<button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
<button class="btn btn-primary" onclick="debounce(addMissingHelminthRecipes);" data-loc="cheats_addMissingSubsumedAbilities"></button>

View File

@ -2780,3 +2780,16 @@ document.querySelectorAll("#sidebar .nav-link").forEach(function (elm) {
window.scrollTo(0, 0);
});
});
async function markAllAsRead() {
await revalidateAuthz();
const { Inbox } = await fetch("/api/inbox.php?" + window.authz).then(x => x.json());
let any = false;
for (const msg of Inbox) {
if (!msg.r) {
await fetch("/api/inbox.php?" + window.authz + "&messageId=" + msg.messageId.$oid);
any = true;
}
}
toast(loc(any ? "code_succRelog" : "code_nothingToDo"));
}

View File

@ -45,6 +45,8 @@ dict = {
code_focusUnlocked: `|COUNT| neue Fokus-Schulen freigeschaltet! Ein Inventar-Update wird benötigt, damit die Änderungen im Spiel sichtbar werden. Die Sternenkarte zu besuchen, sollte der einfachste Weg sein, dies auszulösen.`,
code_addModsConfirm: `Bist du sicher, dass du |COUNT| Mods zu deinem Account hinzufügen möchtest?`,
code_succImport: `Erfolgreich importiert.`,
code_succRelog: `[UNTRANSLATED] Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `[UNTRANSLATED] Done. There was nothing to do.`,
code_gild: `Veredeln`,
code_moa: `Moa`,
code_zanuka: `Jagdhund`,
@ -200,6 +202,7 @@ dict = {
cheats_changeSupportedSyndicate: `Unterstütztes Syndikat`,
cheats_changeButton: `Ändern`,
cheats_none: `Keines`,
cheats_markAllAsRead: `[UNTRANSLATED] Mark Inbox As Read`,
worldState: `[UNTRANSLATED] World State`,
worldState_creditBoost: `[UNTRANSLATED] Credit Boost`,

View File

@ -44,6 +44,8 @@ dict = {
code_focusUnlocked: `Unlocked |COUNT| new focus schools! An inventory update will be needed for the changes to be reflected in-game. Visiting the navigation should be the easiest way to trigger that.`,
code_addModsConfirm: `Are you sure you want to add |COUNT| mods to your account?`,
code_succImport: `Successfully imported.`,
code_succRelog: `Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `Done. There was nothing to do.`,
code_gild: `Gild`,
code_moa: `Moa`,
code_zanuka: `Hound`,
@ -199,6 +201,7 @@ dict = {
cheats_changeSupportedSyndicate: `Supported syndicate`,
cheats_changeButton: `Change`,
cheats_none: `None`,
cheats_markAllAsRead: `Mark Inbox As Read`,
worldState: `World State`,
worldState_creditBoost: `Credit Boost`,

View File

@ -45,6 +45,8 @@ dict = {
code_focusUnlocked: `¡Desbloqueadas |COUNT| nuevas escuelas de enfoque! Se necesita una actualización del inventario para reflejar los cambios en el juego. Visitar la navegación debería ser la forma más sencilla de activarlo.`,
code_addModsConfirm: `¿Estás seguro de que deseas agregar |COUNT| modificadores a tu cuenta?`,
code_succImport: `Importación exitosa.`,
code_succRelog: `[UNTRANSLATED] Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `[UNTRANSLATED] Done. There was nothing to do.`,
code_gild: `Refinar`,
code_moa: `Moa`,
code_zanuka: `Sabueso`,
@ -200,6 +202,7 @@ dict = {
cheats_changeSupportedSyndicate: `Sindicatos disponibles`,
cheats_changeButton: `Cambiar`,
cheats_none: `Ninguno`,
cheats_markAllAsRead: `[UNTRANSLATED] Mark Inbox As Read`,
worldState: `Estado del mundo`,
worldState_creditBoost: `Potenciador de Créditos`,

View File

@ -45,6 +45,8 @@ dict = {
code_focusUnlocked: `|COUNT| écoles de Focus déverrouillées ! Synchronisation de l'inventaire nécessaire.`,
code_addModsConfirm: `Ajouter |COUNT| mods à l'inventaire ?`,
code_succImport: `Importé.`,
code_succRelog: `[UNTRANSLATED] Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `[UNTRANSLATED] Done. There was nothing to do.`,
code_gild: `Polir`,
code_moa: `Moa`,
code_zanuka: `Molosse`,
@ -200,6 +202,7 @@ dict = {
cheats_changeSupportedSyndicate: `Allégeance`,
cheats_changeButton: `Changer`,
cheats_none: `Aucun`,
cheats_markAllAsRead: `[UNTRANSLATED] Mark Inbox As Read`,
worldState: `[UNTRANSLATED] World State`,
worldState_creditBoost: `[UNTRANSLATED] Credit Boost`,

View File

@ -45,6 +45,8 @@ dict = {
code_focusUnlocked: `Разблокировано |COUNT| новых школ фокуса! Для отображения изменений в игре потребуется обновление инвентаря. Посещение навигации — самый простой способ этого добиться.`,
code_addModsConfirm: `Вы уверены, что хотите добавить |COUNT| модов на ваш аккаунт?`,
code_succImport: `Успешно импортировано.`,
code_succRelog: `[UNTRANSLATED] Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `[UNTRANSLATED] Done. There was nothing to do.`,
code_gild: `Улучшить`,
code_moa: `МОА`,
code_zanuka: `Гончая`,
@ -200,6 +202,7 @@ dict = {
cheats_changeSupportedSyndicate: `Поддерживаемый синдикат`,
cheats_changeButton: `Изменить`,
cheats_none: `Отсутствует`,
cheats_markAllAsRead: `[UNTRANSLATED] Mark Inbox As Read`,
worldState: `[UNTRANSLATED] World State`,
worldState_creditBoost: `[UNTRANSLATED] Credit Boost`,

View File

@ -45,6 +45,8 @@ dict = {
code_focusUnlocked: `已解锁|COUNT|个新专精学派!需要游戏内仓库更新才能生效,您可以通过访问星图来触发仓库更新.`,
code_addModsConfirm: `确定要向账户添加|COUNT|张MOD吗?`,
code_succImport: `导入成功。`,
code_succRelog: `[UNTRANSLATED] Done. Please note that you'll need to relog to see a difference in-game.`,
code_nothingToDo: `[UNTRANSLATED] Done. There was nothing to do.`,
code_gild: `镀金`,
code_moa: `恐鸟`,
code_zanuka: `猎犬`,
@ -200,6 +202,7 @@ dict = {
cheats_changeSupportedSyndicate: `支持的集团`,
cheats_changeButton: `更改`,
cheats_none: ``,
cheats_markAllAsRead: `[UNTRANSLATED] Mark Inbox As Read`,
worldState: `世界状态配置`,
worldState_creditBoost: `现金加成`,