Commit 9af475ad authored by Georgiana Piscoi's avatar Georgiana Piscoi

Fixed #69 - Serialize custom filters correctly for Edge backup

parent 6ea643d3
Pipeline #80203425 failed with stages
in 22 minutes and 7 seconds
......@@ -55,38 +55,32 @@ function saveToStorage()
{
browser.storage.local.set({
[BACKUP_NAME]: {
content: serialize(),
content: Array.from(serialize()),
lastModified: Date.now()
}
});
}
function serialize()
function* serialize()
{
let buffer = [];
for (let subscription of filterStorage.subscriptions())
{
if (subscription instanceof SpecialSubscription)
{
subscription.serialize(buffer);
buffer.push("[Subscription filters]");
subscription.serializeFilters(buffer);
yield* subscription.serialize();
yield* subscription.serializeFilters();
}
else if (subscription instanceof DownloadableSubscription)
{
let {homepage, title, url, disabled} = subscription;
buffer.push(
"[Subscription]",
`homepage=${homepage}`,
`title=${title}`,
`url=${url}`,
`disabled=${disabled}`
);
yield "[Subscription]";
yield `homepage=${homepage}`;
yield `title=${title}`;
yield `url=${url}`;
yield `disabled=${disabled}`;
}
}
return buffer;
}
function getBackupData()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment