v5.2.3-beta.1

This commit is contained in:
2026-04-10 13:18:18 -04:00
6 changed files with 114 additions and 2 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ function exportSettings() {
chrome.storage.local.get(null, function (localStorage) {
const backup = importExportUtils.buildBackupPayload(
storage,
localStorage,
importExportUtils.filterLocalSettingsForExport(localStorage),
new Date()
);
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "Speeder",
"short_name": "Speeder",
"version": "5.2.2.0",
"version": "5.2.3",
"manifest_version": 2,
"description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts (New and improved version of \"Video Speed Controller\")",
"homepage_url": "https://github.com/SoPat712/speeder",
+24
View File
@@ -46,6 +46,29 @@
});
}
/**
* Local-only keys excluded from backup JSON. These are disposable caches
* (e.g. Lucide tags.json) that bloat exports and are refetched when needed.
* Keep in sync with lucide-client.js (LUCIDE_TAGS_CACHE_KEY + "At").
*/
var localSettingsKeysOmittedFromExport = [
"lucideTagsCacheV1",
"lucideTagsCacheV1At"
];
function filterLocalSettingsForExport(local) {
if (!local || typeof local !== "object" || Array.isArray(local)) {
return {};
}
var out = {};
for (var key in local) {
if (!Object.prototype.hasOwnProperty.call(local, key)) continue;
if (localSettingsKeysOmittedFromExport.indexOf(key) !== -1) continue;
out[key] = local[key];
}
return out;
}
function generateBackupFilename(now) {
var date = now instanceof Date ? now : new Date(now || Date.now());
var year = date.getFullYear();
@@ -117,6 +140,7 @@
return {
buildBackupPayload: buildBackupPayload,
extractImportSettings: extractImportSettings,
filterLocalSettingsForExport: filterLocalSettingsForExport,
generateBackupFilename: generateBackupFilename,
isRecognizedRawSettingsObject: isRecognizedRawSettingsObject,
parseImportText: parseImportText
+48
View File
@@ -79,6 +79,54 @@ describe("import/export flows", () => {
window.Blob = OriginalBlob;
});
it("export strips lucideTagsCacheV1 from localSettings", async () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 3, 4, 8, 9, 10));
await setupImportExport({
sync: { rememberSpeed: true },
local: {
customButtonIcons: { faster: { slug: "rocket", svg: "<svg/>" } },
lucideTagsCacheV1: { "a-arrow-down": ["letter"] },
lucideTagsCacheV1At: 42
}
});
const OriginalBlob = window.Blob;
class TestBlob {
constructor(parts) {
this.parts = parts;
}
async text() {
return this.parts.join("");
}
}
globalThis.Blob = TestBlob;
window.Blob = TestBlob;
let capturedBlob = null;
Object.defineProperty(window.URL, "createObjectURL", {
configurable: true,
value: vi.fn((blob) => {
capturedBlob = blob;
return "blob:test";
})
});
Object.defineProperty(window.URL, "revokeObjectURL", {
configurable: true,
value: vi.fn(() => {})
});
vi.spyOn(window.HTMLAnchorElement.prototype, "click").mockImplementation(
() => {}
);
document.getElementById("exportSettings").click();
await flushAsyncWork();
expect(JSON.parse(await capturedBlob.text()).localSettings).toEqual({
customButtonIcons: { faster: { slug: "rocket", svg: "<svg/>" } }
});
globalThis.Blob = OriginalBlob;
window.Blob = OriginalBlob;
});
it("imports wrapped backup payloads and refreshes options", async () => {
vi.useFakeTimers();
const chrome = await setupImportExport();
+30
View File
@@ -87,6 +87,36 @@ describe("importExport.js", () => {
expect(document.querySelector("#status").textContent).toContain("exported");
});
it("omits Lucide tags cache from exported localSettings", async () => {
vi.spyOn(window.HTMLAnchorElement.prototype, "click").mockImplementation(
() => {}
);
const { createObjectURL } = bootImportExport({
syncData: { rememberSpeed: true },
localData: {
customButtonIcons: {
faster: { slug: "rocket", svg: "<svg></svg>" }
},
lucideTagsCacheV1: { "a-arrow-down": ["letter", "text"] },
lucideTagsCacheV1At: 999
}
});
document.querySelector("#exportSettings").click();
await flushAsyncWork();
const blob = createObjectURL.mock.calls[0][0];
const backup = JSON.parse(await blob.text());
expect(backup.localSettings).toEqual({
customButtonIcons: {
faster: { slug: "rocket", svg: "<svg></svg>" }
}
});
expect(backup.localSettings.lucideTagsCacheV1).toBeUndefined();
expect(backup.localSettings.lucideTagsCacheV1At).toBeUndefined();
});
it("imports wrapped backups, restores local data, and refreshes the options page", async () => {
const { chrome } = bootImportExport();
window.restore_options = vi.fn();
+10
View File
@@ -149,5 +149,15 @@ describe("shared helpers", () => {
expect(importExportUtils.isRecognizedRawSettingsObject({ wat: true })).toBe(
false
);
expect(
importExportUtils.filterLocalSettingsForExport({
customButtonIcons: { faster: { slug: "zap" } },
lucideTagsCacheV1: { "a-arrow-down": ["letter"] },
lucideTagsCacheV1At: 123
})
).toEqual({
customButtonIcons: { faster: { slug: "zap" } }
});
});
});