added info for mac keychain

This commit is contained in:
2024-10-18 22:06:33 -04:00
parent bd39268c0a
commit 064a2c7f7d
8 changed files with 170 additions and 143 deletions

View File

@ -6,26 +6,26 @@
malLoggedIn,
simklAnime,
simklLoggedIn,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
import { push } from "svelte-spa-router"
import { Button } from "flowbite-svelte"
import type { AniListGetSingleAnime } from "../anilist/types/AniListCurrentUserWatchListType"
import Rating from "./Rating.svelte"
import convertAniListDateToString from "../helperFunctions/convertAniListDateToString"
import AnimeTable from "./AnimeTable.svelte"
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import { push } from "svelte-spa-router";
import { Button } from "flowbite-svelte";
import type { AniListGetSingleAnime } from "../anilist/types/AniListCurrentUserWatchListType";
import Rating from "./Rating.svelte";
import convertAniListDateToString from "../helperFunctions/convertAniListDateToString";
import AnimeTable from "./AnimeTable.svelte";
import type {
MALAnime,
MalListStatus,
MALUploadStatus,
} from "../mal/types/MALTypes"
import type { SimklAnime } from "../simkl/types/simklTypes"
import { writable } from "svelte/store"
} from "../mal/types/MALTypes";
import type { SimklAnime } from "../simkl/types/simklTypes";
import { writable } from "svelte/store";
import type {
StatusOption,
StatusOptions,
} from "../helperTypes/StatusTypes"
import type { AniListUpdateVariables } from "../anilist/types/AniListTypes"
import convertDateStringToAniList from "../helperFunctions/convertDateStringToAniList"
} from "../helperTypes/StatusTypes";
import type { AniListUpdateVariables } from "../anilist/types/AniListTypes";
import convertDateStringToAniList from "../helperFunctions/convertDateStringToAniList";
import {
AniListDeleteEntry,
AniListUpdateEntry,
@ -35,32 +35,32 @@
SimklSyncRating,
SimklSyncRemove,
SimklSyncStatus,
} from "../../wailsjs/go/main/App"
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte"
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte"
} from "../../wailsjs/go/main/App";
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
let isAniListLoggedIn: boolean
let isMalLoggedIn: boolean
let isSimklLoggedIn: boolean
let currentAniListAnime: AniListGetSingleAnime
let currentMalAnime: MALAnime
let currentSimklAnime: SimklAnime
let submitting = writable(false)
let isSubmitting: boolean
let submitSuccess = writable(false)
let isAniListLoggedIn: boolean;
let isMalLoggedIn: boolean;
let isSimklLoggedIn: boolean;
let currentAniListAnime: AniListGetSingleAnime;
let currentMalAnime: MALAnime;
let currentSimklAnime: SimklAnime;
let submitting = writable(false);
let isSubmitting: boolean;
let submitSuccess = writable(false);
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value))
malLoggedIn.subscribe((value) => (isMalLoggedIn = value))
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value))
aniListAnime.subscribe((value) => (currentAniListAnime = value))
malAnime.subscribe((value) => (currentMalAnime = value))
simklAnime.subscribe((value) => (currentSimklAnime = value))
submitting.subscribe((value) => (isSubmitting = value))
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
malLoggedIn.subscribe((value) => (isMalLoggedIn = value));
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value));
aniListAnime.subscribe((value) => (currentAniListAnime = value));
malAnime.subscribe((value) => (currentMalAnime = value));
simklAnime.subscribe((value) => (currentSimklAnime = value));
submitting.subscribe((value) => (isSubmitting = value));
const title =
currentAniListAnime.data.MediaList.media.title.english !== ""
? currentAniListAnime.data.MediaList.media.title.english
: currentAniListAnime.data.MediaList.media.title.romaji
: currentAniListAnime.data.MediaList.media.title.romaji;
const statusOptions: StatusOptions = [
{ id: 0, aniList: "CURRENT", mal: "watching", simkl: "watching" },
{
@ -73,17 +73,17 @@
{ id: 3, aniList: "DROPPED", mal: "dropped", simkl: "dropped" },
{ id: 4, aniList: "PAUSED", mal: "on_hold", simkl: "hold" },
{ id: 5, aniList: "REPEATING", mal: "rewatching", simkl: "watching" },
]
];
let startingAnilistStatusOption: StatusOption = statusOptions.filter(
(option) =>
currentAniListAnime.data.MediaList.status === option.aniList,
)[0]
)[0];
const startedAtDate = convertAniListDateToString(
currentAniListAnime.data.MediaList.startedAt,
)
);
const completedAtDate = convertAniListDateToString(
currentAniListAnime.data.MediaList.completedAt,
)
);
if (isAniListLoggedIn)
AddAnimeServiceToTable({
@ -101,7 +101,7 @@
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes,
})
});
if (isMalLoggedIn)
AddAnimeServiceToTable({
@ -115,7 +115,7 @@
score: currentMalAnime.my_list_status.score,
repeat: currentMalAnime.my_list_status.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments,
})
});
if (isSimklLoggedIn && Object.keys(currentSimklAnime).length > 0)
AddAnimeServiceToTable({
@ -129,18 +129,18 @@
score: currentSimklAnime.user_rating,
repeat: 0,
notes: "",
})
});
const handleSubmit = async (e: any) => {
submitting.set(true)
submitting.set(true);
let submitData: {
rating: number
episodes: number
status: StatusOption
startedAt: string
completedAt: string
repeat: number
notes: string
rating: number;
episodes: number;
status: StatusOption;
startedAt: string;
completedAt: string;
repeat: number;
notes: string;
} = {
rating: 0,
episodes: 0,
@ -154,27 +154,27 @@
completedAt: "",
repeat: 0,
notes: "",
}
const formData = new FormData(e.target)
};
const formData = new FormData(e.target);
for (let field of formData) {
const [key, value] = field
const [key, value] = field;
if (key === "rating") {
submitData.rating = Number(value) * 2
continue
submitData.rating = Number(value) * 2;
continue;
}
if (key === "episodes") {
submitData.episodes = Number(value)
continue
submitData.episodes = Number(value);
continue;
}
if (key === "repeat") {
submitData.repeat = Number(value)
continue
submitData.repeat = Number(value);
continue;
}
if (key === "status") {
submitData.status = startingAnilistStatusOption
continue
submitData.status = startingAnilistStatusOption;
continue;
}
submitData[key] = value
submitData[key] = value;
}
if (
@ -190,16 +190,16 @@
notes: submitData.notes,
startedAt: convertDateStringToAniList(submitData.startedAt),
completedAt: convertDateStringToAniList(submitData.completedAt),
}
};
await AniListUpdateEntry(body).then(
(value: AniListGetSingleAnime) => {
// in future when you inevitably add tags to typescript, until Anilist fixes the api bug
// where tags break the SaveMediaListEntry return, you'll want to use this delete line
// delete value.data.MediaList.media.tags
aniListAnime.update((newValue) => {
newValue = value
return newValue
})
newValue = value;
return newValue;
});
AddAnimeServiceToTable({
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
title,
@ -215,9 +215,9 @@
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes,
})
});
},
)
);
}
if (malLoggedIn && currentMalAnime.id !== 0) {
@ -228,22 +228,22 @@
num_watched_episodes: submitData.episodes,
num_times_rewatched: submitData.repeat,
comments: submitData.notes,
}
};
await MyAnimeListUpdate(currentMalAnime, body).then(
(malAnimeReturn: MalListStatus) => {
malAnime.update((value) => {
value.my_list_status.status = malAnimeReturn.status
value.my_list_status.status = malAnimeReturn.status;
value.my_list_status.is_rewatching =
malAnimeReturn.is_rewatching
value.my_list_status.score = malAnimeReturn.score
malAnimeReturn.is_rewatching;
value.my_list_status.score = malAnimeReturn.score;
value.my_list_status.num_episodes_watched =
malAnimeReturn.num_episodes_watched
malAnimeReturn.num_episodes_watched;
value.my_list_status.num_times_rewatched =
malAnimeReturn.num_times_rewatched
value.my_list_status.comments = malAnimeReturn.comments
return value
})
malAnimeReturn.num_times_rewatched;
value.my_list_status.comments = malAnimeReturn.comments;
return value;
});
AddAnimeServiceToTable({
id: `m-${currentMalAnime.id}`,
title: currentMalAnime.title,
@ -257,9 +257,9 @@
repeat: currentMalAnime.my_list_status
.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments,
})
});
},
)
);
}
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
@ -281,12 +281,12 @@
score: value.user_rating,
repeat: 0,
notes: "",
})
});
simklAnime.update((newValue) => {
newValue = value
return newValue
})
})
newValue = value;
return newValue;
});
});
}
if (currentSimklAnime.user_rating !== submitData.rating) {
@ -305,12 +305,12 @@
score: value.user_rating,
repeat: 0,
notes: "",
})
});
simklAnime.update((newValue) => {
newValue = value
return newValue
})
})
newValue = value;
return newValue;
});
});
}
if (currentSimklAnime.status !== submitData.status.simkl) {
@ -329,27 +329,27 @@
score: value.user_rating,
repeat: 0,
notes: "",
})
});
simklAnime.update((newValue) => {
newValue = value
return newValue
})
})
newValue = value;
return newValue;
});
});
}
}
submitting.set(false)
submitSuccess.set(true)
setTimeout(() => submitSuccess.set(false), 2000)
}
submitting.set(false);
submitSuccess.set(true);
setTimeout(() => submitSuccess.set(false), 2000);
};
const deleteEntries = async () => {
submitting.set(true)
submitting.set(true);
if (
isAniListLoggedIn &&
currentAniListAnime.data.MediaList.mediaId !== 0
) {
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id)
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id);
AddAnimeServiceToTable({
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
title,
@ -361,10 +361,10 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
if (malLoggedIn && currentMalAnime.id !== 0) {
await DeleteMyAnimeListEntry(currentMalAnime.id)
await DeleteMyAnimeListEntry(currentMalAnime.id);
AddAnimeServiceToTable({
id: `m-${currentMalAnime.id}`,
title: currentMalAnime.title,
@ -376,10 +376,10 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
await SimklSyncRemove(currentSimklAnime)
await SimklSyncRemove(currentSimklAnime);
AddAnimeServiceToTable({
id: `s-${currentSimklAnime.show.ids.simkl}`,
title: currentSimklAnime.show.title,
@ -391,12 +391,12 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
submitting.set(false)
submitSuccess.set(true)
setTimeout(() => submitSuccess.set(false), 2000)
}
submitting.set(false);
submitSuccess.set(true);
setTimeout(() => submitSuccess.set(false), 2000);
};
</script>
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
@ -431,8 +431,11 @@
id="episodes"
class="border {currentAniListAnime.data.MediaList
.progress < 0 ||
currentAniListAnime.data.MediaList.progress >
currentAniListAnime.data.MediaList.media.episodes
(currentAniListAnime.data.MediaList.media.episodes >
0 &&
currentAniListAnime.data.MediaList.progress >
currentAniListAnime.data.MediaList.media
.episodes)
? 'border-red-500 border-[2px] text-rose-300 focus:ring-red-500 focus:border-red-500'
: 'border-gray-500 text-white focus:ring-blue-500 focus:border-blue-500'} text-sm rounded-lg block w-24 p-2.5 bg-gray-600 placeholder-gray-400"
bind:value={currentAniListAnime.data.MediaList.progress}
@ -661,8 +664,8 @@
focus:ring-gray-700 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:text-white
dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700"
on:click={async () => {
await CheckIfAniListLoggedInAndLoadWatchList()
return push("/")
await CheckIfAniListLoggedInAndLoadWatchList();
return push("/");
}}
>
Go Home

View File

@ -0,0 +1,10 @@
// vite.config.ts
import { defineConfig } from "file:///home/nymusicman/Code/AniTrack/frontend/node_modules/vite/dist/node/index.js";
import { svelte } from "file:///home/nymusicman/Code/AniTrack/frontend/node_modules/@sveltejs/vite-plugin-svelte/src/index.js";
var vite_config_default = defineConfig({
plugins: [svelte()]
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9ueW11c2ljbWFuL0NvZGUvQW5pVHJhY2svZnJvbnRlbmRcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9ob21lL255bXVzaWNtYW4vQ29kZS9BbmlUcmFjay9mcm9udGVuZC92aXRlLmNvbmZpZy50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vaG9tZS9ueW11c2ljbWFuL0NvZGUvQW5pVHJhY2svZnJvbnRlbmQvdml0ZS5jb25maWcudHNcIjtpbXBvcnQge2RlZmluZUNvbmZpZ30gZnJvbSAndml0ZSdcbmltcG9ydCB7c3ZlbHRlfSBmcm9tICdAc3ZlbHRlanMvdml0ZS1wbHVnaW4tc3ZlbHRlJ1xuXG4vLyBodHRwczovL3ZpdGVqcy5kZXYvY29uZmlnL1xuZXhwb3J0IGRlZmF1bHQgZGVmaW5lQ29uZmlnKHtcbiAgcGx1Z2luczogW3N2ZWx0ZSgpXVxufSlcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBdVMsU0FBUSxvQkFBbUI7QUFDbFUsU0FBUSxjQUFhO0FBR3JCLElBQU8sc0JBQVEsYUFBYTtBQUFBLEVBQzFCLFNBQVMsQ0FBQyxPQUFPLENBQUM7QUFDcEIsQ0FBQzsiLAogICJuYW1lcyI6IFtdCn0K

View File

@ -231,6 +231,8 @@ export namespace main {
background: background;
related_anime: relatedAnime;
recommendations: recommendations;
// Go type: struct { NumListUsers int "json:\"num_list_users\" ts_type:\"numListUsers\""; Status struct { Watching string "json:\"watching\" ts_type:\"watching\""; Completed string "json:\"completed\" ts_type:\"completed\""; OnHold string "json:\"on_hold\" ts_type:\"onHold\""; Dropped string "json:\"dropped\" ts_type:\"dropped\""; PlanToWatch string "json:\"plan_to_watch\" ts_type:\"planToWatch\"" } }
Statistics: any;
static createFrom(source: any = {}) {
return new MALAnime(source);
@ -268,6 +270,7 @@ export namespace main {
this.background = source["background"];
this.related_anime = source["related_anime"];
this.recommendations = source["recommendations"];
this.Statistics = this.convertValues(source["Statistics"], Object);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {