Skip to content

Commit cd0662c

Browse files
committed
load from backup if we need to
1 parent d1f2a75 commit cd0662c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/lib/storage.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ class Storage extends ScratchStorage {
4747
die,
4848
die,
4949
);
50+
this.addWebStore(
51+
[
52+
this.AssetType.ImageVector,
53+
this.AssetType.ImageBitmap,
54+
this.AssetType.Sound,
55+
this.AssetType.Font,
56+
],
57+
this.getAssetBackupGetConfig.bind(this),
58+
die,
59+
die,
60+
);
5061
}
5162
setProjectHost(projectHost) {
5263
this.projectHost = projectHost;
@@ -71,6 +82,13 @@ class Storage extends ScratchStorage {
7182

7283
return `${this.assetHost}/${this.projectId}_${asset.assetId}.${asset.dataFormat}`;
7384
}
85+
getAssetBackupGetConfig(asset) {
86+
if (!this.projectId) {
87+
return `https://assets.scratch.mit.edu/internalapi/asset/${asset.assetId}.${asset.dataFormat}/get/`;
88+
}
89+
90+
return `https://projects.penguinmod.com/api/v1/projects/backupassetget?asset_name=${this.projectId}_${asset.assetId}.${asset.dataFormat}`;
91+
}
7492
getScratchAssetGetConfig(asset) {
7593
return `https://assets.scratch.mit.edu/internalapi/asset/${asset.assetId}.${asset.dataFormat}/get/`;
7694
}

0 commit comments

Comments
 (0)