This commit is contained in:
Marek Lenczewski
2026-04-15 23:07:21 +02:00
parent 1ca4371ea0
commit f439231e3c
8 changed files with 133 additions and 14 deletions

View File

@@ -1,9 +1,20 @@
const SERVER_BASE = "https://youtube.marha.de";
browser.runtime.onMessage.addListener(({ profileId, video }) => {
fetch(`${SERVER_BASE}/profiles/${profileId}/videos`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(video),
}).catch(() => {});
browser.runtime.onMessage.addListener((msg) => {
if (msg?.type === "sync-cookies") {
return syncCookies();
}
if (msg?.profileId && msg?.video) {
fetch(`${SERVER_BASE}/profiles/${msg.profileId}/videos`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(msg.video),
}).catch(() => {});
}
});
syncCookies();
browser.alarms.create("cookieSync", { periodInMinutes: 1440 });
browser.alarms.onAlarm.addListener((a) => {
if (a.name === "cookieSync") syncCookies();
});