aboutsummaryrefslogtreecommitdiff
path: root/src/stores/settings.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-06-05 11:10:22 +0000
committerFuwn <[email protected]>2026-06-05 11:10:22 +0000
commit4b56194ee6807acb56abf0949394efadabf830d4 (patch)
tree5cb2074a8d012bf9b7c900e7e44cbdfd0e15123f /src/stores/settings.ts
parentfix(lists): tick count down when media leaves a list (diff)
downloaddue.moe-4b56194ee6807acb56abf0949394efadabf830d4.tar.xz
due.moe-4b56194ee6807acb56abf0949394efadabf830d4.zip
feat(airing): replace SubsPlease with AnimeSchedule (sub+dub)
Source both subbed and dubbed episode schedules from AnimeSchedule.net v3 (absolute timestamps, episode numbers, delay windows, streams), keyed to AniList shows by title. Removes SubsPlease and its ~650-line fuzzy matcher. Countdown source is now a setting (native|sub|dub) with a dub->sub->native fallback. Requires ANIMESCHEDULE_CLIENT_TOKEN.
Diffstat (limited to 'src/stores/settings.ts')
-rw-r--r--src/stores/settings.ts29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/stores/settings.ts b/src/stores/settings.ts
index 1edab858..1e77afbd 100644
--- a/src/stores/settings.ts
+++ b/src/stores/settings.ts
@@ -6,7 +6,7 @@ import identity from "./identity";
import settingsSyncPulled from "./settingsSyncPulled";
import settingsSyncTimes from "./settingsSyncTimes";
-const VERSION = "1.0.1";
+const VERSION = "1.0.2";
export interface Settings {
cacheMangaMinutes: number;
@@ -49,7 +49,7 @@ export interface Settings {
disableUpcomingAnime: boolean;
display24HourTime: boolean;
displayCountdownRightAligned: boolean;
- displayNativeCountdown: boolean;
+ countdownSource: "native" | "sub" | "dub";
displayHoverCover: boolean;
displayDisableAnimations: boolean;
displayDisableNotifications: boolean;
@@ -101,7 +101,7 @@ const defaultSettings: Settings = {
disableUpcomingAnime: false,
display24HourTime: false,
displayCountdownRightAligned: false,
- displayNativeCountdown: false,
+ countdownSource: "sub",
displayHoverCover: false,
displayDisableAnimations: false,
displayDisableNotifications: false,
@@ -147,11 +147,28 @@ const defaultSettings: Settings = {
settingsVersion: VERSION,
};
+// Carry the retired `displayNativeCountdown` boolean over to `countdownSource`.
+const migrateSettings = (stored: Settings): Settings => {
+ const legacy = stored as Settings & { displayNativeCountdown?: boolean };
+
+ if (
+ legacy.countdownSource === undefined &&
+ legacy.displayNativeCountdown !== undefined
+ )
+ legacy.countdownSource = legacy.displayNativeCountdown ? "native" : "sub";
+
+ delete legacy.displayNativeCountdown;
+
+ return legacy;
+};
+
const createStore = () => {
const initialValue = browser
- ? parseJsonStringOrDefault(
- localStorage.getItem("settings") || "",
- defaultSettings,
+ ? migrateSettings(
+ parseJsonStringOrDefault(
+ localStorage.getItem("settings") || "",
+ defaultSettings,
+ ),
)
: defaultSettings;
const store = writable<Settings>(initialValue);