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:
parent
e80be8e974
commit
82bde0d275
@ -1596,6 +1596,6 @@
|
||||
</symbol>
|
||||
</svg>
|
||||
|
||||
<script src="js/main.js?20241201b"></script>
|
||||
<script src="js/main.js?20241201c"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
12
js/main.js
12
js/main.js
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user