diff --git a/.drone.yml b/.drone.yml index a9c4904..939dfdb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ steps: path: /cache - name: Frontend install - image: node:18.2.0 + image: node:24.13.1 commands: - node -v - yarn --version @@ -42,8 +42,14 @@ steps: - name: cache path: /cache + - name: Lint project using eslint + image: node:24.13.1 + commands: + - yarn lint + failure: ignore + - name: Frontend build - image: node:18.2.0 + image: node:24.13.1 commands: - yarn build environment: @@ -56,12 +62,6 @@ steps: SEASONED_DOMAIN: from_secret: SEASONED_DOMAIN - - name: Lint project using eslint - image: node:18.2.0 - commands: - - yarn lint - failure: ignore - - name: Build and publish docker image image: plugins/docker settings: @@ -107,6 +107,6 @@ trigger: # - pull_request --- kind: signature -hmac: 8f76d7d8af65a215a4abafe7db270f93a4ae76d116db5ce6f1895af25354ff2d +hmac: 6f10b2871d2bd6b5cd26ddf72796325991ba211ba1eb62b657baf993e9d549c8 ... diff --git a/.gitignore b/.gitignore index 93bd3be..e75c9fe 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ src/config.json # Build directory dist/ +lib/ # Node packages node_modules/ diff --git a/src/api.ts b/src/api.ts index e18ebc2..456b139 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,5 +1,9 @@ /* eslint-disable n/no-unsupported-features/node-builtins */ import { IList, IMediaCredits, IPersonCredits } from "./interfaces/IList"; +import type { + IRequestStatusResponse, + IRequestSubmitResponse +} from "./interfaces/IRequestResponse"; const API_HOSTNAME = import.meta.env.VITE_SEASONED_API; const ELASTIC_URL = import.meta.env.VITE_ELASTIC_URL; @@ -261,7 +265,7 @@ const addMagnet = (magnet: string, name: string, tmdbId: number | null) => { * @param {string} type Movie or show type * @returns {object} Success/Failure response */ -const request = (id, type) => { +const request = (id, type): Promise => { const url = new URL("/api/v2/request", API_HOSTNAME); const options = { @@ -284,18 +288,13 @@ const request = (id, type) => { * @param {string} type * @returns {object} Success/Failure response */ -const getRequestStatus = (id, type = undefined) => { +const getRequestStatus = (id, type = null): Promise => { const url = new URL("/api/v2/request", API_HOSTNAME); url.pathname = `${url.pathname}/${id.toString()}`; url.searchParams.append("type", type); return fetch(url.href) - .then(resp => { - const { status } = resp; - if (status === 200) return true; - - return false; - }) + .then(resp => resp.json()) .catch(err => Promise.reject(err)); }; @@ -437,9 +436,13 @@ const unlinkPlexAccount = () => { // - - - User graphs - - - -const fetchGraphData = (urlPath, days, chartType) => { +const fetchGraphData = async ( + urlPath: string, + days: number, + chartType: string +) => { const url = new URL(`/api/v1/user/${urlPath}`, API_HOSTNAME); - url.searchParams.append("days", days); + url.searchParams.append("days", String(days)); url.searchParams.append("y_axis", chartType); return fetch(url.href).then(resp => { @@ -454,7 +457,7 @@ const fetchGraphData = (urlPath, days, chartType) => { // - - - Random emoji - - - -const getEmoji = () => { +const getEmoji = async () => { const url = new URL("/api/v1/emoji", API_HOSTNAME); return fetch(url.href) @@ -475,28 +478,51 @@ const getEmoji = () => { * @param {string} query * @returns {object} List of movies and shows matching query */ + const elasticSearchMoviesAndShows = (query, count = 22) => { const url = new URL(`${ELASTIC_URL}/_search`); const body = { sort: [{ popularity: { order: "desc" } }, "_score"], + size: count, query: { - bool: { - should: [ - { - match_phrase_prefix: { - original_name: query - } - }, - { - match_phrase_prefix: { - original_title: query - } - } - ] + multi_match: { + query, + fields: ["name", "original_title", "original_name"], + type: "phrase_prefix", + tie_breaker: 0.3 } }, - size: count + suggest: { + text: query, + "person-suggest": { + prefix: query, + completion: { + field: "name.completion", + fuzzy: { + fuzziness: "AUTO" + } + } + }, + "movie-suggest": { + prefix: query, + completion: { + field: "original_title.completion", + fuzzy: { + fuzziness: "AUTO" + } + } + }, + "show-suggest": { + prefix: query, + completion: { + field: "original_name.completion", + fuzzy: { + fuzziness: "AUTO" + } + } + } + } }; const options = { diff --git a/src/components/CastListItem.vue b/src/components/CastListItem.vue index 177f682..53f4754 100644 --- a/src/components/CastListItem.vue +++ b/src/components/CastListItem.vue @@ -9,7 +9,7 @@ diff --git a/src/components/torrent/TorrentTable.vue b/src/components/torrent/TorrentTable.vue index 0b1dadb..94b6b8f 100644 --- a/src/components/torrent/TorrentTable.vue +++ b/src/components/torrent/TorrentTable.vue @@ -52,7 +52,7 @@