@stacksjs/browser-extension 0.70.249 → 0.70.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/firefox-previews.js
CHANGED
|
@@ -66,7 +66,8 @@ export async function listFirefoxPreviews(addonId, auth) {
|
|
|
66
66
|
return ((await response.json()).previews ?? []).map((preview, index) => ({
|
|
67
67
|
id: preview.id,
|
|
68
68
|
position: preview.position ?? index,
|
|
69
|
-
size: preview.image_size ?? [0, 0]
|
|
69
|
+
size: preview.image_size ?? [0, 0],
|
|
70
|
+
caption: typeof preview.caption === "string" ? preview.caption : preview.caption?.["en-US"]
|
|
70
71
|
}));
|
|
71
72
|
}
|
|
72
73
|
export async function syncFirefoxPreviews(config, options = {}) {
|
|
@@ -80,9 +81,20 @@ export async function syncFirefoxPreviews(config, options = {}) {
|
|
|
80
81
|
throw Error(`[browser-extension] Firefox screenshot not found: ${path}`);
|
|
81
82
|
})), size = imageSize(bytes);
|
|
82
83
|
return { path: file, bytes, width: size?.width ?? 0, height: size?.height ?? 0 };
|
|
83
|
-
})), auth = resolveAuth(options), existing = await listFirefoxPreviews(config.geckoId, auth);
|
|
84
|
-
if (
|
|
84
|
+
})), auth = resolveAuth(options), existing = await listFirefoxPreviews(config.geckoId, auth), ordered = existing.slice().sort((a, b) => a.position - b.position), imagesMatch = files.every((file) => file.width > 0 && file.height > 0) && ordered.length === files.length && ordered.every((preview, index) => preview.size[0] === files[index].width && preview.size[1] === files[index].height), captionFor = (index) => store.screenshotCaptions?.[index] ?? "", drifted = imagesMatch ? ordered.map((preview, index) => ({ preview, caption: captionFor(index) })).filter((entry) => (entry.preview.caption ?? "") !== entry.caption) : [];
|
|
85
|
+
if (imagesMatch && !drifted.length)
|
|
85
86
|
return { unchanged: !0, uploaded: [], removed: [] };
|
|
87
|
+
if (imagesMatch) {
|
|
88
|
+
if (options.dryRun)
|
|
89
|
+
return { unchanged: !1, uploaded: [], removed: [] };
|
|
90
|
+
for (const { preview, caption } of drifted)
|
|
91
|
+
await amo(`/addons/addon/${encodeURIComponent(config.geckoId)}/previews/${preview.id}/`, auth, {
|
|
92
|
+
method: "PATCH",
|
|
93
|
+
headers: { "Content-Type": "application/json" },
|
|
94
|
+
body: JSON.stringify({ caption: caption ? { "en-US": caption } : null })
|
|
95
|
+
});
|
|
96
|
+
return { unchanged: !1, uploaded: ordered, removed: [] };
|
|
97
|
+
}
|
|
86
98
|
if (options.dryRun)
|
|
87
99
|
return { unchanged: !1, uploaded: [], removed: existing.map((preview) => preview.id) };
|
|
88
100
|
const uploaded = [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/browser-extension",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.250",
|
|
5
5
|
"description": "Build MV3 browser extensions (Chrome, Firefox, Safari) the Stacks way — manifest, content/background scripts, DNR rules, packaging, Safari container app, all config-driven.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|