mirror of
https://github.com/p-stream/p-stream.git
synced 2026-08-16 04:14:58 +00:00
what happened to my prettier config 😭
This commit is contained in:
parent
cb6675f67d
commit
9af6e36d94
6 changed files with 38 additions and 14 deletions
|
|
@ -6,7 +6,7 @@ import { AccountWithToken } from "@/stores/auth";
|
|||
import { BookmarkInput } from "./bookmarks";
|
||||
import { ProgressInput } from "./progress";
|
||||
import { SettingsInput } from "./settings";
|
||||
import { WatchHistoryInput, watchHistoryItemsToInputs } from "./watchHistory";
|
||||
import { WatchHistoryInput } from "./watchHistory";
|
||||
|
||||
export function importProgress(
|
||||
url: string,
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ import {
|
|||
importSettings,
|
||||
importWatchHistory,
|
||||
} from "@/backend/accounts/import";
|
||||
import { watchHistoryItemsToInputs } from "@/backend/accounts/watchHistory";
|
||||
// import { getLoginChallengeToken, loginAccount } from "@/backend/accounts/login";
|
||||
import { progressMediaItemToInputs } from "@/backend/accounts/progress";
|
||||
import {
|
||||
getRegisterChallengeToken,
|
||||
registerAccount,
|
||||
} from "@/backend/accounts/register";
|
||||
import { watchHistoryItemsToInputs } from "@/backend/accounts/watchHistory";
|
||||
// import { removeSession } from "@/backend/accounts/sessions";
|
||||
// import { getSettings } from "@/backend/accounts/settings";
|
||||
// import {
|
||||
|
|
@ -186,7 +186,14 @@ export function useMigration() {
|
|||
bytesToBase64(keys.seed),
|
||||
);
|
||||
|
||||
await importData(backendUrl, account, progress, watchHistory, bookmarks, groupOrder);
|
||||
await importData(
|
||||
backendUrl,
|
||||
account,
|
||||
progress,
|
||||
watchHistory,
|
||||
bookmarks,
|
||||
groupOrder,
|
||||
);
|
||||
|
||||
return account;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export function MigrationDownloadPage() {
|
|||
console.error("Error during data download:", error);
|
||||
setStatus("error");
|
||||
}
|
||||
}, [
|
||||
}, [
|
||||
bookmarks,
|
||||
progress,
|
||||
watchHistory,
|
||||
|
|
@ -174,13 +174,16 @@ export function MigrationDownloadPage() {
|
|||
|
||||
<div className="p-4 bg-background rounded-lg">
|
||||
<div className="flex items-center gap-2">
|
||||
<Icon icon={Icons.HISTORY} className="text-xl" />
|
||||
<Icon icon={Icons.CLOCK} className="text-xl" />
|
||||
<span className="font-medium">
|
||||
{t("migration.preview.items.watchHistory")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-xl font-bold mt-2">
|
||||
{Object.keys(persistedWatchHistory.items || watchHistory).length}
|
||||
{
|
||||
Object.keys(persistedWatchHistory.items || watchHistory)
|
||||
.length
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import {
|
|||
importSettings,
|
||||
importWatchHistory,
|
||||
} from "@/backend/accounts/import";
|
||||
import { watchHistoryItemsToInputs } from "@/backend/accounts/watchHistory";
|
||||
import { progressMediaItemToInputs } from "@/backend/accounts/progress";
|
||||
import { watchHistoryItemsToInputs } from "@/backend/accounts/watchHistory";
|
||||
import { Button } from "@/components/buttons/Button";
|
||||
import { Icon, Icons } from "@/components/Icon";
|
||||
import { SettingsCard } from "@/components/layout/SettingsCard";
|
||||
|
|
@ -157,7 +157,10 @@ export function MigrationUploadPage() {
|
|||
typeof item.watchedAt === "number"
|
||||
? item.watchedAt
|
||||
: Date.now(),
|
||||
completed: typeof item.completed === "boolean" ? item.completed : false,
|
||||
completed:
|
||||
typeof item.completed === "boolean"
|
||||
? item.completed
|
||||
: false,
|
||||
episodeId: item.episodeId,
|
||||
seasonId: item.seasonId,
|
||||
seasonNumber: item.seasonNumber,
|
||||
|
|
@ -214,7 +217,9 @@ export function MigrationUploadPage() {
|
|||
uploadedData.watchHistory &&
|
||||
Object.keys(uploadedData.watchHistory).length > 0
|
||||
) {
|
||||
const watchHistoryInputs = watchHistoryItemsToInputs(uploadedData.watchHistory);
|
||||
const watchHistoryInputs = watchHistoryItemsToInputs(
|
||||
uploadedData.watchHistory,
|
||||
);
|
||||
importPromises.push(
|
||||
importWatchHistory(backendUrl, user.account, watchHistoryInputs),
|
||||
);
|
||||
|
|
@ -296,6 +301,7 @@ export function MigrationUploadPage() {
|
|||
}, [
|
||||
replaceBookmarks,
|
||||
replaceProgress,
|
||||
replaceWatchHistory,
|
||||
uploadedData,
|
||||
user.account,
|
||||
handleBackendImport,
|
||||
|
|
@ -494,6 +500,7 @@ export function MigrationUploadPage() {
|
|||
uploadedData,
|
||||
replaceBookmarks,
|
||||
replaceProgress,
|
||||
replaceWatchHistory,
|
||||
setGroupOrder,
|
||||
preferencesStore,
|
||||
subtitleStore,
|
||||
|
|
@ -639,7 +646,7 @@ export function MigrationUploadPage() {
|
|||
|
||||
<div className="p-4 bg-background rounded-lg">
|
||||
<div className="flex items-center gap-2">
|
||||
<Icon icon={Icons.HISTORY} className="text-xl" />
|
||||
<Icon icon={Icons.CLOCK} className="text-xl" />
|
||||
<span className="font-medium">
|
||||
{t("migration.preview.items.watchHistory")}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -142,7 +142,9 @@ export const useProgressStore = create(
|
|||
watched: 0,
|
||||
};
|
||||
|
||||
const wasCompleted = item.progress.duration > 0 && item.progress.watched / item.progress.duration > 0.9;
|
||||
const wasCompleted =
|
||||
item.progress.duration > 0 &&
|
||||
item.progress.watched / item.progress.duration > 0.9;
|
||||
item.progress = { ...progress };
|
||||
|
||||
// Update watch history only if becoming completed
|
||||
|
|
@ -178,7 +180,9 @@ export const useProgressStore = create(
|
|||
};
|
||||
|
||||
const episodeItem = item.episodes[meta.episode.tmdbId];
|
||||
const wasCompleted = episodeItem.progress.duration > 0 && episodeItem.progress.watched / episodeItem.progress.duration > 0.9;
|
||||
const wasCompleted =
|
||||
episodeItem.progress.duration > 0 &&
|
||||
episodeItem.progress.watched / episodeItem.progress.duration > 0.9;
|
||||
episodeItem.progress = { ...progress };
|
||||
|
||||
// Update watch history only if becoming completed
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ export const useWatchHistoryStore = create(
|
|||
|
||||
// Only add/update if this is a completion or if the item doesn't exist yet
|
||||
const existingItem = s.items[key];
|
||||
const shouldUpdate = !existingItem || (completed && !existingItem.completed);
|
||||
const shouldUpdate =
|
||||
!existingItem || (completed && !existingItem.completed);
|
||||
|
||||
if (!shouldUpdate) return;
|
||||
|
||||
|
|
@ -128,7 +129,9 @@ export const useWatchHistoryStore = create(
|
|||
// add to updateQueue
|
||||
updateId += 1;
|
||||
s.updateQueue.push({
|
||||
tmdbId: existingItem.episodeId ? existingItem.seasonId || id.split("-")[0] : id,
|
||||
tmdbId: existingItem.episodeId
|
||||
? existingItem.seasonId || id.split("-")[0]
|
||||
: id,
|
||||
title: existingItem.title,
|
||||
year: existingItem.year,
|
||||
poster: existingItem.poster,
|
||||
|
|
|
|||
Loading…
Reference in a new issue