chore(wailsv3): migrate frontend to v3 bindings and runtime

Regenerated bindings with wails3 generate bindings (1 service, 29 methods, 25 models) into frontend/bindings/AniTrack as TypeScript; output verified byte-deterministic across regens, so it is committed like wailsjs was.

- 10 Svelte files: wailsjs/go/main/App imports -> import {App} from bindings/AniTrack with App.* call prefixes. No logic or markup changes.
- WebsiteLink.svelte: BrowserOpenURL -> Browser.OpenURL from @wailsio/runtime.
- AvatarMenu.svelte: runtime.Quit -> Application.Quit from @wailsio/runtime.
- package.json: add @wailsio/runtime pinned to 3.0.0-beta.20 (exact, matching the Go framework); lockfile updated, all deps still max in-range, majors deferred.
- Production vite build passes with the new bindings.
This commit is contained in:
John O'Keefe
2026-09-13 17:10:17 -04:00
parent 850c1c6aee
commit 0642163844
18 changed files with 475 additions and 79 deletions
+131
View File
@@ -0,0 +1,131 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* App struct
* @module
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";
export function AniListBrowse(page: number, perPage: number, id: number, isAdult: boolean, search: string, format: string[] | null, status: string, countryOfOrigin: string, source: string, season: string, seasonYear: number, year: string, onList: boolean, yearLesser: number, yearGreater: number, episodeLesser: number, episodeGreater: number, durationLesser: number, durationGreater: number, chapterLesser: number, chapterGreater: number, volumeLesser: number, volumeGreater: number, licensedBy: number[] | null, isLicensed: boolean, genres: string[] | null, excludedGenres: string[] | null, tags: string[] | null, excludedTags: string[] | null, minimumTagRank: number, sort: string[] | null): $CancellablePromise<$models.AniListCurrentUserWatchList> {
return $Call.ByID(509958107, page, perPage, id, isAdult, search, format, status, countryOfOrigin, source, season, seasonYear, year, onList, yearLesser, yearGreater, episodeLesser, episodeGreater, durationLesser, durationGreater, chapterLesser, chapterGreater, volumeLesser, volumeGreater, licensedBy, isLicensed, genres, excludedGenres, tags, excludedTags, minimumTagRank, sort);
}
export function AniListDeleteEntry(mediaListId: number): $CancellablePromise<$models.DeleteAniListReturn> {
return $Call.ByID(814044062, mediaListId);
}
export function AniListLogin(): $CancellablePromise<void> {
return $Call.ByID(1289244998);
}
export function AniListSearch(query: string): $CancellablePromise<any> {
return $Call.ByID(535361453, query);
}
export function AniListUpdateEntry(updateBody: $models.AniListUpdateVariables): $CancellablePromise<$models.AniListGetSingleAnime> {
return $Call.ByID(1288135876, updateBody);
}
export function CheckIfAniListLoggedIn(): $CancellablePromise<boolean> {
return $Call.ByID(3851355);
}
export function CheckIfMyAnimeListLoggedIn(): $CancellablePromise<boolean> {
return $Call.ByID(3447028267);
}
export function CheckIfSimklLoggedIn(): $CancellablePromise<boolean> {
return $Call.ByID(2483871029);
}
export function DeleteMyAnimeListEntry(id: number): $CancellablePromise<boolean> {
return $Call.ByID(3393515640, id);
}
export function GetAniListItem(aniId: number, login: boolean): $CancellablePromise<$models.AniListGetSingleAnime> {
return $Call.ByID(2336493728, aniId, login);
}
export function GetAniListLoggedInUser(): $CancellablePromise<$models.AniListUser> {
return $Call.ByID(448499589);
}
export function GetAniListUserWatchingList(page: number, perPage: number, sort: string): $CancellablePromise<$models.AniListCurrentUserWatchList> {
return $Call.ByID(3978330877, page, perPage, sort);
}
export function GetMyAnimeList(count: number): $CancellablePromise<$models.MALWatchlist> {
return $Call.ByID(1771759135, count);
}
export function GetMyAnimeListAnime(id: number): $CancellablePromise<$models.MALAnime> {
return $Call.ByID(1368244377, id);
}
export function GetMyAnimeListLoggedInUser(): $CancellablePromise<$models.MyAnimeListUser> {
return $Call.ByID(768446973);
}
export function GetSimklLoggedInUser(): $CancellablePromise<$models.SimklUser> {
return $Call.ByID(2872164207);
}
export function LogoutAniList(): $CancellablePromise<string> {
return $Call.ByID(1911309547);
}
export function LogoutMyAnimeList(): $CancellablePromise<string> {
return $Call.ByID(2568421227);
}
export function LogoutSimkl(): $CancellablePromise<string> {
return $Call.ByID(734133957);
}
export function MyAnimeListLogin(): $CancellablePromise<void> {
return $Call.ByID(439153478);
}
export function MyAnimeListUpdate(anime: $models.MALAnime, update: $models.MALUploadStatus): $CancellablePromise<$models.MalListStatus> {
return $Call.ByID(2544871568, anime, update);
}
export function ShowVersion(): $CancellablePromise<void> {
return $Call.ByID(4089383544);
}
export function SimklGetUserWatchlist(): $CancellablePromise<$models.SimklWatchListType> {
return $Call.ByID(3479741957);
}
export function SimklLogin(): $CancellablePromise<void> {
return $Call.ByID(4146248);
}
export function SimklSearch(aniListAnime: $models.MediaList): $CancellablePromise<$models.SimklAnime> {
return $Call.ByID(3130411731, aniListAnime);
}
export function SimklSyncEpisodes(anime: $models.SimklAnime, progress: number): $CancellablePromise<$models.SimklAnime> {
return $Call.ByID(3607297770, anime, progress);
}
export function SimklSyncRating(anime: $models.SimklAnime, rating: number): $CancellablePromise<$models.SimklAnime> {
return $Call.ByID(2909509273, anime, rating);
}
export function SimklSyncRemove(anime: $models.SimklAnime): $CancellablePromise<boolean> {
return $Call.ByID(1794667404, anime);
}
export function SimklSyncStatus(anime: $models.SimklAnime, status: string): $CancellablePromise<$models.SimklAnime> {
return $Call.ByID(2561714086, anime, status);
}
+35
View File
@@ -0,0 +1,35 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as App from "./app.js";
export {
App
};
export type {
AiringScheduleNode,
AniListCurrentUserWatchList,
AniListGetSingleAnime,
AniListUpdateVariables,
AniListUser,
AnimeStatistics,
CompletedAt,
DeleteAniListReturn,
FlexString,
MALAnime,
MALUploadStatus,
MALWatchlist,
MalListStatus,
Media,
MediaAiringSchedule,
MediaFuzzyDate,
MediaList,
MediaRelation,
MediaRelations,
MediaTitle,
MyAnimeListUser,
SimklAnime,
SimklUser,
SimklWatchListType,
StartedAt
} from "./models.js";
+240
View File
@@ -0,0 +1,240 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export interface AiringScheduleNode {
"id": number;
"airingAt": number;
"timeUntilAiring": number;
"episode": number;
"mediaId": number;
}
export interface AniListCurrentUserWatchList {
"data": {"Page": {"pageInfo": {"total": number, "perPage": number, "currentPage": number, "lastPage": number, "hasNextPage": boolean}, "mediaList": MediaList[] | null}};
}
export interface AniListGetSingleAnime {
"data": {"MediaList": MediaList};
}
export interface AniListUpdateVariables {
"mediaId": number;
"progress": number;
"status": string;
"score": number;
"repeat": number;
"notes": string;
"startedAt": StartedAt;
"completedAt": CompletedAt;
}
export interface AniListUser {
"data": {"Viewer": {"id": number, "name": string, "avatar": {"large": string, "medium": string}, "bannerImage": string, "siteUrl": string}};
}
export interface AnimeStatistics {
"num_items_watching": number;
"num_items_completed": number;
"num_items_on_hold": number;
"num_items_dropped": number;
"num_items_plan_to_watch": number;
"num_items": number;
"num_days_watched": number;
"num_days_watching": number;
"num_days_completed": number;
"num_days_on_hold": number;
"num_days_dropped": number;
"num_days": number;
"num_episodes": number;
"num_times_rewatched": number;
"mean_score": number;
}
export interface CompletedAt {
"year": number;
"month": number;
"day": number;
}
export interface DeleteAniListReturn {
"data": {"DeleteMediaListEntry": {"deleted": boolean}};
}
export type FlexString = string;
export interface MALAnime {
"id": number;
"title": string;
"main_picture": {"large": string, "medium": string};
"alternative_titles": {"synonyms": string[] | null, "en": string, "ja": string};
"start_date": string;
"end_date": string;
"synopsis": string;
"mean": number;
"rank": number;
"popularity": number;
"num_list_users": number;
"num_scoring_users": number;
"nsfw": string;
"genres": {"id": number, "name": string}[] | null;
"created_at": string;
"updated_at": string;
"media_type": string;
"status": string;
"my_list_status": MalListStatus;
"num_episodes": number;
"start_season": {"year": number, "season": string};
"broadcast": {"day_of_the_week": string, "start_time": string};
"source": string;
"average_episode_duration": number;
"rating": string;
"studios": {"id": number, "name": string}[] | null;
"pictures": {"large": string, "medium": string}[] | null;
"background": string;
"related_anime": {"node": MALAnime, "relation_type": string, "relation_type_formatted": string}[] | null;
"recommendations": {"node": MALAnime, "num_recommendations": number}[] | null;
"Statistics": {"num_list_users": number, "Status": {"watching": FlexString, "completed": FlexString, "on_hold": FlexString, "dropped": FlexString, "plan_to_watch": FlexString}};
}
export interface MALUploadStatus {
"status": string;
"is_rewatching": boolean;
"score": number;
"num_watched_episodes": number;
"num_times_rewatched": number;
"comments": string;
}
export interface MALWatchlist {
"data": {"node": {"id": number, "title": string, "main_picture": {"medium": string, "large": string}}, "list_status": {"status": string, "score": number, "num_episodes_watched": number, "is_rewatching": boolean, "updated_at": string, "start_date": string, "finish_date": string}}[] | null;
"paging": {"previous": string, "next": string};
}
export interface MalListStatus {
"status": string;
"score": number;
"num_episodes_watched": number;
"is_rewatching": boolean;
"start_date": string;
"finish_date": string;
"priority": number;
"num_times_rewatched": number;
"rewatch_value": number;
"tags": string[] | null;
"comments": string;
"updated_at": string;
}
export interface Media {
"id": number;
"idMal": number;
"title": MediaTitle;
"description": string;
"coverImage": {"ExtraLarge": string, "large": string, "Medium": string, "Color": string};
"BannerImage": string;
"Format": string;
"season": string;
"seasonYear": number;
"status": string;
"episodes": number;
"Duration": number;
"CountryOfOrigin": string;
"Source": string;
"Synonyms": string[] | null;
"AverageScore": number;
"MeanScore": number;
"Popularity": number;
"Trending": number;
"Favourites": number;
"relations": MediaRelations;
"startDate": MediaFuzzyDate;
"endDate": MediaFuzzyDate;
"nextAiringEpisode": {"airingAt": number, "timeUntilAiring": number, "episode": number};
"airingSchedule": MediaAiringSchedule;
"genres": string[] | null;
"tags": {"id": number, "name": string, "description": string, "rank": number, "isMediaSpoiler": boolean, "isAdult": boolean}[] | null;
"isAdult": boolean;
}
export interface MediaAiringSchedule {
"nodes": AiringScheduleNode[] | null;
}
export interface MediaFuzzyDate {
"year": number;
"month": number;
"day": number;
}
export interface MediaList {
"id": number;
"mediaId": number;
"userId": number;
"status": string;
"media": Media;
"startedAt": {"year": number, "month": number, "day": number};
"completedAt": {"year": number, "month": number, "day": number};
"notes": string;
"progress": number;
"score": number;
"repeat": number;
"user": {"id": number, "name": string, "avatar": {"large": string, "medium": string}, "statistics": {"anime": {"count": number, "statuses": {"status": string, "count": number}[] | null}}};
}
export interface MediaRelation {
"id": number;
"title": MediaTitle;
}
export interface MediaRelations {
"nodes": MediaRelation[] | null;
}
export interface MediaTitle {
"userPreferred": string;
"romaji": string;
"english": string;
"native": string;
}
export interface MyAnimeListUser {
"id": number;
"name": string;
"picture": string;
"gender": string;
"birthday": string;
"location": string;
"joined_at": string;
"anime_statistics": AnimeStatistics;
"time_zone": string;
"is_supporter": boolean;
}
export interface SimklAnime {
"last_watched_at": string;
"status": string;
"user_rating": number;
"last_watched": string;
"next_to_watch": string;
"watched_episodes_count": number;
"total_episodes_count": number;
"not_aired_episodes_count": number;
"show": {"title": string, "poster": string, "ids": {"simkl": number, "slug": string, "offjp": string, "tw": string, "ann": string, "mal": string, "wikien": string, "wikijp": string, "allcin": string, "imdb": string, "tmdb": string, "offen": string, "crunchyroll": string, "tvdbslug": string, "anilist": string, "animeplanet": string, "anisearch": string, "kitsu": string, "livechart": string, "traktslug": string, "anidb": string}};
"anime_type": string;
}
export interface SimklUser {
"user": {"name": string, "joined_at": string, "gender": string, "avatar": string, "bio": string, "loc": string, "age": string};
"account": {"id": number, "timezone": string, "type": string};
"connections": {"facebook": boolean};
}
export interface SimklWatchListType {
"anime": SimklAnime[] | null;
}
export interface StartedAt {
"year": number;
"month": number;
"day": number;
}
@@ -0,0 +1,9 @@
//@ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";
Object.freeze($Create.Events);
@@ -0,0 +1,2 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
+7
View File
@@ -9,6 +9,7 @@
"version": "0.0.0",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@wailsio/runtime": "3.0.0-beta.20",
"flowbite": "^2.5.1",
"flowbite-svelte": "^0.46.16",
"moment": "^2.30.1"
@@ -651,6 +652,12 @@
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
"license": "MIT"
},
"node_modules/@wailsio/runtime": {
"version": "3.0.0-beta.20",
"resolved": "https://registry.npmjs.org/@wailsio/runtime/-/runtime-3.0.0-beta.20.tgz",
"integrity": "sha512-oPpWBgNK4QISP9/AweVnRIBg6hlEP7HVi0i4gVl0+6JEsQ6vDDTJXmbyy/j6AITPHWq7cWOYl2Ey5uucl1u3hw==",
"license": "MIT"
},
"node_modules/@yr/monotone-cubic-spline": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz",
+1
View File
@@ -27,6 +27,7 @@
},
"dependencies": {
"@popperjs/core": "^2.11.8",
"@wailsio/runtime": "3.0.0-beta.20",
"flowbite": "^2.5.1",
"flowbite-svelte": "^0.46.16",
"moment": "^2.30.1"
+4 -8
View File
@@ -20,11 +20,7 @@
import { CheckIfAniListLoggedInAndLoadWatchList } from "./helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
import { CheckIfMALLoggedInAndSetUser } from "./helperModules/CheckIfMyAnimeListLoggedIn.svelte";
import { CheckIfSimklLoggedInAndSetUser } from "./helperModules/CheckIsSimklLoggedIn.svelte";
import {
CheckIfAniListLoggedIn,
GetMyAnimeList,
SimklGetUserWatchlist,
} from "../wailsjs/go/main/App";
import {App} from "../bindings/AniTrack";
import { loc } from "svelte-spa-router";
import ErrorModal from "./helperComponents/ErrorModal.svelte";
@@ -49,10 +45,10 @@
await CheckIfAniListLoggedInAndLoadWatchList();
}
if ($malLoggedIn && $malPrimary) {
await GetMyAnimeList(1000).then((w) => malWatchList.set(w));
await App.GetMyAnimeList(1000).then((w) => malWatchList.set(w));
}
if ($simklLoggedIn && $simklPrimary) {
await SimklGetUserWatchlist().then((w) => simklWatchList.set(w));
await App.SimklGetUserWatchlist().then((w) => simklWatchList.set(w));
}
watchlistNeedsRefresh.set(false);
@@ -67,7 +63,7 @@
"/": Home,
"/anime/:id": wrap({
asyncComponent: () => import("./routes/AnimeRoutePage.svelte"),
conditions: [async () => await CheckIfAniListLoggedIn()],
conditions: [async () => await App.CheckIfAniListLoggedIn()],
loadingComponent: Spinner,
}),
// '*': "Not Found"
+9 -18
View File
@@ -28,16 +28,7 @@
import type { StatusOption, StatusOptions } from "../helperTypes/StatusTypes";
import type { AniListUpdateVariables } from "../anilist/types/AniListTypes";
import { convertDateToAniList } from "../helperFunctions/convertDateToAniList";
import {
AniListDeleteEntry,
AniListUpdateEntry,
DeleteMyAnimeListEntry,
MyAnimeListUpdate,
SimklSyncEpisodes,
SimklSyncRating,
SimklSyncRemove,
SimklSyncStatus,
} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
import Datepicker from "./Datepicker.svelte";
@@ -207,7 +198,7 @@
startedAt: convertDateToAniList(startedAtDate),
completedAt: convertDateToAniList(completedAtDate),
};
await AniListUpdateEntry(body).then((value: AniListGetSingleAnime) => {
await App.AniListUpdateEntry(body).then((value: AniListGetSingleAnime) => {
if (!value.data?.MediaList || value.data.MediaList.mediaId === 0) {
setApiError(
"anilist",
@@ -261,7 +252,7 @@
comments: submitData.notes,
};
await MyAnimeListUpdate(currentMalAnime, body).then(
await App.MyAnimeListUpdate(currentMalAnime, body).then(
(malAnimeReturn: MalListStatus) => {
malAnime.update((value) => {
value.my_list_status.status = malAnimeReturn.status;
@@ -317,7 +308,7 @@
try {
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
if (currentSimklAnime.watched_episodes_count !== submitData.episodes) {
await SimklSyncEpisodes(currentSimklAnime, submitData.episodes).then(
await App.SimklSyncEpisodes(currentSimklAnime, submitData.episodes).then(
(value: SimklAnime) => {
AddAnimeServiceToTable({
id: `s-${value.show.ids.simkl}`,
@@ -340,7 +331,7 @@
}
if (currentSimklAnime.user_rating !== submitData.rating) {
await SimklSyncRating(currentSimklAnime, submitData.rating).then(
await App.SimklSyncRating(currentSimklAnime, submitData.rating).then(
(value) => {
AddAnimeServiceToTable({
id: `s-${value.show.ids.simkl}`,
@@ -363,7 +354,7 @@
}
if (currentSimklAnime.status !== submitData.status.simkl) {
await SimklSyncStatus(
await App.SimklSyncStatus(
currentSimklAnime,
submitData.status.simkl,
).then((value) => {
@@ -409,7 +400,7 @@
isAniListLoggedIn &&
currentAniListAnime.data.MediaList.mediaId !== 0
) {
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id);
await App.AniListDeleteEntry(currentAniListAnime.data.MediaList.id);
AddAnimeServiceToTable({
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
title,
@@ -436,7 +427,7 @@
try {
if (malLoggedIn && currentMalAnime.id !== 0) {
await DeleteMyAnimeListEntry(currentMalAnime.id);
await App.DeleteMyAnimeListEntry(currentMalAnime.id);
AddAnimeServiceToTable({
id: `m-${currentMalAnime.id}`,
title: currentMalAnime.title,
@@ -463,7 +454,7 @@
try {
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
await SimklSyncRemove(currentSimklAnime);
await App.SimklSyncRemove(currentSimklAnime);
AddAnimeServiceToTable({
id: `s-${currentSimklAnime.show.ids.simkl}`,
title: currentSimklAnime.show.title,
@@ -16,10 +16,10 @@
logoutOfSimkl,
serviceLoggingIn,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import * as runtime from "../../wailsjs/runtime";
import {Application} from "@wailsio/runtime";
import type { MyAnimeListUser } from "../mal/types/MALTypes";
import type { SimklUser } from "../simkl/types/simklTypes";
import { ShowVersion } from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
let currentAniListUser: AniListUser;
let currentMALUser: MyAnimeListUser;
@@ -189,14 +189,14 @@
<button
on:click={() => {
dropdownUser();
ShowVersion();
App.ShowVersion();
}}
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
>
Version
</button>
<button
on:click={() => runtime.Quit()}
on:click={() => Application.Quit()}
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
>
Exit Application
@@ -8,7 +8,7 @@
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import type { AniListCurrentUserWatchList } from "../anilist/types/AniListCurrentUserWatchListType";
import { GetAniListUserWatchingList } from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
let aniListWatchListLoaded: AniListCurrentUserWatchList;
let page: number;
@@ -23,7 +23,7 @@
const perPageOptions = [10, 20, 50];
function ChangeWatchListPage(newPage: number) {
GetAniListUserWatchingList(newPage, perPage, sort).then((result) => {
App.GetAniListUserWatchingList(newPage, perPage, sort).then((result) => {
watchListPage.set(newPage);
aniListWatchlist.set(result);
aniListLoggedIn.set(true);
@@ -43,7 +43,7 @@
function changeCountPerPage(
e: Event & { currentTarget: HTMLSelectElement },
): void {
GetAniListUserWatchingList(1, Number(e.currentTarget.value), sort).then(
App.GetAniListUserWatchingList(1, Number(e.currentTarget.value), sort).then(
(result) => {
animePerPage.set(Number(e.currentTarget.value));
watchListPage.set(1);
+2 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import {AniListSearch} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import type {AniSearchList} from "../anilist/types/AniListTypes";
import {push} from "svelte-spa-router";
@@ -81,7 +81,7 @@
reject(new Error("AniList is taking too long to respond. Please try again."))
}, SEARCH_TIMEOUT_MS)
})
const result = await Promise.race([AniListSearch(term), timeout])
const result = await Promise.race([App.AniListSearch(term), timeout])
if (searchRequestId !== myRequest) {
return
}
+2 -2
View File
@@ -6,7 +6,7 @@
aniListWatchlist,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import { MediaListSort } from "../anilist/types/AniListTypes";
import { GetAniListUserWatchingList } from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
const sortTypes = [
{ value: MediaListSort.MediaId, name: "Media Id Asc" },
@@ -55,7 +55,7 @@
console.log(sort);
async function changeWatchListSort() {
const result = await GetAniListUserWatchingList(
const result = await App.GetAniListUserWatchingList(
$watchListPage,
$animePerPage,
$aniListSort,
@@ -1,5 +1,5 @@
<script lang="ts">
import { BrowserOpenURL } from "../../wailsjs/runtime";
import {Browser} from "@wailsio/runtime";
export let id: string;
export let url = "";
@@ -25,7 +25,7 @@
<button
type="button"
class="underline underline-offset-2 px-4 py-1"
on:click={() => BrowserOpenURL(url)}>{newId}</button
on:click={() => Browser.OpenURL(url)}>{newId}</button
>
{:else}
{id}
@@ -1,9 +1,5 @@
<script lang="ts" context="module">
import {
CheckIfAniListLoggedIn,
GetAniListLoggedInUser,
GetAniListUserWatchingList,
} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import {
aniListUser,
watchListPage,
@@ -29,7 +25,7 @@
export const LoadAniListUser = async () => {
try {
await GetAniListLoggedInUser().then((user) => {
await App.GetAniListLoggedInUser().then((user) => {
aniListUser.set(user);
});
} catch (err) {
@@ -46,7 +42,7 @@
export const LoadAniListWatchList = async () => {
try {
const watchList = await GetAniListUserWatchingList(page, perPage, sort);
const watchList = await App.GetAniListUserWatchingList(page, perPage, sort);
aniListWatchlist.set(watchList);
clearApiError();
} catch (err) {
@@ -63,7 +59,7 @@
export const CheckIfAniListLoggedInAndLoadWatchList = async () => {
serviceLoggingIn.update((s) => [...s, "anilist"]);
try {
const loggedIn = await CheckIfAniListLoggedIn();
const loggedIn = await App.CheckIfAniListLoggedIn();
if (loggedIn) {
await LoadAniListUser();
if (isAniListPrimary) await LoadAniListWatchList();
@@ -1,5 +1,5 @@
<script lang="ts" context="module">
import {CheckIfMyAnimeListLoggedIn, GetMyAnimeList, GetMyAnimeListLoggedInUser} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import {malUser, malPrimary, malWatchList, malLoggedIn, serviceLoggingIn} from "./GlobalVariablesAndHelperFunctions.svelte"
import type { MyAnimeListUser } from "../mal/types/MALTypes";
@@ -8,9 +8,9 @@
export const CheckIfMALLoggedInAndSetUser = async () => {
serviceLoggingIn.update((s) => [...s, "mal"])
await CheckIfMyAnimeListLoggedIn().then(loggedIn => {
await App.CheckIfMyAnimeListLoggedIn().then(loggedIn => {
if (loggedIn) {
GetMyAnimeListLoggedInUser().then(user => {
App.GetMyAnimeListLoggedInUser().then(user => {
if (!user.name) {
malUser.set({} as MyAnimeListUser)
malLoggedIn.set(false)
@@ -18,7 +18,7 @@
}
malUser.set(user)
if (isMalPrimary) {
GetMyAnimeList(1000).then(watchList => {
App.GetMyAnimeList(1000).then(watchList => {
malWatchList.set(watchList)
malLoggedIn.set(loggedIn)
})
@@ -1,5 +1,5 @@
<script lang="ts" context="module">
import {CheckIfSimklLoggedIn, GetSimklLoggedInUser, SimklGetUserWatchlist} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import { simklLoggedIn, simklUser, simklPrimary, simklWatchList, serviceLoggingIn } from "./GlobalVariablesAndHelperFunctions.svelte";
let isSimklPrimary: boolean
@@ -7,15 +7,15 @@
export const CheckIfSimklLoggedInAndSetUser = async () => {
serviceLoggingIn.update((s) => [...s, "simkl"])
await CheckIfSimklLoggedIn().then(loggedIn => {
await App.CheckIfSimklLoggedIn().then(loggedIn => {
if (loggedIn) {
GetSimklLoggedInUser().then(user => {
App.GetSimklLoggedInUser().then(user => {
if (Object.keys(user).length === 0) {
simklLoggedIn.set(false)
} else {
simklUser.set(user)
if (isSimklPrimary) {
SimklGetUserWatchlist().then(result => {
App.SimklGetUserWatchlist().then(result => {
simklWatchList.set(result)
simklLoggedIn.set(loggedIn)
})
@@ -1,17 +1,5 @@
<script lang="ts" context="module">
import {
GetAniListItem,
GetAniListLoggedInUser,
GetAniListUserWatchingList,
GetMyAnimeListAnime,
GetMyAnimeListLoggedInUser,
GetSimklLoggedInUser,
LogoutAniList,
LogoutMyAnimeList,
LogoutSimkl,
SimklGetUserWatchlist,
SimklSearch,
} from "../../wailsjs/go/main/App";
import {App} from "../../bindings/AniTrack";
import type {
AniListCurrentUserWatchList,
AniListGetSingleAnime,
@@ -109,7 +97,7 @@
aniId: number,
login: boolean,
): Promise<""> {
await GetAniListItem(aniId, login).then((aniListResult) => {
await App.GetAniListItem(aniId, login).then((aniListResult) => {
let finalResult: AniListGetSingleAnime;
finalResult = aniListResult;
if (login === false) {
@@ -133,14 +121,14 @@
);
});
if (isMalLoggedIn) {
await GetMyAnimeListAnime(
await App.GetMyAnimeListAnime(
currentAniListAnime.data.MediaList.media.idMal,
).then((malResult) => {
malAnime.set(malResult);
});
}
if (isSimklLoggedIn) {
await SimklSearch(currentAniListAnime.data.MediaList).then(
await App.SimklSearch(currentAniListAnime.data.MediaList).then(
(value: SimklAnime) => {
simklAnime.set(value);
},
@@ -168,13 +156,13 @@
export function loginToSimkl(): void {
setServiceLoggingIn("simkl", true);
GetSimklLoggedInUser()
App.GetSimklLoggedInUser()
.then((user) => {
if (Object.keys(user).length === 0) {
simklLoggedIn.set(false);
} else {
simklUser.set(user);
SimklGetUserWatchlist().then((result) => {
App.SimklGetUserWatchlist().then((result) => {
simklWatchList.set(result);
simklLoggedIn.set(true);
});
@@ -185,11 +173,11 @@
export function loginToAniList(): void {
setServiceLoggingIn("anilist", true);
GetAniListLoggedInUser()
App.GetAniListLoggedInUser()
.then((result) => {
aniListUser.set(result);
if (isAniListPrimary) {
GetAniListUserWatchingList(page, perPage, sort).then((result) => {
App.GetAniListUserWatchingList(page, perPage, sort).then((result) => {
aniListWatchlist.set(result);
aniListLoggedIn.set(true);
});
@@ -202,7 +190,7 @@
export function loginToMAL(): void {
setServiceLoggingIn("mal", true);
GetMyAnimeListLoggedInUser()
App.GetMyAnimeListLoggedInUser()
.then((result) => {
if (!result.name) {
malUser.set({} as MyAnimeListUser);
@@ -216,7 +204,7 @@
}
export function logoutOfAniList(): void {
LogoutAniList().then((result) => {
App.LogoutAniList().then((result) => {
console.log(result);
if (Object.keys(aniWatchlist).length !== 0) {
aniListWatchlist.set({} as AniListCurrentUserWatchList);
@@ -227,7 +215,7 @@
}
export function logoutOfMAL(): void {
LogoutMyAnimeList().then((result) => {
App.LogoutMyAnimeList().then((result) => {
console.log(result);
malUser.set({} as MyAnimeListUser);
malLoggedIn.set(false);
@@ -235,7 +223,7 @@
}
export function logoutOfSimkl(): void {
LogoutSimkl().then((result) => {
App.LogoutSimkl().then((result) => {
console.log(result);
simklUser.set({} as SimklUser);
simklLoggedIn.set(false);