diff --git a/frontend/src/locales/bg_BG/common.json b/frontend/src/locales/bg_BG/common.json index 3d99bdeb5..fef245451 100644 --- a/frontend/src/locales/bg_BG/common.json +++ b/frontend/src/locales/bg_BG/common.json @@ -129,7 +129,7 @@ "search": "Търси", "select": "Избери", "select-platform": "Избери платформа", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Връзката със сървъра е прекъсната, повторен опит…", "server-reconnected": "Reconnected to the server", "server-stats": "Статистики на сървъра", "settings": "Настройки", diff --git a/frontend/src/locales/bg_BG/play.json b/frontend/src/locales/bg_BG/play.json index 4c39d66ea..b8b6b65f5 100644 --- a/frontend/src/locales/bg_BG/play.json +++ b/frontend/src/locales/bg_BG/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Изход без запазване на скорошния напредък?", "keep-playing": "Продължи играта", "last-save-synced": "Последният запис за {game} е синхронизиран.", + "last-state-synced": "Последният бърз запис за {game} е синхронизиран.", "latest-version": "Най-нова", "launch-extracting-archive": "Разопакуване на архива", "launch-extracting-pkg": "Инсталиране на файловете на играта", @@ -140,10 +141,11 @@ "save-data-none-note": "Играйте и запишете в играта. Ще се синхронизира при края на сесията.", "save-data-note": "Възстановено на конзолата преди стартиране. Заредете го от менюто на самата игра.", "save-data-synced": "Синхронизирано", - "save-not-synced": "Последният ви запис не достигна до сървъра. Той се съхранява в този браузър и ще се синхронизира следващия път, когато играете тази игра.", + "save-not-synced": "Последният ви запис още не е достигнал до сървъра. Той се съхранява в този браузър и RomM продължава да опитва във фонов режим.", "save-progress-to": "Записвай напредъка в", "save-slot": "Слот за запазване", "save-state": "Запазване на състояние", + "save-sync-refused": "Сървърът отхвърли съхранения запис за {game}: {reason}. Той вече не се съхранява в този браузър.", "select-background-color": "Избери цвят на фона", "select-save": "Избери запис", "select-state": "Избери бърз запис", @@ -160,6 +162,8 @@ "slot-versions": "{count} версия | {count} версии", "start-fresh-hint": "Избери един по-долу, за да продължиш, или натисни Играй, за да започнеш отначало.", "state-incompatible-core": "Записан с {emulator}, което избраното ядро не може да зареди.", + "state-not-synced": "Последният ви бърз запис още не е достигнал до сървъра. Той се съхранява в този браузър и RomM продължава да опитва във фонов режим.", + "state-sync-refused": "Сървърът отхвърли съхранения бърз запис за {game}: {reason}. Той вече не се съхранява в този браузър.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/cs_CZ/common.json b/frontend/src/locales/cs_CZ/common.json index 785881474..73d977ffe 100644 --- a/frontend/src/locales/cs_CZ/common.json +++ b/frontend/src/locales/cs_CZ/common.json @@ -129,7 +129,7 @@ "search": "Hledat", "select": "Vybrat", "select-platform": "Vyberte platformu", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Spojení se serverem bylo ztraceno, zkoušíme znovu…", "server-reconnected": "Reconnected to the server", "server-stats": "Statistiky serveru", "settings": "Nastavení", diff --git a/frontend/src/locales/cs_CZ/play.json b/frontend/src/locales/cs_CZ/play.json index 664c1f7d9..349bf0cf5 100644 --- a/frontend/src/locales/cs_CZ/play.json +++ b/frontend/src/locales/cs_CZ/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Ukončit bez uložení posledního postupu?", "keep-playing": "Pokračovat ve hře", "last-save-synced": "Poslední uložená pozice pro {game} byla synchronizována.", + "last-state-synced": "Poslední stav pro {game} byl synchronizován.", "latest-version": "Nejnovější", "launch-extracting-archive": "Rozbalování archivu", "launch-extracting-pkg": "Instalace herních souborů", @@ -140,10 +141,11 @@ "save-data-none-note": "Hrajte a uložte ve hře. Po skončení relace se data synchronizují.", "save-data-note": "Obnoveno do konzole před spuštěním. Načtěte je z nabídky samotné hry.", "save-data-synced": "Synchronizováno", - "save-not-synced": "Vaše poslední uložená pozice se nedostala na server. Je uložena v tomto prohlížeči a synchronizuje se, až si tuto hru zahrajete příště.", + "save-not-synced": "Vaše poslední uložená pozice se zatím nedostala na server. Je uložena v tomto prohlížeči a RomM to na pozadí zkouší dál.", "save-progress-to": "Ukládat postup do", "save-slot": "Pozice uložení", "save-state": "Uložit stav", + "save-sync-refused": "Server odmítl uloženou pozici, kterou jsme měli pro {game}: {reason}. Už není uložena v tomto prohlížeči.", "select-background-color": "Vybrat barvu pozadí", "select-save": "Vybrat uloženou pozici", "select-state": "Vybrat stav", @@ -160,6 +162,8 @@ "slot-versions": "{count} verzí | {count} verze | {count} verze | {count} verzí", "start-fresh-hint": "Vyberte níže pro pokračování, nebo stiskněte Hrát pro nový začátek.", "state-incompatible-core": "Uloženo pomocí {emulator}, což vybrané jádro nedokáže načíst.", + "state-not-synced": "Váš poslední stav se zatím nedostal na server. Je uložen v tomto prohlížeči a RomM to na pozadí zkouší dál.", + "state-sync-refused": "Server odmítl stav, který jsme měli pro {game}: {reason}. Už není uložen v tomto prohlížeči.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/de_DE/common.json b/frontend/src/locales/de_DE/common.json index de5c569bb..7fd1c8e4b 100644 --- a/frontend/src/locales/de_DE/common.json +++ b/frontend/src/locales/de_DE/common.json @@ -129,7 +129,7 @@ "search": "Suche", "select": "Auswählen", "select-platform": "Plattform auswählen", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Serververbindung verloren, neuer Versuch…", "server-reconnected": "Reconnected to the server", "server-stats": "Serverstatistiken", "settings": "Einstellungen", diff --git a/frontend/src/locales/de_DE/play.json b/frontend/src/locales/de_DE/play.json index fddd835db..403498607 100644 --- a/frontend/src/locales/de_DE/play.json +++ b/frontend/src/locales/de_DE/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Beenden, ohne den letzten Fortschritt zu speichern?", "keep-playing": "Weiterspielen", "last-save-synced": "Letzter Spielstand für {game} synchronisiert.", + "last-state-synced": "Letzter Zustand für {game} synchronisiert.", "latest-version": "Neueste", "launch-extracting-archive": "Archiv wird entpackt", "launch-extracting-pkg": "Spieldateien werden installiert", @@ -140,10 +141,11 @@ "save-data-none-note": "Spiele und speichere im Spiel. Der Stand wird am Ende der Sitzung synchronisiert.", "save-data-note": "Vor dem Start auf die Konsole übertragen. Lade ihn im Menü des Spiels.", "save-data-synced": "Synchronisiert", - "save-not-synced": "Dein letzter Spielstand hat den Server nicht erreicht. Er wird in diesem Browser aufbewahrt und beim nächsten Spielen dieses Spiels synchronisiert.", + "save-not-synced": "Dein letzter Spielstand hat den Server noch nicht erreicht. Er wird in diesem Browser aufbewahrt und RomM versucht es im Hintergrund weiter.", "save-progress-to": "Fortschritt speichern in", "save-slot": "Speicherplatz", "save-state": "Spielstand speichern", + "save-sync-refused": "Der Server hat den aufbewahrten Spielstand für {game} abgelehnt: {reason}. Er wird in diesem Browser nicht mehr aufbewahrt.", "select-background-color": "Hintergrundfarbe auswählen", "select-save": "Speicherstand auswählen", "select-state": "Speicherstand auswählen", @@ -160,6 +162,8 @@ "slot-versions": "{count} Version | {count} Versionen", "start-fresh-hint": "Wähle unten einen, um fortzufahren, oder klicke auf Play, um neu zu starten.", "state-incompatible-core": "Mit {emulator} gespeichert, was der gewählte Core nicht laden kann.", + "state-not-synced": "Dein letzter Zustand hat den Server noch nicht erreicht. Er wird in diesem Browser aufbewahrt und RomM versucht es im Hintergrund weiter.", + "state-sync-refused": "Der Server hat den aufbewahrten Zustand für {game} abgelehnt: {reason}. Er wird in diesem Browser nicht mehr aufbewahrt.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/en_GB/common.json b/frontend/src/locales/en_GB/common.json index 0bdfda736..6bc378df8 100644 --- a/frontend/src/locales/en_GB/common.json +++ b/frontend/src/locales/en_GB/common.json @@ -129,7 +129,7 @@ "search": "Search", "select": "Select", "select-platform": "Select a platform", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Server connection lost, retrying…", "server-reconnected": "Reconnected to the server", "server-stats": "Server stats", "settings": "Settings", diff --git a/frontend/src/locales/en_GB/play.json b/frontend/src/locales/en_GB/play.json index 8259e3338..9e6b7ed67 100644 --- a/frontend/src/locales/en_GB/play.json +++ b/frontend/src/locales/en_GB/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Quit without saving recent progress?", "keep-playing": "Keep playing", "last-save-synced": "Last save synced for {game}.", + "last-state-synced": "Last state synced for {game}.", "latest-version": "Latest", "launch-extracting-archive": "Unpacking the archive", "launch-extracting-pkg": "Installing the game files", @@ -140,10 +141,11 @@ "save-data-none-note": "Play, then save in-game. It syncs back when the session ends.", "save-data-note": "Restored to the console before launch. Load it from the game's own menu.", "save-data-synced": "Synced", - "save-not-synced": "Your last save has not reached the server. It is kept in this browser and will sync the next time you play this game.", + "save-not-synced": "Your last save has not reached the server yet. It is kept in this browser and RomM keeps retrying in the background.", "save-progress-to": "Save progress to", "save-slot": "Save slot", "save-state": "Save state", + "save-sync-refused": "The server refused the save held for {game}: {reason}. It is no longer kept in this browser.", "select-background-color": "Select background colour", "select-save": "Select save", "select-state": "Select state", @@ -160,6 +162,8 @@ "slot-versions": "{count} version | {count} versions", "start-fresh-hint": "Pick one below to resume, or hit Play to start fresh.", "state-incompatible-core": "Saved with {emulator}, which the selected core cannot load.", + "state-not-synced": "Your last state has not reached the server yet. It is kept in this browser and RomM keeps retrying in the background.", + "state-sync-refused": "The server refused the state held for {game}: {reason}. It is no longer kept in this browser.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/en_US/common.json b/frontend/src/locales/en_US/common.json index 0bdfda736..6bc378df8 100644 --- a/frontend/src/locales/en_US/common.json +++ b/frontend/src/locales/en_US/common.json @@ -129,7 +129,7 @@ "search": "Search", "select": "Select", "select-platform": "Select a platform", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Server connection lost, retrying…", "server-reconnected": "Reconnected to the server", "server-stats": "Server stats", "settings": "Settings", diff --git a/frontend/src/locales/en_US/play.json b/frontend/src/locales/en_US/play.json index d3d0502e1..7aa91b7ac 100644 --- a/frontend/src/locales/en_US/play.json +++ b/frontend/src/locales/en_US/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Quit without saving recent progress?", "keep-playing": "Keep playing", "last-save-synced": "Last save synced for {game}.", + "last-state-synced": "Last state synced for {game}.", "latest-version": "Latest", "launch-extracting-archive": "Unpacking the archive", "launch-extracting-pkg": "Installing the game files", @@ -140,10 +141,11 @@ "save-data-none-note": "Play, then save in-game. It syncs back when the session ends.", "save-data-note": "Restored to the console before launch. Load it from the game's own menu.", "save-data-synced": "Synced", - "save-not-synced": "Your last save has not reached the server. It is kept in this browser and will sync the next time you play this game.", + "save-not-synced": "Your last save has not reached the server yet. It is kept in this browser and RomM keeps retrying in the background.", "save-progress-to": "Save progress to", "save-slot": "Save slot", "save-state": "Save state", + "save-sync-refused": "The server refused the save held for {game}: {reason}. It is no longer kept in this browser.", "select-background-color": "Select background color", "select-save": "Select save", "select-state": "Select state", @@ -160,6 +162,8 @@ "slot-versions": "{count} version | {count} versions", "start-fresh-hint": "Pick one below to resume, or hit Play to start fresh.", "state-incompatible-core": "Saved with {emulator}, which the selected core cannot load.", + "state-not-synced": "Your last state has not reached the server yet. It is kept in this browser and RomM keeps retrying in the background.", + "state-sync-refused": "The server refused the state held for {game}: {reason}. It is no longer kept in this browser.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/es_ES/common.json b/frontend/src/locales/es_ES/common.json index c253244ae..99a4a6552 100644 --- a/frontend/src/locales/es_ES/common.json +++ b/frontend/src/locales/es_ES/common.json @@ -129,7 +129,7 @@ "search": "Buscar", "select": "Seleccionar", "select-platform": "Seleccionar plataforma", - "server-offline-retrying": "Se perdió la conexión con el servidor · reintentando…", + "server-offline-retrying": "Se perdió la conexión con el servidor, reintentando…", "server-reconnected": "Conexión con el servidor restablecida", "server-stats": "Estadísticas del servidor", "settings": "Ajustes", diff --git a/frontend/src/locales/es_ES/play.json b/frontend/src/locales/es_ES/play.json index 0da25d814..4b0b53073 100644 --- a/frontend/src/locales/es_ES/play.json +++ b/frontend/src/locales/es_ES/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "¿Salir sin guardar el progreso reciente?", "keep-playing": "Seguir jugando", "last-save-synced": "Se ha sincronizado la última partida guardada de {game}.", + "last-state-synced": "Se ha sincronizado el último estado de {game}.", "latest-version": "Más reciente", "launch-extracting-archive": "Extrayendo el archivo", "launch-extracting-pkg": "Instalando los archivos del juego", @@ -140,10 +141,11 @@ "save-data-none-note": "Juega y guarda dentro del juego. Se sincronizará al terminar la sesión.", "save-data-note": "Restaurado en la consola antes de iniciar. Cárgalo desde el menú del propio juego.", "save-data-synced": "Sincronizado", - "save-not-synced": "Tu última partida guardada no ha llegado al servidor. Se conserva en este navegador y se sincronizará la próxima vez que juegues a este juego.", + "save-not-synced": "Tu última partida guardada aún no ha llegado al servidor. Se conserva en este navegador y RomM sigue reintentándolo en segundo plano.", "save-progress-to": "Guardar progreso en", "save-slot": "Ranura de guardado", "save-state": "Guardar estado", + "save-sync-refused": "El servidor ha rechazado la partida guardada que se conservaba de {game}: {reason}. Ya no se conserva en este navegador.", "select-background-color": "Seleccionar color de fondo", "select-save": "Seleccionar guardado", "select-state": "Seleccionar estado", @@ -160,6 +162,8 @@ "slot-versions": "{count} versión | {count} versiones", "start-fresh-hint": "Empezar desde cero — sin partidas guardadas.", "state-incompatible-core": "Guardado con {emulator}, que el core seleccionado no puede cargar.", + "state-not-synced": "Tu último estado aún no ha llegado al servidor. Se conserva en este navegador y RomM sigue reintentándolo en segundo plano.", + "state-sync-refused": "El servidor ha rechazado el estado que se conservaba de {game}: {reason}. Ya no se conserva en este navegador.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/fr_FR/common.json b/frontend/src/locales/fr_FR/common.json index 479fba53e..15e031264 100644 --- a/frontend/src/locales/fr_FR/common.json +++ b/frontend/src/locales/fr_FR/common.json @@ -129,7 +129,7 @@ "search": "Rechercher", "select": "Sélectionner", "select-platform": "Sélectionner une plateforme", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Connexion au serveur perdue, nouvelle tentative…", "server-reconnected": "Reconnected to the server", "server-stats": "Statistiques du serveur", "settings": "Paramètres", diff --git a/frontend/src/locales/fr_FR/play.json b/frontend/src/locales/fr_FR/play.json index 54ca96265..21c0eb35d 100644 --- a/frontend/src/locales/fr_FR/play.json +++ b/frontend/src/locales/fr_FR/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Quitter sans enregistrer la progression récente ?", "keep-playing": "Continuer à jouer", "last-save-synced": "Dernière sauvegarde de {game} synchronisée.", + "last-state-synced": "Dernier état de {game} synchronisé.", "latest-version": "Dernière", "launch-extracting-archive": "Extraction de l'archive", "launch-extracting-pkg": "Installation des fichiers du jeu", @@ -140,10 +141,11 @@ "save-data-none-note": "Jouez, puis sauvegardez dans le jeu. La synchronisation se fait à la fin de la session.", "save-data-note": "Restauré sur la console avant le lancement. Chargez-le depuis le menu du jeu.", "save-data-synced": "Synchronisé", - "save-not-synced": "Votre dernière sauvegarde n'est pas parvenue au serveur. Elle est conservée dans ce navigateur et sera synchronisée la prochaine fois que vous jouerez à ce jeu.", + "save-not-synced": "Votre dernière sauvegarde n'est pas encore parvenue au serveur. Elle est conservée dans ce navigateur et RomM continue d'essayer en arrière-plan.", "save-progress-to": "Enregistrer la progression dans", "save-slot": "Emplacement de sauvegarde", "save-state": "Sauvegarder l'état", + "save-sync-refused": "Le serveur a refusé la sauvegarde conservée pour {game} : {reason}. Elle n'est plus conservée dans ce navigateur.", "select-background-color": "Sélectionner la couleur d'arrière-plan", "select-save": "Sélectionner la sauvegarde", "select-state": "Sélectionner l'état", @@ -160,6 +162,8 @@ "slot-versions": "{count} version | {count} versions", "start-fresh-hint": "Choisissez-en un ci-dessous pour reprendre, ou appuyez sur Jouer pour démarrer une nouvelle partie.", "state-incompatible-core": "Sauvegardé avec {emulator}, que le cœur sélectionné ne peut pas charger.", + "state-not-synced": "Votre dernier état n'est pas encore parvenu au serveur. Il est conservé dans ce navigateur et RomM continue d'essayer en arrière-plan.", + "state-sync-refused": "Le serveur a refusé l'état conservé pour {game} : {reason}. Il n'est plus conservé dans ce navigateur.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/hu_HU/common.json b/frontend/src/locales/hu_HU/common.json index 962ad88f0..43dd54fad 100644 --- a/frontend/src/locales/hu_HU/common.json +++ b/frontend/src/locales/hu_HU/common.json @@ -129,7 +129,7 @@ "search": "Keresés", "select": "Kiválasztás", "select-platform": "Válassz platformot", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "A kiszolgálókapcsolat megszakadt, újrapróbálkozás…", "server-reconnected": "Reconnected to the server", "server-stats": "Szerver statisztika", "settings": "Beállítások", diff --git a/frontend/src/locales/hu_HU/play.json b/frontend/src/locales/hu_HU/play.json index dd77ab767..85ccead05 100644 --- a/frontend/src/locales/hu_HU/play.json +++ b/frontend/src/locales/hu_HU/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Kilépés a legutóbbi előrehaladás mentése nélkül?", "keep-playing": "Játék folytatása", "last-save-synced": "A(z) {game} legutóbbi mentése szinkronizálva.", + "last-state-synced": "A(z) {game} legutóbbi állása szinkronizálva.", "latest-version": "Legújabb", "launch-extracting-archive": "Archívum kicsomagolása", "launch-extracting-pkg": "Játékfájlok telepítése", @@ -140,10 +141,11 @@ "save-data-none-note": "Játssz, majd ments a játékon belül. A munkamenet végén szinkronizálódik.", "save-data-note": "Indítás előtt visszaállítva a konzolra. Töltsd be a játék saját menüjéből.", "save-data-synced": "Szinkronizálva", - "save-not-synced": "A legutóbbi mentésed nem jutott el a kiszolgálóra. Ebben a böngészőben tárolódik, és a játék következő indításakor szinkronizálódik.", + "save-not-synced": "A legutóbbi mentésed még nem jutott el a kiszolgálóra. Ebben a böngészőben tárolódik, és a RomM a háttérben tovább próbálkozik.", "save-progress-to": "Haladás mentése ide", "save-slot": "Mentési hely", "save-state": "Állapot mentése", + "save-sync-refused": "A kiszolgáló elutasította a(z) {game} megőrzött mentését: {reason}. Már nem tárolódik ebben a böngészőben.", "select-background-color": "Háttérszín kiválasztása", "select-save": "Mentés kiválasztása", "select-state": "Állás kiválasztása", @@ -160,6 +162,8 @@ "slot-versions": "{count} verzió | {count} verzió", "start-fresh-hint": "Válassz egyet az alábbiak közül a folytatáshoz, vagy nyomd meg az Indítást egy új játékhoz.", "state-incompatible-core": "{emulator} emulátorral mentve, amit a kiválasztott mag nem tud betölteni.", + "state-not-synced": "A legutóbbi állásod még nem jutott el a kiszolgálóra. Ebben a böngészőben tárolódik, és a RomM a háttérben tovább próbálkozik.", + "state-sync-refused": "A kiszolgáló elutasította a(z) {game} megőrzött állását: {reason}. Már nem tárolódik ebben a böngészőben.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/it_IT/common.json b/frontend/src/locales/it_IT/common.json index c652b57b7..14cd143b7 100644 --- a/frontend/src/locales/it_IT/common.json +++ b/frontend/src/locales/it_IT/common.json @@ -129,7 +129,7 @@ "search": "Cerca", "select": "Seleziona", "select-platform": "Seleziona una piattaforma", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Connessione al server persa, nuovo tentativo…", "server-reconnected": "Reconnected to the server", "server-stats": "Statistiche del server", "settings": "Impostazioni", diff --git a/frontend/src/locales/it_IT/play.json b/frontend/src/locales/it_IT/play.json index cd8cb9f5b..f53ee3520 100644 --- a/frontend/src/locales/it_IT/play.json +++ b/frontend/src/locales/it_IT/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Uscire senza salvare i progressi recenti?", "keep-playing": "Continua a giocare", "last-save-synced": "Ultimo salvataggio di {game} sincronizzato.", + "last-state-synced": "Ultimo stato di {game} sincronizzato.", "latest-version": "Più recente", "launch-extracting-archive": "Estrazione dell'archivio", "launch-extracting-pkg": "Installazione dei file di gioco", @@ -140,10 +141,11 @@ "save-data-none-note": "Gioca e salva dentro il gioco. Verrà sincronizzato al termine della sessione.", "save-data-note": "Ripristinato sulla console prima dell'avvio. Caricalo dal menu del gioco.", "save-data-synced": "Sincronizzato", - "save-not-synced": "Il tuo ultimo salvataggio non è arrivato al server. Viene conservato in questo browser e verrà sincronizzato la prossima volta che giocherai a questo gioco.", + "save-not-synced": "Il tuo ultimo salvataggio non è ancora arrivato al server. Viene conservato in questo browser e RomM continua a riprovare in background.", "save-progress-to": "Salva i progressi in", "save-slot": "Slot di salvataggio", "save-state": "Salva stato", + "save-sync-refused": "Il server ha rifiutato il salvataggio conservato per {game}: {reason}. Non è più conservato in questo browser.", "select-background-color": "Seleziona colore di sfondo", "select-save": "Seleziona Salvataggio", "select-state": "Seleziona Stato", @@ -160,6 +162,8 @@ "slot-versions": "{count} versione | {count} versioni", "start-fresh-hint": "Scegline uno qui sotto per riprendere, oppure premi Gioca per iniziare da capo.", "state-incompatible-core": "Salvato con {emulator}, che il core selezionato non può caricare.", + "state-not-synced": "Il tuo ultimo stato non è ancora arrivato al server. Viene conservato in questo browser e RomM continua a riprovare in background.", + "state-sync-refused": "Il server ha rifiutato lo stato conservato per {game}: {reason}. Non è più conservato in questo browser.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/ja_JP/common.json b/frontend/src/locales/ja_JP/common.json index f713cecb8..0db247e55 100644 --- a/frontend/src/locales/ja_JP/common.json +++ b/frontend/src/locales/ja_JP/common.json @@ -129,7 +129,7 @@ "search": "検索", "select": "選択", "select-platform": "プラットフォームを選択", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "サーバーとの接続が切れました、再試行中…", "server-reconnected": "Reconnected to the server", "server-stats": "サーバーステータス", "settings": "設定", diff --git a/frontend/src/locales/ja_JP/play.json b/frontend/src/locales/ja_JP/play.json index e77ef89aa..e07181b33 100644 --- a/frontend/src/locales/ja_JP/play.json +++ b/frontend/src/locales/ja_JP/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "最近の進行状況を保存せずに終了しますか?", "keep-playing": "プレイを続ける", "last-save-synced": "{game} の最後のセーブデータを同期しました。", + "last-state-synced": "{game} の最後のステートを同期しました。", "latest-version": "最新", "launch-extracting-archive": "アーカイブを展開しています", "launch-extracting-pkg": "ゲームファイルをインストールしています", @@ -140,10 +141,11 @@ "save-data-none-note": "プレイしてゲーム内でセーブしてください。セッション終了時に同期されます。", "save-data-note": "起動前に本体へ復元されます。ゲーム内のメニューから読み込んでください。", "save-data-synced": "同期済み", - "save-not-synced": "最後のセーブデータはサーバーに届きませんでした。このブラウザーに保存されており、次にこのゲームをプレイしたときに同期されます。", + "save-not-synced": "最後のセーブデータはまだサーバーに届いていません。このブラウザーに保存されており、RomM がバックグラウンドで再試行を続けます。", "save-progress-to": "進行状況の保存先", "save-slot": "セーブスロット", "save-state": "ステートをセーブ", + "save-sync-refused": "サーバーが {game} の保存していたセーブデータを拒否しました: {reason}。このブラウザーには残りません。", "select-background-color": "背景色を選択", "select-save": "セーブデータを選択", "select-state": "ステートを選択", @@ -160,6 +162,8 @@ "slot-versions": "{count}件のバージョン | {count}件のバージョン", "start-fresh-hint": "下から選んで再開するか、Playを押して最初から始めてください。", "state-incompatible-core": "{emulator} で保存されたため、選択中のコアでは読み込めません。", + "state-not-synced": "最後のステートはまだサーバーに届いていません。このブラウザーに保存されており、RomM がバックグラウンドで再試行を続けます。", + "state-sync-refused": "サーバーが {game} の保存していたステートを拒否しました: {reason}。このブラウザーには残りません。", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/ko_KR/common.json b/frontend/src/locales/ko_KR/common.json index b67b6988c..db20af29c 100644 --- a/frontend/src/locales/ko_KR/common.json +++ b/frontend/src/locales/ko_KR/common.json @@ -129,7 +129,7 @@ "search": "검색", "select": "선택", "select-platform": "플랫폼 선택", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "서버 연결이 끊어졌습니다, 다시 시도하는 중…", "server-reconnected": "Reconnected to the server", "server-stats": "서버 통계", "settings": "설정", diff --git a/frontend/src/locales/ko_KR/play.json b/frontend/src/locales/ko_KR/play.json index 03d68ed9f..d3d1bf32c 100644 --- a/frontend/src/locales/ko_KR/play.json +++ b/frontend/src/locales/ko_KR/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "최근 진행 상황을 저장하지 않고 종료하시겠습니까?", "keep-playing": "계속 플레이", "last-save-synced": "{game}의 마지막 저장 데이터를 동기화했습니다.", + "last-state-synced": "{game}의 마지막 상태를 동기화했습니다.", "latest-version": "최신", "launch-extracting-archive": "아카이브 압축을 푸는 중", "launch-extracting-pkg": "게임 파일을 설치하는 중", @@ -140,10 +141,11 @@ "save-data-none-note": "플레이한 뒤 게임에서 저장하세요. 세션이 끝나면 동기화됩니다.", "save-data-note": "실행 전에 콘솔로 복원됩니다. 게임 자체 메뉴에서 불러오세요.", "save-data-synced": "동기화됨", - "save-not-synced": "마지막 저장 데이터가 서버에 전달되지 않았습니다. 이 브라우저에 보관되며 다음에 이 게임을 플레이할 때 동기화됩니다.", + "save-not-synced": "마지막 저장 데이터가 아직 서버에 전달되지 않았습니다. 이 브라우저에 보관되며 RomM이 백그라운드에서 계속 재시도합니다.", "save-progress-to": "진행 상황 저장 위치", "save-slot": "저장 슬롯", "save-state": "상태 저장", + "save-sync-refused": "서버가 {game}의 보관 중이던 저장 데이터를 거부했습니다: {reason}. 이제 이 브라우저에 보관되지 않습니다.", "select-background-color": "배경색 선택", "select-save": "세이브 선택", "select-state": "상태 선택", @@ -160,6 +162,8 @@ "slot-versions": "버전 {count}개 | 버전 {count}개", "start-fresh-hint": "아래에서 하나를 선택하여 이어 하거나, 실행을 눌러 새로 시작하세요.", "state-incompatible-core": "{emulator}(으)로 저장되어 선택한 코어에서 불러올 수 없습니다.", + "state-not-synced": "마지막 상태가 아직 서버에 전달되지 않았습니다. 이 브라우저에 보관되며 RomM이 백그라운드에서 계속 재시도합니다.", + "state-sync-refused": "서버가 {game}의 보관 중이던 상태를 거부했습니다: {reason}. 이제 이 브라우저에 보관되지 않습니다.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/pl_PL/common.json b/frontend/src/locales/pl_PL/common.json index d4b3e2024..d2472334d 100644 --- a/frontend/src/locales/pl_PL/common.json +++ b/frontend/src/locales/pl_PL/common.json @@ -129,7 +129,7 @@ "search": "Szukaj", "select": "Wybierz", "select-platform": "Wybierz platformę", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Utracono połączenie z serwerem, ponawianie…", "server-reconnected": "Reconnected to the server", "server-stats": "Statystyki serwera", "settings": "Ustawienia", diff --git a/frontend/src/locales/pl_PL/play.json b/frontend/src/locales/pl_PL/play.json index 43bf8e80c..596975c25 100644 --- a/frontend/src/locales/pl_PL/play.json +++ b/frontend/src/locales/pl_PL/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Wyjść bez zapisywania ostatnich postępów?", "keep-playing": "Graj dalej", "last-save-synced": "Zsynchronizowano ostatni zapis gry {game}.", + "last-state-synced": "Zsynchronizowano ostatni stan gry {game}.", "latest-version": "Najnowsza", "launch-extracting-archive": "Rozpakowywanie archiwum", "launch-extracting-pkg": "Instalowanie plików gry", @@ -140,10 +141,11 @@ "save-data-none-note": "Zagraj i zapisz w grze. Synchronizacja nastąpi po zakończeniu sesji.", "save-data-note": "Przywrócone na konsolę przed uruchomieniem. Wczytaj je z menu samej gry.", "save-data-synced": "Zsynchronizowano", - "save-not-synced": "Twój ostatni zapis nie dotarł na serwer. Jest przechowywany w tej przeglądarce i zostanie zsynchronizowany przy następnym uruchomieniu tej gry.", + "save-not-synced": "Twój ostatni zapis jeszcze nie dotarł na serwer. Jest przechowywany w tej przeglądarce, a RomM ponawia próby w tle.", "save-progress-to": "Zapisuj postęp do", "save-slot": "Miejsce zapisu", "save-state": "Zapisz stan", + "save-sync-refused": "Serwer odrzucił przechowywany zapis gry {game}: {reason}. Nie jest już przechowywany w tej przeglądarce.", "select-background-color": "Wybierz kolor tła", "select-save": "Wybierz zapis", "select-state": "Wybierz stan", @@ -160,6 +162,8 @@ "slot-versions": "{count} wersja | {count} wersje | {count} wersji", "start-fresh-hint": "Wybierz jeden poniżej, aby wznowić, lub naciśnij Graj, aby zacząć od nowa.", "state-incompatible-core": "Zapisano w {emulator}, czego wybrany rdzeń nie może wczytać.", + "state-not-synced": "Twój ostatni stan jeszcze nie dotarł na serwer. Jest przechowywany w tej przeglądarce, a RomM ponawia próby w tle.", + "state-sync-refused": "Serwer odrzucił przechowywany stan gry {game}: {reason}. Nie jest już przechowywany w tej przeglądarce.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/pt_BR/common.json b/frontend/src/locales/pt_BR/common.json index 08dfb820e..0749ad3c5 100644 --- a/frontend/src/locales/pt_BR/common.json +++ b/frontend/src/locales/pt_BR/common.json @@ -129,7 +129,7 @@ "search": "Buscar", "select": "Selecionar", "select-platform": "Selecione uma plataforma", - "server-offline-retrying": "Conexão com o servidor perdida · tentando novamente…", + "server-offline-retrying": "Conexão com o servidor perdida, tentando novamente…", "server-reconnected": "Reconnected to the server", "server-stats": "Estatísticas do servidor", "settings": "Configurações", diff --git a/frontend/src/locales/pt_BR/play.json b/frontend/src/locales/pt_BR/play.json index d207866c9..ec482336b 100644 --- a/frontend/src/locales/pt_BR/play.json +++ b/frontend/src/locales/pt_BR/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Sair sem salvar o progresso recente?", "keep-playing": "Continuar jogando", "last-save-synced": "Último save de {game} sincronizado.", + "last-state-synced": "Último state de {game} sincronizado.", "latest-version": "Mais recente", "launch-extracting-archive": "Extraindo o arquivo", "launch-extracting-pkg": "Instalando os arquivos do jogo", @@ -140,10 +141,11 @@ "save-data-none-note": "Jogue e salve dentro do jogo. A sincronização acontece ao encerrar a sessão.", "save-data-note": "Restaurado no console antes de iniciar. Carregue pelo menu do próprio jogo.", "save-data-synced": "Sincronizado", - "save-not-synced": "Seu último save não chegou ao servidor. Ele fica armazenado neste navegador e será sincronizado na próxima vez que você jogar este jogo.", + "save-not-synced": "Seu último save ainda não chegou ao servidor. Ele fica guardado neste navegador e o RomM continua tentando em segundo plano.", "save-progress-to": "Salvar progresso em", "save-slot": "Slot de salvamento", "save-state": "Salvar estado", + "save-sync-refused": "O servidor recusou o save que estava guardado de {game}: {reason}. Ele não fica mais neste navegador.", "select-background-color": "Selecionar cor de fundo", "select-save": "Selecionar save", "select-state": "Selecionar estado", @@ -160,6 +162,8 @@ "slot-versions": "{count} versão | {count} versões", "start-fresh-hint": "Escolha um abaixo para retomar, ou clique em Jogar para começar do zero.", "state-incompatible-core": "Salvo com {emulator}, que o core selecionado não consegue carregar.", + "state-not-synced": "Seu último state ainda não chegou ao servidor. Ele fica guardado neste navegador e o RomM continua tentando em segundo plano.", + "state-sync-refused": "O servidor recusou o state que estava guardado de {game}: {reason}. Ele não fica mais neste navegador.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/ro_RO/common.json b/frontend/src/locales/ro_RO/common.json index d922e7c34..ae51ed829 100644 --- a/frontend/src/locales/ro_RO/common.json +++ b/frontend/src/locales/ro_RO/common.json @@ -129,7 +129,7 @@ "search": "Căutare", "select": "Selectează", "select-platform": "Selectează o platformă", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Conexiunea la server s-a pierdut, se reîncearcă…", "server-reconnected": "Reconnected to the server", "server-stats": "Statistici server", "settings": "Setări", diff --git a/frontend/src/locales/ro_RO/play.json b/frontend/src/locales/ro_RO/play.json index 32bd3d3ed..e43cb8819 100644 --- a/frontend/src/locales/ro_RO/play.json +++ b/frontend/src/locales/ro_RO/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Ieși fără a salva progresul recent?", "keep-playing": "Continuă să joci", "last-save-synced": "Ultima salvare pentru {game} a fost sincronizată.", + "last-state-synced": "Ultima stare pentru {game} a fost sincronizată.", "latest-version": "Cea mai recentă", "launch-extracting-archive": "Se dezarhivează arhiva", "launch-extracting-pkg": "Se instalează fișierele jocului", @@ -140,10 +141,11 @@ "save-data-none-note": "Joacă, apoi salvează în joc. Se sincronizează la încheierea sesiunii.", "save-data-note": "Restaurat pe consolă înainte de lansare. Încarcă-l din meniul jocului.", "save-data-synced": "Sincronizat", - "save-not-synced": "Ultima ta salvare nu a ajuns pe server. Este păstrată în acest browser și se va sincroniza data viitoare când joci acest joc.", + "save-not-synced": "Ultima ta salvare încă nu a ajuns pe server. Este păstrată în acest browser, iar RomM încearcă în continuare în fundal.", "save-progress-to": "Salvează progresul în", "save-slot": "Slot de salvare", "save-state": "Salvează starea", + "save-sync-refused": "Serverul a refuzat salvarea păstrată pentru {game}: {reason}. Nu mai este păstrată în acest browser.", "select-background-color": "Selectează culoarea de fundal", "select-save": "Selectează salvare", "select-state": "Selectează stare", @@ -160,6 +162,8 @@ "slot-versions": "{count} versiune | {count} versiuni", "start-fresh-hint": "Alege una mai jos pentru a relua sau apasă Joacă pentru a începe de la zero.", "state-incompatible-core": "Salvat cu {emulator}, pe care nucleul selectat nu îl poate încărca.", + "state-not-synced": "Ultima ta stare încă nu a ajuns pe server. Este păstrată în acest browser, iar RomM încearcă în continuare în fundal.", + "state-sync-refused": "Serverul a refuzat starea păstrată pentru {game}: {reason}. Nu mai este păstrată în acest browser.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/ru_RU/common.json b/frontend/src/locales/ru_RU/common.json index 2f7811461..d5a13e3e1 100644 --- a/frontend/src/locales/ru_RU/common.json +++ b/frontend/src/locales/ru_RU/common.json @@ -129,7 +129,7 @@ "search": "Поиск", "select": "Выбрать", "select-platform": "Выберите платформу", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "Соединение с сервером потеряно, повторная попытка…", "server-reconnected": "Reconnected to the server", "server-stats": "Статистика сервера", "settings": "Настройки", diff --git a/frontend/src/locales/ru_RU/play.json b/frontend/src/locales/ru_RU/play.json index eaac00386..79049de8d 100644 --- a/frontend/src/locales/ru_RU/play.json +++ b/frontend/src/locales/ru_RU/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Выйти, не сохраняя недавний прогресс?", "keep-playing": "Продолжить игру", "last-save-synced": "Последнее сохранение для {game} синхронизировано.", + "last-state-synced": "Последнее состояние для {game} синхронизировано.", "latest-version": "Последняя", "launch-extracting-archive": "Распаковка архива", "launch-extracting-pkg": "Установка файлов игры", @@ -140,10 +141,11 @@ "save-data-none-note": "Играйте и сохранитесь в игре. Синхронизация произойдёт в конце сеанса.", "save-data-note": "Восстановлено на консоль перед запуском. Загрузите его из меню самой игры.", "save-data-synced": "Синхронизировано", - "save-not-synced": "Ваше последнее сохранение не дошло до сервера. Оно хранится в этом браузере и синхронизируется при следующем запуске этой игры.", + "save-not-synced": "Ваше последнее сохранение ещё не дошло до сервера. Оно хранится в этом браузере, и RomM продолжает попытки в фоне.", "save-progress-to": "Сохранять прогресс в", "save-slot": "Слот сохранения", "save-state": "Сохранить состояние", + "save-sync-refused": "Сервер отклонил сохранение, которое хранилось для {game}: {reason}. Оно больше не хранится в этом браузере.", "select-background-color": "Выбрать цвет фона", "select-save": "Выбрать сохранение", "select-state": "Выбрать состояние", @@ -160,6 +162,8 @@ "slot-versions": "{count} версия | {count} версий", "start-fresh-hint": "Выберите одно из ниже, чтобы продолжить, или нажмите «Играть», чтобы начать заново.", "state-incompatible-core": "Сохранено в {emulator}, выбранное ядро не может его загрузить.", + "state-not-synced": "Ваше последнее состояние ещё не дошло до сервера. Оно хранится в этом браузере, и RomM продолжает попытки в фоне.", + "state-sync-refused": "Сервер отклонил состояние, которое хранилось для {game}: {reason}. Оно больше не хранится в этом браузере.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/tr_TR/common.json b/frontend/src/locales/tr_TR/common.json index e50e9b0d4..696f65ef0 100644 --- a/frontend/src/locales/tr_TR/common.json +++ b/frontend/src/locales/tr_TR/common.json @@ -129,7 +129,7 @@ "search": "Ara", "select": "Seç", "select-platform": "Platform seçin", - "server-offline-retrying": "Sunucu bağlantısı kesildi · yeniden bağlanılıyor…", + "server-offline-retrying": "Sunucu bağlantısı kesildi, yeniden bağlanılıyor…", "server-reconnected": "Sunucuya yeniden bağlanıldı", "server-stats": "Sunucu istatistikleri", "settings": "Ayarlar", diff --git a/frontend/src/locales/tr_TR/play.json b/frontend/src/locales/tr_TR/play.json index 799195dc2..d2e83dd6d 100644 --- a/frontend/src/locales/tr_TR/play.json +++ b/frontend/src/locales/tr_TR/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "Son ilerlemeyi kaydetmeden çıkılsın mı?", "keep-playing": "Oynamaya devam et", "last-save-synced": "{game} için son kayıt eşitlendi.", + "last-state-synced": "{game} için son durum kaydı eşitlendi.", "latest-version": "En yeni", "launch-extracting-archive": "Arşiv çıkarılıyor", "launch-extracting-pkg": "Oyun dosyaları yükleniyor", @@ -140,10 +141,11 @@ "save-data-none-note": "Oyna, sonra oyun içinde kaydet. Oturum bitince eşitlenir.", "save-data-note": "Başlatmadan önce konsola geri yüklendi. Oyunun kendi menüsünden yükle.", "save-data-synced": "Eşitlendi", - "save-not-synced": "Son kaydınız sunucuya ulaşmadı. Bu tarayıcıda saklanıyor ve bu oyunu bir sonraki oynayışınızda eşitlenecek.", + "save-not-synced": "Son kaydınız sunucuya henüz ulaşmadı. Bu tarayıcıda saklanıyor ve RomM arka planda denemeye devam ediyor.", "save-progress-to": "İlerlemeyi şuraya kaydet", "save-slot": "Kayıt yuvası", "save-state": "Durumu kaydet", + "save-sync-refused": "Sunucu {game} için saklanan kaydı reddetti: {reason}. Artık bu tarayıcıda saklanmıyor.", "select-background-color": "Arka plan rengi seç", "select-save": "Kayıt seç", "select-state": "Durum kaydı seç", @@ -160,6 +162,8 @@ "slot-versions": "{count} sürüm | {count} sürüm", "start-fresh-hint": "Devam etmek için aşağıdan birini seçin veya baştan başlamak için Oyna'ya basın.", "state-incompatible-core": "{emulator} ile kaydedildi; seçili çekirdek bunu yükleyemez.", + "state-not-synced": "Son durum kaydınız sunucuya henüz ulaşmadı. Bu tarayıcıda saklanıyor ve RomM arka planda denemeye devam ediyor.", + "state-sync-refused": "Sunucu {game} için saklanan durum kaydını reddetti: {reason}. Artık bu tarayıcıda saklanmıyor.", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/locales/zh_CN/common.json b/frontend/src/locales/zh_CN/common.json index 1d0667bb7..a03507ba6 100644 --- a/frontend/src/locales/zh_CN/common.json +++ b/frontend/src/locales/zh_CN/common.json @@ -129,7 +129,7 @@ "search": "搜索", "select": "选择", "select-platform": "选择平台", - "server-offline-retrying": "与服务器的连接已断开 · 正在重试…", + "server-offline-retrying": "与服务器的连接已断开,正在重试…", "server-reconnected": "已重新连接到服务器", "server-stats": "服务器状态", "settings": "设置", diff --git a/frontend/src/locales/zh_CN/play.json b/frontend/src/locales/zh_CN/play.json index 7f866cfe8..6d7743db0 100644 --- a/frontend/src/locales/zh_CN/play.json +++ b/frontend/src/locales/zh_CN/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "不保存最近的进度并退出吗?", "keep-playing": "继续游戏", "last-save-synced": "{game} 的最近存档已同步。", + "last-state-synced": "{game} 的最近即时存档已同步。", "latest-version": "最新", "launch-extracting-archive": "正在解压压缩包", "launch-extracting-pkg": "正在安装游戏文件", @@ -140,10 +141,11 @@ "save-data-none-note": "先游玩,然后在游戏内存档。会话结束时会同步回来。", "save-data-note": "启动前已还原到主机。请从游戏自身的菜单中读取。", "save-data-synced": "已同步", - "save-not-synced": "你最近的存档尚未上传到服务器。它保存在此浏览器中,下次游玩该游戏时会自动同步。", + "save-not-synced": "你最近的存档还没有上传到服务器。它保存在此浏览器中,RomM 会在后台继续重试。", "save-progress-to": "进度保存到", "save-slot": "存档位", "save-state": "保存即时存档", + "save-sync-refused": "服务器拒绝了 {game} 暂存的存档:{reason}。它已从此浏览器中移除。", "select-background-color": "选择背景颜色", "select-save": "选择存档", "select-state": "选择状态", @@ -160,6 +162,8 @@ "slot-versions": "{count} 个版本 | {count} 个版本", "start-fresh-hint": "选择下方任一项继续,或点击开始从头开始。", "state-incompatible-core": "由 {emulator} 保存,所选核心无法加载。", + "state-not-synced": "你最近的即时存档还没有上传到服务器。它保存在此浏览器中,RomM 会在后台继续重试。", + "state-sync-refused": "服务器拒绝了 {game} 暂存的即时存档:{reason}。它已从此浏览器中移除。", "states-view": "状态视图", "states-view-grid": "网格", "states-view-list": "列表", diff --git a/frontend/src/locales/zh_TW/common.json b/frontend/src/locales/zh_TW/common.json index 6652db299..a35f0da85 100644 --- a/frontend/src/locales/zh_TW/common.json +++ b/frontend/src/locales/zh_TW/common.json @@ -129,7 +129,7 @@ "search": "搜尋", "select": "選擇", "select-platform": "選擇平台", - "server-offline-retrying": "Server connection lost · retrying…", + "server-offline-retrying": "與伺服器的連線已中斷,正在重試…", "server-reconnected": "Reconnected to the server", "server-stats": "伺服器狀態", "settings": "設定", diff --git a/frontend/src/locales/zh_TW/play.json b/frontend/src/locales/zh_TW/play.json index 0425502ba..c5e48893e 100644 --- a/frontend/src/locales/zh_TW/play.json +++ b/frontend/src/locales/zh_TW/play.json @@ -57,6 +57,7 @@ "jsdos-quit-without-saving": "不儲存最近的進度並退出嗎?", "keep-playing": "繼續遊戲", "last-save-synced": "{game} 的最近存檔已同步。", + "last-state-synced": "{game} 的最近即時存檔已同步。", "latest-version": "最新", "launch-extracting-archive": "正在解壓縮封存檔", "launch-extracting-pkg": "正在安裝遊戲檔案", @@ -140,10 +141,11 @@ "save-data-none-note": "先遊玩,然後在遊戲內存檔。工作階段結束時會同步回來。", "save-data-note": "啟動前已還原到主機。請從遊戲本身的選單中讀取。", "save-data-synced": "已同步", - "save-not-synced": "你最近的存檔尚未上傳到伺服器。它保存在此瀏覽器中,下次遊玩該遊戲時會自動同步。", + "save-not-synced": "你最近的存檔還沒有上傳到伺服器。它保存在此瀏覽器中,RomM 會在背景繼續重試。", "save-progress-to": "進度儲存至", "save-slot": "存檔格", "save-state": "儲存即時存檔", + "save-sync-refused": "伺服器拒絕了 {game} 暫存的存檔:{reason}。它已從此瀏覽器中移除。", "select-background-color": "選擇背景顏色", "select-save": "選擇存檔", "select-state": "選擇即時存檔", @@ -160,6 +162,8 @@ "slot-versions": "{count} 個版本 | {count} 個版本", "start-fresh-hint": "從下方選擇一項繼續遊玩,或按下 Play 重新開始。", "state-incompatible-core": "由 {emulator} 儲存,所選核心無法載入。", + "state-not-synced": "你最近的即時存檔還沒有上傳到伺服器。它保存在此瀏覽器中,RomM 會在背景繼續重試。", + "state-sync-refused": "伺服器拒絕了 {game} 暫存的即時存檔:{reason}。它已從此瀏覽器中移除。", "states-view": "State view", "states-view-grid": "Grid", "states-view-list": "List", diff --git a/frontend/src/services/api/state.ts b/frontend/src/services/api/state.ts index 70b5b78b9..f4399aea7 100644 --- a/frontend/src/services/api/state.ts +++ b/frontend/src/services/api/state.ts @@ -9,6 +9,19 @@ import { buildFormInput } from "@/utils/formData"; export const stateApi = api; +/** States are named after the ROM and the moment the core was serialized. */ +export function sessionStateName( + rom: { fs_name_no_ext: string }, + capturedAt: Date, +): string { + const timestamp = capturedAt + .toISOString() + .replace(/[:.]/g, "-") + .replace("T", " ") + .replace("Z", ""); + return `${rom.fs_name_no_ext.trim()} [${timestamp}]`; +} + type StateUploadInput = Omit & { stateFile: File; screenshotFile?: File; diff --git a/frontend/src/services/pending-asset.test.ts b/frontend/src/services/pending-asset.test.ts new file mode 100644 index 000000000..f9ab30723 --- /dev/null +++ b/frontend/src/services/pending-asset.test.ts @@ -0,0 +1,321 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import pendingAssetStore, { + hasPendingAssets, + pendingAssetId, + pendingAssetKinds, + syncPendingAssets, + type PendingAsset, +} from "@/services/pending-asset"; + +const romApiMocks = vi.hoisted(() => ({ getRom: vi.fn() })); +const saveApiMocks = vi.hoisted(() => ({ uploadSaves: vi.fn() })); +const stateApiMocks = vi.hoisted(() => ({ uploadStates: vi.fn() })); + +vi.mock("@/services/api/rom", () => ({ default: romApiMocks })); +vi.mock("@/services/api/save", async (importOriginal) => ({ + ...(await importOriginal()), + default: saveApiMocks, +})); +vi.mock("@/services/api/state", async (importOriginal) => ({ + ...(await importOriginal()), + default: stateApiMocks, +})); + +// happy-dom ships no IndexedDB, which is also what a locked-down origin or a +// private window looks like. Losing the frame must never cost the player a save. +describe("pendingAssetStore without IndexedDB", () => { + beforeEach(() => { + vi.spyOn(console, "error").mockImplementation(() => undefined); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + it("lists nothing rather than throwing", async () => { + await expect(pendingAssetStore.list()).resolves.toEqual([]); + }); + + it("swallows a write", async () => { + await expect( + pendingAssetStore.write({ + id: "1:a", + kind: "save", + romId: 1, + romName: "Game", + bytes: new Uint8Array([1, 2, 3]).buffer, + capturedAt: 0, + }), + ).resolves.toBeUndefined(); + }); + + it("swallows a clear", async () => { + await expect(pendingAssetStore.clear("1:a")).resolves.toBeUndefined(); + }); + + it("reports nothing as held", async () => { + await expect(pendingAssetKinds(1)).resolves.toEqual(new Set()); + }); + + it("has nothing to hand over", async () => { + await expect(syncPendingAssets()).resolves.toEqual({ + synced: [], + dropped: [], + }); + }); +}); + +describe("pendingAssetId", () => { + afterEach(() => { + vi.unstubAllGlobals(); + }); + + it("keys a capture to its rom", () => { + expect(pendingAssetId(7)).toMatch(/^7:.+/); + }); + + // RomM served over plain http on a LAN address is not a secure context, and + // there `crypto.randomUUID` does not exist at all (#4610). + it("still hands out distinct ids without randomUUID", () => { + vi.stubGlobal("crypto", {}); + + const first = pendingAssetId(7); + const second = pendingAssetId(7); + + expect(first).toMatch(/^7:.+/); + expect(second).not.toBe(first); + }); +}); + +// The sliver of IndexedDB the store uses, in memory, so the retry itself can +// be exercised rather than only its unavailable-storage fallback. +function installFakeIndexedDB(rows: Map) { + function request(result?: unknown) { + const req: Record = { result }; + queueMicrotask(() => (req.onsuccess as (() => void) | undefined)?.()); + return req; + } + const objectStore = { + getAll: () => request([...rows.values()]), + put: (entry: PendingAsset) => { + rows.set(entry.id, entry); + return request(); + }, + delete: (id: string) => { + rows.delete(id); + return request(); + }, + }; + const db = { + objectStoreNames: [] as string[], + createObjectStore: () => objectStore, + deleteObjectStore: () => undefined, + close: () => undefined, + transaction: () => { + const transaction: Record = { + objectStore: () => objectStore, + error: null, + }; + queueMicrotask(() => + (transaction.oncomplete as (() => void) | undefined)?.(), + ); + return transaction; + }, + }; + vi.stubGlobal("indexedDB", { + open: () => { + const req: Record = { result: db }; + queueMicrotask(() => { + (req.onupgradeneeded as (() => void) | undefined)?.(); + (req.onsuccess as (() => void) | undefined)?.(); + }); + return req; + }, + }); +} + +// What axios hands back: a status only when the server answered at all. +function refusal(status?: number, detail?: string) { + return Object.assign(new Error(`Request failed with status code ${status}`), { + isAxiosError: true, + response: + status === undefined + ? undefined + : { status, statusText: `HTTP ${status}`, data: { detail } }, + }); +} + +describe("syncPendingAssets", () => { + let rows: Map; + const bytes = new Uint8Array([1, 2, 3]).buffer; + const shot = new Uint8Array([9, 9]).buffer; + + // The ids are unique per test: a row the server has taken is remembered for + // the lifetime of the module, which is what stops it syncing twice. + function queue(entry: Partial & { id: string }) { + const row: PendingAsset = { + kind: "save", + romId: 1, + romName: "Held Game", + bytes, + capturedAt: Date.parse("2024-05-06T07:08:09.010Z"), + ...entry, + }; + rows.set(row.id, row); + return row; + } + + beforeEach(() => { + rows = new Map(); + installFakeIndexedDB(rows); + vi.spyOn(console, "error").mockImplementation(() => undefined); + romApiMocks.getRom.mockResolvedValue({ + data: { + id: 1, + name: "Game", + fs_name_no_ext: "game", + path_cover_small: "cover.png", + }, + }); + saveApiMocks.uploadSaves.mockResolvedValue([{ status: "fulfilled" }]); + stateApiMocks.uploadStates.mockResolvedValue([{ status: "fulfilled" }]); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + vi.restoreAllMocks(); + romApiMocks.getRom.mockReset(); + saveApiMocks.uploadSaves.mockReset(); + stateApiMocks.uploadStates.mockReset(); + }); + + it("hands a held save to the slot it was written for", async () => { + queue({ id: "save:taken", slot: "main_quest", screenshotBytes: shot }); + + await expect(syncPendingAssets()).resolves.toEqual({ + synced: [{ kind: "save", romId: 1, name: "Game", cover: "cover.png" }], + dropped: [], + }); + + const request = saveApiMocks.uploadSaves.mock.calls[0][0]; + expect(request).toMatchObject({ + slot: "main_quest", + autocleanup: false, + overwrite: false, + }); + expect(request.savesToUpload[0].screenshotFile.name).toBe("game.png"); + expect(rows.size).toBe(0); + }); + + it("hands a held state over under the name of its capture", async () => { + queue({ id: "state:taken", kind: "state", screenshotBytes: shot }); + + await expect(syncPendingAssets()).resolves.toEqual({ + synced: [{ kind: "state", romId: 1, name: "Game", cover: "cover.png" }], + dropped: [], + }); + + const { statesToUpload } = stateApiMocks.uploadStates.mock.calls[0][0]; + expect(statesToUpload[0].stateFile.name).toBe( + "game [2024-05-06 07-08-09-010].state", + ); + expect(statesToUpload[0].screenshotFile.name).toBe( + "game [2024-05-06 07-08-09-010].png", + ); + expect(rows.size).toBe(0); + }); + + // A server that is down or failing has not judged the asset, so it keeps it. + it.each([ + ["no response at all", refusal(undefined)], + ["a server that is failing", refusal(500)], + ["a session that has expired", refusal(401)], + ])("holds on through %s", async (_label, reason) => { + stateApiMocks.uploadStates.mockResolvedValue([ + { status: "rejected", reason }, + ]); + queue({ id: `state:kept:${Math.random()}`, kind: "state" }); + + await expect(syncPendingAssets()).resolves.toMatchObject({ + synced: [], + dropped: [], + }); + + expect(rows.size).toBe(1); + await expect(hasPendingAssets()).resolves.toBe(true); + }); + + // Retrying a refusal for the rest of time would only nag the player about + // progress that is never going through. + it("drops what the server refused for good and says why", async () => { + stateApiMocks.uploadStates.mockResolvedValue([ + { status: "rejected", reason: refusal(409, "Slot has a newer save") }, + ]); + queue({ id: "state:refused", kind: "state" }); + + await expect(syncPendingAssets()).resolves.toEqual({ + synced: [], + dropped: [ + { + kind: "state", + romId: 1, + name: "Game", + cover: "cover.png", + reason: "Slot has a newer save", + }, + ], + }); + + expect(rows.size).toBe(0); + await expect(hasPendingAssets()).resolves.toBe(false); + }); + + // The rom is gone, so the name stored with the row is all there is to go on. + it("names a game the server no longer knows from the row itself", async () => { + romApiMocks.getRom.mockRejectedValue(refusal(404, "Rom not found")); + queue({ id: "save:orphan" }); + + await expect(syncPendingAssets()).resolves.toMatchObject({ + dropped: [{ name: "Held Game", reason: "Rom not found" }], + }); + + expect(rows.size).toBe(0); + }); + + it("drops a row that holds no bytes rather than uploading nothing", async () => { + queue({ id: "save:empty", bytes: new ArrayBuffer(0) }); + + await expect(syncPendingAssets()).resolves.toEqual({ + synced: [], + dropped: [], + }); + + expect(saveApiMocks.uploadSaves).not.toHaveBeenCalled(); + expect(rows.size).toBe(0); + }); + + // A running session owns its own save, so the caller can ask for the rest. + it("hands over only the kinds it was asked for", async () => { + queue({ id: "save:not-asked" }); + queue({ id: "state:asked", kind: "state" }); + + await expect(syncPendingAssets(["state"])).resolves.toMatchObject({ + synced: [{ kind: "state" }], + }); + + expect(saveApiMocks.uploadSaves).not.toHaveBeenCalled(); + expect([...rows.keys()]).toEqual(["save:not-asked"]); + }); + + it("reports both kinds a rom is still owed", async () => { + queue({ id: "save:held" }); + queue({ id: "state:held", kind: "state" }); + queue({ id: "other-rom:held", romId: 2 }); + + await expect(pendingAssetKinds(1)).resolves.toEqual( + new Set(["save", "state"]), + ); + await expect(pendingAssetKinds(2)).resolves.toEqual(new Set(["save"])); + await expect(pendingAssetKinds(3)).resolves.toEqual(new Set()); + }); +}); diff --git a/frontend/src/services/pending-asset.ts b/frontend/src/services/pending-asset.ts new file mode 100644 index 000000000..dc8b1c82b --- /dev/null +++ b/frontend/src/services/pending-asset.ts @@ -0,0 +1,317 @@ +// Saves and states the server has not accepted yet, held in the browser with +// the frame captured at the moment the game wrote them. A sync that fails +// offline would otherwise lose that frame and picture a later moment on the +// retry, and a closed tab would lose the progress outright. +import axios from "axios"; +import type { DetailedRomSchema } from "@/__generated__"; +import romApi from "@/services/api/rom"; +import saveApi, { AUTOSAVE_SLOT, sessionSaveFile } from "@/services/api/save"; +import stateApi, { sessionStateName } from "@/services/api/state"; + +const DB_NAME = "romm-player"; +// A row cannot be rekeyed or reshaped in place, so every upgrade rebuilds the +// store rather than migrating it. +const DB_VERSION = 3; +const STORE_NAME = "pending-assets"; + +export type PendingAssetKind = "save" | "state"; + +export interface PendingAsset { + /** One row per capture, so two offline sessions cannot overwrite each other. */ + id: string; + kind: PendingAssetKind; + romId: number; + /** Named at capture time, so a rom the server no longer has can still be announced. */ + romName: string; + bytes: ArrayBuffer; + screenshotBytes?: ArrayBuffer; + /** Saves only: the slot the session was writing to. */ + slot?: string; + emulator?: string; + /** Saves only: the device the session was playing on. */ + deviceId?: string; + capturedAt: number; +} + +// `crypto.randomUUID` needs a secure context and RomM is often served over +// plain http on a LAN address. The id only has to be unique within a browser. +function randomToken(): string { + const webCrypto = globalThis.crypto; + if (typeof webCrypto?.randomUUID === "function") + return webCrypto.randomUUID(); + return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`; +} + +/** A key of its own for one capture, so no other can write over it. */ +export function pendingAssetId(romId: number): string { + return `${romId}:${randomToken()}`; +} + +export interface PendingAssetStore { + list(): Promise; + write(entry: PendingAsset): Promise; + clear(id: string): Promise; +} + +function openDatabase(): Promise { + return new Promise((resolve, reject) => { + const request = indexedDB.open(DB_NAME, DB_VERSION); + request.onupgradeneeded = () => { + const db = request.result; + for (const name of Array.from(db.objectStoreNames)) { + db.deleteObjectStore(name); + } + db.createObjectStore(STORE_NAME, { keyPath: "id" }); + }; + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); +} + +// Storage is a best effort: a private window, a blocked origin or a failed +// upgrade must cost the player nothing, so every path resolves to null. +async function withStore( + mode: IDBTransactionMode, + run: (store: IDBObjectStore) => IDBRequest, +): Promise { + if (typeof indexedDB === "undefined") return null; + + let db: IDBDatabase; + try { + db = await openDatabase(); + } catch (error) { + console.error("Pending asset storage unavailable", error); + return null; + } + + try { + return await new Promise((resolve, reject) => { + const transaction = db.transaction(STORE_NAME, mode); + const request = run(transaction.objectStore(STORE_NAME)); + // A delete that resolves on the request alone can still be rolled back, + // which is how a row survives its own removal and syncs forever. + transaction.oncomplete = () => resolve(request.result as T); + transaction.onabort = () => reject(transaction.error); + request.onerror = () => reject(request.error); + }); + } catch (error) { + console.error("Pending asset storage failed", error); + return null; + } finally { + // The connection closes once the transaction above commits. + db.close(); + } +} + +const pendingAssetStore: PendingAssetStore = { + async list() { + return ( + (await withStore("readonly", (store) => + store.getAll(), + )) ?? [] + ); + }, + async write(entry) { + await withStore("readwrite", (store) => store.put(entry)); + }, + async clear(id) { + await withStore("readwrite", (store) => store.delete(id)); + }, +}; + +export default pendingAssetStore; + +/** What the browser is still holding for a rom, save and state apart. */ +export async function pendingAssetKinds( + romId: number, +): Promise> { + const entries = await pendingAssetStore.list(); + return new Set( + entries + .filter((entry) => entry.romId === romId && !accepted.has(entry.id)) + .map((entry) => entry.kind), + ); +} + +// Rows the server has taken. A delete that does not stick would otherwise have +// this upload the same progress again on the next pass, and again after that. +const accepted = new Set(); + +async function uploadSave( + entry: PendingAsset, + rom: DetailedRomSchema, +): Promise | undefined> { + const slot = entry.slot ?? AUTOSAVE_SLOT; + const uploaded = await saveApi.uploadSaves({ + rom, + emulator: entry.emulator, + deviceId: entry.deviceId, + slot, + autocleanup: slot === AUTOSAVE_SLOT, + // The dedupe is the point: a retry of bytes the server already has must + // return that version, not mint another one. + overwrite: false, + savesToUpload: [ + { + saveFile: sessionSaveFile(rom, null, entry.bytes), + screenshotFile: entry.screenshotBytes + ? new File( + [entry.screenshotBytes], + `${rom.fs_name_no_ext.trim()}.png`, + { type: "application/octet-stream" }, + ) + : undefined, + }, + ], + }); + return uploaded[0]; +} + +async function uploadState( + entry: PendingAsset, + rom: DetailedRomSchema, +): Promise | undefined> { + // The backend files a state under the row already at that name, so pinning + // the name to the capture has a retry update it rather than duplicate it. + const name = sessionStateName(rom, new Date(entry.capturedAt)); + const uploaded = await stateApi.uploadStates({ + rom, + emulator: entry.emulator, + statesToUpload: [ + { + stateFile: new File([entry.bytes], `${name}.state`, { + type: "application/octet-stream", + }), + screenshotFile: entry.screenshotBytes + ? new File([entry.screenshotBytes], `${name}.png`, { + type: "application/octet-stream", + }) + : undefined, + }, + ], + }); + return uploaded[0]; +} + +// A server that is failing, a network that is down and an expired session all +// deserve another pass; anything else the server answers with is its verdict. +const RETRYABLE_STATUSES = new Set([401, 408, 425, 429]); + +/** + * Why the server refused this asset for good, if it did. + * + * Returns: + * The reason to show the player, or null when the attempt is worth repeating. + */ +function permanentRefusal(error: unknown): string | null { + if (!axios.isAxiosError(error) || !error.response) return null; + const { status, statusText, data } = error.response; + if (status >= 500 || RETRYABLE_STATUSES.has(status)) return null; + const detail = data?.detail; + return (typeof detail === "string" && detail) || statusText || error.message; +} + +interface AssetOutcome { + asset: SyncedAsset; + /** Set when the server refused it for good and the row was dropped. */ + reason?: string; +} + +// A row the server has answered for is no longer owed, refused as much as +// taken: holding a refusal back would only retry it for the rest of time. +async function settle( + entry: PendingAsset, + rom: DetailedRomSchema | null, + reason?: string, +): Promise { + accepted.add(entry.id); + await pendingAssetStore.clear(entry.id); + return { + asset: { + kind: entry.kind, + romId: entry.romId, + name: rom?.name ?? rom?.fs_name_no_ext ?? entry.romName, + cover: rom?.path_cover_small, + }, + reason, + }; +} + +async function uploadPendingAsset( + entry: PendingAsset, +): Promise { + if (accepted.has(entry.id)) return null; + if (!entry.bytes?.byteLength) { + await pendingAssetStore.clear(entry.id); + return null; + } + + let rom: DetailedRomSchema | null = null; + try { + rom = (await romApi.getRom({ romId: entry.romId })).data; + const upload = + entry.kind === "state" + ? await uploadState(entry, rom) + : await uploadSave(entry, rom); + if (upload?.status === "fulfilled") return settle(entry, rom); + + const refusal = permanentRefusal( + upload?.status === "rejected" ? upload.reason : null, + ); + return refusal ? settle(entry, rom, refusal) : null; + } catch (error) { + const refusal = permanentRefusal(error); + if (refusal) return settle(entry, rom, refusal); + console.error("Pending asset sync failed", error); + return null; + } +} + +/** An asset the server has just taken, named so the toast can say which game. */ +export interface SyncedAsset { + kind: PendingAssetKind; + romId: number; + name: string; + cover?: string | null; +} + +/** One the server refused for good, dropped rather than retried forever. */ +export interface DroppedAsset extends SyncedAsset { + reason: string; +} + +export interface PendingSyncResult { + synced: SyncedAsset[]; + dropped: DroppedAsset[]; +} + +/** + * Hands the server what the browser is still holding. + * + * Args: + * kinds: What to hand over, for a caller that owns one of them itself. + * + * Returns: + * What the server took, so their views can refresh and say so, and what it + * refused for good, so the player is told why it is gone. + */ +export async function syncPendingAssets( + kinds: readonly PendingAssetKind[] = ["save", "state"], +): Promise { + const synced: SyncedAsset[] = []; + const dropped: DroppedAsset[] = []; + for (const entry of await pendingAssetStore.list()) { + if (!kinds.includes(entry.kind)) continue; + const outcome = await uploadPendingAsset(entry); + if (!outcome) continue; + if (outcome.reason === undefined) synced.push(outcome.asset); + else dropped.push({ ...outcome.asset, reason: outcome.reason }); + } + return { synced, dropped }; +} + +/** Whether anything is still owed, ignoring rows a delete failed to remove. */ +export async function hasPendingAssets(): Promise { + const entries = await pendingAssetStore.list(); + return entries.some((entry) => !accepted.has(entry.id)); +} diff --git a/frontend/src/services/pending-save.test.ts b/frontend/src/services/pending-save.test.ts deleted file mode 100644 index 480dc3ad6..000000000 --- a/frontend/src/services/pending-save.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import pendingSaveStore, { - pendingSaveRomIds, - syncPendingSaves, -} from "@/services/pending-save"; - -// happy-dom ships no IndexedDB, which is also what a locked-down origin or a -// private window looks like. Losing the frame must never cost the player a save. -describe("pendingSaveStore without IndexedDB", () => { - beforeEach(() => { - vi.spyOn(console, "error").mockImplementation(() => undefined); - }); - - afterEach(() => { - vi.restoreAllMocks(); - }); - - it("lists nothing rather than throwing", async () => { - await expect(pendingSaveStore.list()).resolves.toEqual([]); - }); - - it("swallows a write", async () => { - await expect( - pendingSaveStore.write({ - id: "1:a", - romId: 1, - saveBytes: new Uint8Array([1, 2, 3]).buffer, - capturedAt: 0, - }), - ).resolves.toBeUndefined(); - }); - - it("swallows a clear", async () => { - await expect(pendingSaveStore.clear("1:a")).resolves.toBeUndefined(); - }); - - it("reports no rom as held when nothing is stored", async () => { - await expect(pendingSaveRomIds()).resolves.toEqual(new Set()); - }); - - it("has nothing to hand over", async () => { - await expect(syncPendingSaves()).resolves.toEqual([]); - }); -}); diff --git a/frontend/src/services/pending-save.ts b/frontend/src/services/pending-save.ts deleted file mode 100644 index 128e4148d..000000000 --- a/frontend/src/services/pending-save.ts +++ /dev/null @@ -1,187 +0,0 @@ -// Saves the server has not accepted yet, held in the browser with the frame -// captured at the moment the game wrote them. A sync that fails offline would -// otherwise lose that frame and picture a later moment on the retry, and a -// closed tab would lose the progress outright. -import romApi from "@/services/api/rom"; -import saveApi, { AUTOSAVE_SLOT, sessionSaveFile } from "@/services/api/save"; - -const DB_NAME = "romm-player"; -// v2 rekeyed the store from the rom to the playing session. An upgrade cannot -// rewrite keys in place, and a row carrying the old key can never be deleted by -// the new one, so the store is rebuilt rather than migrated. -const DB_VERSION = 2; -const STORE_NAME = "pending-saves"; - -export interface PendingSave { - /** One row per playing session, so two offline sessions cannot overwrite each other. */ - id: string; - romId: number; - saveBytes: ArrayBuffer; - screenshotBytes?: ArrayBuffer; - slot?: string; - emulator?: string; - deviceId?: string; - capturedAt: number; -} - -export interface PendingSaveStore { - list(): Promise; - write(entry: PendingSave): Promise; - clear(id: string): Promise; -} - -function openDatabase(): Promise { - return new Promise((resolve, reject) => { - const request = indexedDB.open(DB_NAME, DB_VERSION); - request.onupgradeneeded = () => { - const db = request.result; - if (db.objectStoreNames.contains(STORE_NAME)) { - db.deleteObjectStore(STORE_NAME); - } - db.createObjectStore(STORE_NAME, { keyPath: "id" }); - }; - request.onsuccess = () => resolve(request.result); - request.onerror = () => reject(request.error); - }); -} - -// Storage is a best effort: a private window, a blocked origin or a failed -// upgrade must cost the player nothing, so every path resolves to null. -async function withStore( - mode: IDBTransactionMode, - run: (store: IDBObjectStore) => IDBRequest, -): Promise { - if (typeof indexedDB === "undefined") return null; - - let db: IDBDatabase; - try { - db = await openDatabase(); - } catch (error) { - console.error("Pending save storage unavailable", error); - return null; - } - - try { - return await new Promise((resolve, reject) => { - const transaction = db.transaction(STORE_NAME, mode); - const request = run(transaction.objectStore(STORE_NAME)); - // A delete that resolves on the request alone can still be rolled back, - // which is how a row survives its own removal and syncs forever. - transaction.oncomplete = () => resolve(request.result as T); - transaction.onabort = () => reject(transaction.error); - request.onerror = () => reject(request.error); - }); - } catch (error) { - console.error("Pending save storage failed", error); - return null; - } finally { - // The connection closes once the transaction above commits. - db.close(); - } -} - -const pendingSaveStore: PendingSaveStore = { - async list() { - return ( - (await withStore("readonly", (store) => store.getAll())) ?? - [] - ); - }, - async write(entry) { - await withStore("readwrite", (store) => store.put(entry)); - }, - async clear(id) { - await withStore("readwrite", (store) => store.delete(id)); - }, -}; - -export default pendingSaveStore; - -/** The rom ids the browser is still holding progress for. */ -export async function pendingSaveRomIds(): Promise> { - const entries = await pendingSaveStore.list(); - return new Set( - entries.filter((e) => !accepted.has(e.id)).map((entry) => entry.romId), - ); -} - -// Rows the server has taken. A delete that does not stick would otherwise have -// this upload the same progress again on the next pass, and again after that. -const accepted = new Set(); - -async function uploadPendingSave( - entry: PendingSave, -): Promise { - if (accepted.has(entry.id)) return null; - if (!entry.saveBytes?.byteLength) { - await pendingSaveStore.clear(entry.id); - return null; - } - - try { - const { data: rom } = await romApi.getRom({ romId: entry.romId }); - const slot = entry.slot ?? AUTOSAVE_SLOT; - const uploaded = await saveApi.uploadSaves({ - rom, - emulator: entry.emulator, - deviceId: entry.deviceId, - slot, - autocleanup: slot === AUTOSAVE_SLOT, - // The dedupe is the point: a retry of bytes the server already has must - // return that version, not mint another one. - overwrite: false, - savesToUpload: [ - { - saveFile: sessionSaveFile(rom, null, entry.saveBytes), - screenshotFile: entry.screenshotBytes - ? new File( - [entry.screenshotBytes], - `${rom.fs_name_no_ext.trim()}.png`, - { type: "application/octet-stream" }, - ) - : undefined, - }, - ], - }); - - if (uploaded[0]?.status !== "fulfilled") return null; - accepted.add(entry.id); - await pendingSaveStore.clear(entry.id); - return { - romId: entry.romId, - name: rom.name ?? rom.fs_name_no_ext, - cover: rom.path_cover_small, - }; - } catch (error) { - console.error("Pending save sync failed", error); - return null; - } -} - -/** A save the server has just taken, named so the toast can say which game. */ -export interface SyncedSave { - romId: number; - name: string; - cover?: string | null; -} - -/** - * Hands the server everything the browser is still holding. - * - * Returns: - * The saves the server took, so their views can refresh and say so. - */ -export async function syncPendingSaves(): Promise { - const synced: SyncedSave[] = []; - for (const entry of await pendingSaveStore.list()) { - const result = await uploadPendingSave(entry); - if (result) synced.push(result); - } - return synced; -} - -/** Whether anything is still owed, ignoring rows a delete failed to remove. */ -export async function hasPendingSaves(): Promise { - const entries = await pendingSaveStore.list(); - return entries.some((entry) => !accepted.has(entry.id)); -} diff --git a/frontend/src/v2/components/AppShell/BackendStatusBanner.test.ts b/frontend/src/v2/components/AppShell/BackendStatusBanner.test.ts new file mode 100644 index 000000000..c3b55276f --- /dev/null +++ b/frontend/src/v2/components/AppShell/BackendStatusBanner.test.ts @@ -0,0 +1,104 @@ +import { mount } from "@vue/test-utils"; +import { createPinia, setActivePinia } from "pinia"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { ref } from "vue"; +import storePlaying from "@/stores/playing"; +import BackendStatusBanner from "./BackendStatusBanner.vue"; + +vi.mock("vue-i18n", () => ({ + useI18n: () => ({ t: (key: string) => key }), +})); + +const isOffline = ref(false); +vi.mock("@/v2/composables/useServerConnection", () => ({ + useServerConnection: () => ({ isOffline, retryNow: vi.fn() }), +})); + +vi.mock("@v2/lib", () => ({ + RBtn: { name: "RBtn", template: "" }, + RIcon: { name: "RIcon", template: "" }, + RTooltip: { + name: "RTooltip", + props: ["text", "activator", "location"], + template: "", + }, +})); + +let wrapper: ReturnType | null = null; + +async function render() { + wrapper = mount(BackendStatusBanner); + await wrapper.vm.$nextTick(); +} + +const banner = () => wrapper!.find(".r-backend-banner"); +const body = () => wrapper!.find(".r-backend-banner__body"); + +describe("BackendStatusBanner", () => { + beforeEach(() => { + setActivePinia(createPinia()); + vi.useFakeTimers(); + isOffline.value = false; + }); + + afterEach(() => { + wrapper?.unmount(); + wrapper = null; + vi.useRealTimers(); + }); + + it("stays out of sight while the server answers", async () => { + await render(); + + expect(banner().exists()).toBe(false); + }); + + it("offers the retry button outside a game", async () => { + isOffline.value = true; + + await render(); + + expect(banner().classes()).not.toContain("r-backend-banner--in-game"); + expect(wrapper!.find(".r-backend-banner__retry").exists()).toBe(true); + // The message is right there to read, so nothing hovers over it. + expect(banner().attributes("title")).toBeUndefined(); + expect(wrapper!.find(".r-tooltip-stub").exists()).toBe(false); + }); + + // A notice the player cannot dismiss has no business sitting over the game. + it("shrinks to its icon once a game has been running a while", async () => { + isOffline.value = true; + storePlaying().setPlaying(true); + + await render(); + expect(banner().classes()).toContain("r-backend-banner--in-game"); + expect(body().exists()).toBe(true); + expect(wrapper!.find(".r-backend-banner__retry").exists()).toBe(false); + + await vi.advanceTimersByTimeAsync(6000); + await wrapper!.vm.$nextTick(); + + expect(body().exists()).toBe(false); + expect(banner().classes()).toContain("r-backend-banner--collapsed"); + // Only the icon is left, so the message moves into a tooltip of our own. + expect(banner().attributes("title")).toBeUndefined(); + expect(wrapper!.find(".r-tooltip-stub").exists()).toBe(true); + }); + + it("says its piece again in full once the game is over", async () => { + isOffline.value = true; + const playing = storePlaying(); + playing.setPlaying(true); + + await render(); + await vi.advanceTimersByTimeAsync(6000); + await wrapper!.vm.$nextTick(); + expect(body().exists()).toBe(false); + + playing.setPlaying(false); + await wrapper!.vm.$nextTick(); + + expect(body().exists()).toBe(true); + expect(wrapper!.find(".r-backend-banner__retry").exists()).toBe(true); + }); +}); diff --git a/frontend/src/v2/components/AppShell/BackendStatusBanner.vue b/frontend/src/v2/components/AppShell/BackendStatusBanner.vue index 234371c09..9392afed7 100644 --- a/frontend/src/v2/components/AppShell/BackendStatusBanner.vue +++ b/frontend/src/v2/components/AppShell/BackendStatusBanner.vue @@ -11,36 +11,89 @@ // poll / passive DOM-event listeners / recovery watcher (idempotent). This // component is mounted once, under `v-if="isV2"` in RomM.vue, so it covers both // the auth and main shells. -import { RBtn, RIcon } from "@v2/lib"; +import { RBtn, RIcon, RTooltip } from "@v2/lib"; +import { storeToRefs } from "pinia"; +import { onBeforeUnmount, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; +import storePlaying from "@/stores/playing"; import { useServerConnection } from "@/v2/composables/useServerConnection"; defineOptions({ inheritAttrs: false }); +// Long enough to read before the notice gets out of the way of the game. +const COLLAPSE_MS = 6000; + const { t } = useI18n(); const { isOffline, retryNow } = useServerConnection(); +const { playing } = storeToRefs(storePlaying()); + +// A notice that cannot be dismissed has no business sitting over a running +// game, so it says its piece and then shrinks to its icon. +const collapsed = ref(false); +let collapseTimer: ReturnType | null = null; + +function stopCollapsing() { + if (collapseTimer === null) return; + clearTimeout(collapseTimer); + collapseTimer = null; +} + +watch( + [isOffline, playing], + ([offline, inGame]) => { + stopCollapsing(); + collapsed.value = false; + if (!offline || !inGame) return; + collapseTimer = setTimeout(() => (collapsed.value = true), COLLAPSE_MS); + }, + { immediate: true }, +); + +onBeforeUnmount(stopCollapsing); @@ -79,11 +132,40 @@ const { isOffline, retryNow } = useServerConnection(); line-height: 1.4; } +/* A running game owns the screen, so the notice takes the corner the player + already puts its own messages in and leaves the middle of the screen alone. */ +.r-backend-banner--in-game { + top: 16px; + left: 16px; + right: auto; + transform: none; + max-width: min(420px, calc(100vw - 32px)); + /* The retry button is what pads the right edge out; without it the text + needs the same room the icon gets. */ + padding: 8px 14px; +} + +.r-backend-banner--in-game .r-backend-banner__body { + white-space: nowrap; +} + +.r-backend-banner--collapsed { + padding: 8px; +} + .r-backend-banner__icon { flex-shrink: 0; color: var(--r-color-danger-fg); } +.r-backend-banner__body { + display: inline-flex; + align-items: center; + gap: 10px; + min-width: 0; + overflow: hidden; +} + .r-backend-banner__msg { min-width: 0; } @@ -105,6 +187,24 @@ const { isOffline, retryNow } = useServerConnection(); opacity: 0; transform: translate(-50%, -12px); } +.r-backend-banner--in-game.r-backend-banner-enter-from, +.r-backend-banner--in-game.r-backend-banner-leave-to { + transform: translateY(-12px); +} + +/* Collapsing to the icon: the text slides shut rather than blinking out. */ +.r-backend-banner-body-enter-active, +.r-backend-banner-body-leave-active { + transition: + opacity var(--r-motion-med) var(--r-motion-ease-out), + max-width var(--r-motion-med) var(--r-motion-ease-out); + max-width: 420px; +} +.r-backend-banner-body-enter-from, +.r-backend-banner-body-leave-to { + opacity: 0; + max-width: 0; +} /* On phones keep it centred but allow the safe full width. */ html[data-bp~="xs"] .r-backend-banner { @@ -118,4 +218,10 @@ html[data-bp~="xs"] .r-backend-banner-enter-from, html[data-bp~="xs"] .r-backend-banner-leave-to { transform: translateY(-12px); } +html[data-bp~="xs"] .r-backend-banner--in-game { + left: 12px; + right: auto; + max-width: calc(100vw - 24px); + justify-content: flex-start; +} diff --git a/frontend/src/v2/components/Notifications/NotificationHost.vue b/frontend/src/v2/components/Notifications/NotificationHost.vue index 2f99d07ef..f37bf9335 100644 --- a/frontend/src/v2/components/Notifications/NotificationHost.vue +++ b/frontend/src/v2/components/Notifications/NotificationHost.vue @@ -23,6 +23,8 @@ type Toast = { msg: string; icon?: string; image?: string | null; + /** Artwork the browser could not load, so the tone's icon stands in. */ + imageBroken?: boolean; tone: ToastTone; timer?: number; }; @@ -83,46 +85,59 @@ function dismiss(id: number) { const openHandler = (snackbar: SnackbarStatus) => push(snackbar); emitter?.on("snackbarShow", openHandler); + +// A fullscreen element is the only thing the browser paints, so the host moves +// inside it: a player that took the screen still gets to show its notices. +const fullscreenHost = ref(null); +function trackFullscreen() { + fullscreenHost.value = document.fullscreenElement as HTMLElement | null; +} +document.addEventListener("fullscreenchange", trackFullscreen); + onBeforeUnmount(() => { emitter?.off("snackbarShow", openHandler); + document.removeEventListener("fullscreenchange", trackFullscreen); toasts.value.forEach((t) => t.timer && window.clearTimeout(t.timer)); }); diff --git a/frontend/src/v2/components/Player/SelectSaveDialog.vue b/frontend/src/v2/components/Player/SelectSaveDialog.vue index b09c3daf9..f9c47388c 100644 --- a/frontend/src/v2/components/Player/SelectSaveDialog.vue +++ b/frontend/src/v2/components/Player/SelectSaveDialog.vue @@ -1,16 +1,17 @@