mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19:56 -05:00
Feat: Implemented Basic Tracker Support (Anilist, Mal, Etc)
This commit is contained in:
+240
-1
@@ -436,6 +436,7 @@ export const INSTALL_EXTERNAL_EXTENSION = `
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
// ── Settings ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export const GET_SETTINGS = `
|
||||
@@ -454,4 +455,242 @@ export const SET_EXTENSION_REPOS = `
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
`;
|
||||
|
||||
// ── Trackers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export const GET_TRACKERS = `
|
||||
query GetTrackers {
|
||||
trackers {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
icon
|
||||
isLoggedIn
|
||||
authUrl
|
||||
supportsPrivateTracking
|
||||
scores
|
||||
statuses {
|
||||
value
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_MANGA_TRACK_RECORDS = `
|
||||
query GetMangaTrackRecords($mangaId: Int!) {
|
||||
manga(id: $mangaId) {
|
||||
trackRecords {
|
||||
nodes {
|
||||
id
|
||||
trackerId
|
||||
remoteId
|
||||
title
|
||||
status
|
||||
score
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
remoteUrl
|
||||
startDate
|
||||
finishDate
|
||||
private
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SEARCH_TRACKER = `
|
||||
query SearchTracker($trackerId: Int!, $query: String!) {
|
||||
searchTracker(input: { trackerId: $trackerId, query: $query }) {
|
||||
trackSearches {
|
||||
id
|
||||
trackerId
|
||||
remoteId
|
||||
title
|
||||
coverUrl
|
||||
summary
|
||||
publishingStatus
|
||||
publishingType
|
||||
startDate
|
||||
totalChapters
|
||||
trackingUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const BIND_TRACK = `
|
||||
mutation BindTrack($mangaId: Int!, $trackerId: Int!, $remoteId: LongString!) {
|
||||
bindTrack(input: { mangaId: $mangaId, trackerId: $trackerId, remoteId: $remoteId }) {
|
||||
trackRecord {
|
||||
id
|
||||
trackerId
|
||||
remoteId
|
||||
title
|
||||
status
|
||||
score
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
remoteUrl
|
||||
startDate
|
||||
finishDate
|
||||
private
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_TRACK = `
|
||||
mutation UpdateTrack($recordId: Int!, $status: Int, $lastChapterRead: Float, $scoreString: String, $startDate: LongString, $finishDate: LongString, $private: Boolean) {
|
||||
updateTrack(input: { recordId: $recordId, status: $status, lastChapterRead: $lastChapterRead, scoreString: $scoreString, startDate: $startDate, finishDate: $finishDate, private: $private }) {
|
||||
trackRecord {
|
||||
id
|
||||
trackerId
|
||||
status
|
||||
score
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
startDate
|
||||
finishDate
|
||||
private
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNBIND_TRACK = `
|
||||
mutation UnbindTrack($recordId: Int!) {
|
||||
unbindTrack(input: { recordId: $recordId }) {
|
||||
trackRecord {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_TRACK = `
|
||||
mutation FetchTrack($recordId: Int!) {
|
||||
fetchTrack(input: { recordId: $recordId }) {
|
||||
trackRecord {
|
||||
id
|
||||
trackerId
|
||||
status
|
||||
score
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
startDate
|
||||
finishDate
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_ALL_TRACKER_RECORDS = `
|
||||
query GetAllTrackerRecords {
|
||||
trackers {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
icon
|
||||
isLoggedIn
|
||||
scores
|
||||
statuses { value name }
|
||||
trackRecords {
|
||||
nodes {
|
||||
id
|
||||
trackerId
|
||||
title
|
||||
status
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
remoteUrl
|
||||
private
|
||||
manga {
|
||||
id
|
||||
title
|
||||
thumbnailUrl
|
||||
inLibrary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_TRACKER_RECORDS = `
|
||||
query GetTrackerRecords($trackerId: Int!) {
|
||||
trackers(condition: { id: $trackerId }) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
statuses { value name }
|
||||
trackRecords {
|
||||
nodes {
|
||||
id
|
||||
title
|
||||
status
|
||||
displayScore
|
||||
lastChapterRead
|
||||
totalChapters
|
||||
remoteUrl
|
||||
manga {
|
||||
id
|
||||
title
|
||||
thumbnailUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGIN_TRACKER_OAUTH = `
|
||||
mutation LoginTrackerOAuth($trackerId: Int!, $callbackUrl: String!) {
|
||||
loginTrackerOAuth(input: { trackerId: $trackerId, callbackUrl: $callbackUrl }) {
|
||||
isLoggedIn
|
||||
tracker {
|
||||
id
|
||||
name
|
||||
isLoggedIn
|
||||
authUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGIN_TRACKER_CREDENTIALS = `
|
||||
mutation LoginTrackerCredentials($trackerId: Int!, $username: String!, $password: String!) {
|
||||
loginTrackerCredentials(input: { trackerId: $trackerId, username: $username, password: $password }) {
|
||||
isLoggedIn
|
||||
tracker {
|
||||
id
|
||||
name
|
||||
isLoggedIn
|
||||
authUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGOUT_TRACKER = `
|
||||
mutation LogoutTracker($trackerId: Int!) {
|
||||
logoutTracker(input: { trackerId: $trackerId }) {
|
||||
tracker {
|
||||
id
|
||||
name
|
||||
isLoggedIn
|
||||
authUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
+47
-1
@@ -86,4 +86,50 @@ export interface DownloadStatus {
|
||||
|
||||
export interface Connection<T> {
|
||||
nodes: T[];
|
||||
}
|
||||
}
|
||||
|
||||
export interface TrackerStatus {
|
||||
value: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Tracker {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
isLoggedIn: boolean;
|
||||
authUrl: string | null;
|
||||
supportsPrivateTracking: boolean;
|
||||
scores: string[];
|
||||
statuses: TrackerStatus[];
|
||||
}
|
||||
|
||||
export interface TrackRecord {
|
||||
id: number;
|
||||
trackerId: number;
|
||||
remoteId: string;
|
||||
title: string;
|
||||
status: number;
|
||||
score: number;
|
||||
displayScore: string;
|
||||
lastChapterRead: number;
|
||||
totalChapters: number;
|
||||
remoteUrl: string | null;
|
||||
startDate: string | null;
|
||||
finishDate: string | null;
|
||||
private: boolean;
|
||||
}
|
||||
|
||||
export interface TrackSearch {
|
||||
id: number;
|
||||
trackerId: number;
|
||||
remoteId: string;
|
||||
title: string;
|
||||
coverUrl: string | null;
|
||||
summary: string | null;
|
||||
publishingStatus: string | null;
|
||||
publishingType: string | null;
|
||||
startDate: string | null;
|
||||
totalChapters: number;
|
||||
trackingUrl: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user