Skip to content

Commit

Permalink
feat: includeExclusiveSubmissions
Browse files Browse the repository at this point in the history
  • Loading branch information
std-microblock committed Feb 13, 2024
1 parent f66e87e commit 438291c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Binary file modified resources/dist.rc
Binary file not shown.
3 changes: 3 additions & 0 deletions src/celemod-ui/src/api/wegfan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export interface WegfanSearchSubmissionParams {
section?: string;
search?: string;
sort?: "new" | "updateAdded" | "updated" | "views" | "likes";
includeExclusiveSubmissions?: boolean;
}

export const searchSubmission = async ({
Expand All @@ -133,6 +134,7 @@ export const searchSubmission = async ({
section,
search,
sort,
includeExclusiveSubmissions
}: WegfanSearchSubmissionParams): Promise<WegfanSubmissionSearchResult> => {
const params = new URLSearchParams();
if (page) params.set("page", page.toString());
Expand All @@ -141,6 +143,7 @@ export const searchSubmission = async ({
if (section) params.set("section", section);
if (search) params.set("search", search);
if (sort) params.set("sort", sort);
if (includeExclusiveSubmissions) params.set("includeExclusiveSubmissions", includeExclusiveSubmissions.toString());
return fetch(`https://celeste.weg.fan/api/v2/submission/search?${params.toString()}`, {
headers: {
'User-Agent': celemodUA
Expand Down
5 changes: 4 additions & 1 deletion src/celemod-ui/src/routes/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Fragment, h } from 'preact';
import { useState, useEffect } from 'preact/hooks';
import { ModList } from '../components/ModList';
import { getMods, Mod, SearchModResp } from '../api/xmao';
import { useCurrentEverestVersion, useGamePath } from '../states';
import { useCurrentEverestVersion, useGamePath, useMirror } from '../states';
import './Search.scss';
import { Button } from '../components/Button';
import { Icon } from '../components/Icon';
Expand Down Expand Up @@ -40,6 +40,8 @@ export const Search = () => {
>('likes');
const [currentPage, setCurrentPage] = useState(1);

const [mirror] = useMirror();

const fetchModPage = async (page: number) => {
console.log('fetching', page);
setLoading(true);
Expand All @@ -51,6 +53,7 @@ export const Search = () => {
sort,
section: 'Mod',
size: 25,
includeExclusiveSubmissions: mirror === 'wegfan'
});
console.log('finished, size:', res.content.length);
setLoading(false);
Expand Down

0 comments on commit 438291c

Please sign in to comment.