Compare commits
180 Commits
020a09da6f
...
0.1.6
Author | SHA1 | Date | |
---|---|---|---|
d08283bd2d | |||
73d349ee1a | |||
c9c6650829 | |||
896c6640e2 | |||
18c744c1cf | |||
dde5d20537 | |||
314646e7f5 | |||
72dfbf4a03 | |||
d4ad4bc430 | |||
49681f3ffb | |||
d98d0e77c1 | |||
8e57b4b259 | |||
1e1c891173 | |||
5ee9c42352 | |||
23ec111c60 | |||
f24ee9edfd | |||
1fd453f399 | |||
3ab77ea8d3 | |||
3edfed6272 | |||
aa81102194 | |||
0c90c3e29d | |||
2292ae32c2 | |||
31cc19ba7a | |||
5c712454d5 | |||
10430caddf | |||
9a6c844691 | |||
476507a695 | |||
1fdb859f05 | |||
064a2c7f7d | |||
bd39268c0a | |||
2cffd54c4d | |||
7e3369d0f0 | |||
e229311190 | |||
753ecd968e | |||
30c48dcf9b | |||
9b28f2fb0a | |||
0bf784562a | |||
ea2c4475de | |||
572366eb91 | |||
77dc48fcf2 | |||
c7694900e3 | |||
00930f611e | |||
5cdf86a147 | |||
74afb317d1 | |||
a24a187c7f | |||
9f8014ff00 | |||
4c329d6b9d | |||
be6c3439ca | |||
4866f49d13 | |||
60a38ff569 | |||
45b11fa8f4 | |||
908325628f | |||
5915bb28b8 | |||
cbcb07d2f1 | |||
d611ed8b3a | |||
77e361b5b2 | |||
aeec8f79b2 | |||
5a34c89cd5 | |||
f5001cff04 | |||
4fa38b5252 | |||
8d87100373 | |||
7b503875ca | |||
ca6727d2b6 | |||
58fb1e41c2 | |||
c962a6ac9b | |||
8ae3b8dd22 | |||
e3ed5bb2b9 | |||
4d9012b43c | |||
6ebf5ac48e | |||
55cb0e2bd5 | |||
f37622010f | |||
8f884ce1a1 | |||
5fc3a1792a | |||
862c78d3b8 | |||
a433df84db | |||
76ea4f73ec | |||
fb2d5fbdea | |||
3b5518113e | |||
3c7ca15376 | |||
22ff290a81 | |||
f9c6f4b827 | |||
eb7ad5d1a3 | |||
90b68b717a | |||
0ae1e4cb7d | |||
4a60d45089 | |||
12706426f4 | |||
5050cb92d9 | |||
adad8418a9 | |||
c2bf45313d | |||
0f647e85cb | |||
a0e193e343 | |||
03413cd11a | |||
fa3304db92 | |||
43a054ac92 | |||
15d61290be | |||
d573b871ae | |||
8daf3af5f9 | |||
d644758253 | |||
1b08918d8e | |||
a6b26171d4 | |||
b11395a617 | |||
8a6b3bd2b7 | |||
aaf0f421f2 | |||
49e461d0ff | |||
6c4fdabb79 | |||
77289052e9 | |||
1dcf7ba5bd | |||
46e2a9156f | |||
1e90f68e70 | |||
8fc2b8b508 | |||
ce52ae20f5 | |||
94c0f97e95 | |||
79ed79c25e | |||
091ca82f69 | |||
eeb4a62f26 | |||
a0b00de615 | |||
6e9c2cf46e | |||
53b7368daf | |||
c95b658131 | |||
de38d0335b | |||
d2ef265807 | |||
7af14ad7f3 | |||
2f272fe7af | |||
54d5932d8a | |||
8c61c5e96b | |||
7044dc1d90 | |||
d1258c54d3 | |||
237958cce5 | |||
c6972ad765 | |||
0ed827fc9a | |||
784e6c0b7d | |||
aac66ec4e8 | |||
fdd1994f13 | |||
065ac0950f | |||
ada4832904 | |||
b24a8fb5f6 | |||
205b5d075f | |||
5035712402 | |||
65c12472f1 | |||
9e0b05fb60 | |||
e3cde57f62 | |||
70558a4128 | |||
fbc9f766dd | |||
2932cf1d3b | |||
183537f7e7 | |||
33d1d1cfde | |||
d89121a4de | |||
5a8b64b610 | |||
69ce979367 | |||
93f54d8425 | |||
e004933d52 | |||
2be45caa21 | |||
55c73a84a3 | |||
cdf37707bf | |||
286ecbfddd | |||
d99f71e18c | |||
530a4bc3ff | |||
bcdccf8061 | |||
b6e06c1134 | |||
24a4d4e0d6 | |||
2dd0114cc3 | |||
4e11b218be | |||
b1880690dc | |||
59fe3d32ff | |||
64def1a763 | |||
dcf7322b0c | |||
d7233a52ba | |||
2a75022723 | |||
076b1e67ee | |||
6aca33cfc7 | |||
0f4a75b33c | |||
2da6581b7a | |||
cbef98f293 | |||
f0bcc13300 | |||
3d5c2d77cc | |||
daa9c3c40a | |||
dfcc479106 | |||
d86f22bb06 | |||
7a4c823d93 | |||
1196bac234 |
4
.gitignore
vendored
@ -27,4 +27,6 @@ node_modules
|
|||||||
frontend/dist
|
frontend/dist
|
||||||
package.json.md5
|
package.json.md5
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.idea
|
.idea
|
||||||
|
.env
|
||||||
|
environment.go
|
550
AniListFunctions.go
Normal file
@ -0,0 +1,550 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
|
||||||
|
reader, _ := json.Marshal(body)
|
||||||
|
response, err := http.NewRequest("POST", "https://graphql.anilist.co", bytes.NewBuffer(reader))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at response, %s\n", err)
|
||||||
|
}
|
||||||
|
if login && (AniListJWT{}) != aniListJwt {
|
||||||
|
response.Header.Add("Authorization", "Bearer "+aniListJwt.AccessToken)
|
||||||
|
} else if login {
|
||||||
|
return nil, "Please login to AniList to make this request"
|
||||||
|
}
|
||||||
|
response.Header.Add("Content-Type", "application/json")
|
||||||
|
response.Header.Add("Accept", "application/json")
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
res, resErr := client.Do(response)
|
||||||
|
if resErr != nil {
|
||||||
|
log.Printf("Failed at res, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
returnedBody, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "Could not read the returned body."
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnedBody, res.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
||||||
|
user := a.GetAniListLoggedInUser()
|
||||||
|
|
||||||
|
var neededVariables interface{}
|
||||||
|
|
||||||
|
if login {
|
||||||
|
neededVariables = struct {
|
||||||
|
MediaId int `json:"mediaId"`
|
||||||
|
UserId int `json:"userId"`
|
||||||
|
ListType string `json:"listType"`
|
||||||
|
}{
|
||||||
|
MediaId: aniId,
|
||||||
|
UserId: user.Data.Viewer.ID,
|
||||||
|
ListType: "ANIME",
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
neededVariables = struct {
|
||||||
|
MediaId int `json:"mediaId"`
|
||||||
|
ListType string `json:"listType"`
|
||||||
|
}{
|
||||||
|
MediaId: aniId,
|
||||||
|
ListType: "ANIME",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
Variables interface{} `json:"variables"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
query($userId: Int, $mediaId: Int, $listType: MediaType) {
|
||||||
|
MediaList(mediaId: $mediaId, userId: $userId, type: $listType) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode {
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics {
|
||||||
|
anime {
|
||||||
|
count
|
||||||
|
statuses {
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
Variables: neededVariables,
|
||||||
|
}
|
||||||
|
|
||||||
|
returnedBody, status := AniListQuery(body, login)
|
||||||
|
var post AniListGetSingleAnime
|
||||||
|
|
||||||
|
if status == "404 Not Found" && !login {
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
if status == "404 Not Found" {
|
||||||
|
post = a.GetAniListItem(aniId, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !login {
|
||||||
|
post.Data.MediaList.UserID = user.Data.Viewer.ID
|
||||||
|
post.Data.MediaList.Status = ""
|
||||||
|
post.Data.MediaList.StartedAt.Year = 0
|
||||||
|
post.Data.MediaList.StartedAt.Month = 0
|
||||||
|
post.Data.MediaList.StartedAt.Day = 0
|
||||||
|
post.Data.MediaList.CompletedAt.Year = 0
|
||||||
|
post.Data.MediaList.CompletedAt.Month = 0
|
||||||
|
post.Data.MediaList.CompletedAt.Day = 0
|
||||||
|
post.Data.MediaList.Notes = ""
|
||||||
|
post.Data.MediaList.Progress = 0
|
||||||
|
post.Data.MediaList.Score = 0
|
||||||
|
post.Data.MediaList.Repeat = 0
|
||||||
|
post.Data.MediaList.User.ID = user.Data.Viewer.ID
|
||||||
|
post.Data.MediaList.User.Name = user.Data.Viewer.Name
|
||||||
|
post.Data.MediaList.User.Avatar.Large = user.Data.Viewer.Avatar.Large
|
||||||
|
post.Data.MediaList.User.Avatar.Medium = user.Data.Viewer.Avatar.Medium
|
||||||
|
post.Data.MediaList.User.Statistics.Anime.Count = 0
|
||||||
|
// This provides an empty array and frees up the memory from the garbage collector
|
||||||
|
post.Data.MediaList.User.Statistics.Anime.Statuses = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) AniListSearch(query string) any {
|
||||||
|
type Variables struct {
|
||||||
|
Search string `json:"search"`
|
||||||
|
ListType string `json:"listType"`
|
||||||
|
}
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
Variables Variables `json:"variables"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
query ($search: String!, $listType: MediaType) {
|
||||||
|
Page (page: 1, perPage: 100) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
perPage
|
||||||
|
}
|
||||||
|
media (search: $search, type: $listType) {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode{
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
Variables: Variables{
|
||||||
|
Search: query,
|
||||||
|
ListType: "ANIME",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
returnedBody, _ := AniListQuery(body, false)
|
||||||
|
|
||||||
|
var post interface{}
|
||||||
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) AniListCurrentUserWatchList {
|
||||||
|
user := a.GetAniListLoggedInUser()
|
||||||
|
type Variables struct {
|
||||||
|
Page int `json:"page"`
|
||||||
|
PerPage int `json:"perPage"`
|
||||||
|
UserId int `json:"userId"`
|
||||||
|
ListType string `json:"listType"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Sort string `json:"sort"`
|
||||||
|
}
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
Variables Variables `json:"variables"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
query(
|
||||||
|
$page: Int
|
||||||
|
$perPage: Int
|
||||||
|
$userId: Int
|
||||||
|
$listType: MediaType
|
||||||
|
$status: MediaListStatus
|
||||||
|
$sort:[MediaListSort]
|
||||||
|
) {
|
||||||
|
Page(page: $page, perPage: $perPage) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
perPage
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
}
|
||||||
|
mediaList(userId: $userId, type: $listType, status: $status, sort: $sort) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode{
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar{
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics {
|
||||||
|
anime {
|
||||||
|
count
|
||||||
|
statuses {
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
Variables: Variables{
|
||||||
|
Page: page,
|
||||||
|
PerPage: perPage,
|
||||||
|
UserId: user.Data.Viewer.ID,
|
||||||
|
ListType: "ANIME",
|
||||||
|
Status: "CURRENT",
|
||||||
|
Sort: sort,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
if status == "200 OK" {
|
||||||
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
// 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
|
||||||
|
var total int
|
||||||
|
for _, status := range statuses {
|
||||||
|
if status.Status == "CURRENT" {
|
||||||
|
total = status.Count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastPage := total / perPage
|
||||||
|
|
||||||
|
post.Data.Page.PageInfo.Total = total
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) AniListGetSingleAnime {
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
Variables AniListUpdateVariables `json:"variables"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
mutation(
|
||||||
|
$mediaId:Int,
|
||||||
|
$progress:Int,
|
||||||
|
$status:MediaListStatus,
|
||||||
|
$score:Float,
|
||||||
|
$repeat:Int,
|
||||||
|
$notes:String,
|
||||||
|
$startedAt:FuzzyDateInput,
|
||||||
|
$completedAt:FuzzyDateInput,
|
||||||
|
){
|
||||||
|
SaveMediaListEntry(
|
||||||
|
mediaId:$mediaId,
|
||||||
|
progress:$progress,
|
||||||
|
status:$status,
|
||||||
|
score:$score,
|
||||||
|
repeat:$repeat,
|
||||||
|
notes:$notes,
|
||||||
|
startedAt:$startedAt
|
||||||
|
completedAt:$completedAt
|
||||||
|
){
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode {
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar{
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics{
|
||||||
|
anime{
|
||||||
|
count
|
||||||
|
statuses{
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
Variables: updateBody,
|
||||||
|
}
|
||||||
|
|
||||||
|
returnedBody, _ := AniListQuery(body, true)
|
||||||
|
|
||||||
|
var returnedJson AniListUpdateReturn
|
||||||
|
err := json.Unmarshal(returnedBody, &returnedJson)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var post AniListGetSingleAnime
|
||||||
|
|
||||||
|
post.Data.MediaList = returnedJson.Data.SaveMediaListEntry
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) AniListDeleteEntry(mediaListId int) DeleteAniListReturn {
|
||||||
|
type Variables = struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
Variables Variables `json:"variables"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
mutation(
|
||||||
|
$id:Int,
|
||||||
|
){
|
||||||
|
DeleteMediaListEntry(
|
||||||
|
id:$id,
|
||||||
|
){
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
Variables: Variables{
|
||||||
|
Id: mediaListId,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
returnedBody, _ := AniListQuery(body, true)
|
||||||
|
|
||||||
|
var post DeleteAniListReturn
|
||||||
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
212
AniListTypes.go
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type AniListJWT struct {
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
ExpiresIn int `json:"expires_in"`
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AniListUser struct {
|
||||||
|
Data struct {
|
||||||
|
Viewer struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Avatar struct {
|
||||||
|
Large string `json:"large"`
|
||||||
|
Medium string `json:"medium"`
|
||||||
|
} `json:"avatar"`
|
||||||
|
BannerImage string `json:"bannerImage"`
|
||||||
|
SiteUrl string `json:"siteUrl"`
|
||||||
|
} `json:"Viewer"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AniListCurrentUserWatchList struct {
|
||||||
|
Data struct {
|
||||||
|
Page struct {
|
||||||
|
PageInfo struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
PerPage int `json:"perPage"`
|
||||||
|
CurrentPage int `json:"currentPage"`
|
||||||
|
LastPage int `json:"lastPage"`
|
||||||
|
HasNextPage bool `json:"hasNextPage"`
|
||||||
|
} `json:"pageInfo"`
|
||||||
|
MediaList []MediaList `json:"mediaList"`
|
||||||
|
} `json:"Page"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AniListGetSingleAnime struct {
|
||||||
|
Data struct {
|
||||||
|
MediaList MediaList `json:"MediaList"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AniListUpdateReturn struct {
|
||||||
|
Data struct {
|
||||||
|
SaveMediaListEntry MediaList `json:"SaveMediaListEntry"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaList struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
MediaID int `json:"mediaId"`
|
||||||
|
UserID int `json:"userId"`
|
||||||
|
Media struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
IDMal int `json:"idMal"`
|
||||||
|
Title struct {
|
||||||
|
Romaji string `json:"romaji"`
|
||||||
|
English string `json:"english"`
|
||||||
|
Native string `json:"native"`
|
||||||
|
} `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
CoverImage struct {
|
||||||
|
Large string `json:"large"`
|
||||||
|
} `json:"coverImage"`
|
||||||
|
Season string `json:"season"`
|
||||||
|
SeasonYear int `json:"seasonYear"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Episodes int `json:"episodes"`
|
||||||
|
NextAiringEpisode struct {
|
||||||
|
AiringAt int `json:"airingAt"`
|
||||||
|
TimeUntilAiring int `json:"timeUntilAiring"`
|
||||||
|
Episode int `json:"episode"`
|
||||||
|
} `json:"nextAiringEpisode"`
|
||||||
|
Tags []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Rank int `json:"rank"`
|
||||||
|
IsMediaSpoiler bool `json:"isMediaSpoiler"`
|
||||||
|
IsAdult bool `json:"isAdult"`
|
||||||
|
} `json:"tags"`
|
||||||
|
IsAdult bool `json:"isAdult"`
|
||||||
|
} `json:"media"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
StartedAt struct {
|
||||||
|
Year int `json:"year"`
|
||||||
|
Month int `json:"month"`
|
||||||
|
Day int `json:"day"`
|
||||||
|
} `json:"startedAt"`
|
||||||
|
CompletedAt struct {
|
||||||
|
Year int `json:"year"`
|
||||||
|
Month int `json:"month"`
|
||||||
|
Day int `json:"day"`
|
||||||
|
} `json:"completedAt"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
Progress int `json:"progress"`
|
||||||
|
Score float64 `json:"score"`
|
||||||
|
Repeat int `json:"repeat"`
|
||||||
|
User struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Avatar struct {
|
||||||
|
Large string `json:"large"`
|
||||||
|
Medium string `json:"medium"`
|
||||||
|
} `json:"avatar"`
|
||||||
|
Statistics struct {
|
||||||
|
Anime struct {
|
||||||
|
Count int `json:"count"`
|
||||||
|
Statuses []struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
} `json:"statuses"`
|
||||||
|
} `json:"anime"`
|
||||||
|
} `json:"statistics"`
|
||||||
|
} `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StartedAt struct {
|
||||||
|
Year int `json:"year"`
|
||||||
|
Month int `json:"month"`
|
||||||
|
Day int `json:"day"`
|
||||||
|
}
|
||||||
|
type CompletedAt struct {
|
||||||
|
Year int `json:"year"`
|
||||||
|
Month int `json:"month"`
|
||||||
|
Day int `json:"day"`
|
||||||
|
}
|
||||||
|
type AniListUpdateVariables struct {
|
||||||
|
MediaId int `json:"mediaId"`
|
||||||
|
Progress int `json:"progress"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Score float64 `json:"score"`
|
||||||
|
Repeat int `json:"repeat"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
StartedAt StartedAt `json:"startedAt"`
|
||||||
|
CompletedAt CompletedAt `json:"completedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteAniListReturn struct {
|
||||||
|
Data struct {
|
||||||
|
DeleteMediaListEntry struct {
|
||||||
|
Deleted bool `json:"deleted"`
|
||||||
|
} `json:"DeleteMediaListEntry"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//var MediaListSort = struct {
|
||||||
|
// MediaId string
|
||||||
|
// MediaIdDesc string
|
||||||
|
// Score string
|
||||||
|
// ScoreDesc string
|
||||||
|
// Status string
|
||||||
|
// StatusDesc string
|
||||||
|
// Progress string
|
||||||
|
// ProgressDesc string
|
||||||
|
// ProgressVolumes string
|
||||||
|
// ProgressVolumesDesc string
|
||||||
|
// Repeat string
|
||||||
|
// RepeatDesc string
|
||||||
|
// Priority string
|
||||||
|
// PriorityDesc string
|
||||||
|
// StartedOn string
|
||||||
|
// StartedOnDesc string
|
||||||
|
// FinishedOn string
|
||||||
|
// FinishedOnDesc string
|
||||||
|
// AddedTime string
|
||||||
|
// AddedTimeDesc string
|
||||||
|
// UpdatedTime string
|
||||||
|
// UpdatedTimeDesc string
|
||||||
|
// MediaTitleRomaji string
|
||||||
|
// MediaTitleRomajiDesc string
|
||||||
|
// MediaTitleEnglish string
|
||||||
|
// MediaTitleEnglishDesc string
|
||||||
|
// MediaTitleNative string
|
||||||
|
// MediaTitleNativeDesc string
|
||||||
|
// MediaPopularity string
|
||||||
|
// MediaPopularityDesc string
|
||||||
|
//}{
|
||||||
|
// MediaId: "MEDIA_ID",
|
||||||
|
// MediaIdDesc: "MEDIA_ID_DESC",
|
||||||
|
// Score: "SCORE",
|
||||||
|
// ScoreDesc: "SCORE_DESC",
|
||||||
|
// Status: "STATUS",
|
||||||
|
// StatusDesc: "STATUS_DESC",
|
||||||
|
// Progress: "PROGRESS",
|
||||||
|
// ProgressDesc: "PROGRESS_DESC",
|
||||||
|
// ProgressVolumes: "PROGRESS_VOLUMES",
|
||||||
|
// ProgressVolumesDesc: "PROGRESS_VOLUMES_DESC",
|
||||||
|
// Repeat: "REPEAT",
|
||||||
|
// RepeatDesc: "REPEAT_DESC",
|
||||||
|
// Priority: "PRIORITY",
|
||||||
|
// PriorityDesc: "PRIORITY_DESC",
|
||||||
|
// StartedOn: "STARTED_ON",
|
||||||
|
// StartedOnDesc: "STARTED_ON_DESC",
|
||||||
|
// FinishedOn: "FINISHED_ON",
|
||||||
|
// FinishedOnDesc: "FINISHED_ON_DESC",
|
||||||
|
// AddedTime: "ADDED_TIME",
|
||||||
|
// AddedTimeDesc: "ADDED_TIME_DESC",
|
||||||
|
// UpdatedTime: "UPDATED_TIME",
|
||||||
|
// UpdatedTimeDesc: "UPDATED_TIME_DESC",
|
||||||
|
// MediaTitleRomaji: "MEDIA_TITLE_ROMAJI",
|
||||||
|
// MediaTitleRomajiDesc: "MEDIA_TITLE_ROMAJI_DESC",
|
||||||
|
// MediaTitleEnglish: "MEDIA_TITLE_ENGLISH",
|
||||||
|
// MediaTitleEnglishDesc: "MEDIA_TITLE_ENGLISH_DESC",
|
||||||
|
// MediaTitleNative: "MEDIA_TITLE_NATIVE",
|
||||||
|
// MediaTitleNativeDesc: "MEDIA_TITLE_NATIVE_DESC",
|
||||||
|
// MediaPopularity: "MEDIA_POPULARITY",
|
||||||
|
// MediaPopularityDesc: "MEDIA_POPULARITY_DESC",
|
||||||
|
//}
|
222
AniListUserFunctions.go
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/99designs/keyring"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
var aniListJwt AniListJWT
|
||||||
|
|
||||||
|
var aniRing, _ = keyring.Open(keyring.Config{
|
||||||
|
ServiceName: "AniTrack",
|
||||||
|
KeychainName: "AniTrack",
|
||||||
|
KeychainSynchronizable: false,
|
||||||
|
KeychainTrustApplication: true,
|
||||||
|
KeychainAccessibleWhenUnlocked: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
var aniCtxShutdown, aniCancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
func (a *App) CheckIfAniListLoggedIn() bool {
|
||||||
|
if (AniListJWT{} == aniListJwt) {
|
||||||
|
tokenType, tokenErr := aniRing.Get("anilistTokenType")
|
||||||
|
expiresIn, expiresInErr := aniRing.Get("anilistTokenExpiresIn")
|
||||||
|
refreshToken, refreshTokenErr := aniRing.Get("anilistRefreshToken")
|
||||||
|
accessToken, accessTokenErr := aniRing.Get("anilistAccessToken")
|
||||||
|
if (tokenErr != nil || expiresInErr != nil || refreshTokenErr != nil || accessTokenErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
aniListJwt.TokenType = string(tokenType.Data)
|
||||||
|
aniListJwt.AccessToken = string(accessToken.Data)
|
||||||
|
aniListJwt.RefreshToken = string(refreshToken.Data)
|
||||||
|
aniListJwt.ExpiresIn, _ = strconv.Atoi(string(expiresIn.Data))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) AniListLogin() {
|
||||||
|
if (AniListJWT{} == aniListJwt) {
|
||||||
|
tokenType, tokenErr := aniRing.Get("anilistTokenType")
|
||||||
|
expiresIn, expiresInErr := aniRing.Get("anilistTokenExpiresIn")
|
||||||
|
refreshToken, refreshTokenErr := aniRing.Get("anilistRefreshToken")
|
||||||
|
accessToken, accessTokenErr := aniRing.Get("anilistAccessToken")
|
||||||
|
if (tokenErr != nil || expiresInErr != nil || refreshTokenErr != nil || accessTokenErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
getAniListCodeUrl := "https://anilist.co/api/v2/oauth/authorize?client_id=" + Environment.ANILIST_APP_ID + "&redirect_uri=" + Environment.ANILIST_CALLBACK_URI + "&response_type=code"
|
||||||
|
runtime.BrowserOpenURL(*wailsContext, getAniListCodeUrl)
|
||||||
|
|
||||||
|
serverDone := &sync.WaitGroup{}
|
||||||
|
serverDone.Add(1)
|
||||||
|
a.handleAniListCallback(serverDone)
|
||||||
|
serverDone.Wait()
|
||||||
|
} else {
|
||||||
|
aniListJwt.TokenType = string(tokenType.Data)
|
||||||
|
aniListJwt.AccessToken = string(accessToken.Data)
|
||||||
|
aniListJwt.RefreshToken = string(refreshToken.Data)
|
||||||
|
aniListJwt.ExpiresIn, _ = strconv.Atoi(string(expiresIn.Data))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) handleAniListCallback(wg *sync.WaitGroup) {
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||||
|
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
select {
|
||||||
|
case <-aniCtxShutdown.Done():
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
content := r.FormValue("code")
|
||||||
|
if content != "" {
|
||||||
|
aniListJwt = getAniListAuthorizationToken(content)
|
||||||
|
_ = aniRing.Set(keyring.Item{
|
||||||
|
Key: "anilistTokenType",
|
||||||
|
Data: []byte(aniListJwt.TokenType),
|
||||||
|
})
|
||||||
|
_ = aniRing.Set(keyring.Item{
|
||||||
|
Key: "anilistTokenExpiresIn",
|
||||||
|
Data: []byte(strconv.Itoa(aniListJwt.ExpiresIn)),
|
||||||
|
})
|
||||||
|
_ = aniRing.Set(keyring.Item{
|
||||||
|
Key: "anilistAccessToken",
|
||||||
|
Data: []byte(aniListJwt.AccessToken),
|
||||||
|
})
|
||||||
|
_ = aniRing.Set(keyring.Item{
|
||||||
|
Key: "anilistRefreshToken",
|
||||||
|
Data: []byte(aniListJwt.RefreshToken),
|
||||||
|
})
|
||||||
|
_, err := runtime.MessageDialog(*wailsContext, runtime.MessageDialogOptions{
|
||||||
|
Title: "AniList Authorization",
|
||||||
|
Message: "It is now safe to close your browser tab",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
aniCancel()
|
||||||
|
err = srv.Shutdown(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
log.Println("server.Shutdown:", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err := fmt.Fprintf(w, "Getting code failed.")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||||
|
log.Fatalf("listen: %s\n", err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAniListAuthorizationToken(content string) AniListJWT {
|
||||||
|
apiUrl := "https://anilist.co/api/v2/oauth/token"
|
||||||
|
resource := "/api/v2/oauth/token"
|
||||||
|
data := url.Values{}
|
||||||
|
data.Set("grant_type", "authorization_code")
|
||||||
|
data.Set("client_id", Environment.ANILIST_APP_ID)
|
||||||
|
data.Set("client_secret", Environment.ANILIST_SECRET_TOKEN)
|
||||||
|
data.Set("redirect_uri", Environment.ANILIST_CALLBACK_URI)
|
||||||
|
data.Set("code", content)
|
||||||
|
|
||||||
|
u, _ := url.ParseRequestURI(apiUrl)
|
||||||
|
u.Path = resource
|
||||||
|
urlStr := u.String()
|
||||||
|
|
||||||
|
response, err := http.NewRequest("POST", urlStr, strings.NewReader(data.Encode()))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at response, %s\n", err)
|
||||||
|
}
|
||||||
|
response.Header.Add("Content-type", "application/x-www-form-urlencoded")
|
||||||
|
response.Header.Add("Accept", "application/json")
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
res, resErr := client.Do(response)
|
||||||
|
if resErr != nil {
|
||||||
|
log.Printf("Failed at res, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
returnedBody, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Could not read returned body, %s\n.", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var post AniListJWT
|
||||||
|
err = json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetAniListLoggedInUser() AniListUser {
|
||||||
|
a.AniListLogin()
|
||||||
|
body := struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
}{
|
||||||
|
Query: `
|
||||||
|
query {
|
||||||
|
Viewer {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
bannerImage
|
||||||
|
siteUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
|
user, _ := AniListQuery(body, true)
|
||||||
|
|
||||||
|
var post AniListUser
|
||||||
|
err := json.Unmarshal(user, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) LogoutAniList() string {
|
||||||
|
if (AniListJWT{} != aniListJwt) {
|
||||||
|
typeErr := aniRing.Remove("anilistTokenType")
|
||||||
|
expiresInErr := aniRing.Remove("anilistTokenExpiresIn")
|
||||||
|
accessTokenErr := aniRing.Remove("anilistAccessToken")
|
||||||
|
refreshTokenErr := aniRing.Remove("anilistRefreshToken")
|
||||||
|
if typeErr != nil || expiresInErr != nil || accessTokenErr != nil || refreshTokenErr != nil {
|
||||||
|
fmt.Println("AniList Logout Failed")
|
||||||
|
}
|
||||||
|
aniListJwt = AniListJWT{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "AniList Logged Out Successfully"
|
||||||
|
}
|
116
MALFunctions.go
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MALHelper(method string, malUrl string, body url.Values) (json.RawMessage, string) {
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
req, _ := http.NewRequest(method, malUrl, strings.NewReader(body.Encode()))
|
||||||
|
|
||||||
|
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
req.Header.Add("Authorization", "Bearer "+myAnimeListJwt.AccessToken)
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Errored when sending request to the server")
|
||||||
|
message, _ := json.Marshal(struct {
|
||||||
|
Message string `json:"message" ts_type:"message"`
|
||||||
|
}{
|
||||||
|
Message: "Errored when sending request to the server" + err.Error(),
|
||||||
|
})
|
||||||
|
|
||||||
|
return message, resp.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
respBody, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
|
if resp.Status == "401 Unauthorized" {
|
||||||
|
refreshMyAnimeListAuthorizationToken()
|
||||||
|
MALHelper(method, malUrl, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody, resp.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetMyAnimeList(count int) MALWatchlist {
|
||||||
|
limit := strconv.Itoa(count)
|
||||||
|
user := a.GetMyAnimeListLoggedInUser()
|
||||||
|
malUrl := "https://api.myanimelist.net/v2/users/" + user.Name + "/animelist?fields=list_status&status=watching&limit=" + limit
|
||||||
|
|
||||||
|
var malList MALWatchlist
|
||||||
|
|
||||||
|
respBody, resStatus := MALHelper("GET", malUrl, nil)
|
||||||
|
|
||||||
|
if resStatus == "200 OK" {
|
||||||
|
err := json.Unmarshal(respBody, &malList)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to unmarshal json response, %s\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return malList
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) MyAnimeListUpdate(anime MALAnime, update MALUploadStatus) MalListStatus {
|
||||||
|
if update.NumTimesRewatched >= 1 {
|
||||||
|
update.IsRewatching = true
|
||||||
|
} else {
|
||||||
|
update.IsRewatching = false
|
||||||
|
}
|
||||||
|
body := url.Values{}
|
||||||
|
body.Set("status", update.Status)
|
||||||
|
body.Set("is_rewatching", strconv.FormatBool(update.IsRewatching))
|
||||||
|
body.Set("score", strconv.Itoa(update.Score))
|
||||||
|
body.Set("num_watched_episodes", strconv.Itoa(update.NumWatchedEpisodes))
|
||||||
|
body.Set("num_times_rewatched", strconv.Itoa(update.NumTimesRewatched))
|
||||||
|
body.Set("comments", update.Comments)
|
||||||
|
|
||||||
|
malUrl := "https://api.myanimelist.net/v2/anime/" + strconv.Itoa(anime.Id) + "/my_list_status"
|
||||||
|
var status MalListStatus
|
||||||
|
respBody, respStatus := MALHelper("PATCH", malUrl, body)
|
||||||
|
|
||||||
|
if respStatus == "200 OK" {
|
||||||
|
err := json.Unmarshal(respBody, &status)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to unmarshal json response, %s\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetMyAnimeListAnime(id int) MALAnime {
|
||||||
|
malUrl := "https://api.myanimelist.net/v2/anime/" + strconv.Itoa(id) + "?fields=id,title,main_picture,alternative_titles,start_date,end_date,synopsis,mean,rank,popularity,num_list_users,num_scoring_users,nsfw,genres,created_at,updated_at,media_type,status,my_list_status,num_episodes,start_season,broadcast,source,average_episode_duration,rating,pictures,background,related_anime,recommendations,studios,statistics"
|
||||||
|
respBody, respStatus := MALHelper("GET", malUrl, nil)
|
||||||
|
var malAnime MALAnime
|
||||||
|
|
||||||
|
if respStatus == "200 OK" {
|
||||||
|
err := json.Unmarshal(respBody, &malAnime)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to unmarshal json response, %s\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return malAnime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) DeleteMyAnimeListEntry(id int) bool {
|
||||||
|
malUrl := "https://api.myanimelist.net/v2/anime/" + strconv.Itoa(id) + "/my_list_status"
|
||||||
|
_, respStatus := MALHelper("DELETE", malUrl, nil)
|
||||||
|
if respStatus == "200 OK" {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
163
MALTypes.go
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type MyAnimeListJWT struct {
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
ExpiresIn int `json:"expires_in"`
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MyAnimeListUser struct {
|
||||||
|
Id int32 `json:"id" ts_type:"id"`
|
||||||
|
Name string `json:"name" ts_type:"name"`
|
||||||
|
Picture string `json:"picture" ts_type:"picture"`
|
||||||
|
Gender string `json:"gender" ts_type:"gender"`
|
||||||
|
Birthday string `json:"birthday" ts_type:"birthday"`
|
||||||
|
Location string `json:"location" ts_type:"location"`
|
||||||
|
JoinedAt string `json:"joined_at" ts_type:"joinedAt"`
|
||||||
|
AnimeStatistics `json:"anime_statistics" ts_type:"AnimeStatistics"`
|
||||||
|
TimeZone string `json:"time_zone" ts_type:"timeZone"`
|
||||||
|
IsSupporter bool `json:"is_supporter" ts_type:"isSupporter"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AnimeStatistics struct {
|
||||||
|
NumItemsWatching int `json:"num_items_watching" ts_type:"numItemsWatching"`
|
||||||
|
NumItemsCompleted int `json:"num_items_completed" ts_type:"numItemsCompleted"`
|
||||||
|
NumItemsOnHold int `json:"num_items_on_hold" ts_type:"numItemsOnHold"`
|
||||||
|
NumItemsDropped int `json:"num_items_dropped" ts_type:"numItemsDropped"`
|
||||||
|
NumItemsPlanToWatch int `json:"num_items_plan_to_watch" ts_type:"numItemsPlanToWatch"`
|
||||||
|
NumItems int `json:"num_items" ts_type:"numItems"`
|
||||||
|
NumDaysWatched float64 `json:"num_days_watched" ts_type:"numDaysWatched"`
|
||||||
|
NumDaysWatching float64 `json:"num_days_watching" ts_type:"numDaysWatching"`
|
||||||
|
NumDaysCompleted float64 `json:"num_days_completed" ts_type:"numDaysCompleted"`
|
||||||
|
NumDaysOnHold float64 `json:"num_days_on_hold" ts_type:"numDaysOnHold"`
|
||||||
|
NumDaysDropped float64 `json:"num_days_dropped" ts_type:"numDaysDropped"`
|
||||||
|
NumDays float64 `json:"num_days" ts_type:"numDays"`
|
||||||
|
NumEpisodes int `json:"num_episodes" ts_type:"numEpisodes"`
|
||||||
|
NumTimesRewatched int `json:"num_times_rewatched" ts_type:"numTimesRewatched"`
|
||||||
|
MeanScore float64 `json:"mean_score" ts_type:"meanScore"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MALWatchlist struct {
|
||||||
|
Data []struct {
|
||||||
|
Node struct {
|
||||||
|
Id int `json:"id" ts_type:"id"`
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
MainPicture struct {
|
||||||
|
Medium string `json:"medium" ts_type:"medium"`
|
||||||
|
Large string `json:"large" ts_type:"large"`
|
||||||
|
} `json:"main_picture" ts_type:"mainPicture"`
|
||||||
|
} `json:"node" ts_type:"node"`
|
||||||
|
ListStatus struct {
|
||||||
|
Status string `json:"status" ts_type:"status"`
|
||||||
|
Score int `json:"score" ts_type:"score"`
|
||||||
|
NumEpisodesWatched int `json:"num_episodes_watched" ts_type:"numEpisodesWatched"`
|
||||||
|
IsRewatching bool `json:"is_rewatching" ts_type:"isRewatching"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" ts_type:"updatedAt"`
|
||||||
|
StartDate string `json:"start_date" ts_type:"startDate"`
|
||||||
|
FinishDate string `json:"finish_date" ts_type:"finishDate"`
|
||||||
|
} `json:"list_status" ts_type:"listStatus"`
|
||||||
|
} `json:"data" ts_type:"data"`
|
||||||
|
Paging struct {
|
||||||
|
Previous string `json:"previous" ts_type:"previous"`
|
||||||
|
Next string `json:"next" ts_type:"next"`
|
||||||
|
} `json:"paging" ts_type:"paging"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MALAnime struct {
|
||||||
|
Id int `json:"id" ts_type:"id"`
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
MainPicture struct {
|
||||||
|
Large string `json:"large" ts_type:"large"`
|
||||||
|
Medium string `json:"medium" ts_type:"medium"`
|
||||||
|
} `json:"main_picture" ts_type:"mainPicture"`
|
||||||
|
AlternativeTitles struct {
|
||||||
|
Synonyms []string `json:"synonyms" ts_type:"synonyms"`
|
||||||
|
En string `json:"en" ts_type:"en"`
|
||||||
|
Ja string `json:"ja" ts_type:"ja"`
|
||||||
|
} `json:"alternative_titles" ts_type:"alternativeTitles"`
|
||||||
|
StartDate string `json:"start_date" ts_type:"startDate"`
|
||||||
|
EndDate string `json:"end_date" ts_type:"endDate"`
|
||||||
|
Synopsis string `json:"synopsis" ts_type:"synopsis"`
|
||||||
|
Mean float64 `json:"mean" ts_type:"mean"`
|
||||||
|
Rank int `json:"rank" ts_type:"rank"`
|
||||||
|
Popularity int `json:"popularity" ts_type:"popularity"`
|
||||||
|
NumListUsers int `json:"num_list_users" ts_type:"numListUsers"`
|
||||||
|
NumScoringUsers int `json:"num_scoring_users" ts_type:"numScoringUsers"`
|
||||||
|
NSFW string `json:"nsfw" ts_type:"nsfw"`
|
||||||
|
Genres []struct {
|
||||||
|
Id int `json:"id" ts_type:"id"`
|
||||||
|
Name string `json:"name" ts_type:"name"`
|
||||||
|
} `json:"genres" ts_type:"genres"`
|
||||||
|
CreatedAt string `json:"created_at" ts_type:"createdAt"`
|
||||||
|
UpdatedAt string `json:"updated_at" ts_type:"updatedAt"`
|
||||||
|
MediaType string `json:"media_type" ts_type:"mediaType"`
|
||||||
|
Status string `json:"status" ts_type:"status"`
|
||||||
|
MalListStatus MalListStatus `json:"my_list_status" ts_type:"MalListStatus"`
|
||||||
|
NumEpisodes int `json:"num_episodes" ts_type:"numEpisodes"`
|
||||||
|
StartSeason struct {
|
||||||
|
Year int `json:"year" ts_type:"year"`
|
||||||
|
Season string `json:"season" ts_type:"season"`
|
||||||
|
} `json:"start_season" ts_type:"startSeason"`
|
||||||
|
Broadcast struct {
|
||||||
|
DayOfTheWeek string `json:"day_of_the_week" ts_type:"dayOfTheWeek"`
|
||||||
|
StartTime string `json:"start_time" ts_type:"startTime"`
|
||||||
|
} `json:"broadcast" ts_type:"broadcast"`
|
||||||
|
Source string `json:"source" ts_type:"source"`
|
||||||
|
AverageEpisodeDuration int `json:"average_episode_duration" ts_type:"averageEpisodeDuration"`
|
||||||
|
Rating string `json:"rating" ts_type:"rating"`
|
||||||
|
Studios []struct {
|
||||||
|
Id int `json:"id" ts_type:"id"`
|
||||||
|
Name string `json:"name" ts_type:"name"`
|
||||||
|
} `json:"studios" ts_type:"studios"`
|
||||||
|
Pictures []struct {
|
||||||
|
Large string `json:"large" ts_type:"large"`
|
||||||
|
Medium string `json:"medium" ts_type:"medium"`
|
||||||
|
} `json:"pictures" ts_type:"pictures"`
|
||||||
|
Background string `json:"background" ts_type:"background"`
|
||||||
|
RelatedAnime []struct {
|
||||||
|
Node MALAnime `json:"node" ts_type:"node"`
|
||||||
|
RelationType string `json:"relation_type" ts_type:"relationType"`
|
||||||
|
RelationTypeFormatted string `json:"relation_type_formatted" ts_type:"relationTypeFormatted"`
|
||||||
|
} `json:"related_anime" ts_type:"relatedAnime"`
|
||||||
|
Recommendations []struct {
|
||||||
|
Node MALAnime `json:"node" ts_type:"node"`
|
||||||
|
NumRecommendations int `json:"num_recommendations" ts_type:"numRecommendations"`
|
||||||
|
} `json:"recommendations" ts_type:"recommendations"`
|
||||||
|
Statistics 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"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type MalListStatus struct {
|
||||||
|
Status string `json:"status" ts_type:"status"`
|
||||||
|
Score int `json:"score" ts_type:"score"`
|
||||||
|
NumEpisodesWatched int `json:"num_episodes_watched" ts_type:"numEpisodesWatched"`
|
||||||
|
IsRewatching bool `json:"is_rewatching" ts_type:"isRewatching"`
|
||||||
|
StartDate string `json:"start_date" ts_type:"startDate"`
|
||||||
|
FinishDate string `json:"finish_date" ts_type:"finishDate"`
|
||||||
|
Priority int `json:"priority" ts_type:"priority"`
|
||||||
|
NumTimesRewatched int `json:"num_times_rewatched" ts_type:"numTimesRewatched"`
|
||||||
|
RewatchValue int `json:"rewatch_value" ts_type:"rewatchValue"`
|
||||||
|
Tags []string `json:"tags" ts_type:"tags"`
|
||||||
|
Comments string `json:"comments" ts_type:"comments"`
|
||||||
|
UpdatedAt string `json:"updated_at" ts_type:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MALUploadStatus struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
IsRewatching bool `json:"is_rewatching"`
|
||||||
|
Score int `json:"score"`
|
||||||
|
NumWatchedEpisodes int `json:"num_watched_episodes"`
|
||||||
|
NumTimesRewatched int `json:"num_times_rewatched"`
|
||||||
|
Comments string `json:"comments"`
|
||||||
|
}
|
353
MALUserFunctions.go
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"math/rand"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/99designs/keyring"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
var myAnimeListJwt MyAnimeListJWT
|
||||||
|
|
||||||
|
var myAnimeListRing, _ = keyring.Open(keyring.Config{
|
||||||
|
ServiceName: "AniTrack",
|
||||||
|
KeychainName: "AniTrack",
|
||||||
|
KeychainSynchronizable: false,
|
||||||
|
KeychainTrustApplication: true,
|
||||||
|
KeychainAccessibleWhenUnlocked: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
var myAnimeListCtxShutdown, myAnimeListCancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
type CodeVerifier struct {
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
length = 32
|
||||||
|
)
|
||||||
|
|
||||||
|
func base64URLEncode(str []byte) string {
|
||||||
|
encoded := base64.StdEncoding.EncodeToString(str)
|
||||||
|
encoded = strings.Replace(encoded, "+", "-", -1)
|
||||||
|
encoded = strings.Replace(encoded, "/", "_", -1)
|
||||||
|
encoded = strings.Replace(encoded, "=", "", -1)
|
||||||
|
return encoded
|
||||||
|
}
|
||||||
|
|
||||||
|
func verifier() (*CodeVerifier, error) {
|
||||||
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
b := make([]byte, length)
|
||||||
|
for i := 0; i < length; i++ {
|
||||||
|
b[i] = byte(r.Intn(255))
|
||||||
|
}
|
||||||
|
return CreateCodeVerifierFromBytes(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateCodeVerifierFromBytes(b []byte) (*CodeVerifier, error) {
|
||||||
|
return &CodeVerifier{
|
||||||
|
Value: base64URLEncode(b),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *CodeVerifier) CodeChallengeS256() string {
|
||||||
|
h := sha256.New()
|
||||||
|
h.Write([]byte(v.Value))
|
||||||
|
return base64URLEncode(h.Sum(nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) CheckIfMyAnimeListLoggedIn() bool {
|
||||||
|
if (MyAnimeListJWT{} == myAnimeListJwt) {
|
||||||
|
tokenType, tokenErr := myAnimeListRing.Get("MyAnimeListTokenType")
|
||||||
|
expiresIn, expiresInErr := myAnimeListRing.Get("MyAnimeListExpiresIn")
|
||||||
|
refreshToken, refreshTokenErr := myAnimeListRing.Get("MyAnimeListAccessToken")
|
||||||
|
accessToken, accessTokenErr := myAnimeListRing.Get("MyAnimeListRefreshToken")
|
||||||
|
if (tokenErr != nil || expiresInErr != nil || refreshTokenErr != nil || accessTokenErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
var expiresInConvertErr error
|
||||||
|
myAnimeListJwt.TokenType = string(tokenType.Data)
|
||||||
|
myAnimeListJwt.ExpiresIn, expiresInConvertErr = strconv.Atoi(string(expiresIn.Data))
|
||||||
|
if expiresInConvertErr != nil {
|
||||||
|
fmt.Println("unable to convert string to int")
|
||||||
|
}
|
||||||
|
myAnimeListJwt.AccessToken = string(accessToken.Data)
|
||||||
|
myAnimeListJwt.RefreshToken = string(refreshToken.Data)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) MyAnimeListLogin() {
|
||||||
|
if !a.CheckIfMyAnimeListLoggedIn() {
|
||||||
|
fmt.Println("check logged in function failed")
|
||||||
|
tokenType, tokenErr := myAnimeListRing.Get("MyAnimeListTokenType")
|
||||||
|
expiresIn, expiresInErr := myAnimeListRing.Get("MyAnimeListExpiresIn")
|
||||||
|
refreshToken, refreshTokenErr := myAnimeListRing.Get("MyAnimeListAccessToken")
|
||||||
|
accessToken, accessTokenErr := myAnimeListRing.Get("MyAnimeListRefreshToken")
|
||||||
|
if (tokenErr != nil || expiresInErr != nil || refreshTokenErr != nil || accessTokenErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
verifier, _ := verifier()
|
||||||
|
getMyAnimeListCodeUrl := "https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=" + Environment.MAL_CLIENT_ID + "&redirect_uri=" + Environment.MAL_CALLBACK_URI + "&code_challenge=" + verifier.Value + "&code_challenge_method=plain"
|
||||||
|
runtime.BrowserOpenURL(*wailsContext, getMyAnimeListCodeUrl)
|
||||||
|
serverDone := &sync.WaitGroup{}
|
||||||
|
serverDone.Add(1)
|
||||||
|
a.handleMyAnimeListCallback(serverDone, verifier)
|
||||||
|
serverDone.Wait()
|
||||||
|
} else {
|
||||||
|
var expiresInConvertErr error
|
||||||
|
myAnimeListJwt.TokenType = string(tokenType.Data)
|
||||||
|
myAnimeListJwt.ExpiresIn, expiresInConvertErr = strconv.Atoi(string(expiresIn.Data))
|
||||||
|
if expiresInConvertErr != nil {
|
||||||
|
fmt.Println("unable to convert string to int in Login function")
|
||||||
|
}
|
||||||
|
myAnimeListJwt.AccessToken = string(accessToken.Data)
|
||||||
|
myAnimeListJwt.RefreshToken = string(refreshToken.Data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) handleMyAnimeListCallback(wg *sync.WaitGroup, verifier *CodeVerifier) {
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||||
|
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
select {
|
||||||
|
case <-myAnimeListCtxShutdown.Done():
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
content := r.FormValue("code")
|
||||||
|
|
||||||
|
if content != "" {
|
||||||
|
myAnimeListJwt = getMyAnimeListAuthorizationToken(content, verifier)
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListTokenType",
|
||||||
|
Data: []byte(myAnimeListJwt.TokenType),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListExpiresIn",
|
||||||
|
Data: []byte(strconv.Itoa(myAnimeListJwt.ExpiresIn)),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListAccessToken",
|
||||||
|
Data: []byte(myAnimeListJwt.AccessToken),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListRefreshToken",
|
||||||
|
Data: []byte(myAnimeListJwt.RefreshToken),
|
||||||
|
})
|
||||||
|
_, err := runtime.MessageDialog(*wailsContext, runtime.MessageDialogOptions{
|
||||||
|
Title: "MyAnimeList Authorization",
|
||||||
|
Message: "It is now safe to close your browser tab",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
myAnimeListCancel()
|
||||||
|
err = srv.Shutdown(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
log.Println("server.Shutdown:", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err := fmt.Fprintf(w, "Getting code failed.")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||||
|
log.Fatalf("listen: %s\n", err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getMyAnimeListAuthorizationToken(content string, verifier *CodeVerifier) MyAnimeListJWT {
|
||||||
|
dataForURLs := struct {
|
||||||
|
GrantType string `json:"grant_type"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
RedirectURI string `json:"redirect_uri"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
CodeVerifier *CodeVerifier `json:"code_verifier"`
|
||||||
|
}{
|
||||||
|
GrantType: "authorization_code",
|
||||||
|
ClientID: Environment.MAL_CLIENT_ID,
|
||||||
|
ClientSecret: Environment.MAL_CLIENT_SECRET,
|
||||||
|
RedirectURI: Environment.MAL_CALLBACK_URI,
|
||||||
|
Code: content,
|
||||||
|
CodeVerifier: verifier,
|
||||||
|
}
|
||||||
|
|
||||||
|
data := url.Values{}
|
||||||
|
data.Set("grant_type", dataForURLs.GrantType)
|
||||||
|
data.Set("client_id", dataForURLs.ClientID)
|
||||||
|
data.Set("client_secret", dataForURLs.ClientSecret)
|
||||||
|
data.Set("redirect_uri", dataForURLs.RedirectURI)
|
||||||
|
data.Set("code", dataForURLs.Code)
|
||||||
|
data.Set("code_verifier", dataForURLs.CodeVerifier.Value)
|
||||||
|
|
||||||
|
response, err := http.NewRequest("POST", "https://myanimelist.net/v1/oauth2/token", strings.NewReader(data.Encode()))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at response, %s\n", err)
|
||||||
|
}
|
||||||
|
response.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
res, resErr := client.Do(response)
|
||||||
|
if resErr != nil {
|
||||||
|
log.Printf("Failed at res, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
returnedBody, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Could not read returned body, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var post MyAnimeListJWT
|
||||||
|
err = json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func refreshMyAnimeListAuthorizationToken() {
|
||||||
|
dataForURLs := struct {
|
||||||
|
GrantType string `json:"grant_type"`
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
RedirectURI string `json:"redirect_uri"`
|
||||||
|
}{
|
||||||
|
GrantType: "refresh_token",
|
||||||
|
RefreshToken: myAnimeListJwt.RefreshToken,
|
||||||
|
ClientID: Environment.MAL_CLIENT_ID,
|
||||||
|
ClientSecret: Environment.MAL_CLIENT_SECRET,
|
||||||
|
RedirectURI: Environment.MAL_CALLBACK_URI,
|
||||||
|
}
|
||||||
|
|
||||||
|
data := url.Values{}
|
||||||
|
data.Set("grant_type", dataForURLs.GrantType)
|
||||||
|
data.Set("refresh_token", dataForURLs.RefreshToken)
|
||||||
|
data.Set("client_id", dataForURLs.ClientID)
|
||||||
|
data.Set("client_secret", dataForURLs.ClientSecret)
|
||||||
|
data.Set("redirect_uri", dataForURLs.RedirectURI)
|
||||||
|
|
||||||
|
response, err := http.NewRequest("POST", "https://myanimelist.net/v1/oauth2/token", strings.NewReader(data.Encode()))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at response, %s\n", err)
|
||||||
|
}
|
||||||
|
response.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
res, resErr := client.Do(response)
|
||||||
|
if resErr != nil {
|
||||||
|
log.Printf("Failed at res, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
returnedBody, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Could not read returned body, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(returnedBody, &myAnimeListJwt)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListTokenType",
|
||||||
|
Data: []byte(myAnimeListJwt.TokenType),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListExpiresIn",
|
||||||
|
Data: []byte(strconv.Itoa(myAnimeListJwt.ExpiresIn)),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListAccessToken",
|
||||||
|
Data: []byte(myAnimeListJwt.AccessToken),
|
||||||
|
})
|
||||||
|
_ = myAnimeListRing.Set(keyring.Item{
|
||||||
|
Key: "MyAnimeListRefreshToken",
|
||||||
|
Data: []byte(myAnimeListJwt.RefreshToken),
|
||||||
|
})
|
||||||
|
_, err = runtime.MessageDialog(*wailsContext, runtime.MessageDialogOptions{
|
||||||
|
Title: "MyAnimeList Authorization",
|
||||||
|
Message: "It is now safe to close your browser tab",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
||||||
|
a.MyAnimeListLogin()
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "https://api.myanimelist.net/v2/users/@me?fields=anime_statistics", nil)
|
||||||
|
|
||||||
|
req.Header.Add("Content-Type", "application/json")
|
||||||
|
req.Header.Add("Authorization", "Bearer "+myAnimeListJwt.AccessToken)
|
||||||
|
req.Header.Add("myAnimeList-api-key", Environment.MAL_CLIENT_ID)
|
||||||
|
|
||||||
|
response, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at request, %s\n", err)
|
||||||
|
return MyAnimeListUser{}
|
||||||
|
}
|
||||||
|
|
||||||
|
defer response.Body.Close()
|
||||||
|
|
||||||
|
var user MyAnimeListUser
|
||||||
|
|
||||||
|
respBody, _ := io.ReadAll(response.Body)
|
||||||
|
|
||||||
|
err = json.Unmarshal(respBody, &user)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return user
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) LogoutMyAnimeList() string {
|
||||||
|
if (MyAnimeListJWT{} != myAnimeListJwt) {
|
||||||
|
typeErr := myAnimeListRing.Remove("MyAnimeListTokenType")
|
||||||
|
expiresInErr := myAnimeListRing.Remove("MyAnimeListExpiresIn")
|
||||||
|
accessTokenErr := myAnimeListRing.Remove("MyAnimeListAccessToken")
|
||||||
|
refreshTokenErr := myAnimeListRing.Remove("MyAnimeListRefreshToken")
|
||||||
|
if typeErr != nil || expiresInErr != nil || accessTokenErr != nil || refreshTokenErr != nil {
|
||||||
|
fmt.Println("MAL Logout Failed")
|
||||||
|
}
|
||||||
|
myAnimeListJwt = MyAnimeListJWT{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "MAL Logged Out Successfully"
|
||||||
|
}
|
29
README.md
@ -2,10 +2,35 @@
|
|||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
Track anime shows by syncing with various services. Anilist, MyAnimeList, Kitsu, Simkl...
|
Track the anime you are watching by syncing with various services. Anilist, MyAnimeList, Simkl...
|
||||||
|
|
||||||
This has been built with the official Wails Svelte-TS template.
|
This has been built with the official Wails Svelte-TS template.
|
||||||
|
|
||||||
|
To run as is, please feel free to download a binary from the releases page.
|
||||||
|
|
||||||
|
If you are getting too many errors due to api usage, please build from source.
|
||||||
|
|
||||||
|
## Build from Source
|
||||||
|
|
||||||
|
### Get API Keys
|
||||||
|
First you will need your own API keys for the various services the app connects to.
|
||||||
|
AniList: [AniList Developer App](https://anilist.co/settings/developer)
|
||||||
|
MyAnimeList: [MyAnimeList Developer App](https://myanimelist.net/apiconfig/create)
|
||||||
|
Simkl: [Simkl Developer](https://simkl.com/settings/developer/)
|
||||||
|
|
||||||
|
- Name: AniTrack
|
||||||
|
- Redirect URL: http://localhost:6734/callback
|
||||||
|
- App Type: web
|
||||||
|
- Homepage URL: http://localhost or the Github URL
|
||||||
|
- Company Name: AniTrack
|
||||||
|
- Commercial/Non-Commercial: non-commercial
|
||||||
|
- Purpose of Use: hobbyist
|
||||||
|
|
||||||
|
Once you have the IDs, Keys, and Secrets create an environment.go file based on the environment.go.example and fill in the fields.
|
||||||
|
|
||||||
|
### Install Wails and Dependencies
|
||||||
|
Please follow the instructions [here](https://wails.io/docs/gettingstarted/installation) to get Wails up and running and follow the instructions below.
|
||||||
|
|
||||||
## Live Development
|
## Live Development
|
||||||
|
|
||||||
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
||||||
@ -15,4 +40,4 @@ to this in your browser, and you can call your Go code from devtools.
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To build a redistributable, production mode package, use `wails build`.
|
To build a redistributable, production mode package, use `wails build --clean`.
|
||||||
|
348
SimklFunctions.go
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"reflect"
|
||||||
|
"slices"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var SimklWatchList SimklWatchListType
|
||||||
|
|
||||||
|
func SimklHelper(method string, url string, body interface{}) json.RawMessage {
|
||||||
|
reader, _ := json.Marshal(body)
|
||||||
|
var req *http.Request
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
if body != nil {
|
||||||
|
req, _ = http.NewRequest(method, url, bytes.NewBuffer(reader))
|
||||||
|
} else {
|
||||||
|
req, _ = http.NewRequest(method, url, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Header.Add("Content-Type", "application/json")
|
||||||
|
req.Header.Add("Authorization", "Bearer "+simklJwt.AccessToken)
|
||||||
|
req.Header.Add("simkl-api-key", Environment.SIMKL_CLIENT_ID)
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Errored when sending request to the server")
|
||||||
|
message, _ := json.Marshal(struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
}{
|
||||||
|
Message: "Errored when sending request to the server" + err.Error(),
|
||||||
|
})
|
||||||
|
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
respBody, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
|
return respBody
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklGetUserWatchlist() SimklWatchListType {
|
||||||
|
method := "GET"
|
||||||
|
url := "https://api.simkl.com/sync/all-items/anime"
|
||||||
|
|
||||||
|
respBody := SimklHelper(method, url, nil)
|
||||||
|
|
||||||
|
var errCheck struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &errCheck)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if errCheck.Error != "" {
|
||||||
|
a.LogoutSimkl()
|
||||||
|
return SimklWatchListType{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var watchlist SimklWatchListType
|
||||||
|
|
||||||
|
err = json.Unmarshal(respBody, &watchlist)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
SimklWatchList = watchlist
|
||||||
|
|
||||||
|
return watchlist
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklSyncEpisodes(anime SimklAnime, progress int) SimklAnime {
|
||||||
|
var episodes []Episode
|
||||||
|
var url string
|
||||||
|
var shows []SimklPostShow
|
||||||
|
|
||||||
|
if progress >= anime.WatchedEpisodesCount {
|
||||||
|
for i := 1; i <= progress; i++ {
|
||||||
|
episodes = append(episodes, Episode{Number: i})
|
||||||
|
}
|
||||||
|
url = "https://api.simkl.com/sync/history"
|
||||||
|
} else {
|
||||||
|
for i := anime.WatchedEpisodesCount; i > progress; i-- {
|
||||||
|
episodes = append(episodes, Episode{Number: i})
|
||||||
|
}
|
||||||
|
url = "https://api.simkl.com/sync/history/remove"
|
||||||
|
}
|
||||||
|
|
||||||
|
formattedShow := SimklPostShow{
|
||||||
|
Title: anime.Show.Title,
|
||||||
|
Ids: Ids{
|
||||||
|
Simkl: anime.Show.Ids.Simkl,
|
||||||
|
Mal: anime.Show.Ids.Mal,
|
||||||
|
Anilist: anime.Show.Ids.AniList,
|
||||||
|
},
|
||||||
|
Episodes: episodes,
|
||||||
|
}
|
||||||
|
|
||||||
|
shows = append(shows, formattedShow)
|
||||||
|
|
||||||
|
simklSync := SimklSyncHistoryType{shows}
|
||||||
|
|
||||||
|
respBody := SimklHelper("POST", url, simklSync)
|
||||||
|
|
||||||
|
var success interface{}
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &success)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, simklAnime := range SimklWatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
SimklWatchList.Anime[i].WatchedEpisodesCount = progress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.WatchedEpisodesCount = progress
|
||||||
|
|
||||||
|
WatchListUpdate(anime)
|
||||||
|
|
||||||
|
return anime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklSyncRating(anime SimklAnime, rating int) SimklAnime {
|
||||||
|
var url string
|
||||||
|
showWithRating := ShowWithRating{
|
||||||
|
Title: anime.Show.Title,
|
||||||
|
Ids: Ids{
|
||||||
|
Simkl: anime.Show.Ids.Simkl,
|
||||||
|
Mal: anime.Show.Ids.Mal,
|
||||||
|
Anilist: anime.Show.Ids.AniList,
|
||||||
|
},
|
||||||
|
Rating: rating,
|
||||||
|
}
|
||||||
|
|
||||||
|
showWithoutRating := ShowWithoutRating{
|
||||||
|
Title: anime.Show.Title,
|
||||||
|
Ids: Ids{
|
||||||
|
Simkl: anime.Show.Ids.Simkl,
|
||||||
|
Mal: anime.Show.Ids.Mal,
|
||||||
|
Anilist: anime.Show.Ids.AniList,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var shows []interface{}
|
||||||
|
|
||||||
|
if rating > 0 {
|
||||||
|
shows = append(shows, showWithRating)
|
||||||
|
url = "https://api.simkl.com/sync/ratings"
|
||||||
|
} else {
|
||||||
|
shows = append(shows, showWithoutRating)
|
||||||
|
url = "https://api.simkl.com/sync/ratings/remove"
|
||||||
|
}
|
||||||
|
|
||||||
|
simklSync := struct {
|
||||||
|
Shows []interface{} `json:"shows" ts_type:"shows"`
|
||||||
|
}{shows}
|
||||||
|
|
||||||
|
respBody := SimklHelper("POST", url, simklSync)
|
||||||
|
|
||||||
|
var success interface{}
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &success)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, simklAnime := range SimklWatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
SimklWatchList.Anime[i].UserRating = rating
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.UserRating = rating
|
||||||
|
|
||||||
|
WatchListUpdate(anime)
|
||||||
|
|
||||||
|
return anime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklSyncStatus(anime SimklAnime, status string) SimklAnime {
|
||||||
|
url := "https://api.simkl.com/sync/add-to-list"
|
||||||
|
show := SimklShowStatus{
|
||||||
|
Title: anime.Show.Title,
|
||||||
|
Ids: Ids{
|
||||||
|
Simkl: anime.Show.Ids.Simkl,
|
||||||
|
Mal: anime.Show.Ids.Mal,
|
||||||
|
Anilist: anime.Show.Ids.AniList,
|
||||||
|
},
|
||||||
|
To: status,
|
||||||
|
}
|
||||||
|
|
||||||
|
var shows []SimklShowStatus
|
||||||
|
|
||||||
|
shows = append(shows, show)
|
||||||
|
|
||||||
|
simklSync := struct {
|
||||||
|
Shows []SimklShowStatus `json:"shows" ts_type:"shows"`
|
||||||
|
}{shows}
|
||||||
|
|
||||||
|
respBody := SimklHelper("POST", url, simklSync)
|
||||||
|
|
||||||
|
var success interface{}
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &success)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, simklAnime := range SimklWatchList.Anime {
|
||||||
|
if anime.Show.Ids.Simkl == simklAnime.Show.Ids.Simkl {
|
||||||
|
SimklWatchList.Anime[i].Status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.Status = status
|
||||||
|
|
||||||
|
WatchListUpdate(anime)
|
||||||
|
|
||||||
|
return anime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklSearch(aniListAnime MediaList) SimklAnime {
|
||||||
|
var result SimklAnime
|
||||||
|
|
||||||
|
if reflect.DeepEqual(SimklWatchList, SimklWatchListType{}) {
|
||||||
|
fmt.Println("Watchlist empty. Calling...")
|
||||||
|
SimklWatchList = a.SimklGetUserWatchlist()
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, anime := range SimklWatchList.Anime {
|
||||||
|
id, err := strconv.Atoi(anime.Show.Ids.AniList)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("AniList ID does not exist on " + anime.Show.Title)
|
||||||
|
}
|
||||||
|
if id == aniListAnime.Media.ID {
|
||||||
|
result = anime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if reflect.DeepEqual(result, SimklAnime{}) {
|
||||||
|
var anime SimklSearchType
|
||||||
|
url := "https://api.simkl.com/search/id?anilist=" + strconv.Itoa(aniListAnime.Media.ID)
|
||||||
|
|
||||||
|
respBody := SimklHelper("GET", url, nil)
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &anime)
|
||||||
|
|
||||||
|
if len(anime) == 0 {
|
||||||
|
url = "https://api.simkl.com/search/id?mal=" + strconv.Itoa(aniListAnime.Media.IDMal)
|
||||||
|
respBody = SimklHelper("GET", url, nil)
|
||||||
|
fmt.Println(string(respBody))
|
||||||
|
err = json.Unmarshal(respBody, &anime)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(anime) == 0 {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, watchListAnime := range SimklWatchList.Anime {
|
||||||
|
id := watchListAnime.Show.Ids.Simkl
|
||||||
|
if id == anime[0].Ids.Simkl {
|
||||||
|
result = watchListAnime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if reflect.DeepEqual(result, SimklAnime{}) && len(anime) > 0 {
|
||||||
|
result.Show.Title = anime[0].Title
|
||||||
|
result.Show.Poster = anime[0].Poster
|
||||||
|
result.Show.Ids.Simkl = anime[0].Ids.Simkl
|
||||||
|
result.Show.Ids.Slug = anime[0].Ids.Slug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklSyncRemove(anime SimklAnime) bool {
|
||||||
|
url := "https://api.simkl.com/sync/history/remove"
|
||||||
|
var showArray []SimklShowStatus
|
||||||
|
|
||||||
|
singleShow := SimklShowStatus{
|
||||||
|
Title: anime.Show.Title,
|
||||||
|
Ids: Ids{
|
||||||
|
Simkl: anime.Show.Ids.Simkl,
|
||||||
|
Mal: anime.Show.Ids.Mal,
|
||||||
|
Anilist: anime.Show.Ids.AniList,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
showArray = append(showArray, singleShow)
|
||||||
|
|
||||||
|
show := struct {
|
||||||
|
Shows []SimklShowStatus `json:"shows"`
|
||||||
|
}{
|
||||||
|
Shows: showArray,
|
||||||
|
}
|
||||||
|
|
||||||
|
respBody := SimklHelper("POST", url, show)
|
||||||
|
|
||||||
|
var success SimklDeleteType
|
||||||
|
|
||||||
|
err := json.Unmarshal(respBody, &success)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if success.Deleted.Shows >= 1 {
|
||||||
|
for i, simklAnime := range SimklWatchList.Anime {
|
||||||
|
if simklAnime.Show.Ids.Simkl == anime.Show.Ids.Simkl {
|
||||||
|
SimklWatchList.Anime = slices.Delete(SimklWatchList.Anime, i, i+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WatchListUpdate(anime SimklAnime) {
|
||||||
|
updated := false
|
||||||
|
for i, simklAnime := range SimklWatchList.Anime {
|
||||||
|
if simklAnime.Show.Ids.Simkl == anime.Show.Ids.Simkl {
|
||||||
|
SimklWatchList.Anime[i] = anime
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !updated {
|
||||||
|
SimklWatchList.Anime = append(SimklWatchList.Anime, anime)
|
||||||
|
}
|
||||||
|
}
|
133
SimklTypes.go
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type SimklJWT struct {
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklUser struct {
|
||||||
|
User struct {
|
||||||
|
Name string `json:"name" ts_type:"name"`
|
||||||
|
JoinedAt string `json:"joined_at" ts_type:"joined_at"`
|
||||||
|
Gender string `json:"gender" ts_type:"gender"`
|
||||||
|
Avatar string `json:"avatar" ts_type:"avatar"`
|
||||||
|
Bio string `json:"bio" ts_type:"bio"`
|
||||||
|
Loc string `json:"loc" ts_type:"loc"`
|
||||||
|
Age string `json:"age" ts_type:"age"`
|
||||||
|
} `json:"user" ts_type:"user"`
|
||||||
|
Account struct {
|
||||||
|
Id int `json:"id" ts_type:"id"`
|
||||||
|
Timezone string `json:"timezone" ts_type:"timezone"`
|
||||||
|
Type string `json:"type" ts_type:"type"`
|
||||||
|
} `json:"account" ts_type:"account"`
|
||||||
|
Connections struct {
|
||||||
|
Facebook bool `json:"facebook" ts_type:"facebook"`
|
||||||
|
} `json:"connections" ts_type:"connections"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklWatchListType struct {
|
||||||
|
Anime []SimklAnime `json:"anime" ts_type:"anime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklAnime struct {
|
||||||
|
LastWatchedAt string `json:"last_watched_at" ts_type:"last_watched_at"`
|
||||||
|
Status string `json:"status" ts_type:"status"`
|
||||||
|
UserRating int `json:"user_rating" ts_type:"user_rating"`
|
||||||
|
LastWatched string `json:"last_watched" ts_type:"last_watched"`
|
||||||
|
NextToWatch string `json:"next_to_watch" ts_type:"next_to_watch"`
|
||||||
|
WatchedEpisodesCount int `json:"watched_episodes_count" ts_type:"watched_episodes_count"`
|
||||||
|
TotalEpisodesCount int `json:"total_episodes_count" ts_type:"total_episodes_count"`
|
||||||
|
NotAiredEpisodesCount int `json:"not_aired_episodes_count" ts_type:"not_aired_episodes_count"`
|
||||||
|
Show struct {
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
Poster string `json:"poster" ts_type:"poster"`
|
||||||
|
Ids struct {
|
||||||
|
Simkl int `json:"simkl" ts_type:"simkl"`
|
||||||
|
Slug string `json:"slug" ts_type:"slug"`
|
||||||
|
OffJp string `json:"offjp" ts_type:"offjp"`
|
||||||
|
TW string `json:"tw" ts_type:"tw"`
|
||||||
|
ANN string `json:"ann" ts_type:"ann"`
|
||||||
|
Mal string `json:"mal" ts_type:"mal"`
|
||||||
|
Wikien string `json:"wikien" ts_type:"wikien"`
|
||||||
|
WikiJp string `json:"wikijp" ts_type:"wikijp"`
|
||||||
|
AllCin string `json:"allcin" ts_type:"allcin"`
|
||||||
|
IMDB string `json:"imdb" ts_type:"imdb"`
|
||||||
|
TMDB string `json:"tmdb" ts_type:"tmdb"`
|
||||||
|
Offen string `json:"offen" ts_type:"offen"`
|
||||||
|
Crunchyroll string `json:"crunchyroll" ts_type:"crunchyroll"`
|
||||||
|
TVDBSlug string `json:"tvdbslug" ts_type:"tvdbslug"`
|
||||||
|
AniList string `json:"anilist" ts_type:"anilist"`
|
||||||
|
AnimePlanet string `json:"animeplanet" ts_type:"animeplanet"`
|
||||||
|
AniSearch string `json:"anisearch" ts_type:"anisearch"`
|
||||||
|
Kitsu string `json:"kitsu" ts_type:"kitsu"`
|
||||||
|
LiveChart string `json:"livechart" ts_type:"livechart"`
|
||||||
|
TraktSlug string `json:"traktslug" ts_type:"traktslug"`
|
||||||
|
AniDB string `json:"anidb" ts_type:"anidb"`
|
||||||
|
} `json:"ids" ts_type:"ids"`
|
||||||
|
} `json:"show" ts_type:"show"`
|
||||||
|
AnimeType string `json:"anime_type" ts_type:"anime_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklSyncHistoryType struct {
|
||||||
|
Shows []SimklPostShow `json:"shows" ts_type:"shows"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklPostShow struct {
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
Ids `json:"ids" ts_type:"ids"`
|
||||||
|
Episodes []Episode `json:"episodes" ts_type:"episodes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Episode struct {
|
||||||
|
Number int `json:"number" ts_type:"number"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ids struct {
|
||||||
|
Simkl int `json:"simkl" ts_type:"simkl"`
|
||||||
|
Mal string `json:"mal" ts_type:"mal"`
|
||||||
|
Anilist string `json:"anilist" ts_type:"anilist"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShowWithRating struct {
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
Ids `json:"ids" ts_type:"ids"`
|
||||||
|
Rating int `json:"rating" ts_type:"rating"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShowWithoutRating struct {
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
Ids `json:"ids" ts_type:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklShowStatus struct {
|
||||||
|
Title string `json:"title" ts_type:"title"`
|
||||||
|
Ids `json:"ids" ts_type:"ids"`
|
||||||
|
To string `json:"to" ts_type:"to"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklSearchType []struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Poster string `json:"poster"`
|
||||||
|
Year int `json:"year"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Ids struct {
|
||||||
|
Simkl int `json:"simkl"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
} `json:"ids"`
|
||||||
|
TotalEpisodes int `json:"total_episodes"`
|
||||||
|
AnimeType string `json:"anime_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SimklDeleteType struct {
|
||||||
|
Deleted struct {
|
||||||
|
Movies int `json:"movies"`
|
||||||
|
Shows int `json:"shows"`
|
||||||
|
Episodes int `json:"episodes"`
|
||||||
|
} `json:"deleted"`
|
||||||
|
NotFound struct {
|
||||||
|
Movies []interface{} `json:"movies"`
|
||||||
|
Shows []interface{} `json:"shows"`
|
||||||
|
} `json:"not_found"`
|
||||||
|
}
|
231
SimklUserFunctions.go
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/99designs/keyring"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
var simklJwt SimklJWT
|
||||||
|
|
||||||
|
var simklRing, _ = keyring.Open(keyring.Config{
|
||||||
|
ServiceName: "AniTrack",
|
||||||
|
KeychainName: "AniTrack",
|
||||||
|
KeychainSynchronizable: false,
|
||||||
|
KeychainTrustApplication: true,
|
||||||
|
KeychainAccessibleWhenUnlocked: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
var simklCtxShutdown, simklCancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
func (a *App) CheckIfSimklLoggedIn() bool {
|
||||||
|
if (SimklJWT{} == simklJwt) {
|
||||||
|
tokenType, tokenTypeErr := simklRing.Get("SimklTokenType")
|
||||||
|
accessToken, accessTokenErr := simklRing.Get("SimklAccessToken")
|
||||||
|
scope, scopeErr := simklRing.Get("SimklScope")
|
||||||
|
if (tokenTypeErr != nil || accessTokenErr != nil || scopeErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
simklJwt.TokenType = string(tokenType.Data)
|
||||||
|
simklJwt.AccessToken = string(accessToken.Data)
|
||||||
|
simklJwt.Scope = string(scope.Data)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SimklLogin() {
|
||||||
|
if !a.CheckIfSimklLoggedIn() {
|
||||||
|
tokenType, tokenTypeErr := simklRing.Get("SimklTokenType")
|
||||||
|
accessToken, accessTokenErr := simklRing.Get("SimklAccessToken")
|
||||||
|
scope, scopeErr := simklRing.Get("SimklScope")
|
||||||
|
if (tokenTypeErr != nil || accessTokenErr != nil || scopeErr != nil) || len(accessToken.Data) == 0 {
|
||||||
|
getSimklCodeUrl := "https://simkl.com/oauth/authorize?response_type=code&client_id=" + Environment.SIMKL_CLIENT_ID + "&redirect_uri=" + Environment.SIMKL_CALLBACK_URI
|
||||||
|
runtime.BrowserOpenURL(*wailsContext, getSimklCodeUrl)
|
||||||
|
|
||||||
|
serverDone := &sync.WaitGroup{}
|
||||||
|
serverDone.Add(1)
|
||||||
|
a.handleSimklCallback(serverDone)
|
||||||
|
serverDone.Wait()
|
||||||
|
} else {
|
||||||
|
simklJwt.TokenType = string(tokenType.Data)
|
||||||
|
simklJwt.AccessToken = string(accessToken.Data)
|
||||||
|
simklJwt.Scope = string(scope.Data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) handleSimklCallback(wg *sync.WaitGroup) {
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||||
|
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
select {
|
||||||
|
case <-simklCtxShutdown.Done():
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
content := r.FormValue("code")
|
||||||
|
|
||||||
|
if content != "" {
|
||||||
|
simklJwt = getSimklAuthorizationToken(content)
|
||||||
|
_ = simklRing.Set(keyring.Item{
|
||||||
|
Key: "SimklTokenType",
|
||||||
|
Data: []byte(simklJwt.TokenType),
|
||||||
|
})
|
||||||
|
_ = simklRing.Set(keyring.Item{
|
||||||
|
Key: "SimklAccessToken",
|
||||||
|
Data: []byte(simklJwt.AccessToken),
|
||||||
|
})
|
||||||
|
_ = simklRing.Set(keyring.Item{
|
||||||
|
Key: "SimklScope",
|
||||||
|
Data: []byte(simklJwt.Scope),
|
||||||
|
})
|
||||||
|
_, err := runtime.MessageDialog(*wailsContext, runtime.MessageDialogOptions{
|
||||||
|
Title: "Simkl Authorization",
|
||||||
|
Message: "It is now safe to close your browser tab",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
simklCancel()
|
||||||
|
err = srv.Shutdown(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
log.Println("server.Shutdown:", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err := fmt.Fprintf(w, "Getting code failed.")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||||
|
log.Fatalf("listen: %s\n", err)
|
||||||
|
}
|
||||||
|
fmt.Println("Shutting down...")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSimklAuthorizationToken(content string) SimklJWT {
|
||||||
|
data := struct {
|
||||||
|
GrantType string `json:"grant_type"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
RedirectURI string `json:"redirect_uri"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
}{
|
||||||
|
GrantType: "authorization_code",
|
||||||
|
ClientID: Environment.SIMKL_CLIENT_ID,
|
||||||
|
ClientSecret: Environment.SIMKL_CLIENT_SECRET,
|
||||||
|
RedirectURI: Environment.SIMKL_CALLBACK_URI,
|
||||||
|
Code: content,
|
||||||
|
}
|
||||||
|
jsonData, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := http.NewRequest("POST", "https://api.simkl.com/oauth/token", bytes.NewBuffer(jsonData))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at response, %s\n", err)
|
||||||
|
}
|
||||||
|
response.Header.Add("Content-Type", "application/json")
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
res, resErr := client.Do(response)
|
||||||
|
if resErr != nil {
|
||||||
|
log.Printf("Failed at res, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
returnedBody, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Could not read returned body, %s\n.", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var post SimklJWT
|
||||||
|
err = json.Unmarshal(returnedBody, &post)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return post
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) GetSimklLoggedInUser() SimklUser {
|
||||||
|
a.SimklLogin()
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("POST", "https://api.simkl.com/users/settings", nil)
|
||||||
|
|
||||||
|
req.Header.Add("Content-Type", "application/json")
|
||||||
|
req.Header.Add("Authorization", "Bearer "+simklJwt.AccessToken)
|
||||||
|
req.Header.Add("simkl-api-key", Environment.SIMKL_CLIENT_ID)
|
||||||
|
|
||||||
|
response, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at request, %s\n", err)
|
||||||
|
return SimklUser{}
|
||||||
|
}
|
||||||
|
|
||||||
|
defer response.Body.Close()
|
||||||
|
|
||||||
|
respBody, _ := io.ReadAll(response.Body)
|
||||||
|
|
||||||
|
var errCheck struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(respBody, &errCheck)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if errCheck.Error != "" {
|
||||||
|
a.LogoutSimkl()
|
||||||
|
return SimklUser{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var user SimklUser
|
||||||
|
|
||||||
|
err = json.Unmarshal(respBody, &user)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed at unmarshal, %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return user
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) LogoutSimkl() string {
|
||||||
|
if (SimklJWT{} != simklJwt) {
|
||||||
|
tokenTypeErr := simklRing.Remove("SimklTokenType")
|
||||||
|
accessTokenErr := simklRing.Remove("SimklAccessToken")
|
||||||
|
scopeErr := simklRing.Remove("SimklScope")
|
||||||
|
|
||||||
|
if tokenTypeErr != nil || accessTokenErr != nil || scopeErr != nil {
|
||||||
|
fmt.Println("Simkl Logout Failed")
|
||||||
|
}
|
||||||
|
simklJwt = SimklJWT{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Simkl Logged Out Successfully"
|
||||||
|
}
|
28
app.go
@ -2,9 +2,19 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
_ "embed"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed wails.json
|
||||||
|
var wailsJSON string
|
||||||
|
|
||||||
|
var wailsContext *context.Context
|
||||||
|
|
||||||
// App struct
|
// App struct
|
||||||
type App struct {
|
type App struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
@ -18,10 +28,18 @@ func NewApp() *App {
|
|||||||
// startup is called when the app starts. The context is saved
|
// startup is called when the app starts. The context is saved
|
||||||
// so we can call the runtime methods
|
// so we can call the runtime methods
|
||||||
func (a *App) startup(ctx context.Context) {
|
func (a *App) startup(ctx context.Context) {
|
||||||
a.ctx = ctx
|
version := gjson.Get(wailsJSON, "info.productVersion")
|
||||||
|
wailsContext = &ctx
|
||||||
|
runtime.WindowSetTitle(ctx, "AniTrack "+version.String())
|
||||||
|
//runtime.WindowMaximise(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Greet returns a greeting for the given name
|
func (a *App) onSecondInstanceLaunch(secondInstanceData options.SecondInstanceData) {
|
||||||
func (a *App) Greet(name string) string {
|
var secondInstanceArgs = secondInstanceData.Args
|
||||||
return fmt.Sprintf("Hello %s, It's show time!", name)
|
|
||||||
|
println("user opened second instance", strings.Join(secondInstanceData.Args, ","))
|
||||||
|
println("user opened second from", secondInstanceData.WorkingDirectory)
|
||||||
|
runtime.WindowUnminimise(*wailsContext)
|
||||||
|
runtime.Show(*wailsContext)
|
||||||
|
go runtime.EventsEmit(*wailsContext, "launchArgs", secondInstanceArgs)
|
||||||
}
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
115
bruno/AniTrack/AniList/Get Items/AniList Item.bru
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
meta {
|
||||||
|
name: AniList Item
|
||||||
|
type: graphql
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
Authorization: Bearer {{ANILIST_ACCESS_TOKEN}}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
query ($userId: Int, $mediaId: Int, $listType: MediaType) {
|
||||||
|
MediaList(mediaId: $mediaId, userId: $userId, type: $listType) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
tags {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode {
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics {
|
||||||
|
anime {
|
||||||
|
count
|
||||||
|
statuses {
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"userId": 413504,
|
||||||
|
"mediaId": 170998,
|
||||||
|
"listType": "ANIME"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docs {
|
||||||
|
Title
|
||||||
|
|
||||||
|
Image
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
Episodes
|
||||||
|
|
||||||
|
Status
|
||||||
|
|
||||||
|
Season
|
||||||
|
|
||||||
|
External & Streaming Links
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
meta {
|
||||||
|
name: AniList MediaList User Query
|
||||||
|
type: graphql
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
# Write your query or mutation here
|
||||||
|
query(
|
||||||
|
$page: Int
|
||||||
|
$perPage: Int
|
||||||
|
$userId: Int
|
||||||
|
$listType: MediaType
|
||||||
|
$status: MediaListStatus
|
||||||
|
) {
|
||||||
|
Page(page: $page, perPage: $perPage) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
perPage
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
}
|
||||||
|
mediaList(userId: $userId, type: $listType, status: $status) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
episodes
|
||||||
|
}
|
||||||
|
status
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
statistics {
|
||||||
|
anime {
|
||||||
|
count
|
||||||
|
statuses {
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"page": 1,
|
||||||
|
"perPage": 20,
|
||||||
|
"userId": 413504,
|
||||||
|
"listType": "ANIME",
|
||||||
|
"status": "CURRENT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docs {
|
||||||
|
Title
|
||||||
|
Image
|
||||||
|
Description
|
||||||
|
Episodes
|
||||||
|
Status
|
||||||
|
Season
|
||||||
|
External & Streaming Links
|
||||||
|
|
||||||
|
User Stuff Per Item
|
||||||
|
Status
|
||||||
|
Score
|
||||||
|
Episode Progress
|
||||||
|
Total Rewatches
|
||||||
|
Notes
|
||||||
|
}
|
75
bruno/AniTrack/AniList/Get Items/AniList Search.bru
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
meta {
|
||||||
|
name: AniList Search
|
||||||
|
type: graphql
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
query ($search: String!, $listType: MediaType) {
|
||||||
|
Page (page: 1, perPage: 100) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
perPage
|
||||||
|
}
|
||||||
|
media (search: $search, type: $listType) {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode{
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"search": "dan-da-dan",
|
||||||
|
"listType": "ANIME"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docs {
|
||||||
|
Title
|
||||||
|
|
||||||
|
Image
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
Episodes
|
||||||
|
|
||||||
|
Status
|
||||||
|
|
||||||
|
Season
|
||||||
|
|
||||||
|
External & Streaming Links
|
||||||
|
}
|
125
bruno/AniTrack/AniList/Get Items/GetAniListUserWatchingList.bru
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
meta {
|
||||||
|
name: GetAniListUserWatchingList
|
||||||
|
type: graphql
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
# Write your query or mutation here
|
||||||
|
query (
|
||||||
|
$page: Int
|
||||||
|
$perPage: Int
|
||||||
|
$userId: Int
|
||||||
|
$listType: MediaType
|
||||||
|
$status: MediaListStatus
|
||||||
|
$sort: [MediaListSort]
|
||||||
|
) {
|
||||||
|
Page(page: $page, perPage: $perPage) {
|
||||||
|
pageInfo {
|
||||||
|
total
|
||||||
|
perPage
|
||||||
|
currentPage
|
||||||
|
lastPage
|
||||||
|
hasNextPage
|
||||||
|
}
|
||||||
|
mediaList(userId: $userId, type: $listType, status: $status, sort: $sort) {
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode {
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt {
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics {
|
||||||
|
anime {
|
||||||
|
count
|
||||||
|
statuses {
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"page": 1,
|
||||||
|
"perPage": 20,
|
||||||
|
"userId": 413504,
|
||||||
|
"listType": "ANIME",
|
||||||
|
"status": "CURRENT",
|
||||||
|
"sort": "UPDATED_TIME_DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docs {
|
||||||
|
Title
|
||||||
|
|
||||||
|
Image
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
Episodes
|
||||||
|
|
||||||
|
Status
|
||||||
|
|
||||||
|
Season
|
||||||
|
|
||||||
|
External & Streaming Links
|
||||||
|
}
|
28
bruno/AniTrack/AniList/GetAuthorizationToken.bru
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
meta {
|
||||||
|
name: GetAuthorizationToken
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://anilist.co/api/v2/oauth/token
|
||||||
|
body: formUrlEncoded
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Accept: application/json
|
||||||
|
Content-Type: application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
body:form-urlencoded {
|
||||||
|
grant_type: authorization_code
|
||||||
|
client_id: {{ANILIST_APP_ID}}
|
||||||
|
client_secret: {{ANILIST_SECRET_TOKEN}}
|
||||||
|
redirect_uri: http://localhost:6734/callback
|
||||||
|
code: {{code}}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:multipart-form {
|
||||||
|
:
|
||||||
|
}
|
17
bruno/AniTrack/AniList/Load AniList Oauth Page.bru
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
meta {
|
||||||
|
name: Load AniList Oauth Page
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://anilist.co/api/v2/oauth/authorize?client_id={{ANILIST_APP_ID}}&redirect_uri=http://localhost:6734/callback&response_type=code
|
||||||
|
body: none
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
client_id: {{ANILIST_APP_ID}}
|
||||||
|
redirect_uri: http://localhost:6734/callback
|
||||||
|
response_type: code
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
meta {
|
||||||
|
name: AniList Change Episode Watched
|
||||||
|
type: graphql
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{process.env.ANILIST_ACCESS_TOKEN}}
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
mutation($mediaId:Int, $progress:Int, $status:MediaListStatus){
|
||||||
|
SaveMediaListEntry(mediaId:$mediaId, progress:$progress, status:$status){
|
||||||
|
id
|
||||||
|
mediaId
|
||||||
|
userId
|
||||||
|
media {
|
||||||
|
id
|
||||||
|
idMal
|
||||||
|
title {
|
||||||
|
romaji
|
||||||
|
english
|
||||||
|
native
|
||||||
|
}
|
||||||
|
description
|
||||||
|
coverImage {
|
||||||
|
large
|
||||||
|
}
|
||||||
|
season
|
||||||
|
seasonYear
|
||||||
|
status
|
||||||
|
episodes
|
||||||
|
nextAiringEpisode {
|
||||||
|
airingAt
|
||||||
|
timeUntilAiring
|
||||||
|
episode
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
status
|
||||||
|
startedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
notes
|
||||||
|
progress
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar{
|
||||||
|
large
|
||||||
|
medium
|
||||||
|
}
|
||||||
|
statistics{
|
||||||
|
anime{
|
||||||
|
count
|
||||||
|
statuses{
|
||||||
|
status
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"mediaId": 169417,
|
||||||
|
"progress": 12,
|
||||||
|
"status":"COMPLETED"
|
||||||
|
}
|
||||||
|
}
|
33
bruno/AniTrack/AniList/Set Items/AniList Change Status.bru
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
meta {
|
||||||
|
name: AniList Change Status
|
||||||
|
type: graphql
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{process.env.ANILIST_ACCESS_TOKEN}}
|
||||||
|
Content-Type: "application/json"
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
mutation($mediaId:Int, $status:MediaListStatus){
|
||||||
|
SaveMediaListEntry(mediaId:$mediaId, status:$status){
|
||||||
|
id
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"mediaId": 1,
|
||||||
|
"status": "CURRENT"
|
||||||
|
}
|
||||||
|
}
|
79
bruno/AniTrack/AniList/Set Items/Change Episode Count.bru
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
meta {
|
||||||
|
name: Change Episode Count
|
||||||
|
type: graphql
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{ANILIST_ACCESS_TOKEN}}
|
||||||
|
Content-Type: application/json
|
||||||
|
Accept: application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
mutation(
|
||||||
|
$mediaId:Int,
|
||||||
|
$progress:Int,
|
||||||
|
$status:MediaListStatus,
|
||||||
|
$score:Float,
|
||||||
|
$repeat:Int,
|
||||||
|
$notes:String,
|
||||||
|
$startedAt:FuzzyDateInput,
|
||||||
|
$completedAt:FuzzyDateInput,
|
||||||
|
){
|
||||||
|
SaveMediaListEntry(
|
||||||
|
mediaId:$mediaId,
|
||||||
|
progress:$progress,
|
||||||
|
status:$status,
|
||||||
|
score:$score,
|
||||||
|
repeat:$repeat,
|
||||||
|
notes:$notes,
|
||||||
|
startedAt:$startedAt
|
||||||
|
completedAt:$completedAt
|
||||||
|
){
|
||||||
|
mediaId
|
||||||
|
progress
|
||||||
|
status
|
||||||
|
score
|
||||||
|
repeat
|
||||||
|
notes
|
||||||
|
startedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
completedAt{
|
||||||
|
year
|
||||||
|
month
|
||||||
|
day
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"mediaId":170998,
|
||||||
|
"progress":5,
|
||||||
|
"status":"CURRENT",
|
||||||
|
"score":9.0,
|
||||||
|
"repeat":0,
|
||||||
|
"notes":",malSync::eyJ1IjoiaHR0cHM6Ly93d3cuY3J1bmNoeXJvbGwuY29tL3Nlcmllcy9HVkRIWDg1Wk4vI3NlYXNvbj1HNjNWQzJHUUsiLCJwIjoiIn0=::",
|
||||||
|
"startedAt":{
|
||||||
|
"year":2024,
|
||||||
|
"month":7,
|
||||||
|
"day":10
|
||||||
|
},
|
||||||
|
"completedAt":{
|
||||||
|
"year": 0,
|
||||||
|
"month":0,
|
||||||
|
"day":0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
bruno/AniTrack/AniList/Set Items/Delete Media.bru
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
meta {
|
||||||
|
name: Delete Media
|
||||||
|
type: graphql
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://graphql.anilist.co
|
||||||
|
body: graphql
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{ANILIST_ACCESS_TOKEN}}
|
||||||
|
Content-Type: application/json
|
||||||
|
Accept: application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql {
|
||||||
|
mutation($id:Int){
|
||||||
|
DeleteMediaListEntry(id:$id){
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:graphql:vars {
|
||||||
|
{
|
||||||
|
"id":430978266
|
||||||
|
}
|
||||||
|
}
|
25
bruno/AniTrack/MAL/Get AnimeList.bru
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
meta {
|
||||||
|
name: Get AnimeList
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://api.myanimelist.net/v2/users/{{MAL_USER}}/animelist?fields=list_status&status=watching&limit=1000
|
||||||
|
body: formUrlEncoded
|
||||||
|
auth: bearer
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
fields: list_status
|
||||||
|
status: watching
|
||||||
|
limit: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
auth:bearer {
|
||||||
|
token: {{MAL_ACCESS_TOKEN}}
|
||||||
|
}
|
24
bruno/AniTrack/MAL/Get Authorization.bru
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Authorization
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://myanimelist.net/v1/oauth2/token
|
||||||
|
body: formUrlEncoded
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
}
|
||||||
|
|
||||||
|
body:form-urlencoded {
|
||||||
|
grant_type: authorization_code
|
||||||
|
client_id: {{MAL_CLIENT_ID}}
|
||||||
|
client_secret: {{MAL_CLIENT_SECRET}}
|
||||||
|
redirect_uri: {{MAL_CALLBACK_URI}}
|
||||||
|
code: {{MAL_CODE}}
|
||||||
|
code_verifier: {{MAL_VERIFIER}}
|
||||||
|
}
|
19
bruno/AniTrack/MAL/Get Single Anime.bru
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Single Anime
|
||||||
|
type: http
|
||||||
|
seq: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://api.myanimelist.net/v2/anime/57380?fields=id,title,main_picture,alternative_titles,start_date,end_date,synopsis,mean,rank,popularity,num_list_users,num_scoring_users,nsfw,genres,created_at,updated_at,media_type,status,my_list_status,num_episodes,start_season,broadcast,source,average_episode_duration,rating,pictures,background,related_anime,recommendations,studios,statistics
|
||||||
|
body: none
|
||||||
|
auth: bearer
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
fields: id,title,main_picture,alternative_titles,start_date,end_date,synopsis,mean,rank,popularity,num_list_users,num_scoring_users,nsfw,genres,created_at,updated_at,media_type,status,my_list_status,num_episodes,start_season,broadcast,source,average_episode_duration,rating,pictures,background,related_anime,recommendations,studios,statistics
|
||||||
|
}
|
||||||
|
|
||||||
|
auth:bearer {
|
||||||
|
token: {{MAL_ACCESS_TOKEN}}
|
||||||
|
}
|
18
bruno/AniTrack/MAL/MAL Oauth Page.bru
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
meta {
|
||||||
|
name: MAL Oauth Page
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id={{MAL_CLIENT_ID}}&redirect_uri={{MAL_CALLBACK_URI}}
|
||||||
|
body: none
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
response_type: code
|
||||||
|
client_id: {{MAL_CLIENT_ID}}
|
||||||
|
redirect_uri: {{MAL_CALLBACK_URI}}
|
||||||
|
:
|
||||||
|
}
|
19
bruno/AniTrack/MAL/Update Anime Status.bru
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
meta {
|
||||||
|
name: Update Anime Status
|
||||||
|
type: http
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
patch {
|
||||||
|
url: https://api.myanimelist.net/v2/anime/50205/my_list_status
|
||||||
|
body: formUrlEncoded
|
||||||
|
auth: bearer
|
||||||
|
}
|
||||||
|
|
||||||
|
auth:bearer {
|
||||||
|
token: {{MAL_ACCESS_TOKEN}}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:form-urlencoded {
|
||||||
|
num_watched_episodes: 3
|
||||||
|
}
|
29
bruno/AniTrack/Simkl/Get Code.bru
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Code
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://simkl.com/oauth/authorize?response_type=code&client_id={{SIMKL_CLIENT_ID}}&redirect_uri=http://localhost:6734/callback
|
||||||
|
body: none
|
||||||
|
auth: oauth2
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
response_type: code
|
||||||
|
client_id: {{SIMKL_CLIENT_ID}}
|
||||||
|
redirect_uri: http://localhost:6734/callback
|
||||||
|
}
|
||||||
|
|
||||||
|
auth:oauth2 {
|
||||||
|
grant_type: authorization_code
|
||||||
|
callback_url: http://localhost:6734/callback
|
||||||
|
authorization_url: https://api.simkl.com/oauth/authorize
|
||||||
|
access_token_url: https://api.simkl.com/oauth/token
|
||||||
|
client_id: {{SIMKL_CLIENT_ID}}
|
||||||
|
client_secret: {{SIMKL_CLIENT_SECRET}}
|
||||||
|
scope:
|
||||||
|
state:
|
||||||
|
pkce: false
|
||||||
|
}
|
19
bruno/AniTrack/Simkl/Get Items/Get Anime Full Info.bru
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
meta {
|
||||||
|
name: Get Anime Full Info
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://api.simkl.com/anime/40084?extended=full
|
||||||
|
body: none
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
extended: full
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
simkl-api-key: {{SIMKL_CLIENT_ID}}
|
||||||
|
}
|
17
bruno/AniTrack/Simkl/Get Items/GetUser WatchList.bru
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
meta {
|
||||||
|
name: GetUser WatchList
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://api.simkl.com/sync/all-items/anime/
|
||||||
|
body: none
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{SIMKL_AUTH_TOKEN}}
|
||||||
|
Content-Type: application/json
|
||||||
|
simkl-api-key: {{SIMKL_CLIENT_ID}}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
meta {
|
||||||
|
name: Search By MalID to Get Simkl ID
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: https://api.simkl.com/search/id?anilist=174576
|
||||||
|
body: none
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
anilist: 174576
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
simkl-api-key: {{SIMKL_CLIENT_ID}}
|
||||||
|
}
|
29
bruno/AniTrack/Simkl/Post Items/Delete Entry.bru
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
meta {
|
||||||
|
name: Delete Entry
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://api.simkl.com/sync/history/remove
|
||||||
|
body: json
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{SIMKL_AUTH_TOKEN}}
|
||||||
|
Content-Type: application/json
|
||||||
|
simkl-api-key: {{SIMKL_CLIENT_ID}}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"shows": [
|
||||||
|
{
|
||||||
|
"ids": {
|
||||||
|
"simkl": 909121
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
52
bruno/AniTrack/Simkl/Post Items/Update Episode.bru
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
meta {
|
||||||
|
name: Update Episode
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://api.simkl.com/sync/history
|
||||||
|
body: json
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Authorization: Bearer {{SIMKL_AUTH_TOKEN}}
|
||||||
|
Content-Type: application/json
|
||||||
|
simkl-api-key: {{SIMKL_CLIENT_ID}}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"shows": [
|
||||||
|
{
|
||||||
|
"title": "Ramen Aka Neko",
|
||||||
|
"ids": {
|
||||||
|
"simkl": 2307708,
|
||||||
|
"mal": "57325",
|
||||||
|
"anilist": "170998"
|
||||||
|
},
|
||||||
|
"episodes": [
|
||||||
|
{
|
||||||
|
"number": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
37
bruno/AniTrack/Simkl/SimklGetAuthorizationToken.bru
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
meta {
|
||||||
|
name: SimklGetAuthorizationToken
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: https://api.simkl.com/oauth/token
|
||||||
|
body: json
|
||||||
|
auth: none
|
||||||
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Content-Type: application/json
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"grant_type": "authorization_code",
|
||||||
|
"client_id": "{{SIMKL_CLIENT_ID}}",
|
||||||
|
"client_secret": "{{SIMKL_CLIENT_SECRET}}",
|
||||||
|
"redirect_uri": "http://localhost:6734/callback",
|
||||||
|
"code": "c2b956d5086c5515ff518bfb2857d7f55453f5f8a8e245f6a37c2e3838fe1a7a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body:form-urlencoded {
|
||||||
|
grant_type: authorization_code
|
||||||
|
client_id: {{SIMKL_CLIENT_ID}}
|
||||||
|
client_secret: {{SIMKL_CLIENT_SECRET}}
|
||||||
|
redirect_uri: http://localhost:6734/callback
|
||||||
|
code: c2b956d5086c5515ff518bfb2857d7f55453f5f8a8e245f6a37c2e3838fe1a7a
|
||||||
|
}
|
||||||
|
|
||||||
|
body:multipart-form {
|
||||||
|
:
|
||||||
|
}
|
9
bruno/AniTrack/bruno.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"version": "1",
|
||||||
|
"name": "AniTrack",
|
||||||
|
"type": "collection",
|
||||||
|
"ignore": [
|
||||||
|
"node_modules",
|
||||||
|
".git"
|
||||||
|
]
|
||||||
|
}
|
18
bruno/AniTrack/environments/Dev.bru
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
vars {
|
||||||
|
ANILIST_APP_ID: {{process.env.ANILIST_APP_ID}}
|
||||||
|
ANILIST_SECRET_TOKEN: {{process.env.ANILIST_SECRET_TOKEN}}
|
||||||
|
SIMKL_CLIENT_ID: {{process.env.SIMKL_CLIENT_ID}}
|
||||||
|
SIMKL_CLIENT_SECRET: {{process.env.SIMKL_CLIENT_SECRET}}
|
||||||
|
MAL_CLIENT_ID: {{process.env.MAL_CLIENT_ID}}
|
||||||
|
MAL_CLIENT_SECRET: {{process.env.MAL_CLIENT_SECRET}}
|
||||||
|
MAL_CALLBACK_URI: {{process.env.MAL_CALLBACK_URI}}
|
||||||
|
}
|
||||||
|
vars:secret [
|
||||||
|
ANILIST_ACCESS_TOKEN,
|
||||||
|
code,
|
||||||
|
SIMKL_AUTH_TOKEN,
|
||||||
|
MAL_CODE,
|
||||||
|
MAL_VERIFIER,
|
||||||
|
MAL_USER,
|
||||||
|
~MAL_ACCESS_TOKEN
|
||||||
|
]
|
11
build/AniTrack.desktop
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=AniTrack
|
||||||
|
Comment=A manual synchronizer for various Anime trackers.
|
||||||
|
Exec=/home/nymusicman/Applications/AniTrack
|
||||||
|
Icon=AniTrack
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
StartupNotify=true
|
||||||
|
Categories=Internet
|
||||||
|
Keywords=anitrack;anilist;simkl;mal;myanimelist;anime;sync
|
||||||
|
Path=
|
BIN
build/AniTrack.png
Normal file
After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 130 KiB |
@ -1,6 +1,11 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsLocalNetworking</key>
|
||||||
|
<true />
|
||||||
|
</dict>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
16
environmentType.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type EnvironmentStruct struct {
|
||||||
|
ANILIST_SECRET_TOKEN string
|
||||||
|
ANILIST_APP_ID string
|
||||||
|
ANILIST_APP_NAME string
|
||||||
|
ANILIST_CALLBACK_URI string
|
||||||
|
SIMKL_CLIENT_ID string
|
||||||
|
SIMKL_CLIENT_SECRET string
|
||||||
|
SIMKL_CALLBACK_URI string
|
||||||
|
MAL_CLIENT_ID string
|
||||||
|
MAL_CLIENT_SECRET string
|
||||||
|
MAL_CALLBACK_URI string
|
||||||
|
}
|
||||||
|
|
||||||
|
// created a separate environment.go file and add var Environment EnvironmentStruct = {}
|
@ -1,12 +1,16 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8" />
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
<title>AniTrack</title>
|
<title>AniTrack</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="./src/main.ts" type="module"></script>
|
<script src="./src/main.ts" type="module"></script>
|
||||||
</body>
|
<script
|
||||||
|
src="./node_modules/flowbite/dist/flowbite.js"
|
||||||
|
type="module"
|
||||||
|
></script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -10,13 +10,25 @@
|
|||||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^1.0.1",
|
"@sveltejs/vite-plugin-svelte": "^2.4.1",
|
||||||
"@tsconfig/svelte": "^3.0.0",
|
"@tsconfig/svelte": "^4.0.1",
|
||||||
"svelte": "^3.49.0",
|
"autoprefixer": "^10.4.20",
|
||||||
"svelte-check": "^2.8.0",
|
"postcss": "^8.4.45",
|
||||||
"svelte-preprocess": "^4.10.7",
|
"svelte": "^4.0.0",
|
||||||
"tslib": "^2.4.0",
|
"svelte-check": "^3.4.3",
|
||||||
"typescript": "^4.6.4",
|
"svelte-headless-table": "^0.18.2",
|
||||||
"vite": "^3.0.7"
|
"svelte-preprocess": "^5.0.3",
|
||||||
|
"svelte-spa-router": "^4.0.1",
|
||||||
|
"tailwind-merge": "^2.5.2",
|
||||||
|
"tailwindcss": "^3.4.10",
|
||||||
|
"tslib": "^2.7.0",
|
||||||
|
"typescript": "^5.0.0",
|
||||||
|
"vite": "^4.5.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@popperjs/core": "^2.11.8",
|
||||||
|
"flowbite": "^2.5.1",
|
||||||
|
"flowbite-svelte": "^0.46.16",
|
||||||
|
"moment": "^2.30.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
frontend/postcss.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
@ -1,79 +1,44 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import logo from './assets/images/logo-universal.png'
|
import {
|
||||||
import {Greet} from '../wailsjs/go/main/App.js'
|
aniListAnime,
|
||||||
|
GetAnimeSingleItem,
|
||||||
|
} from "./helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
import {onMount} from "svelte";
|
||||||
|
import Router from "svelte-spa-router"
|
||||||
|
import Home from "./routes/Home.svelte";
|
||||||
|
import {wrap} from "svelte-spa-router/wrap";
|
||||||
|
import Spinner from "./helperComponents/Spinner.svelte";
|
||||||
|
import Header from "./helperComponents/Header.svelte";
|
||||||
|
import {CheckIfAniListLoggedInAndLoadWatchList} from "./helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
|
||||||
|
import { CheckIfMALLoggedInAndSetUser } from "./helperModules/CheckIfMyAnimeListLoggedIn.svelte";
|
||||||
|
import {CheckIfSimklLoggedInAndSetUser} from "./helperModules/CheckIsSimklLoggedIn.svelte"
|
||||||
|
import {CheckIfAniListLoggedIn} from "../wailsjs/go/main/App";
|
||||||
|
import {AniListGetSingleAnimeDefaultData} from "./helperDefaults/AniListGetSingleAnime";
|
||||||
|
|
||||||
let resultText: string = "Please enter your name below 👇"
|
onMount(async () => {
|
||||||
let name: string
|
await CheckIfAniListLoggedInAndLoadWatchList()
|
||||||
|
await CheckIfMALLoggedInAndSetUser()
|
||||||
function greet(): void {
|
await CheckIfSimklLoggedInAndSetUser()
|
||||||
Greet(name).then(result => resultText = result)
|
})
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<Header />
|
||||||
<img alt="Wails logo" id="logo" src="{logo}">
|
<Router routes={{
|
||||||
<div class="result" id="result">{resultText}</div>
|
'/': Home,
|
||||||
<div class="input-box" id="input">
|
'/anime/:id': wrap({
|
||||||
<input autocomplete="off" bind:value={name} class="input" id="name" type="text"/>
|
asyncComponent: () => import('./routes/AnimeRoutePage.svelte'),
|
||||||
<button class="btn" on:click={greet}>Greet</button>
|
conditions: [
|
||||||
</div>
|
async () => await CheckIfAniListLoggedIn(),
|
||||||
</main>
|
async (detail) => {
|
||||||
|
aniListAnime.update(value => {
|
||||||
<style>
|
value = AniListGetSingleAnimeDefaultData
|
||||||
|
return value
|
||||||
#logo {
|
})
|
||||||
display: block;
|
await GetAnimeSingleItem(Number(detail.params.id), true)
|
||||||
width: 50%;
|
return Object.keys($aniListAnime).length!==0
|
||||||
height: 50%;
|
},
|
||||||
margin: auto;
|
],
|
||||||
padding: 10% 0 0;
|
loadingComponent: Spinner
|
||||||
background-position: center;
|
}),
|
||||||
background-repeat: no-repeat;
|
// '*': "Not Found"
|
||||||
background-size: 100% 100%;
|
}} />
|
||||||
background-origin: content-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result {
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
margin: 1.5rem auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-box .btn {
|
|
||||||
width: 60px;
|
|
||||||
height: 30px;
|
|
||||||
line-height: 30px;
|
|
||||||
border-radius: 3px;
|
|
||||||
border: none;
|
|
||||||
margin: 0 0 0 20px;
|
|
||||||
padding: 0 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-box .btn:hover {
|
|
||||||
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-box .input {
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
outline: none;
|
|
||||||
height: 30px;
|
|
||||||
line-height: 30px;
|
|
||||||
padding: 0 10px;
|
|
||||||
background-color: rgba(240, 240, 240, 1);
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-box .input:hover {
|
|
||||||
border: none;
|
|
||||||
background-color: rgba(255, 255, 255, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-box .input:focus {
|
|
||||||
border: none;
|
|
||||||
background-color: rgba(255, 255, 255, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
export interface AniListCurrentUserWatchList {
|
||||||
|
data: {
|
||||||
|
Page: {
|
||||||
|
pageInfo: {
|
||||||
|
total: number
|
||||||
|
perPage: number
|
||||||
|
currentPage: number
|
||||||
|
lastPage: number
|
||||||
|
hasNextPage: boolean
|
||||||
|
},
|
||||||
|
mediaList: MediaList[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AniListGetSingleAnime {
|
||||||
|
data: {
|
||||||
|
MediaList: MediaList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MediaList {
|
||||||
|
id: number
|
||||||
|
mediaId: number
|
||||||
|
userId: number
|
||||||
|
media: {
|
||||||
|
id: number
|
||||||
|
idMal: number
|
||||||
|
title: {
|
||||||
|
romaji: string
|
||||||
|
english?: string
|
||||||
|
native: string
|
||||||
|
}
|
||||||
|
description: string
|
||||||
|
coverImage: {
|
||||||
|
large: string
|
||||||
|
}
|
||||||
|
season: string
|
||||||
|
seasonYear: number
|
||||||
|
status: string
|
||||||
|
episodes?: number
|
||||||
|
nextAiringEpisode?: {
|
||||||
|
airingAt: number
|
||||||
|
timeUntilAiring: number
|
||||||
|
episode: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
status: string
|
||||||
|
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
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
106
frontend/src/anilist/types/AniListTypes.ts
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
export interface AniSearchList {
|
||||||
|
data: {
|
||||||
|
Page: {
|
||||||
|
pageInfo: {
|
||||||
|
total: number,
|
||||||
|
currentPage: number,
|
||||||
|
lastPage: number,
|
||||||
|
hasNextPage: boolean,
|
||||||
|
perPage: number
|
||||||
|
},
|
||||||
|
media: [{
|
||||||
|
id: number
|
||||||
|
idMal: number
|
||||||
|
title: {
|
||||||
|
romaji: string
|
||||||
|
english?: string
|
||||||
|
native: string
|
||||||
|
}
|
||||||
|
description: string
|
||||||
|
coverImage: {
|
||||||
|
large: string
|
||||||
|
}
|
||||||
|
season: string
|
||||||
|
seasonYear: number
|
||||||
|
status: string
|
||||||
|
episodes?: number
|
||||||
|
nextAiringEpisode?: {
|
||||||
|
airingAt: number
|
||||||
|
timeUntilAiring: number
|
||||||
|
episode: number
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AniListUser {
|
||||||
|
"data": {
|
||||||
|
"Viewer": {
|
||||||
|
id: number,
|
||||||
|
name: string,
|
||||||
|
avatar: {
|
||||||
|
large: string,
|
||||||
|
medium: string,
|
||||||
|
},
|
||||||
|
bannerImage: string,
|
||||||
|
siteUrl: string,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum MediaListSort {
|
||||||
|
MediaId = "MEDIA_ID",
|
||||||
|
MediaIdDesc = "MEDIA_ID_DESC",
|
||||||
|
Score = "SCORE",
|
||||||
|
ScoreDesc = "SCORE_DESC",
|
||||||
|
Status = "STATUS",
|
||||||
|
StatusDesc = "STATUS_DESC",
|
||||||
|
Progress = "PROGRESS",
|
||||||
|
ProgressDesc = "PROGRESS_DESC",
|
||||||
|
ProgressVolumes = "PROGRESS_VOLUMES",
|
||||||
|
ProgressVolumesDesc = "PROGRESS_VOLUMES_DESC",
|
||||||
|
Repeat = "REPEAT",
|
||||||
|
RepeatDesc = "REPEAT_DESC",
|
||||||
|
Priority = "PRIORITY",
|
||||||
|
PriorityDesc = "PRIORITY_DESC",
|
||||||
|
StartedOn = "STARTED_ON",
|
||||||
|
StartedOnDesc = "STARTED_ON_DESC",
|
||||||
|
FinishedOn = "FINISHED_ON",
|
||||||
|
FinishedOnDesc = "FINISHED_ON_DESC",
|
||||||
|
AddedTime = "ADDED_TIME",
|
||||||
|
AddedTimeDesc = "ADDED_TIME_DESC",
|
||||||
|
UpdatedTime = "UPDATED_TIME",
|
||||||
|
UpdatedTimeDesc = "UPDATED_TIME_DESC",
|
||||||
|
MediaTitleRomaji = "MEDIA_TITLE_ROMAJI",
|
||||||
|
MediaTitleRomajiDesc = "MEDIA_TITLE_ROMAJI_DESC",
|
||||||
|
MediaTitleEnglish = "MEDIA_TITLE_ENGLISH",
|
||||||
|
MediaTitleEnglishDesc = "MEDIA_TITLE_ENGLISH_DESC",
|
||||||
|
MediaTitleNative = "MEDIA_TITLE_NATIVE",
|
||||||
|
MediaTitleNativeDesc = "MEDIA_TITLE_NATIVE_DESC",
|
||||||
|
MediaPopularity = "MEDIA_POPULARITY",
|
||||||
|
MediaPopularityDesc = "MEDIA_POPULARITY_DESC"
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartedAt {
|
||||||
|
year: number
|
||||||
|
month: number
|
||||||
|
day: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompletedAt {
|
||||||
|
year: number
|
||||||
|
month: number
|
||||||
|
day: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AniListUpdateVariables {
|
||||||
|
mediaId: number
|
||||||
|
progress: number
|
||||||
|
status: string
|
||||||
|
score: number
|
||||||
|
repeat: number
|
||||||
|
notes: string
|
||||||
|
startedAt: StartedAt
|
||||||
|
completedAt: CompletedAt
|
||||||
|
}
|
BIN
frontend/src/assets/fonts/MapleMono-Bold.woff2
Normal file
BIN
frontend/src/assets/images/AniTrackLogo.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
1
frontend/src/assets/images/AniTrackLogo.svg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
frontend/src/assets/images/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 136 KiB |
765
frontend/src/helperComponents/Anime.svelte
Normal file
@ -0,0 +1,765 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
aniListAnime,
|
||||||
|
aniListLoggedIn,
|
||||||
|
malAnime,
|
||||||
|
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,
|
||||||
|
convertAniListDateToDate,
|
||||||
|
} from "../helperFunctions/convertAniListDateIn";
|
||||||
|
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";
|
||||||
|
import type {
|
||||||
|
StatusOption,
|
||||||
|
StatusOptions,
|
||||||
|
} from "../helperTypes/StatusTypes";
|
||||||
|
import type { AniListUpdateVariables } from "../anilist/types/AniListTypes";
|
||||||
|
import {
|
||||||
|
convertDateStringToAniList,
|
||||||
|
convertDateToAniList,
|
||||||
|
} from "../helperFunctions/convertDateToAniList";
|
||||||
|
import {
|
||||||
|
AniListDeleteEntry,
|
||||||
|
AniListUpdateEntry,
|
||||||
|
DeleteMyAnimeListEntry,
|
||||||
|
MyAnimeListUpdate,
|
||||||
|
SimklSyncEpisodes,
|
||||||
|
SimklSyncRating,
|
||||||
|
SimklSyncRemove,
|
||||||
|
SimklSyncStatus,
|
||||||
|
} from "../../wailsjs/go/main/App";
|
||||||
|
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
|
||||||
|
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
|
||||||
|
import Datepicker from "./Datepicker.svelte";
|
||||||
|
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
const title =
|
||||||
|
currentAniListAnime.data.MediaList.media.title.english !== ""
|
||||||
|
? currentAniListAnime.data.MediaList.media.title.english
|
||||||
|
: currentAniListAnime.data.MediaList.media.title.romaji;
|
||||||
|
const statusOptions: StatusOptions = [
|
||||||
|
{ id: 0, aniList: "CURRENT", mal: "watching", simkl: "watching" },
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
aniList: "PLANNING",
|
||||||
|
mal: "plan_to_watch",
|
||||||
|
simkl: "plantowatch",
|
||||||
|
},
|
||||||
|
{ id: 2, aniList: "COMPLETED", mal: "completed", simkl: "completed" },
|
||||||
|
{ 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];
|
||||||
|
let startedAtDate: Date | null = convertAniListDateToDate(
|
||||||
|
currentAniListAnime.data.MediaList.startedAt,
|
||||||
|
);
|
||||||
|
let completedAtDate: Date | null = convertAniListDateToDate(
|
||||||
|
currentAniListAnime.data.MediaList.completedAt,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isAniListLoggedIn)
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
|
||||||
|
title,
|
||||||
|
service: "AniList",
|
||||||
|
progress: currentAniListAnime.data.MediaList.progress,
|
||||||
|
status: currentAniListAnime.data.MediaList.status,
|
||||||
|
startedAt: convertAniListDateToString(
|
||||||
|
currentAniListAnime.data.MediaList.startedAt,
|
||||||
|
),
|
||||||
|
completedAt: convertAniListDateToString(
|
||||||
|
currentAniListAnime.data.MediaList.completedAt,
|
||||||
|
),
|
||||||
|
score: currentAniListAnime.data.MediaList.score,
|
||||||
|
repeat: currentAniListAnime.data.MediaList.repeat,
|
||||||
|
notes: currentAniListAnime.data.MediaList.notes,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isMalLoggedIn) {
|
||||||
|
let startDate = "";
|
||||||
|
let finishDate = "";
|
||||||
|
if (currentMalAnime.my_list_status.start_date !== "") {
|
||||||
|
const startArray = re.exec(
|
||||||
|
currentMalAnime.my_list_status.start_date,
|
||||||
|
);
|
||||||
|
startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
|
||||||
|
}
|
||||||
|
if (currentMalAnime.my_list_status.finish_date !== "") {
|
||||||
|
const finishArray = re.exec(
|
||||||
|
currentMalAnime.my_list_status.finish_date,
|
||||||
|
);
|
||||||
|
finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
|
||||||
|
}
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `m-${currentMalAnime.id}`,
|
||||||
|
title: currentMalAnime.title,
|
||||||
|
service: "MyAnimeList",
|
||||||
|
progress: currentMalAnime.my_list_status.num_episodes_watched,
|
||||||
|
status: currentMalAnime.my_list_status.status,
|
||||||
|
startedAt: startDate,
|
||||||
|
completedAt: finishDate,
|
||||||
|
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({
|
||||||
|
id: `s-${currentSimklAnime.show.ids.simkl}`,
|
||||||
|
title: currentSimklAnime.show.title,
|
||||||
|
service: "Simkl",
|
||||||
|
progress: currentSimklAnime.watched_episodes_count,
|
||||||
|
status: currentSimklAnime.status,
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: currentSimklAnime.user_rating,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleSubmit = async (e: any) => {
|
||||||
|
submitting.set(true);
|
||||||
|
let submitData: {
|
||||||
|
rating: number;
|
||||||
|
episodes: number;
|
||||||
|
status: StatusOption;
|
||||||
|
startedAt: Date | null;
|
||||||
|
completedAt: Date | null;
|
||||||
|
repeat: number;
|
||||||
|
notes: string;
|
||||||
|
} = {
|
||||||
|
rating: 0,
|
||||||
|
episodes: 0,
|
||||||
|
status: {
|
||||||
|
id: 0,
|
||||||
|
aniList: "",
|
||||||
|
mal: "",
|
||||||
|
simkl: "",
|
||||||
|
},
|
||||||
|
startedAt: null,
|
||||||
|
completedAt: null,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
};
|
||||||
|
const formData = new FormData(e.target);
|
||||||
|
for (let field of formData) {
|
||||||
|
const [key, value] = field;
|
||||||
|
if (key === "rating") {
|
||||||
|
submitData.rating = Number(value) * 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (key === "episodes") {
|
||||||
|
submitData.episodes = Number(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (key === "repeat") {
|
||||||
|
submitData.repeat = Number(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (key === "status") {
|
||||||
|
submitData.status = startingAnilistStatusOption;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
submitData[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
isAniListLoggedIn &&
|
||||||
|
currentAniListAnime.data.MediaList.mediaId !== 0
|
||||||
|
) {
|
||||||
|
let body: AniListUpdateVariables = {
|
||||||
|
mediaId: currentAniListAnime.data.MediaList.mediaId,
|
||||||
|
progress: submitData.episodes,
|
||||||
|
status: submitData.status.aniList,
|
||||||
|
score: submitData.rating,
|
||||||
|
repeat: submitData.repeat,
|
||||||
|
notes: submitData.notes,
|
||||||
|
startedAt: convertDateToAniList(startedAtDate),
|
||||||
|
completedAt: convertDateToAniList(completedAtDate),
|
||||||
|
};
|
||||||
|
await AniListUpdateEntry(body).then(
|
||||||
|
(value: AniListGetSingleAnime) => {
|
||||||
|
/* 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
|
||||||
|
delete value.data.MediaList.media.tags */
|
||||||
|
aniListAnime.update((newValue) => {
|
||||||
|
newValue = value;
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
|
||||||
|
title,
|
||||||
|
service: "AniList",
|
||||||
|
progress: currentAniListAnime.data.MediaList.progress,
|
||||||
|
status: currentAniListAnime.data.MediaList.status,
|
||||||
|
startedAt: convertAniListDateToString(
|
||||||
|
currentAniListAnime.data.MediaList.startedAt,
|
||||||
|
),
|
||||||
|
completedAt: convertAniListDateToString(
|
||||||
|
currentAniListAnime.data.MediaList.completedAt,
|
||||||
|
),
|
||||||
|
score: currentAniListAnime.data.MediaList.score,
|
||||||
|
repeat: currentAniListAnime.data.MediaList.repeat,
|
||||||
|
notes: currentAniListAnime.data.MediaList.notes,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (malLoggedIn && currentMalAnime.id !== 0) {
|
||||||
|
let body: MALUploadStatus = {
|
||||||
|
status: submitData.status.mal,
|
||||||
|
is_rewatching: submitData.repeat > 0,
|
||||||
|
score: submitData.rating,
|
||||||
|
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.is_rewatching =
|
||||||
|
malAnimeReturn.is_rewatching;
|
||||||
|
value.my_list_status.score = malAnimeReturn.score;
|
||||||
|
value.my_list_status.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;
|
||||||
|
});
|
||||||
|
let startDate = "";
|
||||||
|
let finishDate = "";
|
||||||
|
if (currentMalAnime.my_list_status.start_date !== "") {
|
||||||
|
const startArray = re.exec(
|
||||||
|
currentMalAnime.my_list_status.start_date,
|
||||||
|
);
|
||||||
|
startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
|
||||||
|
}
|
||||||
|
if (currentMalAnime.my_list_status.finish_date !== "") {
|
||||||
|
const finishArray = re.exec(
|
||||||
|
currentMalAnime.my_list_status.finish_date,
|
||||||
|
);
|
||||||
|
finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
|
||||||
|
}
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `m-${currentMalAnime.id}`,
|
||||||
|
title: currentMalAnime.title,
|
||||||
|
service: "MyAnimeList",
|
||||||
|
progress:
|
||||||
|
currentMalAnime.my_list_status.num_episodes_watched,
|
||||||
|
status: currentMalAnime.my_list_status.status,
|
||||||
|
startedAt: startDate,
|
||||||
|
completedAt: finishDate,
|
||||||
|
score: currentMalAnime.my_list_status.score,
|
||||||
|
repeat: currentMalAnime.my_list_status
|
||||||
|
.num_times_rewatched,
|
||||||
|
notes: currentMalAnime.my_list_status.comments,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
||||||
|
if (
|
||||||
|
currentSimklAnime.watched_episodes_count !== submitData.episodes
|
||||||
|
) {
|
||||||
|
await SimklSyncEpisodes(
|
||||||
|
currentSimklAnime,
|
||||||
|
submitData.episodes,
|
||||||
|
).then((value: SimklAnime) => {
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `s-${value.show.ids.simkl}`,
|
||||||
|
title: value.show.title,
|
||||||
|
service: "Simkl",
|
||||||
|
progress: value.watched_episodes_count,
|
||||||
|
status: value.status,
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: value.user_rating,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
simklAnime.update((newValue) => {
|
||||||
|
newValue = value;
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentSimklAnime.user_rating !== submitData.rating) {
|
||||||
|
await SimklSyncRating(
|
||||||
|
currentSimklAnime,
|
||||||
|
submitData.rating,
|
||||||
|
).then((value) => {
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `s-${value.show.ids.simkl}`,
|
||||||
|
title: value.show.title,
|
||||||
|
service: "Simkl",
|
||||||
|
progress: value.watched_episodes_count,
|
||||||
|
status: value.status,
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: value.user_rating,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
simklAnime.update((newValue) => {
|
||||||
|
newValue = value;
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentSimklAnime.status !== submitData.status.simkl) {
|
||||||
|
await SimklSyncStatus(
|
||||||
|
currentSimklAnime,
|
||||||
|
submitData.status.simkl,
|
||||||
|
).then((value) => {
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `s-${value.show.ids.simkl}`,
|
||||||
|
title: value.show.title,
|
||||||
|
service: "Simkl",
|
||||||
|
progress: value.watched_episodes_count,
|
||||||
|
status: value.status,
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: value.user_rating,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
simklAnime.update((newValue) => {
|
||||||
|
newValue = value;
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
submitting.set(false);
|
||||||
|
submitSuccess.set(true);
|
||||||
|
setTimeout(() => submitSuccess.set(false), 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteEntries = async () => {
|
||||||
|
submitting.set(true);
|
||||||
|
if (
|
||||||
|
isAniListLoggedIn &&
|
||||||
|
currentAniListAnime.data.MediaList.mediaId !== 0
|
||||||
|
) {
|
||||||
|
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id);
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `a-${currentAniListAnime.data.MediaList.mediaId}`,
|
||||||
|
title,
|
||||||
|
service: "AniList",
|
||||||
|
progress: 0,
|
||||||
|
status: "",
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: 0,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (malLoggedIn && currentMalAnime.id !== 0) {
|
||||||
|
await DeleteMyAnimeListEntry(currentMalAnime.id);
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `m-${currentMalAnime.id}`,
|
||||||
|
title: currentMalAnime.title,
|
||||||
|
service: "MyAnimeList",
|
||||||
|
progress: 0,
|
||||||
|
status: "",
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: 0,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
|
||||||
|
await SimklSyncRemove(currentSimklAnime);
|
||||||
|
AddAnimeServiceToTable({
|
||||||
|
id: `s-${currentSimklAnime.show.ids.simkl}`,
|
||||||
|
title: currentSimklAnime.show.title,
|
||||||
|
service: "Simkl",
|
||||||
|
progress: 0,
|
||||||
|
status: "",
|
||||||
|
startedAt: "",
|
||||||
|
completedAt: "",
|
||||||
|
score: 0,
|
||||||
|
repeat: 0,
|
||||||
|
notes: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
submitting.set(false);
|
||||||
|
submitSuccess.set(true);
|
||||||
|
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>
|
||||||
|
|
||||||
|
<form on:submit|preventDefault={handleSubmit} class="container pt-3 pb-10">
|
||||||
|
<h1 class="text-white font-bold text-left text-xl pb-3">
|
||||||
|
{title}
|
||||||
|
</h1>
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-10 grid-flow-col gap-4">
|
||||||
|
<div class="md:col-span-2 space-y-3">
|
||||||
|
<img
|
||||||
|
class="rounded-lg"
|
||||||
|
src={currentAniListAnime.data.MediaList.media.coverImage.large}
|
||||||
|
alt="{title} Cover Image"
|
||||||
|
/>
|
||||||
|
<Rating bind:score={currentAniListAnime.data.MediaList.score} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md:col-span-8">
|
||||||
|
<div
|
||||||
|
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-24 lg:gap-x-56"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="episodes"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
|
>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
|
||||||
|
type="number"
|
||||||
|
name="episodes"
|
||||||
|
min="0"
|
||||||
|
{max}
|
||||||
|
id="episodes"
|
||||||
|
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
|
||||||
|
{currentAniListAnime.data.MediaList.progress < 0 ||
|
||||||
|
(currentAniListAnime.data.MediaList.media.episodes >
|
||||||
|
0 &&
|
||||||
|
currentAniListAnime.data.MediaList.progress >
|
||||||
|
currentAniListAnime.data.MediaList.media
|
||||||
|
.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'
|
||||||
|
: '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
|
||||||
|
}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
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>
|
||||||
|
/ {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>
|
||||||
|
<label
|
||||||
|
for="status"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white"
|
||||||
|
>Status</label
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
id="status"
|
||||||
|
name="status"
|
||||||
|
class="border text-sm rounded-lg
|
||||||
|
block p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400
|
||||||
|
text-white focus:ring-blue-500 focus:border-blue-500"
|
||||||
|
bind:value={startingAnilistStatusOption}
|
||||||
|
>
|
||||||
|
{#each statusOptions as option}
|
||||||
|
<option value={option}>{option.aniList}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="startedAt"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
|
>Date Started</label
|
||||||
|
>
|
||||||
|
<Datepicker
|
||||||
|
bind:value={startedAtDate}
|
||||||
|
color="slate"
|
||||||
|
dateFormat={{
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
}}
|
||||||
|
showActionButtons
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="completedAt"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
|
>Date Completed</label
|
||||||
|
>
|
||||||
|
<Datepicker
|
||||||
|
bind:value={completedAtDate}
|
||||||
|
color="slate"
|
||||||
|
dateFormat={{
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
}}
|
||||||
|
showActionButtons
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="repeat"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
|
>Rewatched</label
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="repeat"
|
||||||
|
min="0"
|
||||||
|
id="repeat"
|
||||||
|
class="border {currentAniListAnime.data.MediaList
|
||||||
|
.repeat < 0
|
||||||
|
? '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 text-white"
|
||||||
|
bind:value={currentAniListAnime.data.MediaList.repeat}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center"
|
||||||
|
>
|
||||||
|
<div class="w-full">
|
||||||
|
<label
|
||||||
|
for="notes"
|
||||||
|
class="text-left block mb-2 text-sm font-medium text-white"
|
||||||
|
>Your notes</label
|
||||||
|
>
|
||||||
|
<textarea
|
||||||
|
id="notes"
|
||||||
|
rows="3"
|
||||||
|
name="notes"
|
||||||
|
class="block p-2.5 w-full text-sm rounded-lg border bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
|
||||||
|
placeholder="Write your thoughts here..."
|
||||||
|
bind:value={currentAniListAnime.data.MediaList.notes}
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="external-data">
|
||||||
|
<div
|
||||||
|
id="anilist-data"
|
||||||
|
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36 group"
|
||||||
|
>
|
||||||
|
<h2 class="text-left mb-1 text-base font-semibold text-white">
|
||||||
|
AniList
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AnimeTable />
|
||||||
|
|
||||||
|
<div class="flex rounded-lg shadow max-w-4-4 bg-gray-800">
|
||||||
|
<div
|
||||||
|
class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-start"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
disabled={isSubmitting}
|
||||||
|
id="delete-button"
|
||||||
|
class="text-white bg-red-700 {$submitSuccess
|
||||||
|
? 'bg-green-600 dark:bg-green-600 hover:bg-green-700 dark:hover:bg-green-700 focus:ring-4 focus:ring-green-800 dark:focus:ring-green-800'
|
||||||
|
: 'bg-red-600 dark:bg-red-600 hover:bg-red-700 dark:hover:bg-red-700 focus:ring-4 focus:ring-red-800 dark:focus:ring-red-800'} font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 focus:outline-none"
|
||||||
|
on:click={deleteEntries}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
id="submit-loader"
|
||||||
|
aria-hidden="true"
|
||||||
|
role="status"
|
||||||
|
class="{isSubmitting
|
||||||
|
? 'inline'
|
||||||
|
: 'hidden'} w-4 h-4 me-3 text-white animate-spin"
|
||||||
|
viewBox="0 0 100 101"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||||
|
fill="#E5E7EB"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
Delete Entries
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-end"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
disabled={isSubmitting}
|
||||||
|
id="sync-button"
|
||||||
|
class="text-white {$submitSuccess
|
||||||
|
? 'bg-green-600 dark:bg-green-600 hover:bg-green-700 dark:hover:bg-green-700 focus:ring-4 focus:ring-green-800 dark:focus:ring-green-800'
|
||||||
|
: 'bg-blue-600 dark:bg-blue-600 hover:bg-blue-700 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-800 dark:focus:ring-blue-800'} font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 focus:outline-none"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
id="submit-loader"
|
||||||
|
aria-hidden="true"
|
||||||
|
role="status"
|
||||||
|
class="{isSubmitting
|
||||||
|
? 'inline'
|
||||||
|
: 'hidden'} w-4 h-4 me-3 text-white animate-spin"
|
||||||
|
viewBox="0 0 100 101"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||||
|
fill="#E5E7EB"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
Sync Changes
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
class="text-white bg-gray-800 border border-gray-600 focus:outline-none hover:bg-gray-700 focus:ring-4
|
||||||
|
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("/");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Go Home
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="text-2xl">Summary</h3>
|
||||||
|
<p>{@html currentAniListAnime.data.MediaList.media.description}</p>
|
||||||
|
</div>
|
||||||
|
</form>
|
119
frontend/src/helperComponents/AnimeTable.svelte
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
createRender,
|
||||||
|
createTable,
|
||||||
|
Render,
|
||||||
|
Subscribe,
|
||||||
|
} from "svelte-headless-table"
|
||||||
|
// @ts-ignore
|
||||||
|
import { addSortBy } from "svelte-headless-table/plugins"
|
||||||
|
import { tableItems } from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
|
||||||
|
import WebsiteLink from "./WebsiteLink.svelte"
|
||||||
|
|
||||||
|
//when adding sort here is code { sort: addSortBy() }
|
||||||
|
const table = createTable(tableItems, { sort: addSortBy() })
|
||||||
|
|
||||||
|
const columns = table.createColumns([
|
||||||
|
table.column({
|
||||||
|
header: "Service Id",
|
||||||
|
cell: ({ value }) => createRender(WebsiteLink, {id: value}),
|
||||||
|
accessor: "id",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Anime Title",
|
||||||
|
accessor: "title",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Service",
|
||||||
|
accessor: "service",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Episode Progress",
|
||||||
|
accessor: "progress",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Status",
|
||||||
|
accessor: "status",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Started At",
|
||||||
|
accessor: "startedAt",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Completed At",
|
||||||
|
accessor: "completedAt",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Rating",
|
||||||
|
accessor: "score",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Repeat",
|
||||||
|
accessor: "repeat",
|
||||||
|
}),
|
||||||
|
table.column({
|
||||||
|
header: "Notes",
|
||||||
|
accessor: "notes",
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
|
||||||
|
//add pluginStates when add sort back
|
||||||
|
const { headerRows, rows, tableAttrs, tableBodyAttrs } =
|
||||||
|
table.createViewModel(columns)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="relative overflow-x-auto rounded-lg mb-5">
|
||||||
|
<table
|
||||||
|
class="w-full text-sm text-left rtl:text-right text-gray-400"
|
||||||
|
{...$tableAttrs}
|
||||||
|
>
|
||||||
|
<thead class="text-xs uppercase bg-gray-700 text-gray-400">
|
||||||
|
{#each $headerRows as headerRow (headerRow.id)}
|
||||||
|
<Subscribe attrs={headerRow.attrs()} let:attrs>
|
||||||
|
<tr {...attrs}>
|
||||||
|
{#each headerRow.cells as cell (cell.id)}
|
||||||
|
<Subscribe
|
||||||
|
attrs={cell.attrs()}
|
||||||
|
let:attrs
|
||||||
|
props={cell.props()}
|
||||||
|
let:props
|
||||||
|
>
|
||||||
|
<th
|
||||||
|
{...attrs}
|
||||||
|
on:click={props.sort.toggle}
|
||||||
|
class:sorted={props.sort.order !==
|
||||||
|
undefined}
|
||||||
|
class="px-6 py-3"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<Render of={cell.render()} />
|
||||||
|
{#if props.sort.order === "asc"}
|
||||||
|
⬇️
|
||||||
|
{:else if props.sort.order === "desc"}
|
||||||
|
⬆️
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</tr>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</thead>
|
||||||
|
<tbody {...$tableBodyAttrs}>
|
||||||
|
{#each $rows as row (row.id)}
|
||||||
|
<Subscribe attrs={row.attrs()} let:attrs>
|
||||||
|
<tr {...attrs} class="bg-gray-800 border-gray-700">
|
||||||
|
{#each row.cells as cell (cell.id)}
|
||||||
|
<Subscribe attrs={cell.attrs()} let:attrs>
|
||||||
|
<td {...attrs} class="px-6 py-4">
|
||||||
|
<Render of={cell.render()} />
|
||||||
|
</td>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</tr>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
130
frontend/src/helperComponents/AvatarMenu.svelte
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Avatar } from "flowbite-svelte";
|
||||||
|
import type { AniListUser } from "../anilist/types/AniListTypes";
|
||||||
|
import {
|
||||||
|
aniListLoggedIn,
|
||||||
|
aniListUser,
|
||||||
|
malUser,
|
||||||
|
simklUser,
|
||||||
|
malLoggedIn,
|
||||||
|
simklLoggedIn,
|
||||||
|
loginToAniList,
|
||||||
|
loginToMAL,
|
||||||
|
loginToSimkl,
|
||||||
|
logoutOfAniList,
|
||||||
|
logoutOfMAL,
|
||||||
|
logoutOfSimkl,
|
||||||
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
import * as runtime from "../../wailsjs/runtime";
|
||||||
|
import type {MyAnimeListUser} from "../mal/types/MALTypes";
|
||||||
|
import type {SimklUser} from "../simkl/types/simklTypes";
|
||||||
|
|
||||||
|
let currentAniListUser: AniListUser;
|
||||||
|
let currentMALUser: MyAnimeListUser;
|
||||||
|
let currentSimklUser: SimklUser;
|
||||||
|
let isAniListLoggedIn: boolean;
|
||||||
|
let isSimklLoggedIn: boolean;
|
||||||
|
let isMALLoggedIn: boolean;
|
||||||
|
|
||||||
|
aniListUser.subscribe((value) => (currentAniListUser = value));
|
||||||
|
malUser.subscribe((value) => (currentMALUser = value))
|
||||||
|
simklUser.subscribe(value => currentSimklUser = value)
|
||||||
|
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
|
||||||
|
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value));
|
||||||
|
malLoggedIn.subscribe((value) => (isMALLoggedIn = value));
|
||||||
|
|
||||||
|
function dropdownUser(): void {
|
||||||
|
let dropdown = document.querySelector("#userDropdown");
|
||||||
|
dropdown.classList.toggle("hidden");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<button id="userDropdownButton" on:click={dropdownUser}>
|
||||||
|
{#if isAniListLoggedIn}
|
||||||
|
<Avatar
|
||||||
|
src={currentAniListUser.data.Viewer.avatar.medium}
|
||||||
|
class="cursor-pointer"
|
||||||
|
dot={{ color: "green" }}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<Avatar class="cursor-pointer" dot={{ color: "red" }} />
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
id="userDropdown"
|
||||||
|
class="absolute hidden right-0 2xl:left-1/2 2xl:-translate-x-1/2 z-10 divide-y rounded-lg shadow w-44 bg-gray-700 divide-gray-600"
|
||||||
|
>
|
||||||
|
<div class="px-4 py-3 text-sm text-white">
|
||||||
|
{#if isAniListLoggedIn}
|
||||||
|
<div>{currentAniListUser.data.Viewer.name}</div>
|
||||||
|
{:else}
|
||||||
|
<div>You are not logged into AniList</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<ul
|
||||||
|
class="py-2 text-sm text-gray-200"
|
||||||
|
aria-labelledby="dropdownUserAvatarButton"
|
||||||
|
>
|
||||||
|
{#if isAniListLoggedIn}
|
||||||
|
<li>
|
||||||
|
<button
|
||||||
|
on:click={logoutOfAniList}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate bg-green-800 hover:text-white"
|
||||||
|
>
|
||||||
|
<span class="maple-font text-lg text-green-200 mr-4">A</span>Logout {currentAniListUser.data.Viewer.name}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={loginToAniList}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate hover:text-white">
|
||||||
|
<span class="maple-font text-lg mr-4">A</span>Login to AniList
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{#if isMALLoggedIn}
|
||||||
|
<li>
|
||||||
|
<button
|
||||||
|
on:click={logoutOfMAL}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate bg-blue-800 hover:text-white"
|
||||||
|
>
|
||||||
|
<span class="maple-font text-lg text-blue-200 mr-4">M</span>Logout {currentMALUser.name}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={loginToMAL}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate hover:text-white">
|
||||||
|
<span class="maple-font text-lg mr-4">M</span>Login to MyAnimeList
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{#if isSimklLoggedIn}
|
||||||
|
<li>
|
||||||
|
<button
|
||||||
|
on:click={logoutOfSimkl}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate bg-indigo-800 hover:text-white"
|
||||||
|
>
|
||||||
|
<span class="maple-font text-lg text-indigo-200 mr-4">S</span>Logout {currentSimklUser.user.name}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={loginToSimkl}
|
||||||
|
class="block px-4 py-2 w-full hover:bg-gray-600 truncate hover:text-white">
|
||||||
|
<span class="maple-font text-lg mr-4">S</span>Login to Simkl
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
</ul>
|
||||||
|
<div class="py-2">
|
||||||
|
<button
|
||||||
|
on:click={() => runtime.Quit()}
|
||||||
|
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
|
||||||
|
>
|
||||||
|
Exit Application
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
481
frontend/src/helperComponents/Datepicker.svelte
Normal file
@ -0,0 +1,481 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
import { fade } from "svelte/transition";
|
||||||
|
import { Button } from "flowbite-svelte";
|
||||||
|
|
||||||
|
export let value: Date | null = null;
|
||||||
|
export let defaultDate: Date | null = null;
|
||||||
|
export let range: boolean = false;
|
||||||
|
export let rangeFrom: Date | null = null;
|
||||||
|
export let rangeTo: Date | null = null;
|
||||||
|
export let locale: string = "default";
|
||||||
|
export let firstDayOfWeek: number = 0; // 0 = Monday, 6 = Sunday
|
||||||
|
export let dateFormat: Intl.DateTimeFormatOptions = {
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
};
|
||||||
|
export let placeholder: string = "Select date";
|
||||||
|
export let disabled: boolean = false;
|
||||||
|
export let required: boolean = false;
|
||||||
|
export let inputClass: string = "";
|
||||||
|
export let color: Button["color"] = "primary";
|
||||||
|
export let inline: boolean = false;
|
||||||
|
export let autohide: boolean = true;
|
||||||
|
export let showActionButtons: boolean = false;
|
||||||
|
export let title: string = "";
|
||||||
|
|
||||||
|
// Internal state
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
let isOpen: boolean = inline;
|
||||||
|
let inputElement: HTMLInputElement;
|
||||||
|
let datepickerContainerElement: HTMLDivElement;
|
||||||
|
let currentMonth: Date = value || defaultDate || new Date();
|
||||||
|
let focusedDate: Date | null = null;
|
||||||
|
let calendarRef: HTMLDivElement;
|
||||||
|
|
||||||
|
$: daysInMonth = getDaysInMonth(currentMonth);
|
||||||
|
$: weekdays = getWeekdays();
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (!inline) {
|
||||||
|
document.addEventListener("click", handleClickOutside);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener("click", handleClickOutside);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Color handling functions
|
||||||
|
function getFocusRingClass(color: Button["color"]): string {
|
||||||
|
switch (color) {
|
||||||
|
case "primary":
|
||||||
|
return "focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400";
|
||||||
|
case "blue":
|
||||||
|
return "focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400";
|
||||||
|
case "red":
|
||||||
|
return "focus:ring-2 focus:ring-red-500 dark:focus:ring-red-400";
|
||||||
|
case "green":
|
||||||
|
return "focus:ring-2 focus:ring-green-500 dark:focus:ring-green-400";
|
||||||
|
case "yellow":
|
||||||
|
return "focus:ring-2 focus:ring-yellow-500 dark:focus:ring-yellow-400";
|
||||||
|
case "purple":
|
||||||
|
return "focus:ring-2 focus:ring-purple-500 dark:focus:ring-purple-400";
|
||||||
|
case "slate":
|
||||||
|
return "focus:ring-2 focus:ring-slate-500 dark:focus:ring-slate-400";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRangeBackgroundClass(color: Button["color"]): string {
|
||||||
|
switch (color) {
|
||||||
|
case "primary":
|
||||||
|
return "bg-primary-100 dark:bg-primary-900";
|
||||||
|
case "blue":
|
||||||
|
return "bg-blue-100 dark:bg-blue-900";
|
||||||
|
case "red":
|
||||||
|
return "bg-red-100 dark:bg-red-900";
|
||||||
|
case "green":
|
||||||
|
return "bg-green-100 dark:bg-green-900";
|
||||||
|
case "yellow":
|
||||||
|
return "bg-yellow-100 dark:bg-yellow-900";
|
||||||
|
case "purple":
|
||||||
|
return "bg-purple-100 dark:bg-purple-900";
|
||||||
|
case "slate":
|
||||||
|
return "bg-slate-100 dark:bg-slate-900";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDaysInMonth(date: Date): Date[] {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = date.getMonth();
|
||||||
|
const firstDay = new Date(year, month, 0);
|
||||||
|
const lastDay = new Date(year, month + 1, 0);
|
||||||
|
const daysArray: Date[] = [];
|
||||||
|
|
||||||
|
// Add days from previous month to fill the first week
|
||||||
|
let start = firstDay.getDay() - firstDayOfWeek;
|
||||||
|
if (start < 0) start += 7;
|
||||||
|
for (let i = 0; i < start; i++) {
|
||||||
|
daysArray.unshift(new Date(year, month, -i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add days of the current month
|
||||||
|
for (let i = 1; i <= lastDay.getDate(); i++) {
|
||||||
|
daysArray.push(new Date(year, month, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add days from next month to fill the last week
|
||||||
|
const remainingDays = 7 - (daysArray.length % 7);
|
||||||
|
if (remainingDays < 7) {
|
||||||
|
for (let i = 1; i <= remainingDays; i++) {
|
||||||
|
daysArray.push(new Date(year, month + 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return daysArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWeekdays(): string[] {
|
||||||
|
const weekdays = [];
|
||||||
|
for (let i = 0; i < 7; i++) {
|
||||||
|
const day = new Date(2021, 5, i + firstDayOfWeek);
|
||||||
|
weekdays.push(day.toLocaleString(locale, { weekday: "short" }));
|
||||||
|
}
|
||||||
|
return weekdays;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeMonth(increment: number) {
|
||||||
|
currentMonth = new Date(
|
||||||
|
currentMonth.getFullYear(),
|
||||||
|
currentMonth.getMonth() + increment,
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDaySelect(day: Date) {
|
||||||
|
if (range) {
|
||||||
|
if (!rangeFrom || (rangeFrom && rangeTo)) {
|
||||||
|
rangeFrom = day;
|
||||||
|
rangeTo = null;
|
||||||
|
} else if (day < rangeFrom) {
|
||||||
|
rangeTo = rangeFrom;
|
||||||
|
rangeFrom = day;
|
||||||
|
} else {
|
||||||
|
rangeTo = day;
|
||||||
|
}
|
||||||
|
dispatch("select", { from: rangeFrom, to: rangeTo });
|
||||||
|
} else {
|
||||||
|
value = day;
|
||||||
|
dispatch("select", value);
|
||||||
|
if (autohide && !inline) isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleInputChange() {
|
||||||
|
const date = new Date(inputElement.value);
|
||||||
|
if (!isNaN(date.getTime())) {
|
||||||
|
handleDaySelect(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClickOutside(event: MouseEvent) {
|
||||||
|
if (
|
||||||
|
isOpen &&
|
||||||
|
datepickerContainerElement &&
|
||||||
|
!datepickerContainerElement.contains(event.target as Node)
|
||||||
|
) {
|
||||||
|
isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(date: Date | null): string {
|
||||||
|
if (!date) return "";
|
||||||
|
return date.toLocaleDateString(locale, dateFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSameDate(date1: Date | null, date2: Date | null): boolean {
|
||||||
|
if (!date1 || !date2) return false;
|
||||||
|
return date1.toDateString() === date2.toDateString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$: isSelected = (day: Date): boolean => {
|
||||||
|
if (range) {
|
||||||
|
return isSameDate(day, rangeFrom) || isSameDate(day, rangeTo);
|
||||||
|
}
|
||||||
|
return isSameDate(day, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
function isInRange(day: Date): boolean {
|
||||||
|
if (!range || !rangeFrom || !rangeTo) return false;
|
||||||
|
return day > rangeFrom && day < rangeTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isToday(day: Date): boolean {
|
||||||
|
const today = new Date();
|
||||||
|
return day.toDateString() === today.toDateString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCalendarKeydown(event: KeyboardEvent) {
|
||||||
|
if (!isOpen) return;
|
||||||
|
|
||||||
|
if (!focusedDate) {
|
||||||
|
focusedDate = value || new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event.key) {
|
||||||
|
case "ArrowLeft":
|
||||||
|
focusedDate = new Date(
|
||||||
|
focusedDate.getFullYear(),
|
||||||
|
focusedDate.getMonth(),
|
||||||
|
focusedDate.getDate() - 1,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "ArrowRight":
|
||||||
|
focusedDate = new Date(
|
||||||
|
focusedDate.getFullYear(),
|
||||||
|
focusedDate.getMonth(),
|
||||||
|
focusedDate.getDate() + 1,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "ArrowUp":
|
||||||
|
focusedDate = new Date(
|
||||||
|
focusedDate.getFullYear(),
|
||||||
|
focusedDate.getMonth(),
|
||||||
|
focusedDate.getDate() - 7,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "ArrowDown":
|
||||||
|
focusedDate = new Date(
|
||||||
|
focusedDate.getFullYear(),
|
||||||
|
focusedDate.getMonth(),
|
||||||
|
focusedDate.getDate() + 7,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "Enter":
|
||||||
|
handleDaySelect(focusedDate);
|
||||||
|
break;
|
||||||
|
case "Escape":
|
||||||
|
isOpen = false;
|
||||||
|
inputElement.focus();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
if (focusedDate.getMonth() !== currentMonth.getMonth()) {
|
||||||
|
currentMonth = new Date(
|
||||||
|
focusedDate.getFullYear(),
|
||||||
|
focusedDate.getMonth(),
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Focus the button for the focused date
|
||||||
|
setTimeout(() => {
|
||||||
|
const focusedButton = calendarRef.querySelector(
|
||||||
|
`button[aria-label="${focusedDate!.toLocaleDateString(locale, { weekday: "long", year: "numeric", month: "long", day: "numeric" })}"]`,
|
||||||
|
) as HTMLButtonElement | null;
|
||||||
|
focusedButton?.focus();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleInputKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === "Enter" || event.key === " ") {
|
||||||
|
event.preventDefault();
|
||||||
|
isOpen = !isOpen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToday() {
|
||||||
|
handleDaySelect(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClear() {
|
||||||
|
value = null;
|
||||||
|
rangeFrom = null;
|
||||||
|
rangeTo = null;
|
||||||
|
dispatch("clear");
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleApply() {
|
||||||
|
dispatch("apply", range ? { from: rangeFrom, to: rangeTo } : value);
|
||||||
|
if (!inline) isOpen = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
bind:this={datepickerContainerElement}
|
||||||
|
class="relative {inline ? 'inline-block' : ''}"
|
||||||
|
>
|
||||||
|
{#if !inline}
|
||||||
|
<div class="relative">
|
||||||
|
<input
|
||||||
|
bind:this={inputElement}
|
||||||
|
type="text"
|
||||||
|
class="w-full px-4 py-3 text-sm border rounded-md focus:outline-none dark:bg-gray-700 dark:text-white dark:border-gray-600 {getFocusRingClass(
|
||||||
|
color,
|
||||||
|
)} {inputClass}"
|
||||||
|
{placeholder}
|
||||||
|
value={range
|
||||||
|
? `${formatDate(rangeFrom)} - ${formatDate(rangeTo)}`
|
||||||
|
: formatDate(value)}
|
||||||
|
on:focus={() => (isOpen = true)}
|
||||||
|
on:input={handleInputChange}
|
||||||
|
on:keydown={handleInputKeydown}
|
||||||
|
{disabled}
|
||||||
|
{required}
|
||||||
|
aria-haspopup="dialog"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="absolute inset-y-0 right-0 flex items-center px-3 text-gray-500 dark:text-gray-400 focus:outline-none"
|
||||||
|
on:click={() => (isOpen = !isOpen)}
|
||||||
|
{disabled}
|
||||||
|
aria-label={isOpen ? "Close date picker" : "Open date picker"}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-4 h-4 text-gray-500 dark:text-gray-400"
|
||||||
|
aria-hidden="true"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if isOpen || inline}
|
||||||
|
<div
|
||||||
|
bind:this={calendarRef}
|
||||||
|
id="datepicker-dropdown"
|
||||||
|
class="
|
||||||
|
{inline ? '' : 'absolute z-10 mt-1'}
|
||||||
|
bg-white dark:bg-gray-800 rounded-md shadow-lg"
|
||||||
|
transition:fade={{ duration: 100 }}
|
||||||
|
role="dialog"
|
||||||
|
aria-label="Calendar"
|
||||||
|
>
|
||||||
|
<div class="p-4" role="application">
|
||||||
|
{#if title}
|
||||||
|
<h2 class="text-lg font-semibold mb-4 dark:text-white">
|
||||||
|
{title}
|
||||||
|
</h2>
|
||||||
|
{/if}
|
||||||
|
<div class="flex items-center justify-between mb-4">
|
||||||
|
<Button
|
||||||
|
on:click={() => changeMonth(-1)}
|
||||||
|
{color}
|
||||||
|
size="sm"
|
||||||
|
aria-label="Previous month"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-3 h-3 rtl:rotate-180 text-white dark:text-white"
|
||||||
|
aria-hidden="true"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 14 10"
|
||||||
|
><path
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M13 5H1m0 0 4 4M1 5l4-4"
|
||||||
|
></path></svg
|
||||||
|
>
|
||||||
|
</Button>
|
||||||
|
<h3
|
||||||
|
class="text-lg font-semibold dark:text-white"
|
||||||
|
aria-live="polite"
|
||||||
|
>
|
||||||
|
{currentMonth.toLocaleString(locale, {
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
})}
|
||||||
|
</h3>
|
||||||
|
<Button
|
||||||
|
on:click={() => changeMonth(1)}
|
||||||
|
{color}
|
||||||
|
size="sm"
|
||||||
|
aria-label="Next month"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="w-3 h-3 rtl:rotate-180 text-white dark:text-white"
|
||||||
|
aria-hidden="true"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 14 10"
|
||||||
|
><path
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M1 5h12m0 0L9 1m4 4L9 9"
|
||||||
|
></path></svg
|
||||||
|
>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-7 gap-1" role="grid">
|
||||||
|
{#each weekdays as day}
|
||||||
|
<div
|
||||||
|
class="text-center text-sm font-medium text-gray-500 dark:text-gray-400"
|
||||||
|
role="columnheader"
|
||||||
|
>
|
||||||
|
{day}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{#each daysInMonth as day}
|
||||||
|
<Button
|
||||||
|
color={isSelected(day) ? color : "alternative"}
|
||||||
|
size="sm"
|
||||||
|
class="w-full h-8 {day.getMonth() !==
|
||||||
|
currentMonth.getMonth()
|
||||||
|
? 'text-gray-300 dark:text-gray-600'
|
||||||
|
: ''} {isToday(day)
|
||||||
|
? 'font-bold'
|
||||||
|
: ''} {isInRange(day)
|
||||||
|
? getRangeBackgroundClass(color)
|
||||||
|
: ''}"
|
||||||
|
on:click={() => handleDaySelect(day)}
|
||||||
|
on:keydown={handleCalendarKeydown}
|
||||||
|
aria-label={day.toLocaleDateString(locale, {
|
||||||
|
weekday: "long",
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
})}
|
||||||
|
aria-selected={isSelected(day)}
|
||||||
|
role="gridcell"
|
||||||
|
>
|
||||||
|
{day.getDate()}
|
||||||
|
</Button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{#if showActionButtons}
|
||||||
|
<div class="mt-4 flex justify-between">
|
||||||
|
<Button on:click={handleToday} {color} size="sm"
|
||||||
|
>Today</Button
|
||||||
|
>
|
||||||
|
<Button on:click={handleClear} color="red" size="sm"
|
||||||
|
>Clear</Button
|
||||||
|
>
|
||||||
|
<Button on:click={handleApply} {color} size="sm"
|
||||||
|
>Apply</Button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
[Go to docs](https://flowbite-svelte.com/)
|
||||||
|
## Props
|
||||||
|
@prop export let value: Date | null = null;
|
||||||
|
@prop export let defaultDate: Date | null = null;
|
||||||
|
@prop export let range: boolean = false;
|
||||||
|
@prop export let rangeFrom: Date | null = null;
|
||||||
|
@prop export let rangeTo: Date | null = null;
|
||||||
|
@prop export let locale: string = 'default';
|
||||||
|
@prop export let firstDayOfWeek: number = 0;
|
||||||
|
@prop export let dateFormat: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric' };
|
||||||
|
@prop export let placeholder: string = 'Select date';
|
||||||
|
@prop export let disabled: boolean = false;
|
||||||
|
@prop export let required: boolean = false;
|
||||||
|
@prop export let inputClass: string = '';
|
||||||
|
@prop export let color: Button['color'] = 'primary';
|
||||||
|
@prop export let inline: boolean = false;
|
||||||
|
@prop export let autohide: boolean = true;
|
||||||
|
@prop export let showActionButtons: boolean = false;
|
||||||
|
@prop export let title: string = '';
|
||||||
|
-->
|
77
frontend/src/helperComponents/Header.svelte
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Search from "./Search.svelte"
|
||||||
|
import {
|
||||||
|
aniListLoggedIn,
|
||||||
|
loginToAniList,
|
||||||
|
loginToMAL,
|
||||||
|
loginToSimkl,
|
||||||
|
malLoggedIn,
|
||||||
|
simklLoggedIn,
|
||||||
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
|
||||||
|
import AvatarMenu from "./AvatarMenu.svelte";
|
||||||
|
import logo from "../assets/images/AniTrackLogo.svg"
|
||||||
|
|
||||||
|
let isAniListLoggedIn: boolean
|
||||||
|
let isSimklLoggedIn: boolean
|
||||||
|
let isMALLoggedIn: boolean
|
||||||
|
|
||||||
|
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||||
|
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
|
||||||
|
malLoggedIn.subscribe((value) => isMALLoggedIn = value)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<nav class="border-gray-200 bg-gray-900">
|
||||||
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
||||||
|
<div class="flex items-center space-x-3 rtl:space-x-reverse">
|
||||||
|
<a href="/"><img src={logo} class="h-8" alt="AniTrack Logo"/></a>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center min-[950px]:order-2 space-x-3 min-[950px]:space-x-0 rtl:space-x-reverse">
|
||||||
|
<div class="min-[950px]:block min-[950px]:mr-4">
|
||||||
|
<Search />
|
||||||
|
</div>
|
||||||
|
<AvatarMenu/>
|
||||||
|
<button on:click={() => {
|
||||||
|
let menu = document.querySelector("#navbar-user")
|
||||||
|
menu.classList.toggle("hidden")
|
||||||
|
}} type="button"
|
||||||
|
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm rounded-lg min-[950px]:hidden focus:outline-none focus:ring-2 text-gray-400 hover:bg-gray-700 focus:ring-gray-600"
|
||||||
|
aria-controls="navbar-user" aria-expanded="false">
|
||||||
|
<span class="sr-only">Open main menu</span>
|
||||||
|
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||||
|
viewBox="0 0 17 14">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M1 1h15M1 7h15M1 13h15"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<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">
|
||||||
|
<li>
|
||||||
|
{#if !isAniListLoggedIn}
|
||||||
|
<button on:click={loginToAniList}>
|
||||||
|
<!-- 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">-->
|
||||||
|
AniList Login
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
{#if !isMALLoggedIn}
|
||||||
|
<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
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{#if !isSimklLoggedIn}
|
||||||
|
<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
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="flex justify-center min-[950px]:hidden">
|
||||||
|
<Search/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
145
frontend/src/helperComponents/Pagination.svelte
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
aniListLoggedIn,
|
||||||
|
aniListWatchlist,
|
||||||
|
animePerPage,
|
||||||
|
watchListPage,
|
||||||
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
|
||||||
|
import type {AniListCurrentUserWatchList} from "../anilist/types/AniListCurrentUserWatchListType"
|
||||||
|
import {GetAniListUserWatchingList} from "../../wailsjs/go/main/App";
|
||||||
|
import {MediaListSort} from "../anilist/types/AniListTypes";
|
||||||
|
|
||||||
|
let aniListWatchListLoaded: AniListCurrentUserWatchList
|
||||||
|
let page: number
|
||||||
|
let perPage: number
|
||||||
|
|
||||||
|
watchListPage.subscribe(value => page = value)
|
||||||
|
animePerPage.subscribe(value => perPage = value)
|
||||||
|
aniListWatchlist.subscribe((value) => aniListWatchListLoaded = value)
|
||||||
|
|
||||||
|
const perPageOptions = [10, 20, 50]
|
||||||
|
|
||||||
|
function ChangeWatchListPage(newPage: number) {
|
||||||
|
GetAniListUserWatchingList(newPage, perPage, MediaListSort.UpdatedTimeDesc).then((result) => {
|
||||||
|
watchListPage.set(newPage)
|
||||||
|
aniListWatchlist.set(result)
|
||||||
|
aniListLoggedIn.set(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePage(e): void {
|
||||||
|
if ((e.key === "Enter" || e.key === "Tab") && Number(e.target.value) !== page) ChangeWatchListPage(Number(e.target.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeCountPerPage(e): void {
|
||||||
|
GetAniListUserWatchingList(1, Number(e.target.value), MediaListSort.UpdatedTimeDesc).then((result) => {
|
||||||
|
animePerPage.set(Number(e.target.value))
|
||||||
|
watchListPage.set(1)
|
||||||
|
aniListWatchlist.set(result)
|
||||||
|
aniListLoggedIn.set(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="mb-8">
|
||||||
|
{#if aniListWatchListLoaded.data.Page.pageInfo.lastPage <= 12}
|
||||||
|
<nav aria-label="Page navigation" class="hidden md:block">
|
||||||
|
<ul class="inline-flex -space-x-px text-base h-10">
|
||||||
|
{#if page === 1}
|
||||||
|
<li>
|
||||||
|
<button disabled
|
||||||
|
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight border border-e-0 rounded-s-lg border-gray-700 text-gray-400 cursor-default">
|
||||||
|
Previous
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={() => ChangeWatchListPage(page-1)}
|
||||||
|
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight border border-e-0 rounded-s-lg border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">
|
||||||
|
Previous
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{#each {length: aniListWatchListLoaded.data.Page.pageInfo.lastPage} as _, i}
|
||||||
|
{#if i + 1 === page}
|
||||||
|
<li>
|
||||||
|
<button on:click={() => ChangeWatchListPage(i+1)}
|
||||||
|
class="flex items-center justify-center px-4 h-10 leading-tight border bg-gray-100 border-gray-700 bg-gray-700 text-white">{i + 1}</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={() => ChangeWatchListPage(i+1)}
|
||||||
|
class="flex items-center justify-center px-4 h-10 leading-tight border dark border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">{i + 1}</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
{#if page === aniListWatchListLoaded.data.Page.pageInfo.lastPage}
|
||||||
|
<li>
|
||||||
|
<button disabled
|
||||||
|
class="flex items-center justify-center px-4 h-10 leading-tight border rounded-e-lg dark border-gray-700 text-gray-400 cursor-default">
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li>
|
||||||
|
<button on:click={() => ChangeWatchListPage(page+1)}
|
||||||
|
class="flex items-center justify-center px-4 h-10 leading-tight border rounded-e-lg dark border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{/if}
|
||||||
|
<div class="flex mt-5">
|
||||||
|
<div class="w-20 mx-auto">
|
||||||
|
<select bind:value={perPage} on:change={(e) => changeCountPerPage(e)} id="countPerPage"
|
||||||
|
class="border text-sm rounded-lg block w-full p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500">
|
||||||
|
{#each perPageOptions as option}
|
||||||
|
<option value={option}>
|
||||||
|
{option}
|
||||||
|
</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>Total Anime: {aniListWatchListLoaded.data.Page.pageInfo.total}</div>
|
||||||
|
{#if aniListWatchListLoaded.data.Page.pageInfo.lastPage <= 12}
|
||||||
|
<div class="md:hidden">Page: {page} of {aniListWatchListLoaded.data.Page.pageInfo.lastPage}</div>
|
||||||
|
{:else}
|
||||||
|
<div>Page: {page} of {aniListWatchListLoaded.data.Page.pageInfo.lastPage}</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="max-w-xs mx-auto">
|
||||||
|
<div class="relative flex items-center max-w-[11rem]">
|
||||||
|
<button type="button" id="decrement-button" on:click={() => ChangeWatchListPage(page-1)}
|
||||||
|
class="bg-gray-700 hover:bg-gray-600 border-gray-600 border rounded-s-lg p-3 h-11 focus:ring-gray-700 focus:ring-2 focus:outline-none">
|
||||||
|
<svg class="w-3 h-3 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 type="number" min="1" max="{aniListWatchListLoaded.data.Page.pageInfo.lastPage}"
|
||||||
|
on:keydown={changePage} id="page-counter"
|
||||||
|
class="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none border-x-0 h-11 font-medium text-center text-sm block w-full pb-6 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
|
||||||
|
value={page} required/>
|
||||||
|
<div class="absolute bottom-1 start-1/2 -translate-x-1/2 rtl:translate-x-1/2 flex items-center text-xs text-gray-400 space-x-1 rtl:space-x-reverse">
|
||||||
|
<span>Page #</span>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="increment-button" on:click={() => ChangeWatchListPage(page+1)}
|
||||||
|
class="hover:bg-gray-600 border-gray-600 border rounded-e-lg p-3 h-11 focus:ring-gray-700 focus:ring-2 focus:outline-none">
|
||||||
|
<svg class="w-3 h-3 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>
|
||||||
|
</div>
|
50
frontend/src/helperComponents/Rating.svelte
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import StarRatting from "../star-rating/Stars.svelte";
|
||||||
|
|
||||||
|
export let score
|
||||||
|
|
||||||
|
let config = {
|
||||||
|
readOnly: false,
|
||||||
|
countStars: 5,
|
||||||
|
range: {
|
||||||
|
min: 0,
|
||||||
|
max: 5,
|
||||||
|
step: 0.5
|
||||||
|
},
|
||||||
|
score: score / 2,
|
||||||
|
showScore: false,
|
||||||
|
name: "rating",
|
||||||
|
scoreFormat: function(){ return `(${this.score.toFixed(0)}/${this.countStars})` },
|
||||||
|
starConfig: {
|
||||||
|
size: 32,
|
||||||
|
fillColor: '#F9ED4F',
|
||||||
|
strokeColor: "#e2c714",
|
||||||
|
unfilledColor: '#FFF',
|
||||||
|
strokeUnfilledColor: '#000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ratingInWords = {
|
||||||
|
0: "Not Reviewed",
|
||||||
|
1: "Appalling",
|
||||||
|
2: "Horrible",
|
||||||
|
3: "Very Bad",
|
||||||
|
4: "Bad",
|
||||||
|
5: "Average",
|
||||||
|
6: "Fine",
|
||||||
|
7: "Good",
|
||||||
|
8: "Very Good",
|
||||||
|
9: "Great",
|
||||||
|
10: "Masterpiece",
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeRating = (e: any) => {
|
||||||
|
score = e.target.valueAsNumber * 2
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<StarRatting bind:config on:change={changeRating}/>
|
||||||
|
<p>Rating: {config.score * 2}</p>
|
||||||
|
<p>{ratingInWords[config.score * 2]}</p>
|
||||||
|
</div>
|
84
frontend/src/helperComponents/Search.svelte
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
import {AniListSearch} from "../../wailsjs/go/main/App";
|
||||||
|
import type {AniSearchList} from "../anilist/types/AniListTypes";
|
||||||
|
import {push} from "svelte-spa-router";
|
||||||
|
|
||||||
|
let aniSearch = ""
|
||||||
|
let aniListSearch: AniSearchList
|
||||||
|
let aniListSearchActive = false
|
||||||
|
|
||||||
|
function runAniListSearch(): void {
|
||||||
|
AniListSearch(aniSearch).then(result => {
|
||||||
|
aniListSearch = result
|
||||||
|
aniListSearchActive = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchDropdown(): void {
|
||||||
|
let dropdown = document.querySelector("#aniListSearchDropdown")
|
||||||
|
dropdown.classList.toggle("hidden")
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="searchDropdown" class="relative w-64 md:w-48">
|
||||||
|
<div class="flex">
|
||||||
|
<label for="anime-search" class="mb-2 text-sm font-medium sr-only text-white">Find
|
||||||
|
Anime</label>
|
||||||
|
<div class="relative w-full">
|
||||||
|
<input type="search" id="anime-search" bind:value={aniSearch}
|
||||||
|
class="rounded-s-lg block p-2.5 w-full z-20 text-sm rounded-e-lg bg-gray-700 border-s-gray-700 border-gray-600 placeholder-gray-400 text-white focus:border-blue-500"
|
||||||
|
placeholder="Search for Anime"
|
||||||
|
on:keypress={(e) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
searchDropdown()
|
||||||
|
if(aniSearch.length > 0) runAniListSearch()
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
required/>
|
||||||
|
<button id="aniListSearchButton"
|
||||||
|
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium rounded-e-lg border focus:ring-4 focus:outline-none bg-blue-600 hover:bg-blue-700 focus:ring-blue-800"
|
||||||
|
on:click={() => {
|
||||||
|
searchDropdown()
|
||||||
|
if(aniSearch.length > 0) runAniListSearch()
|
||||||
|
}}>
|
||||||
|
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||||
|
viewBox="0 0 20 20">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||||
|
</svg>
|
||||||
|
<span class="sr-only">Search</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="aniListSearchDropdown" class="z-10 absolute left-0 hidden bg-white rounded-lg shadow w-60 2xl:w-80 dark:bg-gray-700">
|
||||||
|
{#if aniListSearchActive}
|
||||||
|
<ul class="h-56 w-full py-2 overflow-y-auto text-gray-700 dark:text-gray-200"
|
||||||
|
aria-labelledby="aniListSearchButton">
|
||||||
|
{#each aniListSearch.data.Page.media as media}
|
||||||
|
<li class="w-full">
|
||||||
|
<div class="flex w-full items-start p-1 hover:bg-gray-600 hover:text-white rounded-lg">
|
||||||
|
<button on:click={() => {
|
||||||
|
searchDropdown()
|
||||||
|
push(`#/anime/${media.id}`)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img class="rounded-bl-lg rounded-tl-lg max-w-24 max-h-24" src={media.coverImage.large}
|
||||||
|
alt="{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english} Cover">
|
||||||
|
</button>
|
||||||
|
<button class="rounded-bl-lg rounded-tl-lg w-full h-24" on:click={() => {
|
||||||
|
searchDropdown()
|
||||||
|
push(`#/anime/${media.id}`)
|
||||||
|
}} >{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english }</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{:else if aniSearch.length === 0}
|
||||||
|
<div class="m-4">Please enter a search term...</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
11
frontend/src/helperComponents/Spinner.svelte
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<div id="spinner" role="status" class="fixed -translate-x-1/2 -translate-y-1/2 top-2/4 left-1/2">
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
class="inline w-16 h-16 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
||||||
|
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||||
|
fill="currentColor"/>
|
||||||
|
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||||
|
fill="currentFill"/>
|
||||||
|
</svg>
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
68
frontend/src/helperComponents/WatchList.svelte
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
aniListLoggedIn,
|
||||||
|
aniListWatchlist,
|
||||||
|
GetAnimeSingleItem,
|
||||||
|
loading,
|
||||||
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
import {push} from "svelte-spa-router";
|
||||||
|
import type {AniListCurrentUserWatchList} from "../anilist/types/AniListCurrentUserWatchListType"
|
||||||
|
import {Rating} from "flowbite-svelte";
|
||||||
|
import loader from '../helperFunctions/loader'
|
||||||
|
|
||||||
|
|
||||||
|
let isAniListLoggedIn: boolean
|
||||||
|
let aniListWatchListLoaded: AniListCurrentUserWatchList
|
||||||
|
|
||||||
|
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||||
|
aniListWatchlist.subscribe((value) => aniListWatchListLoaded = value)
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{#if isAniListLoggedIn}
|
||||||
|
<div class="mx-auto max-w-2xl p-4 sm:p-6 lg:max-w-7xl lg:px-8 relative items-center">
|
||||||
|
<h1 class="text-left text-xl font-bold mb-4">Your AniList WatchList</h1>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8">
|
||||||
|
{#each aniListWatchListLoaded.data.Page.mediaList as media}
|
||||||
|
<div use:loader={loading} class="aspect-h-1 aspect-w-1 w-full overflow-hidden rounded-lg xl:aspect-h-8 xl:aspect-w-7">
|
||||||
|
<div class="flex flex-col items-center group">
|
||||||
|
<button on:click={() => {
|
||||||
|
push(`#/anime/${media.media.id}`)
|
||||||
|
// loading.set(true)
|
||||||
|
// GetAniListSingleItem(media.media.id, true).then(() => {
|
||||||
|
// loading.set(false)
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img class="rounded-lg" src={media.media.coverImage.large} alt={
|
||||||
|
media.media.title.english === "" ?
|
||||||
|
media.media.title.romaji :
|
||||||
|
media.media.title.english
|
||||||
|
}/>
|
||||||
|
</button>
|
||||||
|
<Rating id="anime-rating" total={5} size={35} rating={media.score/2.0}/>
|
||||||
|
<button class="mt-4 text-md font-semibold text-white-700"
|
||||||
|
on:click={() => GetAnimeSingleItem(media.media.id, true)}>
|
||||||
|
{
|
||||||
|
media.media.title.english === "" ?
|
||||||
|
media.media.title.romaji :
|
||||||
|
media.media.title.english
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
<p class="mt-1 text-lg font-medium text-white-900">{media.progress}
|
||||||
|
/ {media.media.nextAiringEpisode.episode !== 0 ?
|
||||||
|
media.media.nextAiringEpisode.episode - 1 : media.media.episodes}</p>
|
||||||
|
{#if media.media.episodes > 0}
|
||||||
|
<p class="mt-1 text-lg font-medium text-white-900">Total
|
||||||
|
Episodes: {media.media.episodes}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
28
frontend/src/helperComponents/WebsiteLink.svelte
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {BrowserOpenURL} from "../../wailsjs/runtime"
|
||||||
|
|
||||||
|
export let id: string
|
||||||
|
let url = ""
|
||||||
|
let isAniList = false
|
||||||
|
let isMAL = false
|
||||||
|
let isSimkl = false
|
||||||
|
let newId = id
|
||||||
|
let re = /[ams]?-?(.*)/
|
||||||
|
if (id !== undefined && id.length > 0) {
|
||||||
|
isAniList = id.includes("a-")
|
||||||
|
isMAL = id.includes("m-")
|
||||||
|
isSimkl = id.includes("s-")
|
||||||
|
newId = id.match(re)[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isAniList) url = `https://anilist.co/anime/${newId}`
|
||||||
|
if (isMAL) url = `https://myanimelist.net/anime/${newId}`
|
||||||
|
if (isSimkl) url = `https://simkl.com/anime/${newId}`
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if url.length > 0}
|
||||||
|
<button class="underline underline-offset-2 px-4 py-1" on:click={() => BrowserOpenURL(url)}>{newId}</button>
|
||||||
|
{:else}
|
||||||
|
{id}
|
||||||
|
{/if}
|
65
frontend/src/helperDefaults/AniListGetSingleAnime.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import type {AniListGetSingleAnime} from "../anilist/types/AniListCurrentUserWatchListType";
|
||||||
|
|
||||||
|
export const AniListGetSingleAnimeDefaultData: AniListGetSingleAnime = {
|
||||||
|
data: {
|
||||||
|
MediaList: {
|
||||||
|
id: 0,
|
||||||
|
mediaId: 0,
|
||||||
|
userId: 0,
|
||||||
|
media: {
|
||||||
|
id: 0,
|
||||||
|
idMal: 0,
|
||||||
|
title: {
|
||||||
|
romaji: "",
|
||||||
|
english: "",
|
||||||
|
native: "",
|
||||||
|
},
|
||||||
|
description: "",
|
||||||
|
coverImage: {
|
||||||
|
large: "",
|
||||||
|
},
|
||||||
|
season: "",
|
||||||
|
seasonYear: 0,
|
||||||
|
status: "",
|
||||||
|
episodes: 0,
|
||||||
|
nextAiringEpisode: {
|
||||||
|
airingAt: 0,
|
||||||
|
timeUntilAiring: 0,
|
||||||
|
episode: 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
status: "",
|
||||||
|
startedAt: {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
completedAt: {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
notes: "",
|
||||||
|
progress: 0,
|
||||||
|
score: 0,
|
||||||
|
repeat: 0,
|
||||||
|
user: {
|
||||||
|
id: 0,
|
||||||
|
name: "",
|
||||||
|
avatar: {
|
||||||
|
large: "",
|
||||||
|
medium: "",
|
||||||
|
},
|
||||||
|
statistics: {
|
||||||
|
anime: {
|
||||||
|
count: 0,
|
||||||
|
statuses: [{
|
||||||
|
status: "",
|
||||||
|
count: 0,
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
frontend/src/helperFunctions/convertAniListDateIn.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import moment from "moment";
|
||||||
|
|
||||||
|
const convertAniListDateToString = (date: {
|
||||||
|
year?: number;
|
||||||
|
month?: number;
|
||||||
|
day?: number;
|
||||||
|
}): string => {
|
||||||
|
if (
|
||||||
|
date.year === undefined ||
|
||||||
|
(date.year === 0 && date.month === undefined) ||
|
||||||
|
(date.month === 0 && date.day === undefined) ||
|
||||||
|
date.day === 0
|
||||||
|
) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const newISODate = new Date(date.year, date.month - 1, date.day);
|
||||||
|
const newMoment = moment(newISODate);
|
||||||
|
return newMoment.format("MM-DD-YYYY");
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertAniListDateToDate = (date: {
|
||||||
|
year?: number;
|
||||||
|
month?: number;
|
||||||
|
day?: number;
|
||||||
|
}): Date | null => {
|
||||||
|
if (
|
||||||
|
date.year === undefined ||
|
||||||
|
(date.year === 0 && date.month === undefined) ||
|
||||||
|
(date.month === 0 && date.day === undefined) ||
|
||||||
|
date.day === 0
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Date(date.year, date.month - 1, date.day);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { convertAniListDateToString, convertAniListDateToDate };
|
39
frontend/src/helperFunctions/convertDateToAniList.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
type AnilistDate = {
|
||||||
|
year: number;
|
||||||
|
month: number;
|
||||||
|
day: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertDateStringToAniList = (date: string): AnilistDate => {
|
||||||
|
if (date === "") {
|
||||||
|
return {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
|
||||||
|
const newDate = re.exec(date);
|
||||||
|
return {
|
||||||
|
year: Number(newDate[1]),
|
||||||
|
month: Number(newDate[2]),
|
||||||
|
day: Number(newDate[3]),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertDateToAniList = (date: Date | null): AnilistDate => {
|
||||||
|
if (date === null) {
|
||||||
|
return {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
year: Number(date.getFullYear()),
|
||||||
|
month: Number(date.getMonth()) + 1,
|
||||||
|
day: Number(date.getDate()),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export { convertDateStringToAniList, convertDateToAniList };
|
18
frontend/src/helperFunctions/loader.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import Spinner from '../helperComponents/Spinner.svelte';
|
||||||
|
|
||||||
|
export default (node: any, loading: any) => {
|
||||||
|
let Spin: any
|
||||||
|
loading.subscribe((loading: any) => {
|
||||||
|
if(loading){
|
||||||
|
Spin = new Spinner({
|
||||||
|
target: node,
|
||||||
|
intro: true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if(Spin){
|
||||||
|
Spin?.$destroy?.()
|
||||||
|
Spin = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
21
frontend/src/helperModules/AddAnimeServiceToTable.svelte
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
import type {TableItem} from "../helperTypes/TableTypes";
|
||||||
|
import { tableItems } from "./GlobalVariablesAndHelperFunctions.svelte"
|
||||||
|
|
||||||
|
export function AddAnimeServiceToTable(animeItem: TableItem) {
|
||||||
|
tableItems.update((table) => {
|
||||||
|
if (table.length === 0) {
|
||||||
|
table.push(animeItem)
|
||||||
|
} else {
|
||||||
|
for (const [index, tableItem] of table.entries()) {
|
||||||
|
if(tableItem.service === animeItem.service) {
|
||||||
|
table[index] = animeItem
|
||||||
|
return table
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.push(animeItem)
|
||||||
|
}
|
||||||
|
return table
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,34 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
import {CheckIfAniListLoggedIn, GetAniListLoggedInUser, GetAniListUserWatchingList} from "../../wailsjs/go/main/App";
|
||||||
|
import {MediaListSort} from "../anilist/types/AniListTypes";
|
||||||
|
import { aniListUser, watchListPage, animePerPage, aniListPrimary, aniListLoggedIn, aniListWatchlist } from "./GlobalVariablesAndHelperFunctions.svelte"
|
||||||
|
|
||||||
|
let isAniListPrimary: boolean
|
||||||
|
let page: number
|
||||||
|
let perPage: number
|
||||||
|
|
||||||
|
aniListPrimary.subscribe(value => isAniListPrimary = value)
|
||||||
|
watchListPage.subscribe(value => page = value)
|
||||||
|
animePerPage.subscribe(value => perPage = value)
|
||||||
|
|
||||||
|
export const LoadAniListUser = async () => {
|
||||||
|
await GetAniListLoggedInUser().then(user => {
|
||||||
|
aniListUser.set(user)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const LoadAniListWatchList = async () => {
|
||||||
|
await GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((watchList) => {
|
||||||
|
aniListWatchlist.set(watchList)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CheckIfAniListLoggedInAndLoadWatchList = async () => {
|
||||||
|
const loggedIn = await CheckIfAniListLoggedIn()
|
||||||
|
if (loggedIn) {
|
||||||
|
await LoadAniListUser()
|
||||||
|
if (isAniListPrimary) await LoadAniListWatchList()
|
||||||
|
}
|
||||||
|
aniListLoggedIn.set(loggedIn)
|
||||||
|
}
|
||||||
|
</script>
|
25
frontend/src/helperModules/CheckIfMyAnimeListLoggedIn.svelte
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
import {CheckIfMyAnimeListLoggedIn, GetMyAnimeList, GetMyAnimeListLoggedInUser} from "../../wailsjs/go/main/App";
|
||||||
|
import {malUser, malPrimary, malWatchList, malLoggedIn} from "./GlobalVariablesAndHelperFunctions.svelte"
|
||||||
|
|
||||||
|
let isMalPrimary: boolean
|
||||||
|
malPrimary.subscribe(value => isMalPrimary = value)
|
||||||
|
|
||||||
|
export const CheckIfMALLoggedInAndSetUser = async () => {
|
||||||
|
await CheckIfMyAnimeListLoggedIn().then(loggedIn => {
|
||||||
|
if (loggedIn) {
|
||||||
|
GetMyAnimeListLoggedInUser().then(user => {
|
||||||
|
malUser.set(user)
|
||||||
|
if (isMalPrimary) {
|
||||||
|
GetMyAnimeList(1000).then(watchList => {
|
||||||
|
malWatchList.set(watchList)
|
||||||
|
malLoggedIn.set(loggedIn)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
malLoggedIn.set(loggedIn)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
29
frontend/src/helperModules/CheckIsSimklLoggedIn.svelte
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
import {CheckIfSimklLoggedIn, GetSimklLoggedInUser, SimklGetUserWatchlist} from "../../wailsjs/go/main/App";
|
||||||
|
import { simklLoggedIn, simklUser, simklPrimary, simklWatchList } from "./GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
|
||||||
|
let isSimklPrimary: boolean
|
||||||
|
simklPrimary.subscribe(value => isSimklPrimary = value)
|
||||||
|
|
||||||
|
export const CheckIfSimklLoggedInAndSetUser = async () => {
|
||||||
|
await CheckIfSimklLoggedIn().then(loggedIn => {
|
||||||
|
if (loggedIn) {
|
||||||
|
GetSimklLoggedInUser().then(user => {
|
||||||
|
if (Object.keys(user).length === 0) {
|
||||||
|
simklLoggedIn.set(false)
|
||||||
|
} else {
|
||||||
|
simklUser.set(user)
|
||||||
|
if (isSimklPrimary) {
|
||||||
|
SimklGetUserWatchlist().then(result => {
|
||||||
|
simklWatchList.set(result)
|
||||||
|
simklLoggedIn.set(loggedIn)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
simklLoggedIn.set(loggedIn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,162 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
import {
|
||||||
|
GetAniListItem,
|
||||||
|
GetAniListLoggedInUser,
|
||||||
|
GetAniListUserWatchingList,
|
||||||
|
GetMyAnimeListAnime,
|
||||||
|
GetMyAnimeListLoggedInUser,
|
||||||
|
GetSimklLoggedInUser,
|
||||||
|
LogoutAniList,
|
||||||
|
LogoutMyAnimeList,
|
||||||
|
LogoutSimkl,
|
||||||
|
SimklGetUserWatchlist,
|
||||||
|
SimklSearch
|
||||||
|
} from "../../wailsjs/go/main/App";
|
||||||
|
import type {
|
||||||
|
AniListCurrentUserWatchList,
|
||||||
|
AniListGetSingleAnime
|
||||||
|
} from "../anilist/types/AniListCurrentUserWatchListType.js";
|
||||||
|
import {writable} from 'svelte/store'
|
||||||
|
import type {SimklAnime, SimklUser, SimklWatchList} from "../simkl/types/simklTypes";
|
||||||
|
import {type AniListUser, MediaListSort} from "../anilist/types/AniListTypes";
|
||||||
|
import type {MALAnime, MALWatchlist, MyAnimeListUser} from "../mal/types/MALTypes";
|
||||||
|
import type {TableItems} from "../helperTypes/TableTypes";
|
||||||
|
import {AniListGetSingleAnimeDefaultData} from "../helperDefaults/AniListGetSingleAnime";
|
||||||
|
|
||||||
|
export let aniListAnime = writable(AniListGetSingleAnimeDefaultData)
|
||||||
|
export let title = writable("")
|
||||||
|
export let aniListLoggedIn = writable(false)
|
||||||
|
export let simklLoggedIn = writable(false)
|
||||||
|
export let malLoggedIn = writable(false)
|
||||||
|
export let simklWatchList = writable({} as SimklWatchList)
|
||||||
|
export let aniListPrimary = writable(true)
|
||||||
|
export let simklPrimary = writable(false)
|
||||||
|
export let malPrimary = writable(false)
|
||||||
|
export let simklUser = writable({} as SimklUser)
|
||||||
|
export let aniListUser = writable({} as AniListUser)
|
||||||
|
export let malUser = writable({} as MyAnimeListUser)
|
||||||
|
export let aniListWatchlist = writable({} as AniListCurrentUserWatchList)
|
||||||
|
export let malWatchList = writable({} as MALWatchlist)
|
||||||
|
export let malAnime = writable({} as MALAnime)
|
||||||
|
export let simklAnime = writable({} as SimklAnime)
|
||||||
|
export let loading = writable(false)
|
||||||
|
export let tableItems = writable([] as TableItems)
|
||||||
|
|
||||||
|
export let watchListPage = writable(1)
|
||||||
|
export let animePerPage = writable(20)
|
||||||
|
|
||||||
|
let isAniListPrimary: boolean
|
||||||
|
let page: number
|
||||||
|
let perPage: number
|
||||||
|
let aniWatchlist: AniListCurrentUserWatchList
|
||||||
|
let currentAniListAnime: AniListGetSingleAnime
|
||||||
|
|
||||||
|
let isMalLoggedIn: boolean
|
||||||
|
let isSimklLoggedIn: boolean
|
||||||
|
|
||||||
|
aniListPrimary.subscribe(value => isAniListPrimary = value)
|
||||||
|
watchListPage.subscribe(value => page = value)
|
||||||
|
animePerPage.subscribe(value => perPage = value)
|
||||||
|
aniListWatchlist.subscribe(value => aniWatchlist = value)
|
||||||
|
malLoggedIn.subscribe(value => isMalLoggedIn = value)
|
||||||
|
simklLoggedIn.subscribe(value => isSimklLoggedIn = value)
|
||||||
|
aniListAnime.subscribe(value => currentAniListAnime = value)
|
||||||
|
|
||||||
|
|
||||||
|
export async function GetAnimeSingleItem(aniId: number, login: boolean): Promise<""> {
|
||||||
|
await GetAniListItem(aniId, login).then(aniListResult => {
|
||||||
|
let finalResult: AniListGetSingleAnime
|
||||||
|
finalResult = aniListResult
|
||||||
|
if (login === false) {
|
||||||
|
finalResult.data.MediaList.status = ""
|
||||||
|
finalResult.data.MediaList.score = 0
|
||||||
|
finalResult.data.MediaList.progress = 0
|
||||||
|
finalResult.data.MediaList.notes = ""
|
||||||
|
finalResult.data.MediaList.repeat = 0
|
||||||
|
finalResult.data.MediaList.startedAt.day = 0
|
||||||
|
finalResult.data.MediaList.startedAt.month = 0
|
||||||
|
finalResult.data.MediaList.startedAt.year = 0
|
||||||
|
finalResult.data.MediaList.completedAt.day = 0
|
||||||
|
finalResult.data.MediaList.completedAt.month = 0
|
||||||
|
finalResult.data.MediaList.completedAt.year = 0
|
||||||
|
}
|
||||||
|
aniListAnime.set(finalResult)
|
||||||
|
title.set(currentAniListAnime.data.MediaList.media.title.english === "" ?
|
||||||
|
currentAniListAnime.data.MediaList.media.title.romaji :
|
||||||
|
currentAniListAnime.data.MediaList.media.title.english)
|
||||||
|
})
|
||||||
|
if (isMalLoggedIn) {
|
||||||
|
await GetMyAnimeListAnime(currentAniListAnime.data.MediaList.media.idMal).then(malResult => {
|
||||||
|
malAnime.set(malResult)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (isSimklLoggedIn) {
|
||||||
|
await SimklSearch(currentAniListAnime.data.MediaList).then((value: SimklAnime) => {
|
||||||
|
simklAnime.set(value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loginToSimkl(): void {
|
||||||
|
GetSimklLoggedInUser().then(user => {
|
||||||
|
if (Object.keys(user).length === 0) {
|
||||||
|
simklLoggedIn.set(false)
|
||||||
|
} else {
|
||||||
|
simklUser.set(user)
|
||||||
|
SimklGetUserWatchlist().then(result => {
|
||||||
|
simklWatchList.set(result)
|
||||||
|
simklLoggedIn.set(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loginToAniList(): void {
|
||||||
|
GetAniListLoggedInUser().then(result => {
|
||||||
|
aniListUser.set(result)
|
||||||
|
if (isAniListPrimary) {
|
||||||
|
GetAniListUserWatchingList(page, perPage, MediaListSort.UpdatedTimeDesc).then((result) => {
|
||||||
|
aniListWatchlist.set(result)
|
||||||
|
aniListLoggedIn.set(true)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
aniListLoggedIn.set(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loginToMAL(): void {
|
||||||
|
GetMyAnimeListLoggedInUser().then(result => {
|
||||||
|
malUser.set(result)
|
||||||
|
malLoggedIn.set(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logoutOfAniList(): void {
|
||||||
|
LogoutAniList().then(result => {
|
||||||
|
console.log(result)
|
||||||
|
if (Object.keys(aniWatchlist).length !== 0) {
|
||||||
|
aniListWatchlist.set({} as AniListCurrentUserWatchList)
|
||||||
|
}
|
||||||
|
aniListUser.set({} as AniListUser)
|
||||||
|
aniListLoggedIn.set(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logoutOfMAL(): void {
|
||||||
|
LogoutMyAnimeList().then(result => {
|
||||||
|
console.log(result)
|
||||||
|
malUser.set({} as MyAnimeListUser)
|
||||||
|
malLoggedIn.set(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logoutOfSimkl(): void {
|
||||||
|
LogoutSimkl().then(result => {
|
||||||
|
console.log(result)
|
||||||
|
simklUser.set({} as SimklUser)
|
||||||
|
simklLoggedIn.set(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
8
frontend/src/helperTypes/StatusTypes.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export type StatusOptions = StatusOption[]
|
||||||
|
|
||||||
|
export type StatusOption = {
|
||||||
|
id: number,
|
||||||
|
aniList: string,
|
||||||
|
mal: string,
|
||||||
|
simkl: string,
|
||||||
|
}
|
14
frontend/src/helperTypes/TableTypes.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export type TableItems = TableItem[]
|
||||||
|
|
||||||
|
export type TableItem = {
|
||||||
|
id: string
|
||||||
|
title: string
|
||||||
|
service: string
|
||||||
|
progress: number
|
||||||
|
status: string
|
||||||
|
startedAt: string
|
||||||
|
completedAt: string
|
||||||
|
score: number
|
||||||
|
repeat: number
|
||||||
|
notes: string
|
||||||
|
}
|
164
frontend/src/mal/types/MALTypes.ts
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
export interface MyAnimeListUser {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
picture: string
|
||||||
|
gender: string
|
||||||
|
birthday: string
|
||||||
|
location: string
|
||||||
|
joinedAt: string
|
||||||
|
AnimeStatistics: AnimeStatistics
|
||||||
|
timeZone: string
|
||||||
|
isSupporter: boolean
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnimeStatistics {
|
||||||
|
numItemsWatching: number
|
||||||
|
numItemsCompleted: number
|
||||||
|
numItemsOnHold: number
|
||||||
|
numItemsDropped: number
|
||||||
|
numItemsPlanToWatch: number
|
||||||
|
numItems: number
|
||||||
|
numDaysWatched: number
|
||||||
|
numDaysWatching: number
|
||||||
|
numDaysCompleted: number
|
||||||
|
numDaysOnHold: number
|
||||||
|
numDaysDropped: number
|
||||||
|
numDays: number
|
||||||
|
numEpisodes: number
|
||||||
|
numTimesRewatched: number
|
||||||
|
meanScore: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MALWatchlist {
|
||||||
|
data: [MALAnimeFromList]
|
||||||
|
paging: Paging
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MALAnimeFromList {
|
||||||
|
node: Node
|
||||||
|
listStatus: ListStatus | MalListStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Node {
|
||||||
|
id: number
|
||||||
|
title: string
|
||||||
|
mainPicture: MainPicture
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MainPicture {
|
||||||
|
medium: string
|
||||||
|
large: string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Paging {
|
||||||
|
previous: string
|
||||||
|
next: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MALAnime {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
main_picture: {
|
||||||
|
large: string;
|
||||||
|
medium: string;
|
||||||
|
};
|
||||||
|
alternative_titles: {
|
||||||
|
synonyms: string[];
|
||||||
|
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;
|
||||||
|
}[];
|
||||||
|
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;
|
||||||
|
}[];
|
||||||
|
pictures: {
|
||||||
|
large: string;
|
||||||
|
medium: string;
|
||||||
|
}[];
|
||||||
|
background: string;
|
||||||
|
related_anime: {
|
||||||
|
node: MALAnime;
|
||||||
|
relation_type: string;
|
||||||
|
relation_type_formatted: string;
|
||||||
|
}[];
|
||||||
|
recommendations: {
|
||||||
|
node: MALAnime;
|
||||||
|
num_recommendations: number;
|
||||||
|
}[];
|
||||||
|
Statistics: {
|
||||||
|
num_list_users: number;
|
||||||
|
Status: {
|
||||||
|
watching: string;
|
||||||
|
completed: string;
|
||||||
|
on_hold: string;
|
||||||
|
dropped: string;
|
||||||
|
plan_to_watch: 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[];
|
||||||
|
comments: string;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MALUploadStatus {
|
||||||
|
status: string
|
||||||
|
is_rewatching: boolean
|
||||||
|
score: number
|
||||||
|
num_watched_episodes: number
|
||||||
|
num_times_rewatched: number
|
||||||
|
comments: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListStatus {
|
||||||
|
status: string
|
||||||
|
score: number
|
||||||
|
numEpisodesWatched: number
|
||||||
|
isRewatching: boolean
|
||||||
|
updated_at: string
|
||||||
|
startDate: string
|
||||||
|
finishDate: string
|
||||||
|
}
|
9
frontend/src/routes/AnimeRoutePage.svelte
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Anime from "../helperComponents/Anime.svelte"
|
||||||
|
|
||||||
|
export let params: Record<string, string>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#key params.id}
|
||||||
|
<Anime />
|
||||||
|
{/key}
|
25
frontend/src/routes/Home.svelte
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Pagination from "../helperComponents/Pagination.svelte";
|
||||||
|
import WatchList from "../helperComponents/WatchList.svelte";
|
||||||
|
import {
|
||||||
|
aniListLoggedIn,
|
||||||
|
aniListPrimary,
|
||||||
|
loading,
|
||||||
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
|
import loader from '../helperFunctions/loader'
|
||||||
|
|
||||||
|
let isAniListPrimary: boolean
|
||||||
|
let isAniListLoggedIn: boolean
|
||||||
|
|
||||||
|
aniListPrimary.subscribe((value) => isAniListPrimary = value)
|
||||||
|
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
|
||||||
|
</script>
|
||||||
|
{#if isAniListLoggedIn && isAniListPrimary}
|
||||||
|
<div class="container py-10">
|
||||||
|
<Pagination />
|
||||||
|
<WatchList />
|
||||||
|
<Pagination />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div use:loader={loading}></div>
|
||||||
|
{/if}
|
76
frontend/src/simkl/types/simklTypes.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
export type 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 type SimklWatchList = {
|
||||||
|
anime: [SimklAnime]
|
||||||
|
currentIndex: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export type 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,
|
||||||
|
offen: string,
|
||||||
|
crunchyroll: string,
|
||||||
|
tvdbslug: string,
|
||||||
|
anilist: string,
|
||||||
|
animeplanet: string,
|
||||||
|
anisearch: string,
|
||||||
|
kitsu: string,
|
||||||
|
livechart: string,
|
||||||
|
traktslug: string,
|
||||||
|
anidb: string,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
anime_type: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SimklSearchType = [{
|
||||||
|
type: string;
|
||||||
|
title: string;
|
||||||
|
poster: string;
|
||||||
|
year: number;
|
||||||
|
status: string;
|
||||||
|
ids: {
|
||||||
|
simkl: number;
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
totalEpisodes: number;
|
||||||
|
animeType: string;
|
||||||
|
}]
|
63
frontend/src/star-rating/Stars.svelte
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<!-- Originally from @ernane/svelte-star-rating. Wanted to give credit but could not use from the library without causing program crash. -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Star from './components/Star.svelte';
|
||||||
|
export let config = {
|
||||||
|
readOnly: false,
|
||||||
|
countStars: 5,
|
||||||
|
range: { min: 0, max: 5, step: 0.001 },
|
||||||
|
score: 0.0,
|
||||||
|
showScore: true,
|
||||||
|
name: "stars",
|
||||||
|
scoreFormat: function(){ return `(${this.score.toFixed(0)}/${this.countStars})` },
|
||||||
|
starConfig: {
|
||||||
|
size: 30,
|
||||||
|
fillColor: '#F9ED4F',
|
||||||
|
strokeColor: "#BB8511",
|
||||||
|
unfilledColor: '#FFF',
|
||||||
|
strokeUnfilledColor: '#000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="stars-container">
|
||||||
|
<div class="range-stars">
|
||||||
|
<div class="stars">
|
||||||
|
{#each Array(config.countStars) as star, id}
|
||||||
|
{#if Math.floor(config.score) === id}
|
||||||
|
<Star id={config.name + id} readOnly={config.readOnly} starConfig={config.starConfig} fillPercentage={config.score - Math.floor(config.score)}/>
|
||||||
|
{:else if Math.floor(config.score) > id}
|
||||||
|
<Star id={config.name + id} readOnly={config.readOnly} starConfig={config.starConfig} fillPercentage={1}/>
|
||||||
|
{:else}
|
||||||
|
<Star id={config.name + id} readOnly={config.readOnly} starConfig={config.starConfig} fillPercentage={0}/>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<input name={config.name}
|
||||||
|
class="slider"
|
||||||
|
type="range"
|
||||||
|
min={config.readOnly ? config.score : config.range.min}
|
||||||
|
max={config.readOnly ? config.score : config.range.max}
|
||||||
|
step="{config.range.step}" bind:value={config.score}
|
||||||
|
on:change
|
||||||
|
on:click
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{#if config.showScore}
|
||||||
|
<span class="show-score" style="font-size: {config.starConfig.size/2}px;">
|
||||||
|
{#if config.scoreFormat}
|
||||||
|
{config.scoreFormat()}
|
||||||
|
{:else}
|
||||||
|
({((config.score/config.countStars)*100).toFixed(2)}%)
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.stars-container{ position: relative; display: flex; align-items: center; justify-content: center; gap: .5rem; }
|
||||||
|
.range-stars{ position: relative; }
|
||||||
|
.stars{ display: flex; align-items: center; justify-content: center; gap: .5rem; }
|
||||||
|
.slider{ opacity: 0; cursor: pointer; position: absolute; top: 0; left: 0; right: 0; height: 100%; }
|
||||||
|
.show-score{ user-select: none; color: #888 }
|
||||||
|
</style>
|
21
frontend/src/star-rating/components/Star.svelte
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
export let id, readOnly, fillPercentage, starConfig;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="{starConfig.size}" viewBox="0 -10 187.673 179.503" height="{starConfig.size}" >
|
||||||
|
{#if fillPercentage < 1 && fillPercentage > 0}
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="linear-gradient-{id}" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||||
|
<stop offset="0%" style="stop-color:{starConfig.fillColor};stop-opacity:1" />
|
||||||
|
<stop offset="{fillPercentage * 100}%" style="stop-color:{starConfig.fillColor};stop-opacity:1"/>
|
||||||
|
<stop offset="{fillPercentage * 100}%" style="stop-color:{starConfig.unfilledColor};stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
{/if}
|
||||||
|
<path
|
||||||
|
opacity="{readOnly ? .7 : 1}"
|
||||||
|
stroke={fillPercentage > 0 ? starConfig.strokeColor : starConfig.strokeUnfilledColor}
|
||||||
|
fill={fillPercentage === 1 ? starConfig.fillColor : fillPercentage === 0 ? starConfig.unfilledColor : `url(#linear-gradient-${id})`}
|
||||||
|
d="M187.183 57.47a9.955 9.955 0 00-8.587-6.86l-54.167-4.918-21.42-50.134a9.978 9.978 0 00-9.172-6.052 9.972 9.972 0 00-9.172 6.061l-21.42 50.125L9.07 50.611a9.973 9.973 0 00-8.578 6.858 9.964 9.964 0 002.917 10.596l40.944 35.908-12.073 53.184a9.97 9.97 0 003.878 10.298A9.953 9.953 0 0042 169.357a9.937 9.937 0 005.114-1.424l46.724-27.925 46.707 27.925a9.936 9.936 0 0010.964-.478 9.979 9.979 0 003.88-10.298l-12.074-53.184 40.944-35.9a9.98 9.98 0 002.925-10.604zm0 0"
|
||||||
|
/>
|
||||||
|
</svg>
|
@ -1,6 +1,10 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
html {
|
html {
|
||||||
background-color: rgba(27, 38, 54, 1);
|
background-color: rgba(27, 38, 54, 1);
|
||||||
text-align: center;
|
/*text-align: center;*/
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,6 +16,12 @@ body {
|
|||||||
sans-serif;
|
sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.maple-font {
|
||||||
|
font-family: "Maple Mono NF", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
|
||||||
|
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||||
|
sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Nunito";
|
font-family: "Nunito";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@ -20,6 +30,14 @@ body {
|
|||||||
url("assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
|
url("assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Maple Mono NF";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 800;
|
||||||
|
src: local(""),
|
||||||
|
url("assets/fonts/MapleMono-Bold.woff2") format("woff2");
|
||||||
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
44
frontend/tailwind.config.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import flowbitePlugin from 'flowbite/plugin'
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
content: [
|
||||||
|
"./index.html",
|
||||||
|
"./src/**/*.{svelte,js,ts,jsx,tsx}",
|
||||||
|
"./node_modules/flowbite/**/*.{html,js,svelte,ts}",
|
||||||
|
"./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}",
|
||||||
|
],
|
||||||
|
plugins: [ flowbitePlugin ],
|
||||||
|
|
||||||
|
darkMode: 'media',
|
||||||
|
|
||||||
|
theme: {
|
||||||
|
container: {
|
||||||
|
center: true,
|
||||||
|
padding: {
|
||||||
|
DEFAULT: '1rem',
|
||||||
|
sm: '2rem',
|
||||||
|
lg: '4rem',
|
||||||
|
xl: '5rem',
|
||||||
|
'2xl': '6rem',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
// flowbite-svelte
|
||||||
|
primary: {
|
||||||
|
50: '#FFF5F2',
|
||||||
|
100: '#FFF1EE',
|
||||||
|
200: '#FFE4DE',
|
||||||
|
300: '#FFD5CC',
|
||||||
|
400: '#FFBCAD',
|
||||||
|
500: '#FE795D',
|
||||||
|
600: '#EF562F',
|
||||||
|
700: '#EB4F27',
|
||||||
|
800: '#CC4522',
|
||||||
|
900: '#A5371B'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
55
frontend/wailsjs/go/main/App.d.ts
vendored
@ -1,4 +1,57 @@
|
|||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
// This file is automatically generated. DO NOT EDIT
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
import {main} from '../models';
|
||||||
|
|
||||||
export function Greet(arg1:string):Promise<string>;
|
export function AniListDeleteEntry(arg1:number):Promise<main.DeleteAniListReturn>;
|
||||||
|
|
||||||
|
export function AniListLogin():Promise<void>;
|
||||||
|
|
||||||
|
export function AniListSearch(arg1:string):Promise<any>;
|
||||||
|
|
||||||
|
export function AniListUpdateEntry(arg1:main.AniListUpdateVariables):Promise<main.AniListGetSingleAnime>;
|
||||||
|
|
||||||
|
export function CheckIfAniListLoggedIn():Promise<boolean>;
|
||||||
|
|
||||||
|
export function CheckIfMyAnimeListLoggedIn():Promise<boolean>;
|
||||||
|
|
||||||
|
export function CheckIfSimklLoggedIn():Promise<boolean>;
|
||||||
|
|
||||||
|
export function DeleteMyAnimeListEntry(arg1:number):Promise<boolean>;
|
||||||
|
|
||||||
|
export function GetAniListItem(arg1:number,arg2:boolean):Promise<main.AniListGetSingleAnime>;
|
||||||
|
|
||||||
|
export function GetAniListLoggedInUser():Promise<main.AniListUser>;
|
||||||
|
|
||||||
|
export function GetAniListUserWatchingList(arg1:number,arg2:number,arg3:string):Promise<main.AniListCurrentUserWatchList>;
|
||||||
|
|
||||||
|
export function GetMyAnimeList(arg1:number):Promise<main.MALWatchlist>;
|
||||||
|
|
||||||
|
export function GetMyAnimeListAnime(arg1:number):Promise<main.MALAnime>;
|
||||||
|
|
||||||
|
export function GetMyAnimeListLoggedInUser():Promise<main.MyAnimeListUser>;
|
||||||
|
|
||||||
|
export function GetSimklLoggedInUser():Promise<main.SimklUser>;
|
||||||
|
|
||||||
|
export function LogoutAniList():Promise<string>;
|
||||||
|
|
||||||
|
export function LogoutMyAnimeList():Promise<string>;
|
||||||
|
|
||||||
|
export function LogoutSimkl():Promise<string>;
|
||||||
|
|
||||||
|
export function MyAnimeListLogin():Promise<void>;
|
||||||
|
|
||||||
|
export function MyAnimeListUpdate(arg1:main.MALAnime,arg2:main.MALUploadStatus):Promise<main.MalListStatus>;
|
||||||
|
|
||||||
|
export function SimklGetUserWatchlist():Promise<main.SimklWatchListType>;
|
||||||
|
|
||||||
|
export function SimklLogin():Promise<void>;
|
||||||
|
|
||||||
|
export function SimklSearch(arg1:main.MediaList):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
|
export function SimklSyncEpisodes(arg1:main.SimklAnime,arg2:number):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
|
export function SimklSyncRating(arg1:main.SimklAnime,arg2:number):Promise<main.SimklAnime>;
|
||||||
|
|
||||||
|
export function SimklSyncRemove(arg1:main.SimklAnime):Promise<boolean>;
|
||||||
|
|
||||||
|
export function SimklSyncStatus(arg1:main.SimklAnime,arg2:string):Promise<main.SimklAnime>;
|
||||||
|
@ -2,6 +2,110 @@
|
|||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
// This file is automatically generated. DO NOT EDIT
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
export function Greet(arg1) {
|
export function AniListDeleteEntry(arg1) {
|
||||||
return window['go']['main']['App']['Greet'](arg1);
|
return window['go']['main']['App']['AniListDeleteEntry'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AniListLogin() {
|
||||||
|
return window['go']['main']['App']['AniListLogin']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AniListSearch(arg1) {
|
||||||
|
return window['go']['main']['App']['AniListSearch'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AniListUpdateEntry(arg1) {
|
||||||
|
return window['go']['main']['App']['AniListUpdateEntry'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CheckIfAniListLoggedIn() {
|
||||||
|
return window['go']['main']['App']['CheckIfAniListLoggedIn']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CheckIfMyAnimeListLoggedIn() {
|
||||||
|
return window['go']['main']['App']['CheckIfMyAnimeListLoggedIn']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CheckIfSimklLoggedIn() {
|
||||||
|
return window['go']['main']['App']['CheckIfSimklLoggedIn']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DeleteMyAnimeListEntry(arg1) {
|
||||||
|
return window['go']['main']['App']['DeleteMyAnimeListEntry'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetAniListItem(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['GetAniListItem'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetAniListLoggedInUser() {
|
||||||
|
return window['go']['main']['App']['GetAniListLoggedInUser']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetAniListUserWatchingList(arg1, arg2, arg3) {
|
||||||
|
return window['go']['main']['App']['GetAniListUserWatchingList'](arg1, arg2, arg3);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetMyAnimeList(arg1) {
|
||||||
|
return window['go']['main']['App']['GetMyAnimeList'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetMyAnimeListAnime(arg1) {
|
||||||
|
return window['go']['main']['App']['GetMyAnimeListAnime'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetMyAnimeListLoggedInUser() {
|
||||||
|
return window['go']['main']['App']['GetMyAnimeListLoggedInUser']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetSimklLoggedInUser() {
|
||||||
|
return window['go']['main']['App']['GetSimklLoggedInUser']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogoutAniList() {
|
||||||
|
return window['go']['main']['App']['LogoutAniList']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogoutMyAnimeList() {
|
||||||
|
return window['go']['main']['App']['LogoutMyAnimeList']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogoutSimkl() {
|
||||||
|
return window['go']['main']['App']['LogoutSimkl']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MyAnimeListLogin() {
|
||||||
|
return window['go']['main']['App']['MyAnimeListLogin']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MyAnimeListUpdate(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['MyAnimeListUpdate'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklGetUserWatchlist() {
|
||||||
|
return window['go']['main']['App']['SimklGetUserWatchlist']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklLogin() {
|
||||||
|
return window['go']['main']['App']['SimklLogin']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklSearch(arg1) {
|
||||||
|
return window['go']['main']['App']['SimklSearch'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklSyncEpisodes(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['SimklSyncEpisodes'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklSyncRating(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['SimklSyncRating'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklSyncRemove(arg1) {
|
||||||
|
return window['go']['main']['App']['SimklSyncRemove'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SimklSyncStatus(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['SimklSyncStatus'](arg1, arg2);
|
||||||
}
|
}
|
||||||
|
655
frontend/wailsjs/go/models.ts
Executable file
@ -0,0 +1,655 @@
|
|||||||
|
export namespace main {
|
||||||
|
|
||||||
|
export class AniListCurrentUserWatchList {
|
||||||
|
data: struct { Page struct { PageInfo struct { Total int "json:\"total\""; PerPage int "json:\"perPage\""; CurrentPage int "json:\"currentPage\""; LastPage int "json:\"lastPage\""; HasNextPage bool "json:\"hasNextPage\"" } "json:\"pageInfo\""; MediaList []main.;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new AniListCurrentUserWatchList(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.data = this.convertValues(source["data"], Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class AniListGetSingleAnime {
|
||||||
|
data: struct { MediaList main.;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new AniListGetSingleAnime(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.data = this.convertValues(source["data"], Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class CompletedAt {
|
||||||
|
year: number;
|
||||||
|
month: number;
|
||||||
|
day: number;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new CompletedAt(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.year = source["year"];
|
||||||
|
this.month = source["month"];
|
||||||
|
this.day = source["day"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class StartedAt {
|
||||||
|
year: number;
|
||||||
|
month: number;
|
||||||
|
day: number;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new StartedAt(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.year = source["year"];
|
||||||
|
this.month = source["month"];
|
||||||
|
this.day = source["day"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class AniListUpdateVariables {
|
||||||
|
mediaId: number;
|
||||||
|
progress: number;
|
||||||
|
status: string;
|
||||||
|
score: number;
|
||||||
|
repeat: number;
|
||||||
|
notes: string;
|
||||||
|
startedAt: StartedAt;
|
||||||
|
completedAt: CompletedAt;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new AniListUpdateVariables(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.mediaId = source["mediaId"];
|
||||||
|
this.progress = source["progress"];
|
||||||
|
this.status = source["status"];
|
||||||
|
this.score = source["score"];
|
||||||
|
this.repeat = source["repeat"];
|
||||||
|
this.notes = source["notes"];
|
||||||
|
this.startedAt = this.convertValues(source["startedAt"], StartedAt);
|
||||||
|
this.completedAt = this.convertValues(source["completedAt"], CompletedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class AniListUser {
|
||||||
|
// Go type: struct { Viewer struct { ID int "json:\"id\""; Name string "json:\"name\""; Avatar struct { Large string "json:\"large\""; Medium string "json:\"medium\"" } "json:\"avatar\""; BannerImage string "json:\"bannerImage\""; SiteUrl string "json:\"siteUrl\"" } "json:\"Viewer\"" }
|
||||||
|
data: any;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new AniListUser(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.data = this.convertValues(source["data"], Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DeleteAniListReturn {
|
||||||
|
// Go type: struct { DeleteMediaListEntry struct { Deleted bool "json:\"deleted\"" } "json:\"DeleteMediaListEntry\"" }
|
||||||
|
data: any;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new DeleteAniListReturn(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.data = this.convertValues(source["data"], Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MALAnime {
|
||||||
|
id: id;
|
||||||
|
title: title;
|
||||||
|
main_picture: mainPicture;
|
||||||
|
alternative_titles: alternativeTitles;
|
||||||
|
start_date: startDate;
|
||||||
|
end_date: endDate;
|
||||||
|
synopsis: synopsis;
|
||||||
|
mean: mean;
|
||||||
|
rank: rank;
|
||||||
|
popularity: popularity;
|
||||||
|
num_list_users: numListUsers;
|
||||||
|
num_scoring_users: numScoringUsers;
|
||||||
|
nsfw: nsfw;
|
||||||
|
genres: genres;
|
||||||
|
created_at: createdAt;
|
||||||
|
updated_at: updatedAt;
|
||||||
|
media_type: mediaType;
|
||||||
|
status: status;
|
||||||
|
my_list_status: MalListStatus;
|
||||||
|
num_episodes: numEpisodes;
|
||||||
|
start_season: startSeason;
|
||||||
|
broadcast: broadcast;
|
||||||
|
source: source;
|
||||||
|
average_episode_duration: averageEpisodeDuration;
|
||||||
|
rating: rating;
|
||||||
|
studios: studios;
|
||||||
|
pictures: pictures;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.title = source["title"];
|
||||||
|
this.main_picture = source["main_picture"];
|
||||||
|
this.alternative_titles = source["alternative_titles"];
|
||||||
|
this.start_date = source["start_date"];
|
||||||
|
this.end_date = source["end_date"];
|
||||||
|
this.synopsis = source["synopsis"];
|
||||||
|
this.mean = source["mean"];
|
||||||
|
this.rank = source["rank"];
|
||||||
|
this.popularity = source["popularity"];
|
||||||
|
this.num_list_users = source["num_list_users"];
|
||||||
|
this.num_scoring_users = source["num_scoring_users"];
|
||||||
|
this.nsfw = source["nsfw"];
|
||||||
|
this.genres = source["genres"];
|
||||||
|
this.created_at = source["created_at"];
|
||||||
|
this.updated_at = source["updated_at"];
|
||||||
|
this.media_type = source["media_type"];
|
||||||
|
this.status = source["status"];
|
||||||
|
this.my_list_status = source["my_list_status"];
|
||||||
|
this.num_episodes = source["num_episodes"];
|
||||||
|
this.start_season = source["start_season"];
|
||||||
|
this.broadcast = source["broadcast"];
|
||||||
|
this.source = source["source"];
|
||||||
|
this.average_episode_duration = source["average_episode_duration"];
|
||||||
|
this.rating = source["rating"];
|
||||||
|
this.studios = source["studios"];
|
||||||
|
this.pictures = source["pictures"];
|
||||||
|
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 {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MALUploadStatus {
|
||||||
|
status: string;
|
||||||
|
is_rewatching: boolean;
|
||||||
|
score: number;
|
||||||
|
num_watched_episodes: number;
|
||||||
|
num_times_rewatched: number;
|
||||||
|
comments: string;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MALUploadStatus(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.status = source["status"];
|
||||||
|
this.is_rewatching = source["is_rewatching"];
|
||||||
|
this.score = source["score"];
|
||||||
|
this.num_watched_episodes = source["num_watched_episodes"];
|
||||||
|
this.num_times_rewatched = source["num_times_rewatched"];
|
||||||
|
this.comments = source["comments"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MALWatchlist {
|
||||||
|
data: data;
|
||||||
|
paging: paging;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MALWatchlist(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.data = source["data"];
|
||||||
|
this.paging = source["paging"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MalListStatus {
|
||||||
|
status: status;
|
||||||
|
score: score;
|
||||||
|
num_episodes_watched: numEpisodesWatched;
|
||||||
|
is_rewatching: isRewatching;
|
||||||
|
start_date: startDate;
|
||||||
|
finish_date: finishDate;
|
||||||
|
priority: priority;
|
||||||
|
num_times_rewatched: numTimesRewatched;
|
||||||
|
rewatch_value: rewatchValue;
|
||||||
|
tags: tags;
|
||||||
|
comments: comments;
|
||||||
|
updated_at: updatedAt;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MalListStatus(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.status = source["status"];
|
||||||
|
this.score = source["score"];
|
||||||
|
this.num_episodes_watched = source["num_episodes_watched"];
|
||||||
|
this.is_rewatching = source["is_rewatching"];
|
||||||
|
this.start_date = source["start_date"];
|
||||||
|
this.finish_date = source["finish_date"];
|
||||||
|
this.priority = source["priority"];
|
||||||
|
this.num_times_rewatched = source["num_times_rewatched"];
|
||||||
|
this.rewatch_value = source["rewatch_value"];
|
||||||
|
this.tags = source["tags"];
|
||||||
|
this.comments = source["comments"];
|
||||||
|
this.updated_at = source["updated_at"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MediaList {
|
||||||
|
id: number;
|
||||||
|
mediaId: number;
|
||||||
|
userId: number;
|
||||||
|
// Go type: struct { ID int "json:\"id\""; IDMal int "json:\"idMal\""; Title struct { Romaji string "json:\"romaji\""; English string "json:\"english\""; Native string "json:\"native\"" } "json:\"title\""; Description string "json:\"description\""; CoverImage struct { Large string "json:\"large\"" } "json:\"coverImage\""; Season string "json:\"season\""; SeasonYear int "json:\"seasonYear\""; Status string "json:\"status\""; Episodes int "json:\"episodes\""; NextAiringEpisode struct { AiringAt int "json:\"airingAt\""; TimeUntilAiring int "json:\"timeUntilAiring\""; Episode int "json:\"episode\"" } "json:\"nextAiringEpisode\""; Tags []struct { Id int "json:\"id\""; Name string "json:\"name\""; Description string "json:\"description\""; Rank int "json:\"rank\""; IsMediaSpoiler bool "json:\"isMediaSpoiler\""; IsAdult bool "json:\"isAdult\"" } "json:\"tags\""; IsAdult bool "json:\"isAdult\"" }
|
||||||
|
media: any;
|
||||||
|
status: string;
|
||||||
|
// Go type: struct { Year int "json:\"year\""; Month int "json:\"month\""; Day int "json:\"day\"" }
|
||||||
|
startedAt: any;
|
||||||
|
// Go type: struct { Year int "json:\"year\""; Month int "json:\"month\""; Day int "json:\"day\"" }
|
||||||
|
completedAt: any;
|
||||||
|
notes: string;
|
||||||
|
progress: number;
|
||||||
|
score: number;
|
||||||
|
repeat: number;
|
||||||
|
// Go type: struct { ID int "json:\"id\""; Name string "json:\"name\""; Avatar struct { Large string "json:\"large\""; Medium string "json:\"medium\"" } "json:\"avatar\""; Statistics struct { Anime struct { Count int "json:\"count\""; Statuses []struct { Status string "json:\"status\""; Count int "json:\"count\"" } "json:\"statuses\"" } "json:\"anime\"" } "json:\"statistics\"" }
|
||||||
|
user: any;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MediaList(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.mediaId = source["mediaId"];
|
||||||
|
this.userId = source["userId"];
|
||||||
|
this.media = this.convertValues(source["media"], Object);
|
||||||
|
this.status = source["status"];
|
||||||
|
this.startedAt = this.convertValues(source["startedAt"], Object);
|
||||||
|
this.completedAt = this.convertValues(source["completedAt"], Object);
|
||||||
|
this.notes = source["notes"];
|
||||||
|
this.progress = source["progress"];
|
||||||
|
this.score = source["score"];
|
||||||
|
this.repeat = source["repeat"];
|
||||||
|
this.user = this.convertValues(source["user"], Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MyAnimeListUser {
|
||||||
|
id: id;
|
||||||
|
name: name;
|
||||||
|
picture: picture;
|
||||||
|
gender: gender;
|
||||||
|
birthday: birthday;
|
||||||
|
location: location;
|
||||||
|
joined_at: joinedAt;
|
||||||
|
num_items_watching: numItemsWatching;
|
||||||
|
num_items_completed: numItemsCompleted;
|
||||||
|
num_items_on_hold: numItemsOnHold;
|
||||||
|
num_items_dropped: numItemsDropped;
|
||||||
|
num_items_plan_to_watch: numItemsPlanToWatch;
|
||||||
|
num_items: numItems;
|
||||||
|
num_days_watched: numDaysWatched;
|
||||||
|
num_days_watching: numDaysWatching;
|
||||||
|
num_days_completed: numDaysCompleted;
|
||||||
|
num_days_on_hold: numDaysOnHold;
|
||||||
|
num_days_dropped: numDaysDropped;
|
||||||
|
num_days: numDays;
|
||||||
|
num_episodes: numEpisodes;
|
||||||
|
num_times_rewatched: numTimesRewatched;
|
||||||
|
mean_score: meanScore;
|
||||||
|
time_zone: timeZone;
|
||||||
|
is_supporter: isSupporter;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new MyAnimeListUser(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.name = source["name"];
|
||||||
|
this.picture = source["picture"];
|
||||||
|
this.gender = source["gender"];
|
||||||
|
this.birthday = source["birthday"];
|
||||||
|
this.location = source["location"];
|
||||||
|
this.joined_at = source["joined_at"];
|
||||||
|
this.num_items_watching = source["num_items_watching"];
|
||||||
|
this.num_items_completed = source["num_items_completed"];
|
||||||
|
this.num_items_on_hold = source["num_items_on_hold"];
|
||||||
|
this.num_items_dropped = source["num_items_dropped"];
|
||||||
|
this.num_items_plan_to_watch = source["num_items_plan_to_watch"];
|
||||||
|
this.num_items = source["num_items"];
|
||||||
|
this.num_days_watched = source["num_days_watched"];
|
||||||
|
this.num_days_watching = source["num_days_watching"];
|
||||||
|
this.num_days_completed = source["num_days_completed"];
|
||||||
|
this.num_days_on_hold = source["num_days_on_hold"];
|
||||||
|
this.num_days_dropped = source["num_days_dropped"];
|
||||||
|
this.num_days = source["num_days"];
|
||||||
|
this.num_episodes = source["num_episodes"];
|
||||||
|
this.num_times_rewatched = source["num_times_rewatched"];
|
||||||
|
this.mean_score = source["mean_score"];
|
||||||
|
this.time_zone = source["time_zone"];
|
||||||
|
this.is_supporter = source["is_supporter"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class SimklAnime {
|
||||||
|
last_watched_at: last_watched_at;
|
||||||
|
status: status;
|
||||||
|
user_rating: user_rating;
|
||||||
|
last_watched: last_watched;
|
||||||
|
next_to_watch: next_to_watch;
|
||||||
|
watched_episodes_count: watched_episodes_count;
|
||||||
|
total_episodes_count: total_episodes_count;
|
||||||
|
not_aired_episodes_count: not_aired_episodes_count;
|
||||||
|
show: show;
|
||||||
|
anime_type: anime_type;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new SimklAnime(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.last_watched_at = source["last_watched_at"];
|
||||||
|
this.status = source["status"];
|
||||||
|
this.user_rating = source["user_rating"];
|
||||||
|
this.last_watched = source["last_watched"];
|
||||||
|
this.next_to_watch = source["next_to_watch"];
|
||||||
|
this.watched_episodes_count = source["watched_episodes_count"];
|
||||||
|
this.total_episodes_count = source["total_episodes_count"];
|
||||||
|
this.not_aired_episodes_count = source["not_aired_episodes_count"];
|
||||||
|
this.show = source["show"];
|
||||||
|
this.anime_type = source["anime_type"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class SimklUser {
|
||||||
|
user: user;
|
||||||
|
account: account;
|
||||||
|
connections: connections;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new SimklUser(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.user = source["user"];
|
||||||
|
this.account = source["account"];
|
||||||
|
this.connections = source["connections"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class SimklWatchListType {
|
||||||
|
anime: anime;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new SimklWatchListType(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.anime = source["anime"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace struct { MediaList main {
|
||||||
|
|
||||||
|
export class {
|
||||||
|
MediaList: main.MediaList;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.MediaList = this.convertValues(source["MediaList"], main.MediaList);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
if (!a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
if (a.slice && a.map) {
|
||||||
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||||
|
} else if ("object" === typeof a) {
|
||||||
|
if (asMap) {
|
||||||
|
for (const key of Object.keys(a)) {
|
||||||
|
a[key] = new classs(a[key]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return new classs(a);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace struct { Node main {
|
||||||
|
|
||||||
|
export class {
|
||||||
|
node: node;
|
||||||
|
num_recommendations: numRecommendations;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.node = source["node"];
|
||||||
|
this.num_recommendations = source["num_recommendations"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class {
|
||||||
|
node: node;
|
||||||
|
relation_type: relationType;
|
||||||
|
relation_type_formatted: relationTypeFormatted;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.node = source["node"];
|
||||||
|
this.relation_type = source["relation_type"];
|
||||||
|
this.relation_type_formatted = source["relation_type_formatted"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace struct { Node struct { Id int "json:\"id\" ts_type:\"id\""; Title string "json:\"title\" ts_type:\"title\""; MainPicture struct { Medium string "json:\"medium\" ts_type:\"medium\""; Large string "json:\"large\" ts_type:\"large\"" } "json:\"main_picture\" ts_type:\"mainPicture\"" } "json:\"node\" ts_type:\"node\""; ListStatus struct { Status string "json:\"status\" ts_type:\"status\""; Score int "json:\"score\" ts_type:\"score\""; NumEpisodesWatched int "json:\"num_episodes_watched\" ts_type:\"numEpisodesWatched\""; IsRewatching bool "json:\"is_rewatching\" ts_type:\"isRewatching\""; UpdatedAt time {
|
||||||
|
|
||||||
|
export class {
|
||||||
|
node: node;
|
||||||
|
list_status: listStatus;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.node = source["node"];
|
||||||
|
this.list_status = source["list_status"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace struct { Status string "json:\"status\" ts_type:\"status\""; Score int "json:\"score\" ts_type:\"score\""; NumEpisodesWatched int "json:\"num_episodes_watched\" ts_type:\"numEpisodesWatched\""; IsRewatching bool "json:\"is_rewatching\" ts_type:\"isRewatching\""; UpdatedAt time {
|
||||||
|
|
||||||
|
export class {
|
||||||
|
status: status;
|
||||||
|
score: score;
|
||||||
|
num_episodes_watched: numEpisodesWatched;
|
||||||
|
is_rewatching: isRewatching;
|
||||||
|
updated_at: updatedAt;
|
||||||
|
start_date: startDate;
|
||||||
|
finish_date: finishDate;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.status = source["status"];
|
||||||
|
this.score = source["score"];
|
||||||
|
this.num_episodes_watched = source["num_episodes_watched"];
|
||||||
|
this.is_rewatching = source["is_rewatching"];
|
||||||
|
this.updated_at = source["updated_at"];
|
||||||
|
this.start_date = source["start_date"];
|
||||||
|
this.finish_date = source["finish_date"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
58
go.mod
@ -1,39 +1,49 @@
|
|||||||
module AniTrack
|
module AniTrack
|
||||||
|
|
||||||
go 1.21
|
go 1.23
|
||||||
|
|
||||||
toolchain go1.21.11
|
|
||||||
|
|
||||||
require github.com/wailsapp/wails/v2 v2.9.1
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/99designs/keyring v1.2.2
|
||||||
|
github.com/tidwall/gjson v1.18.0
|
||||||
|
github.com/wailsapp/wails/v2 v2.9.2
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
|
||||||
github.com/bep/debounce v1.2.1 // indirect
|
github.com/bep/debounce v1.2.1 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/danieljoos/wincred v1.2.2 // indirect
|
||||||
|
github.com/dvsekhvalnov/jose2go v1.8.0 // indirect
|
||||||
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
|
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
|
||||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||||
github.com/labstack/echo/v4 v4.10.2 // indirect
|
github.com/labstack/echo/v4 v4.13.3 // indirect
|
||||||
github.com/labstack/gommon v0.4.0 // indirect
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
|
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||||
github.com/leaanthony/gosod v1.0.3 // indirect
|
github.com/leaanthony/gosod v1.0.4 // indirect
|
||||||
github.com/leaanthony/slicer v1.6.0 // indirect
|
github.com/leaanthony/slicer v1.6.0 // indirect
|
||||||
github.com/leaanthony/u v1.1.0 // indirect
|
github.com/leaanthony/u v1.1.1 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
github.com/mtibben/percent v0.2.1 // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/rivo/uniseg v0.4.4 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/samber/lo v1.38.1 // indirect
|
github.com/samber/lo v1.47.0 // indirect
|
||||||
github.com/tkrajina/go-reflector v0.5.6 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
|
github.com/tidwall/pretty v1.2.1 // indirect
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
github.com/wailsapp/go-webview2 v1.0.10 // indirect
|
github.com/wailsapp/go-webview2 v1.0.19 // indirect
|
||||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||||
golang.org/x/crypto v0.23.0 // indirect
|
golang.org/x/crypto v0.32.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
|
golang.org/x/net v0.34.0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/sys v0.29.0 // indirect
|
||||||
golang.org/x/sys v0.20.0 // indirect
|
golang.org/x/term v0.28.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/text v0.21.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace github.com/wailsapp/wails/v2 v2.9.1 => /home/nymusicman/go/pkg/mod
|
// replace github.com/wailsapp/wails/v2 v2.9.1 => /home/nymusicman/go/pkg/mod
|
||||||
|
135
go.sum
@ -1,94 +1,109 @@
|
|||||||
|
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||||
|
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
|
||||||
|
github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0=
|
||||||
|
github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk=
|
||||||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=
|
||||||
|
github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
github.com/dvsekhvalnov/jose2go v1.8.0 h1:LqkkVKAlHFfH9LOEl5fe4p/zL02OhWE7pCufMBG2jLA=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/dvsekhvalnov/jose2go v1.8.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
|
||||||
|
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||||
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
|
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
|
||||||
|
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
|
||||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
|
||||||
|
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||||
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
|
||||||
|
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
|
||||||
|
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||||
|
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||||
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
||||||
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.0 h1:T8TuMhFB6TUMIUm0oRrSbgJudTFw9csT3ZK09w0t4Pg=
|
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.0/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
||||||
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
|
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
|
||||||
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
|
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
|
||||||
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
|
|
||||||
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
|
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
|
||||||
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
|
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
|
||||||
github.com/leaanthony/u v1.1.0 h1:2n0d2BwPVXSUq5yhe8lJPHdxevE2qK5G99PMStMZMaI=
|
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
|
||||||
github.com/leaanthony/u v1.1.0/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
||||||
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
|
|
||||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs=
|
||||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
|
github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns=
|
||||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
|
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
|
||||||
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
|
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
|
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||||
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||||
|
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||||
|
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||||
|
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||||
|
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||||
|
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
|
||||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
github.com/wailsapp/go-webview2 v1.0.10 h1:PP5Hug6pnQEAhfRzLCoOh2jJaPdrqeRgJKZhyYyDV/w=
|
github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyTImA6NU=
|
||||||
github.com/wailsapp/go-webview2 v1.0.10/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||||
github.com/wailsapp/wails/v2 v2.9.1 h1:irsXnoQrCpeKzKTYZ2SUVlRRyeMR6I0vCO9Q1cvlEdc=
|
github.com/wailsapp/wails/v2 v2.9.2 h1:Xb5YRTos1w5N7DTMyYegWaGukCP2fIaX9WF21kPPF2k=
|
||||||
github.com/wailsapp/wails/v2 v2.9.1/go.mod h1:7maJV2h+Egl11Ak8QZN/jlGLj2wg05bsQS+ywJPT0gI=
|
github.com/wailsapp/wails/v2 v2.9.2/go.mod h1:uehvlCwJSFcBq7rMCGfk4rxca67QQGsbg5Nm4m9UnBs=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
|
|
||||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
|
|
||||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
|
||||||
|
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
12
main.go
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2"
|
"github.com/wailsapp/wails/v2"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/options/linux"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed all:frontend/dist
|
//go:embed all:frontend/dist
|
||||||
@ -25,11 +26,20 @@ func main() {
|
|||||||
},
|
},
|
||||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
|
SingleInstanceLock: &options.SingleInstanceLock{
|
||||||
|
UniqueId: "49c93b6d-663d-4b7a-9cb0-8a469ea9182b",
|
||||||
|
OnSecondInstanceLaunch: app.onSecondInstanceLaunch,
|
||||||
|
},
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
app,
|
app,
|
||||||
},
|
},
|
||||||
|
Linux: &linux.Options{
|
||||||
|
Icon: []byte("./build/AniTrack.png"),
|
||||||
|
WindowIsTranslucent: false,
|
||||||
|
WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
|
||||||
|
ProgramName: "AniTrack",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println("Error:", err.Error())
|
println("Error:", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,9 @@
|
|||||||
"author": {
|
"author": {
|
||||||
"name": "John O'Keefe",
|
"name": "John O'Keefe",
|
||||||
"email": "jokeefe@fastmail.com"
|
"email": "jokeefe@fastmail.com"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"productName": "AniTrack",
|
||||||
|
"productVersion": "0.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|