Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion substash/src/components/feed/Feed.solid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function FeedInner(props: Props) {
),
JSON.stringify({
pages: data.pages,
pageParams: data.pageParams,
pageParams: data.pageParams as (string | null)[],
savedAt: Date.now(),
} satisfies FeedCache),
);
Expand Down
2 changes: 1 addition & 1 deletion substash/src/components/layout/PageShell.astro
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const {
sessionStorage.setItem(SCROLL_KEY(location.href), String(Math.round(window.scrollY)));
} catch { /* quota */ }

const ev = e as TransitionBeforePreparationEvent;
const ev = e as Event & { navigationType: string; to: URL };
// Expose nav type so Feed islands can detect back-nav without depending
// on astro:after-swap timing (which fires before client:only hydration).
try { sessionStorage.setItem('substash:last-nav-type', ev.navigationType); } catch {}
Expand Down
3 changes: 2 additions & 1 deletion substash/src/lib/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ export const DEMO_ITEMS: ImageFeedItem[] = TOP_50_MEMES.map((meme, i) => {
type: "image" as const,
title,
subreddit: templateId,
subredditExtracted: true,
subredditDisplay:
templateId.charAt(0).toUpperCase() +
templateId.slice(1).replace(/-/g, " "),
Expand Down Expand Up @@ -648,7 +649,7 @@ export function getDemoImage(id: string): StashImage | undefined {
studio: item.studio ? { id: item.studio.id, name: item.studio.name } : null,
performers: item.performers,
tags: item.tags,
files: [{ id, path: null, basename: null, width: 800, height: 600 }],
files: [{ path: "", basename: "", width: 800, height: 600 }],
visual_files: [],
};
}
Expand Down
25 changes: 13 additions & 12 deletions substash/src/lib/search/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,19 @@ async function syncMedia(): Promise<number> {
let hasMoreImages = true;

while (hasMoreScenes || hasMoreImages) {
const [scenesData, imagesData] = await Promise.all([
hasMoreScenes
? stashRequest<FindScenesQuery>(FIND_SCENES, {
filter: { page, per_page: SYNC_PAGE_SIZE, sort: "id" },
}).catch(() => ({ findScenes: { count: 0, scenes: [] } }))
: Promise.resolve({ findScenes: { count: 0, scenes: [] } }),
hasMoreImages
? stashRequest<FindImagesQuery>(FIND_IMAGES, {
filter: { page, per_page: SYNC_PAGE_SIZE, sort: "id" },
}).catch(() => ({ findImages: { count: 0, images: [] } }))
: Promise.resolve({ findImages: { count: 0, images: [] } }),
]);
const [scenesData, imagesData]: [FindScenesQuery, FindImagesQuery] =
await Promise.all([
hasMoreScenes
? stashRequest<FindScenesQuery>(FIND_SCENES, {
filter: { page, per_page: SYNC_PAGE_SIZE, sort: "id" },
}).catch(() => ({ findScenes: { count: 0, scenes: [] } }))
: Promise.resolve({ findScenes: { count: 0, scenes: [] } }),
hasMoreImages
? stashRequest<FindImagesQuery>(FIND_IMAGES, {
filter: { page, per_page: SYNC_PAGE_SIZE, sort: "id" },
}).catch(() => ({ findImages: { count: 0, images: [] } }))
: Promise.resolve({ findImages: { count: 0, images: [] } }),
]);

const sceneRows: CacheRow[] = scenesData.findScenes.scenes.map((s) => {
const item = sceneToFeedItem(s);
Expand Down
5 changes: 4 additions & 1 deletion substash/src/lib/stash/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export type StashStudio = {
name: string;
image_path: Maybe<string>;
scene_count: Maybe<number>;
url: Maybe<string>;
};

export type StashPerformer = {
Expand All @@ -50,6 +49,8 @@ export type StashScene = {
title: Maybe<string>;
date: Maybe<string>;
created_at: Maybe<string>;
/** Only selected by FIND_SCENE, not the list queries. */
details?: Maybe<string>;
rating100: Maybe<number>;
o_counter: Maybe<number>;
play_count: Maybe<number>;
Expand Down Expand Up @@ -126,6 +127,8 @@ export type StashImage = {
title: Maybe<string>;
date: Maybe<string>;
created_at: Maybe<string>;
/** Only selected by FIND_IMAGE, not the list queries. */
details?: Maybe<string>;
rating100: Maybe<number>;
o_counter: Maybe<number>;
paths: StashImagePaths;
Expand Down
2 changes: 1 addition & 1 deletion substash/src/pages/performers/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if (DEMO_MODE) {
}

const cursorPayload = { page: 1, perPage: 20, total: count, sort, performerId: slug };
const displayName = performer?.name ?? slug;
const displayName = performer?.name ?? slug ?? "Performer";
---

<PageShell title={`Substash: ${displayName}`}>
Expand Down
Loading