update
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user