@irfanshadikrishad/anilist 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -373
- package/bin/helpers/auth.js +32 -30
- package/bin/helpers/mutations.js +31 -31
- package/bin/helpers/queries.js +149 -149
- package/bin/helpers/truncate.js +1 -0
- package/bin/helpers/workers.js +66 -66
- package/package.json +2 -1
package/bin/helpers/auth.js
CHANGED
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { Cipher } from "@irfanshadikrishad/cipher";
|
|
10
11
|
import fs from "fs";
|
|
11
12
|
import inquirer from "inquirer";
|
|
12
13
|
import fetch from "node-fetch";
|
|
@@ -21,8 +22,9 @@ import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activ
|
|
|
21
22
|
import { responsiveOutput } from "./truncate.js";
|
|
22
23
|
import { aniListEndpoint, getTitle, redirectUri, timestampToTimeAgo, } from "./workers.js";
|
|
23
24
|
const home_dir = os.homedir();
|
|
24
|
-
const save_path = path.join(home_dir, ".
|
|
25
|
+
const save_path = path.join(home_dir, ".anilist_tok3n");
|
|
25
26
|
const spinner = new Spinner();
|
|
27
|
+
const vigenere = new Cipher.Vigenere("anilist");
|
|
26
28
|
class Auth {
|
|
27
29
|
/**
|
|
28
30
|
* Get access-token from user
|
|
@@ -56,7 +58,7 @@ class Auth {
|
|
|
56
58
|
console.warn("\nNo token provided. Nothing to store.");
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
|
-
fs.writeFileSync(save_path, token, { encoding: "utf8" });
|
|
61
|
+
fs.writeFileSync(save_path, vigenere.encrypt(token), { encoding: "utf8" });
|
|
60
62
|
}
|
|
61
63
|
catch (error) {
|
|
62
64
|
console.error(`\nError storing access token: ${error.message}`);
|
|
@@ -67,7 +69,7 @@ class Auth {
|
|
|
67
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
70
|
try {
|
|
69
71
|
if (fs.existsSync(save_path)) {
|
|
70
|
-
return fs.readFileSync(save_path, { encoding: "utf8" });
|
|
72
|
+
return vigenere.decrypt(fs.readFileSync(save_path, { encoding: "utf8" }));
|
|
71
73
|
}
|
|
72
74
|
else {
|
|
73
75
|
return null;
|
|
@@ -152,33 +154,33 @@ class Auth {
|
|
|
152
154
|
});
|
|
153
155
|
const followersCount = ((_e = (_d = (_c = req_followers === null || req_followers === void 0 ? void 0 : req_followers.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.pageInfo) === null || _e === void 0 ? void 0 : _e.total) || 0;
|
|
154
156
|
const followingCount = ((_h = (_g = (_f = req_following === null || req_following === void 0 ? void 0 : req_following.data) === null || _f === void 0 ? void 0 : _f.Page) === null || _g === void 0 ? void 0 : _g.pageInfo) === null || _h === void 0 ? void 0 : _h.total) || 0;
|
|
155
|
-
console.log(`
|
|
156
|
-
ID: ${user === null || user === void 0 ? void 0 : user.id}
|
|
157
|
-
Name: ${user === null || user === void 0 ? void 0 : user.name}
|
|
158
|
-
siteUrl: ${user === null || user === void 0 ? void 0 : user.siteUrl}
|
|
159
|
-
profileColor: ${(_j = user === null || user === void 0 ? void 0 : user.options) === null || _j === void 0 ? void 0 : _j.profileColor}
|
|
160
|
-
timeZone: ${(_k = user === null || user === void 0 ? void 0 : user.options) === null || _k === void 0 ? void 0 : _k.timezone}
|
|
161
|
-
activityMergeTime: ${(_l = user === null || user === void 0 ? void 0 : user.options) === null || _l === void 0 ? void 0 : _l.activityMergeTime}
|
|
162
|
-
donatorTier: ${user === null || user === void 0 ? void 0 : user.donatorTier}
|
|
163
|
-
donatorBadge: ${user === null || user === void 0 ? void 0 : user.donatorBadge}
|
|
164
|
-
unreadNotificationCount:${user === null || user === void 0 ? void 0 : user.unreadNotificationCount}
|
|
165
|
-
Account Created: ${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}
|
|
166
|
-
Account Updated: ${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}
|
|
167
|
-
|
|
168
|
-
Followers: ${followersCount}
|
|
169
|
-
Following: ${followingCount}
|
|
170
|
-
|
|
171
|
-
Statistics (Anime):
|
|
172
|
-
Count: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.anime) === null || _o === void 0 ? void 0 : _o.count}
|
|
173
|
-
Mean Score: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.anime) === null || _q === void 0 ? void 0 : _q.meanScore}
|
|
174
|
-
Minutes Watched: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.anime) === null || _s === void 0 ? void 0 : _s.minutesWatched}
|
|
175
|
-
Episodes Watched: ${(_u = (_t = user === null || user === void 0 ? void 0 : user.statistics) === null || _t === void 0 ? void 0 : _t.anime) === null || _u === void 0 ? void 0 : _u.episodesWatched}
|
|
176
|
-
|
|
177
|
-
Statistics (Manga):
|
|
178
|
-
Count: ${(_w = (_v = user === null || user === void 0 ? void 0 : user.statistics) === null || _v === void 0 ? void 0 : _v.manga) === null || _w === void 0 ? void 0 : _w.count}
|
|
179
|
-
Mean Score: ${(_y = (_x = user === null || user === void 0 ? void 0 : user.statistics) === null || _x === void 0 ? void 0 : _x.manga) === null || _y === void 0 ? void 0 : _y.meanScore}
|
|
180
|
-
Chapters Read: ${(_0 = (_z = user === null || user === void 0 ? void 0 : user.statistics) === null || _z === void 0 ? void 0 : _z.manga) === null || _0 === void 0 ? void 0 : _0.chaptersRead}
|
|
181
|
-
Volumes Read: ${(_2 = (_1 = user === null || user === void 0 ? void 0 : user.statistics) === null || _1 === void 0 ? void 0 : _1.manga) === null || _2 === void 0 ? void 0 : _2.volumesRead}
|
|
157
|
+
console.log(`
|
|
158
|
+
ID: ${user === null || user === void 0 ? void 0 : user.id}
|
|
159
|
+
Name: ${user === null || user === void 0 ? void 0 : user.name}
|
|
160
|
+
siteUrl: ${user === null || user === void 0 ? void 0 : user.siteUrl}
|
|
161
|
+
profileColor: ${(_j = user === null || user === void 0 ? void 0 : user.options) === null || _j === void 0 ? void 0 : _j.profileColor}
|
|
162
|
+
timeZone: ${(_k = user === null || user === void 0 ? void 0 : user.options) === null || _k === void 0 ? void 0 : _k.timezone}
|
|
163
|
+
activityMergeTime: ${(_l = user === null || user === void 0 ? void 0 : user.options) === null || _l === void 0 ? void 0 : _l.activityMergeTime}
|
|
164
|
+
donatorTier: ${user === null || user === void 0 ? void 0 : user.donatorTier}
|
|
165
|
+
donatorBadge: ${user === null || user === void 0 ? void 0 : user.donatorBadge}
|
|
166
|
+
unreadNotificationCount:${user === null || user === void 0 ? void 0 : user.unreadNotificationCount}
|
|
167
|
+
Account Created: ${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}
|
|
168
|
+
Account Updated: ${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}
|
|
169
|
+
|
|
170
|
+
Followers: ${followersCount}
|
|
171
|
+
Following: ${followingCount}
|
|
172
|
+
|
|
173
|
+
Statistics (Anime):
|
|
174
|
+
Count: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.anime) === null || _o === void 0 ? void 0 : _o.count}
|
|
175
|
+
Mean Score: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.anime) === null || _q === void 0 ? void 0 : _q.meanScore}
|
|
176
|
+
Minutes Watched: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.anime) === null || _s === void 0 ? void 0 : _s.minutesWatched}
|
|
177
|
+
Episodes Watched: ${(_u = (_t = user === null || user === void 0 ? void 0 : user.statistics) === null || _t === void 0 ? void 0 : _t.anime) === null || _u === void 0 ? void 0 : _u.episodesWatched}
|
|
178
|
+
|
|
179
|
+
Statistics (Manga):
|
|
180
|
+
Count: ${(_w = (_v = user === null || user === void 0 ? void 0 : user.statistics) === null || _v === void 0 ? void 0 : _v.manga) === null || _w === void 0 ? void 0 : _w.count}
|
|
181
|
+
Mean Score: ${(_y = (_x = user === null || user === void 0 ? void 0 : user.statistics) === null || _x === void 0 ? void 0 : _x.manga) === null || _y === void 0 ? void 0 : _y.meanScore}
|
|
182
|
+
Chapters Read: ${(_0 = (_z = user === null || user === void 0 ? void 0 : user.statistics) === null || _z === void 0 ? void 0 : _z.manga) === null || _0 === void 0 ? void 0 : _0.chaptersRead}
|
|
183
|
+
Volumes Read: ${(_2 = (_1 = user === null || user === void 0 ? void 0 : user.statistics) === null || _1 === void 0 ? void 0 : _1.manga) === null || _2 === void 0 ? void 0 : _2.volumesRead}
|
|
182
184
|
`);
|
|
183
185
|
console.log(`\nRecent Activities:`);
|
|
184
186
|
if (activities.length > 0) {
|
package/bin/helpers/mutations.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const addAnimeToListMutation = `
|
|
2
|
-
mutation($mediaId: Int, $status: MediaListStatus) {
|
|
3
|
-
SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
|
|
4
|
-
}
|
|
1
|
+
const addAnimeToListMutation = `
|
|
2
|
+
mutation($mediaId: Int, $status: MediaListStatus) {
|
|
3
|
+
SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
|
|
4
|
+
}
|
|
5
5
|
`;
|
|
6
|
-
const addMangaToListMutation = `
|
|
7
|
-
mutation($mediaId: Int, $status: MediaListStatus) {
|
|
8
|
-
SaveMediaListEntry(mediaId: $mediaId, status: $status) {
|
|
9
|
-
id
|
|
10
|
-
status
|
|
11
|
-
media { id title { romaji english } }
|
|
12
|
-
}
|
|
13
|
-
}
|
|
6
|
+
const addMangaToListMutation = `
|
|
7
|
+
mutation($mediaId: Int, $status: MediaListStatus) {
|
|
8
|
+
SaveMediaListEntry(mediaId: $mediaId, status: $status) {
|
|
9
|
+
id
|
|
10
|
+
status
|
|
11
|
+
media { id title { romaji english } }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
14
|
`;
|
|
15
|
-
const deleteActivityMutation = `
|
|
16
|
-
mutation($id: Int!) {
|
|
17
|
-
DeleteActivity(id: $id) { deleted }
|
|
18
|
-
}
|
|
15
|
+
const deleteActivityMutation = `
|
|
16
|
+
mutation($id: Int!) {
|
|
17
|
+
DeleteActivity(id: $id) { deleted }
|
|
18
|
+
}
|
|
19
19
|
`;
|
|
20
|
-
const saveTextActivityMutation = `
|
|
21
|
-
mutation SaveTextActivity($status: String!) {
|
|
22
|
-
SaveTextActivity(text: $status) { id text userId createdAt }
|
|
23
|
-
}
|
|
20
|
+
const saveTextActivityMutation = `
|
|
21
|
+
mutation SaveTextActivity($status: String!) {
|
|
22
|
+
SaveTextActivity(text: $status) { id text userId createdAt }
|
|
23
|
+
}
|
|
24
24
|
`;
|
|
25
|
-
const saveAnimeWithProgressMutation = `
|
|
26
|
-
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
|
|
27
|
-
SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
|
|
28
|
-
id progress hiddenFromStatusLists
|
|
29
|
-
}
|
|
30
|
-
}
|
|
25
|
+
const saveAnimeWithProgressMutation = `
|
|
26
|
+
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
|
|
27
|
+
SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
|
|
28
|
+
id progress hiddenFromStatusLists
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
31
|
`;
|
|
32
|
-
const saveMangaWithProgressMutation = `
|
|
33
|
-
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
|
|
34
|
-
SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
|
|
35
|
-
) { id progress hiddenFromStatusLists private }
|
|
36
|
-
}
|
|
32
|
+
const saveMangaWithProgressMutation = `
|
|
33
|
+
mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
|
|
34
|
+
SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
|
|
35
|
+
) { id progress hiddenFromStatusLists private }
|
|
36
|
+
}
|
|
37
37
|
`;
|
|
38
38
|
export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
|
package/bin/helpers/queries.js
CHANGED
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
const currentUserQuery = `{
|
|
2
|
-
Viewer {
|
|
3
|
-
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
|
-
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
|
|
5
|
-
moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
|
|
6
|
-
statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
|
|
7
|
-
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
8
|
-
}
|
|
9
|
-
}`;
|
|
10
|
-
const trendingQuery = `query ($page: Int, $perPage: Int) {
|
|
11
|
-
Page(page: $page, perPage: $perPage) {
|
|
12
|
-
media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
|
|
13
|
-
}
|
|
14
|
-
}`;
|
|
15
|
-
const popularQuery = `query ($page: Int, $perPage: Int) {
|
|
16
|
-
Page(page: $page, perPage: $perPage) {
|
|
17
|
-
media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
|
|
18
|
-
}
|
|
19
|
-
}`;
|
|
20
|
-
const userQuery = `query ($username: String) {
|
|
21
|
-
User(name: $username) {
|
|
22
|
-
id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
|
|
23
|
-
isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
|
|
24
|
-
statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
|
|
25
|
-
}
|
|
26
|
-
}`;
|
|
27
|
-
const currentUserAnimeList = `query ($id: Int) {
|
|
28
|
-
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
-
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
const currentUserQuery = `{
|
|
2
|
+
Viewer {
|
|
3
|
+
id name about bans siteUrl options { profileColor timezone activityMergeTime }
|
|
4
|
+
donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
|
|
5
|
+
moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
|
|
6
|
+
statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
|
|
7
|
+
mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
|
|
8
|
+
}
|
|
9
|
+
}`;
|
|
10
|
+
const trendingQuery = `query ($page: Int, $perPage: Int) {
|
|
11
|
+
Page(page: $page, perPage: $perPage) {
|
|
12
|
+
media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
|
|
13
|
+
}
|
|
14
|
+
}`;
|
|
15
|
+
const popularQuery = `query ($page: Int, $perPage: Int) {
|
|
16
|
+
Page(page: $page, perPage: $perPage) {
|
|
17
|
+
media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
|
|
18
|
+
}
|
|
19
|
+
}`;
|
|
20
|
+
const userQuery = `query ($username: String) {
|
|
21
|
+
User(name: $username) {
|
|
22
|
+
id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
|
|
23
|
+
isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
|
|
24
|
+
statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
|
|
25
|
+
}
|
|
26
|
+
}`;
|
|
27
|
+
const currentUserAnimeList = `query ($id: Int) {
|
|
28
|
+
MediaListCollection(userId: $id, type: ANIME) {
|
|
29
|
+
lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english native userPreferred } status episodes siteUrl format } } }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
`;
|
|
33
|
-
const currentUserMangaList = `query ($id: Int) {
|
|
34
|
-
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
-
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
33
|
+
const currentUserMangaList = `query ($id: Int) {
|
|
34
|
+
MediaListCollection(userId: $id, type: MANGA) {
|
|
35
|
+
lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english native userPreferred } status chapters } } }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
38
|
`;
|
|
39
|
-
const deleteMediaEntryMutation = `mutation($id: Int!) {
|
|
40
|
-
DeleteMediaListEntry(id: $id) { deleted }
|
|
41
|
-
}`;
|
|
42
|
-
const deleteMangaEntryMutation = `mutation($id: Int) {
|
|
43
|
-
DeleteMediaListEntry(id: $id) { deleted }
|
|
44
|
-
}`;
|
|
45
|
-
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
46
|
-
Page(perPage: $perPage) {
|
|
47
|
-
media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
|
|
48
|
-
id title { romaji english native userPreferred } season seasonYear startDate { year month day }
|
|
49
|
-
episodes description genres
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}`;
|
|
53
|
-
const animeDetailsQuery = `query ($id: Int) {
|
|
54
|
-
Media(id: $id) {
|
|
55
|
-
id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
|
|
56
|
-
duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
|
|
57
|
-
stats { scoreDistribution { score amount } statusDistribution { status amount } }
|
|
58
|
-
}
|
|
59
|
-
}`;
|
|
60
|
-
const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
|
|
61
|
-
Page(page: $page, perPage: $perPage) {
|
|
62
|
-
activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
|
|
63
|
-
... on ListActivity { id status progress createdAt media { id title { romaji english } } }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}`;
|
|
67
|
-
const animeSearchQuery = `query ($search: String, $perPage: Int) {
|
|
68
|
-
Page(perPage: $perPage) {
|
|
69
|
-
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
|
|
70
|
-
}
|
|
71
|
-
}`;
|
|
72
|
-
const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
73
|
-
Page(perPage: $perPage) {
|
|
74
|
-
media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
|
|
75
|
-
}
|
|
76
|
-
}`;
|
|
77
|
-
const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
78
|
-
Page(page: $page, perPage: $perPage) {
|
|
79
|
-
activities(userId: $userId, type: TEXT, sort: ID_DESC) {
|
|
80
|
-
... on TextActivity { id type text createdAt user { id name } }
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}`;
|
|
84
|
-
const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
85
|
-
Page(page: $page, perPage: $perPage) {
|
|
86
|
-
activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
|
|
87
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}`;
|
|
91
|
-
const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
92
|
-
Page(page: $page, perPage: $perPage) {
|
|
93
|
-
activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
|
|
94
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}`;
|
|
98
|
-
const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
99
|
-
Page(page: $page, perPage: $perPage) {
|
|
100
|
-
activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
|
|
101
|
-
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}`;
|
|
105
|
-
const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
106
|
-
Page(page: $page, perPage: $perPage) {
|
|
107
|
-
activities(userId: $userId, sort: ID_DESC) {
|
|
108
|
-
... on TextActivity { id type text createdAt user { id name } }
|
|
109
|
-
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
110
|
-
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}`;
|
|
114
|
-
const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
|
|
115
|
-
Page(page: $page, perPage: $perPage) {
|
|
116
|
-
pageInfo { total currentPage lastPage hasNextPage perPage }
|
|
117
|
-
activities(userId: $userId, type: $type, sort: ID_DESC) {
|
|
118
|
-
... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}`;
|
|
122
|
-
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
-
Media(idMal: $malId, type: ANIME) {
|
|
124
|
-
id title { romaji english } }
|
|
125
|
-
}
|
|
39
|
+
const deleteMediaEntryMutation = `mutation($id: Int!) {
|
|
40
|
+
DeleteMediaListEntry(id: $id) { deleted }
|
|
41
|
+
}`;
|
|
42
|
+
const deleteMangaEntryMutation = `mutation($id: Int) {
|
|
43
|
+
DeleteMediaListEntry(id: $id) { deleted }
|
|
44
|
+
}`;
|
|
45
|
+
const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
|
|
46
|
+
Page(perPage: $perPage) {
|
|
47
|
+
media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
|
|
48
|
+
id title { romaji english native userPreferred } season seasonYear startDate { year month day }
|
|
49
|
+
episodes description genres
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}`;
|
|
53
|
+
const animeDetailsQuery = `query ($id: Int) {
|
|
54
|
+
Media(id: $id) {
|
|
55
|
+
id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
|
|
56
|
+
duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
|
|
57
|
+
stats { scoreDistribution { score amount } statusDistribution { status amount } }
|
|
58
|
+
}
|
|
59
|
+
}`;
|
|
60
|
+
const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
|
|
61
|
+
Page(page: $page, perPage: $perPage) {
|
|
62
|
+
activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
|
|
63
|
+
... on ListActivity { id status progress createdAt media { id title { romaji english } } }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}`;
|
|
67
|
+
const animeSearchQuery = `query ($search: String, $perPage: Int) {
|
|
68
|
+
Page(perPage: $perPage) {
|
|
69
|
+
media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
|
|
70
|
+
}
|
|
71
|
+
}`;
|
|
72
|
+
const mangaSearchQuery = `query ($search: String, $perPage: Int) {
|
|
73
|
+
Page(perPage: $perPage) {
|
|
74
|
+
media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
|
|
75
|
+
}
|
|
76
|
+
}`;
|
|
77
|
+
const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
78
|
+
Page(page: $page, perPage: $perPage) {
|
|
79
|
+
activities(userId: $userId, type: TEXT, sort: ID_DESC) {
|
|
80
|
+
... on TextActivity { id type text createdAt user { id name } }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}`;
|
|
84
|
+
const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
85
|
+
Page(page: $page, perPage: $perPage) {
|
|
86
|
+
activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
|
|
87
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}`;
|
|
91
|
+
const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
92
|
+
Page(page: $page, perPage: $perPage) {
|
|
93
|
+
activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
|
|
94
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}`;
|
|
98
|
+
const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
99
|
+
Page(page: $page, perPage: $perPage) {
|
|
100
|
+
activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
|
|
101
|
+
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}`;
|
|
105
|
+
const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
|
|
106
|
+
Page(page: $page, perPage: $perPage) {
|
|
107
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
108
|
+
... on TextActivity { id type text createdAt user { id name } }
|
|
109
|
+
... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
|
|
110
|
+
... on MessageActivity { id type message recipient { id name } createdAt }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}`;
|
|
114
|
+
const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
|
|
115
|
+
Page(page: $page, perPage: $perPage) {
|
|
116
|
+
pageInfo { total currentPage lastPage hasNextPage perPage }
|
|
117
|
+
activities(userId: $userId, type: $type, sort: ID_DESC) {
|
|
118
|
+
... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}`;
|
|
122
|
+
const malIdToAnilistAnimeId = `query ($malId: Int) {
|
|
123
|
+
Media(idMal: $malId, type: ANIME) {
|
|
124
|
+
id title { romaji english } }
|
|
125
|
+
}
|
|
126
126
|
`;
|
|
127
|
-
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
-
Media(idMal: $malId, type: MANGA) {
|
|
129
|
-
id title { romaji english } }
|
|
130
|
-
}
|
|
127
|
+
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
+
Media(idMal: $malId, type: MANGA) {
|
|
129
|
+
id title { romaji english } }
|
|
130
|
+
}
|
|
131
131
|
`;
|
|
132
|
-
const userFollowingQuery = `query ($userId: Int!, $page: Int) {
|
|
133
|
-
Page (page: $page) {
|
|
134
|
-
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
135
|
-
following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
136
|
-
}
|
|
137
|
-
}
|
|
132
|
+
const userFollowingQuery = `query ($userId: Int!, $page: Int) {
|
|
133
|
+
Page (page: $page) {
|
|
134
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
135
|
+
following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
138
|
`;
|
|
139
|
-
const userFollowersQuery = `query ($userId: Int!, $page: Int) {
|
|
140
|
-
Page (page: $page) {
|
|
141
|
-
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
142
|
-
followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
143
|
-
}
|
|
144
|
-
}
|
|
139
|
+
const userFollowersQuery = `query ($userId: Int!, $page: Int) {
|
|
140
|
+
Page (page: $page) {
|
|
141
|
+
pageInfo { total perPage currentPage lastPage hasNextPage }
|
|
142
|
+
followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
145
|
`;
|
|
146
|
-
const toggleFollowMutation = `mutation ($userId: Int!) {
|
|
147
|
-
ToggleFollow(userId: $userId) { id name isFollower isFollowing }
|
|
148
|
-
}
|
|
146
|
+
const toggleFollowMutation = `mutation ($userId: Int!) {
|
|
147
|
+
ToggleFollow(userId: $userId) { id name isFollower isFollowing }
|
|
148
|
+
}
|
|
149
149
|
`;
|
|
150
|
-
const mangaDetailsQuery = `query ($id: Int) {
|
|
151
|
-
Media(id: $id, type: MANGA) {
|
|
152
|
-
id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
|
|
153
|
-
bannerImage description chapters volumes status genres
|
|
154
|
-
startDate { year month day } endDate { year month day }
|
|
155
|
-
}
|
|
156
|
-
}
|
|
150
|
+
const mangaDetailsQuery = `query ($id: Int) {
|
|
151
|
+
Media(id: $id, type: MANGA) {
|
|
152
|
+
id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
|
|
153
|
+
bannerImage description chapters volumes status genres
|
|
154
|
+
startDate { year month day } endDate { year month day }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
157
|
`;
|
|
158
158
|
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
|
package/bin/helpers/truncate.js
CHANGED
package/bin/helpers/workers.js
CHANGED
|
@@ -202,49 +202,49 @@ function selectFile(fileType) {
|
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
function createAnimeXML(malId, progress, status, episodes, title, format) {
|
|
205
|
-
return `
|
|
206
|
-
<anime>
|
|
207
|
-
<series_animedb_id>${malId}</series_animedb_id>
|
|
208
|
-
<series_title><![CDATA[${title}]]></series_title>
|
|
209
|
-
<series_type>${format}</series_type>
|
|
210
|
-
<series_episodes>${episodes}</series_episodes>
|
|
211
|
-
<my_id>0</my_id>
|
|
212
|
-
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
213
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
214
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
215
|
-
<my_score>0</my_score>
|
|
216
|
-
<my_storage_value>0.00</my_storage_value>
|
|
217
|
-
<my_status>${status}</my_status>
|
|
218
|
-
<my_comments><![CDATA[]]></my_comments>
|
|
219
|
-
<my_times_watched>0</my_times_watched>
|
|
220
|
-
<my_rewatch_value></my_rewatch_value>
|
|
221
|
-
<my_priority>LOW</my_priority>
|
|
222
|
-
<my_tags><![CDATA[]]></my_tags>
|
|
223
|
-
<my_rewatching>0</my_rewatching>
|
|
224
|
-
<my_rewatching_ep>0</my_rewatching_ep>
|
|
225
|
-
<my_discuss>0</my_discuss>
|
|
226
|
-
<my_sns>default</my_sns>
|
|
227
|
-
<update_on_import>1</update_on_import>
|
|
205
|
+
return `
|
|
206
|
+
<anime>
|
|
207
|
+
<series_animedb_id>${malId}</series_animedb_id>
|
|
208
|
+
<series_title><![CDATA[${title}]]></series_title>
|
|
209
|
+
<series_type>${format}</series_type>
|
|
210
|
+
<series_episodes>${episodes}</series_episodes>
|
|
211
|
+
<my_id>0</my_id>
|
|
212
|
+
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
213
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
214
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
215
|
+
<my_score>0</my_score>
|
|
216
|
+
<my_storage_value>0.00</my_storage_value>
|
|
217
|
+
<my_status>${status}</my_status>
|
|
218
|
+
<my_comments><![CDATA[]]></my_comments>
|
|
219
|
+
<my_times_watched>0</my_times_watched>
|
|
220
|
+
<my_rewatch_value></my_rewatch_value>
|
|
221
|
+
<my_priority>LOW</my_priority>
|
|
222
|
+
<my_tags><![CDATA[]]></my_tags>
|
|
223
|
+
<my_rewatching>0</my_rewatching>
|
|
224
|
+
<my_rewatching_ep>0</my_rewatching_ep>
|
|
225
|
+
<my_discuss>0</my_discuss>
|
|
226
|
+
<my_sns>default</my_sns>
|
|
227
|
+
<update_on_import>1</update_on_import>
|
|
228
228
|
</anime>`;
|
|
229
229
|
}
|
|
230
230
|
function createMangaXML(malId, progress, status, chapters, title) {
|
|
231
|
-
return `
|
|
232
|
-
<manga>
|
|
233
|
-
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
234
|
-
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
235
|
-
<manga_volumes>0</manga_volumes>
|
|
236
|
-
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
237
|
-
<my_id>0</my_id>
|
|
238
|
-
<my_read_chapters>${progress}</my_read_chapters>
|
|
239
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
240
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
241
|
-
<my_score>0</my_score>
|
|
242
|
-
<my_status>${status}</my_status>
|
|
243
|
-
<my_reread_value></my_reread_value>
|
|
244
|
-
<my_priority>LOW</my_priority>
|
|
245
|
-
<my_rereading>0</my_rereading>
|
|
246
|
-
<my_discuss>0</my_discuss>
|
|
247
|
-
<update_on_import>1</update_on_import>
|
|
231
|
+
return `
|
|
232
|
+
<manga>
|
|
233
|
+
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
234
|
+
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
235
|
+
<manga_volumes>0</manga_volumes>
|
|
236
|
+
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
237
|
+
<my_id>0</my_id>
|
|
238
|
+
<my_read_chapters>${progress}</my_read_chapters>
|
|
239
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
240
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
241
|
+
<my_score>0</my_score>
|
|
242
|
+
<my_status>${status}</my_status>
|
|
243
|
+
<my_reread_value></my_reread_value>
|
|
244
|
+
<my_priority>LOW</my_priority>
|
|
245
|
+
<my_rereading>0</my_rereading>
|
|
246
|
+
<my_discuss>0</my_discuss>
|
|
247
|
+
<update_on_import>1</update_on_import>
|
|
248
248
|
</manga>`;
|
|
249
249
|
}
|
|
250
250
|
function createAnimeListXML(mediaWithProgress) {
|
|
@@ -268,19 +268,19 @@ function createAnimeListXML(mediaWithProgress) {
|
|
|
268
268
|
const format = anime.format ? anime.format : "";
|
|
269
269
|
return createAnimeXML(malId, progress, status, episodes, title, format);
|
|
270
270
|
});
|
|
271
|
-
return `<myanimelist>
|
|
272
|
-
<myinfo>
|
|
273
|
-
<user_id/>
|
|
274
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
275
|
-
<user_export_type>1</user_export_type>
|
|
276
|
-
<user_total_anime>0</user_total_anime>
|
|
277
|
-
<user_total_watching>0</user_total_watching>
|
|
278
|
-
<user_total_completed>0</user_total_completed>
|
|
279
|
-
<user_total_onhold>0</user_total_onhold>
|
|
280
|
-
<user_total_dropped>0</user_total_dropped>
|
|
281
|
-
<user_total_plantowatch>0</user_total_plantowatch>
|
|
282
|
-
</myinfo>
|
|
283
|
-
\n${xmlEntries.join("\n")}\n
|
|
271
|
+
return `<myanimelist>
|
|
272
|
+
<myinfo>
|
|
273
|
+
<user_id/>
|
|
274
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
275
|
+
<user_export_type>1</user_export_type>
|
|
276
|
+
<user_total_anime>0</user_total_anime>
|
|
277
|
+
<user_total_watching>0</user_total_watching>
|
|
278
|
+
<user_total_completed>0</user_total_completed>
|
|
279
|
+
<user_total_onhold>0</user_total_onhold>
|
|
280
|
+
<user_total_dropped>0</user_total_dropped>
|
|
281
|
+
<user_total_plantowatch>0</user_total_plantowatch>
|
|
282
|
+
</myinfo>
|
|
283
|
+
\n${xmlEntries.join("\n")}\n
|
|
284
284
|
</myanimelist>`;
|
|
285
285
|
});
|
|
286
286
|
}
|
|
@@ -303,19 +303,19 @@ function createMangaListXML(mediaWithProgress) {
|
|
|
303
303
|
const status = statusMap[manga.status];
|
|
304
304
|
return createMangaXML(malId, progress, status, chapters, title);
|
|
305
305
|
});
|
|
306
|
-
return `<myanimelist>
|
|
307
|
-
<myinfo>
|
|
308
|
-
<user_id/>
|
|
309
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
310
|
-
<user_export_type>2</user_export_type>
|
|
311
|
-
<user_total_manga>5</user_total_manga>
|
|
312
|
-
<user_total_reading>1</user_total_reading>
|
|
313
|
-
<user_total_completed>1</user_total_completed>
|
|
314
|
-
<user_total_onhold>1</user_total_onhold>
|
|
315
|
-
<user_total_dropped>1</user_total_dropped>
|
|
316
|
-
<user_total_plantoread>1</user_total_plantoread>
|
|
317
|
-
</myinfo>
|
|
318
|
-
\n${xmlEntries.join("\n")}\n
|
|
306
|
+
return `<myanimelist>
|
|
307
|
+
<myinfo>
|
|
308
|
+
<user_id/>
|
|
309
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
310
|
+
<user_export_type>2</user_export_type>
|
|
311
|
+
<user_total_manga>5</user_total_manga>
|
|
312
|
+
<user_total_reading>1</user_total_reading>
|
|
313
|
+
<user_total_completed>1</user_total_completed>
|
|
314
|
+
<user_total_onhold>1</user_total_onhold>
|
|
315
|
+
<user_total_dropped>1</user_total_dropped>
|
|
316
|
+
<user_total_plantoread>1</user_total_plantoread>
|
|
317
|
+
</myinfo>
|
|
318
|
+
\n${xmlEntries.join("\n")}\n
|
|
319
319
|
</myanimelist>`;
|
|
320
320
|
});
|
|
321
321
|
}
|