This commit is contained in:
Marek Lenczewski
2026-04-08 08:51:59 +02:00
parent 375a9cd386
commit a0c8ecaf27
12 changed files with 75 additions and 92 deletions

View File

@@ -1,7 +1,7 @@
const SERVER_URL = "http://marha.local:8000/videos";
const SERVER_BASE = "http://marha.local:8000";
browser.runtime.onMessage.addListener((video) => {
fetch(SERVER_URL, {
browser.runtime.onMessage.addListener(({ profileId, video }) => {
fetch(`${SERVER_BASE}/profiles/${profileId}/videos`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(video),

View File

@@ -25,10 +25,9 @@ function extractVideoFromCard(element) {
async function sendVideo(video) {
const stored = await browser.storage.local.get("profileId");
const profileId = stored.profileId || null;
const payload = { ...video, profileId };
console.log(`[YT-Erfasser] Video senden (Profil: ${profileId})`, payload.title);
browser.runtime.sendMessage(payload);
const profileId = stored.profileId || 1;
console.log(`[YT-Erfasser] Video senden (Profil: ${profileId})`, video.title);
browser.runtime.sendMessage({ profileId, video });
}
// --- IntersectionObserver: nur sichtbare Cards erfassen ---