From 0e1869aacf288a2212aeba4012f11ece5e6e78ec Mon Sep 17 00:00:00 2001 From: Hare Date: Thu, 9 Apr 2026 02:29:19 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E6=A8=A9=E9=99=90=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.chrome.json | 2 +- manifest.firefox.json | 2 +- src/background/service-worker.ts | 10 +--------- src/shared/messages.ts | 5 +---- src/shared/storage.ts | 25 ------------------------- 5 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 src/shared/storage.ts diff --git a/manifest.chrome.json b/manifest.chrome.json index 912eb96..f305393 100644 --- a/manifest.chrome.json +++ b/manifest.chrome.json @@ -3,7 +3,7 @@ "name": "YT Playlist Features", "version": "0.1.0", "description": "Extract and work with YouTube playlist data", - "permissions": ["storage"], + "permissions": [], "background": { "service_worker": "background/service-worker.js" }, diff --git a/manifest.firefox.json b/manifest.firefox.json index 2ed03a7..1a1148c 100644 --- a/manifest.firefox.json +++ b/manifest.firefox.json @@ -3,7 +3,7 @@ "name": "YT Playlist Features", "version": "0.1.0", "description": "Extract and work with YouTube playlist data", - "permissions": ["storage"], + "permissions": [], "background": { "scripts": ["background/service-worker.js"] }, diff --git a/src/background/service-worker.ts b/src/background/service-worker.ts index bfa3e02..13a34d0 100644 --- a/src/background/service-worker.ts +++ b/src/background/service-worker.ts @@ -1,6 +1,5 @@ import browser from "webextension-polyfill"; import type { Message } from "../shared/messages"; -import { savePlaylist, getPlaylist } from "../shared/storage"; const LOG_PREFIX = "[yt-playlist-features:bg]"; @@ -11,15 +10,8 @@ browser.runtime.onMessage.addListener( if (msg.type === "PLAYLIST_EXTRACTED") { console.log( LOG_PREFIX, - `Saving playlist: "${msg.data.metadata.title}" (${msg.data.extractedCount} videos)`, + `Playlist: "${msg.data.metadata.title}" (${msg.data.extractedCount} videos)`, ); - await savePlaylist(msg.data); - return; - } - - if (msg.type === "GET_PLAYLIST") { - const data = await getPlaylist(msg.playlistId); - return { type: "PLAYLIST_RESPONSE", data } satisfies Message; } }, ); diff --git a/src/shared/messages.ts b/src/shared/messages.ts index 1442c65..a9ddd1f 100644 --- a/src/shared/messages.ts +++ b/src/shared/messages.ts @@ -1,6 +1,3 @@ import type { PlaylistData } from "../types/playlist"; -export type Message = - | { type: "PLAYLIST_EXTRACTED"; data: PlaylistData } - | { type: "GET_PLAYLIST"; playlistId: string } - | { type: "PLAYLIST_RESPONSE"; data: PlaylistData | null }; +export type Message = { type: "PLAYLIST_EXTRACTED"; data: PlaylistData }; diff --git a/src/shared/storage.ts b/src/shared/storage.ts deleted file mode 100644 index 9e69d5b..0000000 --- a/src/shared/storage.ts +++ /dev/null @@ -1,25 +0,0 @@ -import browser from "webextension-polyfill"; -import type { PlaylistData } from "../types/playlist"; - -const STORAGE_PREFIX = "playlist:"; - -export async function savePlaylist(data: PlaylistData): Promise { - await browser.storage.local.set({ - [STORAGE_PREFIX + data.metadata.playlistId]: data, - }); -} - -export async function getPlaylist( - playlistId: string, -): Promise { - const key = STORAGE_PREFIX + playlistId; - const result = await browser.storage.local.get(key); - return (result[key] as PlaylistData) ?? null; -} - -export async function getAllPlaylists(): Promise { - const all = await browser.storage.local.get(null); - return Object.entries(all) - .filter(([key]) => key.startsWith(STORAGE_PREFIX)) - .map(([, value]) => value as PlaylistData); -}