1
0
mirror of https://github.com/s427/MARL.git synced 2025-01-31 11:34:46 +01:00

fix in case bookmarks or likes files are absent from archive

This commit is contained in:
Vincent CLAVIEN 2024-12-01 13:34:59 +01:00
parent e80be8e974
commit 82bde0d275
2 changed files with 13 additions and 1 deletions

View File

@ -1596,6 +1596,6 @@
</symbol>
</svg>
<script src="js/main.js?20241201b"></script>
<script src="js/main.js?20241201c"></script>
</body>
</html>

View File

@ -756,6 +756,18 @@ function resetStores() {
function loadJsonFile(name) {
const content = Alpine.store("files").raw;
if (content[name + ".json"] === undefined) {
if (name === "likes" || name === "bookmarks") {
// we can still run the app without those files
console.warn(`File ${name}.json not found in archive.`);
Alpine.store("files").loaded[name] = true;
} else {
// this should NOT happen and will prevent the app from running
console.error(`File ${name}.json not found in archive.`);
}
return;
}
content[name + ".json"].async("text").then(function (txt) {
if (name === "actor") {
Alpine.store("files").actor = JSON.parse(txt);