Compare commits
10 Commits
10430caddf
...
0.1.4
Author | SHA1 | Date | |
---|---|---|---|
23ec111c60 | |||
f24ee9edfd | |||
1fd453f399 | |||
3ab77ea8d3 | |||
3edfed6272 | |||
aa81102194 | |||
0c90c3e29d | |||
2292ae32c2 | |||
31cc19ba7a | |||
5c712454d5 |
@ -360,14 +360,25 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
returnedBody, _ := AniListQuery(body, true)
|
returnedBody, status := AniListQuery(body, true)
|
||||||
|
|
||||||
|
var badPost struct {
|
||||||
|
Errors []struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
Locations []struct {
|
||||||
|
Line int `json:"line"`
|
||||||
|
Column int `json:"column"`
|
||||||
|
} `json:"locations"`
|
||||||
|
} `json:"errors"`
|
||||||
|
Data any `json:"data"`
|
||||||
|
}
|
||||||
var post AniListCurrentUserWatchList
|
var post AniListCurrentUserWatchList
|
||||||
|
if status == "200 OK" {
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at unmarshal, %s\n", err)
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the real total, finding the real last page and storing that in the Page info
|
// Getting the real total, finding the real last page and storing that in the Page info
|
||||||
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
statuses := post.Data.Page.MediaList[0].User.Statistics.Anime.Statuses
|
||||||
var total int
|
var total int
|
||||||
@ -381,6 +392,15 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
|
|
||||||
post.Data.Page.PageInfo.Total = total
|
post.Data.Page.PageInfo.Total = total
|
||||||
post.Data.Page.PageInfo.LastPage = lastPage
|
post.Data.Page.PageInfo.LastPage = lastPage
|
||||||
|
}
|
||||||
|
|
||||||
|
if status == "403 Forbidden" {
|
||||||
|
err := json.Unmarshal(returnedBody, &badPost)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
log.Fatal(badPost.Errors[0].Message)
|
||||||
|
}
|
||||||
|
|
||||||
return post
|
return post
|
||||||
}
|
}
|
||||||
|
90
bruno/AniTrack/AniList/Get Items/AniChart.bru
Normal file
90
bruno/AniTrack/AniList/Get Items/AniChart.bru
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
meta {
|
||||||
|
name: AniChart
|
||||||
|
type: graphql
|
||||||
|
seq: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
# Write your query or mutation here
|
||||||
|
query ($page: Int, $perPage: Int, $airingAt_greater:Int) {
|
||||||
|
Page(page: $page, perPage: $perPage) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
perPage
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
}
|
||||||
|
airingSchedules(airingAt_greater:$airingAt_greater){
|
||||||
|
id
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
mediaId
|
||||||
|
media{
|
||||||
|
id
|
||||||
|
title{
|
||||||
|
english
|
||||||
|
romaji
|
||||||
|
native
|
||||||
|
}
|
||||||
|
type
|
||||||
|
format
|
||||||
|
status
|
||||||
|
startDate{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
endDate{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
episodes
|
||||||
|
duration
|
||||||
|
coverImage{
|
||||||
|
medium
|
||||||
|
large
|
||||||
|
color
|
||||||
|
extraLarge
|
||||||
|
}
|
||||||
|
bannerImage
|
||||||
|
genres
|
||||||
|
averageScore
|
||||||
|
meanScore
|
||||||
|
popularity
|
||||||
|
trending
|
||||||
|
favourites
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
category
|
||||||
|
rank
|
||||||
|
isGeneralSpoiler
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"page": 50,
|
||||||
|
"perPage": 20,
|
||||||
|
"airingAt_greater": 1730260800
|
||||||
|
}
|
||||||
|
}
|
@ -25,7 +25,7 @@ body:graphql {
|
|||||||
media {
|
media {
|
||||||
id
|
id
|
||||||
idMal
|
idMal
|
||||||
tags{
|
tags {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
description
|
description
|
||||||
|
@ -193,9 +193,9 @@
|
|||||||
};
|
};
|
||||||
await AniListUpdateEntry(body).then(
|
await AniListUpdateEntry(body).then(
|
||||||
(value: AniListGetSingleAnime) => {
|
(value: AniListGetSingleAnime) => {
|
||||||
// in future when you inevitably add tags to typescript, until Anilist fixes the api bug
|
/* TODO 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
|
where tags break the SaveMediaListEntry return, you'll want to use this delete line
|
||||||
// delete value.data.MediaList.media.tags
|
delete value.data.MediaList.media.tags */
|
||||||
aniListAnime.update((newValue) => {
|
aniListAnime.update((newValue) => {
|
||||||
newValue = value;
|
newValue = value;
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -397,6 +397,20 @@
|
|||||||
submitSuccess.set(true);
|
submitSuccess.set(true);
|
||||||
setTimeout(() => submitSuccess.set(false), 2000);
|
setTimeout(() => submitSuccess.set(false), 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let max = 999;
|
||||||
|
|
||||||
|
if (currentAniListAnime.data.MediaList.media.episodes !== 0) {
|
||||||
|
max = currentAniListAnime.data.MediaList.media.episodes;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
currentAniListAnime.data.MediaList.media.episodes === 0 &&
|
||||||
|
currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0
|
||||||
|
) {
|
||||||
|
max =
|
||||||
|
currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode -
|
||||||
|
1;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
||||||
@ -423,27 +437,94 @@
|
|||||||
class="text-left block mb-2 text-sm font-medium text-white"
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
>Episode Progress</label
|
>Episode Progress</label
|
||||||
>
|
>
|
||||||
|
<div class="relative flex items-center max-w-[8rem]">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
id="decrement-button"
|
||||||
|
data-input-counter-decrement="quantity-input"
|
||||||
|
on:click={() =>
|
||||||
|
(currentAniListAnime.data.MediaList.progress -= 1)}
|
||||||
|
class="bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 hover:bg-gray-200 border border-gray-300 rounded-s-lg p-3 h-11 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-3 h-3 text-gray-900 dark:text-white"
|
||||||
|
aria-hidden="true"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 18 2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M1 1h16"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
name="episodes"
|
name="episodes"
|
||||||
min="0"
|
min="0"
|
||||||
max={currentAniListAnime.data.MediaList.media.episodes}
|
{max}
|
||||||
id="episodes"
|
id="episodes"
|
||||||
class="border {currentAniListAnime.data.MediaList
|
class="border border-x-0 p-2.5 h-11 text-center text-sm block w-full placeholder-gray-400 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none
|
||||||
.progress < 0 ||
|
{currentAniListAnime.data.MediaList.progress < 0 ||
|
||||||
(currentAniListAnime.data.MediaList.media.episodes >
|
(currentAniListAnime.data.MediaList.media.episodes >
|
||||||
0 &&
|
0 &&
|
||||||
currentAniListAnime.data.MediaList.progress >
|
currentAniListAnime.data.MediaList.progress >
|
||||||
currentAniListAnime.data.MediaList.media
|
currentAniListAnime.data.MediaList.media
|
||||||
.episodes)
|
.episodes) ||
|
||||||
|
(currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode > 0 &&
|
||||||
|
currentAniListAnime.data.MediaList.progress >
|
||||||
|
currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode -
|
||||||
|
1)
|
||||||
? 'border-red-500 border-[2px] text-rose-300 focus:ring-red-500 focus:border-red-500'
|
? '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"
|
: 'bg-gray-700 hover:bg-gray-600 border-gray-600 text-white focus:ring-blue-500 focus:border-blue-500'} w-24"
|
||||||
bind:value={currentAniListAnime.data.MediaList.progress}
|
bind:value={currentAniListAnime.data.MediaList
|
||||||
|
.progress}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<div>
|
<button
|
||||||
of {currentAniListAnime.data.MediaList.media.episodes}
|
type="button"
|
||||||
|
id="increment-button"
|
||||||
|
data-input-counter-increment="quantity-input"
|
||||||
|
on:click={() =>
|
||||||
|
(currentAniListAnime.data.MediaList.progress += 1)}
|
||||||
|
class="bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 hover:bg-gray-200 border border-gray-300 rounded-e-lg p-3 h-11 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-3 h-3 text-gray-900 dark:text-white"
|
||||||
|
aria-hidden="true"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 18 18"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M9 1v16M1 9h16"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
/ {currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode !== 0
|
||||||
|
? currentAniListAnime.data.MediaList.media
|
||||||
|
.nextAiringEpisode.episode - 1
|
||||||
|
: currentAniListAnime.data.MediaList.media.episodes}
|
||||||
|
</div>
|
||||||
|
{#if currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0}
|
||||||
|
<div>
|
||||||
|
of {currentAniListAnime.data.MediaList.media
|
||||||
|
.episodes}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -2,38 +2,22 @@
|
|||||||
import Search from "./Search.svelte"
|
import Search from "./Search.svelte"
|
||||||
import {
|
import {
|
||||||
aniListLoggedIn,
|
aniListLoggedIn,
|
||||||
aniListUser,
|
|
||||||
loginToAniList,
|
loginToAniList,
|
||||||
loginToMAL,
|
loginToMAL,
|
||||||
loginToSimkl,
|
loginToSimkl,
|
||||||
malLoggedIn,
|
malLoggedIn,
|
||||||
malUser,
|
|
||||||
simklLoggedIn,
|
simklLoggedIn,
|
||||||
simklUser,
|
|
||||||
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
|
||||||
import type {AniListUser} from "../anilist/types/AniListTypes";
|
|
||||||
import type {SimklUser} from "../simkl/types/simklTypes";
|
|
||||||
import type {MyAnimeListUser} from "../mal/types/MALTypes";
|
|
||||||
import AvatarMenu from "./AvatarMenu.svelte";
|
import AvatarMenu from "./AvatarMenu.svelte";
|
||||||
import logo from "../assets/images/AniTrackLogo.svg"
|
import logo from "../assets/images/AniTrackLogo.svg"
|
||||||
import {location} from "svelte-spa-router";
|
|
||||||
|
|
||||||
let isAniListLoggedIn: boolean
|
let isAniListLoggedIn: boolean
|
||||||
let isSimklLoggedIn: boolean
|
let isSimklLoggedIn: boolean
|
||||||
let isMALLoggedIn: boolean
|
let isMALLoggedIn: boolean
|
||||||
let currentAniListUser: AniListUser
|
|
||||||
let currentSimklUser: SimklUser
|
|
||||||
let currentMALUser: MyAnimeListUser
|
|
||||||
|
|
||||||
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||||
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
||||||
malLoggedIn.subscribe((value) => isMALLoggedIn = value)
|
malLoggedIn.subscribe((value) => isMALLoggedIn = value)
|
||||||
aniListUser.subscribe((value) => currentAniListUser = value)
|
|
||||||
simklUser.subscribe((value) => currentSimklUser = value)
|
|
||||||
malUser.subscribe((value) => currentMALUser = value)
|
|
||||||
|
|
||||||
let currentLocation: any
|
|
||||||
location.subscribe(value => currentLocation = value)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="border-gray-200 bg-gray-900">
|
<nav class="border-gray-200 bg-gray-900">
|
||||||
@ -63,37 +47,23 @@
|
|||||||
<div class="hidden items-center justify-between w-full pb-4 min-[950px]:pb-0 min-[950px]:flex min-[950px]:w-auto min-[950px]:order-1 border border-gray-700 min-[950px]:border-0 bg-gray-800 min-[950px]:bg-transparent rounded-lg" id="navbar-user">
|
<div class="hidden items-center justify-between w-full pb-4 min-[950px]:pb-0 min-[950px]:flex min-[950px]:w-auto min-[950px]:order-1 border border-gray-700 min-[950px]:border-0 bg-gray-800 min-[950px]:bg-transparent rounded-lg" id="navbar-user">
|
||||||
<ul class="flex flex-col font-medium pb-6 min-[950px]:p-0 mt-4 min-[950px]:space-x-8 rtl:space-x-reverse min-[950px]:flex-row min-[950px]:mt-0">
|
<ul class="flex flex-col font-medium pb-6 min-[950px]:p-0 mt-4 min-[950px]:space-x-8 rtl:space-x-reverse min-[950px]:flex-row min-[950px]:mt-0">
|
||||||
<li>
|
<li>
|
||||||
{#if isAniListLoggedIn}
|
{#if !isAniListLoggedIn}
|
||||||
<div class="flex justify-center py-2 px-3 rounded bg-transparent min-[950px]:p-0">
|
<button on:click={loginToAniList}>
|
||||||
<span class="w-48 min-[950px]:w-auto text-sm font-medium me-2 px-3 py-2 rounded bg-green-800 text-green-200 cursor-default">AniList: {currentAniListUser.data.Viewer.name}</span>
|
<!-- class="block py-2 px-3 w-full min-[950px]:w-auto rounded text-gray-300 min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">-->
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<button on:click={loginToAniList}
|
|
||||||
class="block py-2 px-3 w-full min-[950px]:w-auto rounded min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">
|
|
||||||
AniList Login
|
AniList Login
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</li>
|
{#if !isMALLoggedIn}
|
||||||
<li>
|
<button on:click={loginToMAL}>
|
||||||
{#if isMALLoggedIn}
|
<!-- class="block py-2 px-3 w-full min-[950px]:w-auto rounded min-[950px]:p-0 text-gray-300 min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">-->
|
||||||
<div class="flex justify-center py-2 px-3 rounded bg-transparent min-[950px]:p-0">
|
|
||||||
<span class="w-48 min-[950px]:w-auto text-sm font-medium me-2 px-3 py-2 rounded bg-blue-800 text-blue-200 cursor-default">MyAnimeList: {currentMALUser.name}</span>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<button on:click={loginToMAL}
|
|
||||||
class="block py-2 px-3 w-full min-[950px]:w-auto rounded min-[950px]:p-0 text-gray-300 min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">
|
|
||||||
MyAnimeList Login
|
MyAnimeList Login
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{#if isSimklLoggedIn}
|
{#if !isSimklLoggedIn}
|
||||||
<div class="flex justify-center py-2 px-3 rounded bg-transparent min-[950px]:p-0">
|
<button on:click={loginToSimkl}>
|
||||||
<span class="w-48 min-[950px]:w-auto text-sm font-medium me-2 px-3 py-2 rounded bg-indigo-800 text-indigo-200 cursor-default">Simkl: {currentSimklUser.user.name}</span>
|
<!-- class="block py-2 px-3 w-full min-[950px]:w-auto rounded min-[950px]:p-0 text-gray-300 min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">-->
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<button on:click={loginToSimkl}
|
|
||||||
class="block py-2 px-3 w-full min-[950px]:w-auto rounded min-[950px]:p-0 text-gray-300 min-[950px]:hover:text-blue-500 hover:bg-gray-700 hover:text-white min-[950px]:hover:bg-transparent border-gray-700">
|
|
||||||
Simkl Login
|
Simkl Login
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import flowbitePlugin from 'flowbite/plugin'
|
||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
export default {
|
export default {
|
||||||
content: [
|
content: [
|
||||||
@ -6,9 +7,7 @@ export default {
|
|||||||
"./node_modules/flowbite/**/*.{html,js,svelte,ts}",
|
"./node_modules/flowbite/**/*.{html,js,svelte,ts}",
|
||||||
"./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}",
|
"./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}",
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [ flowbitePlugin ],
|
||||||
require('flowbite/plugin')
|
|
||||||
],
|
|
||||||
|
|
||||||
darkMode: 'media',
|
darkMode: 'media',
|
||||||
|
|
||||||
|
@ -12,6 +12,6 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"productName": "AniTrack",
|
"productName": "AniTrack",
|
||||||
"productVersion": "0.1.1"
|
"productVersion": "0.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user