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>
|
</symbol>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<script src="js/main.js?20241201b"></script>
|
<script src="js/main.js?20241201c"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
12
js/main.js
12
js/main.js
@ -756,6 +756,18 @@ function resetStores() {
|
|||||||
function loadJsonFile(name) {
|
function loadJsonFile(name) {
|
||||||
const content = Alpine.store("files").raw;
|
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) {
|
content[name + ".json"].async("text").then(function (txt) {
|
||||||
if (name === "actor") {
|
if (name === "actor") {
|
||||||
Alpine.store("files").actor = JSON.parse(txt);
|
Alpine.store("files").actor = JSON.parse(txt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user