diff --git a/.prettierrc b/.prettierrc index a0981bd..fc5b8a3 100644 --- a/.prettierrc +++ b/.prettierrc @@ -11,7 +11,7 @@ "requirePragma": false, "semi": false, "singleQuote": true, - "tabWidth": 2, + "tabWidth": 4, "trailingComma": "none", "useTabs": false, "vueIndentScriptAndStyle": false, diff --git a/build.js b/build.js deleted file mode 100644 index 8b28d38..0000000 --- a/build.js +++ /dev/null @@ -1,72 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const builder = require('electron-builder') -const Platform = builder.Platform - -/** - * @type {import('electron-builder').Configuration} - */ -const options = { - appId: 'com.stratum.crunchyrolldownloader', - productName: 'Crunchyroll Downloader', - - compression: 'maximum', - removePackageScripts: true, - - nodeGypRebuild: true, - buildDependenciesFromSource: true, - - publish: { - provider: 'github', - releaseType: 'release' - }, - - directories: { - output: 'crunchyroll-downloader-output-${version}' - }, - - win: { - artifactName: 'crunchyroll-downloader-${version}-windows-installer.${ext}', - icon: 'public/favicon.ico', - target: [ - { - target: 'nsis', - arch: ['x64', 'ia32'] - } - ] - }, - nsis: { - deleteAppDataOnUninstall: true - }, - mac: { - category: 'public.app-category.entertainment', - hardenedRuntime: false, - gatekeeperAssess: false, - target: [ - { - target: 'default', - arch: ['x64', 'arm64'] - } - ] - }, - linux: { - maintainer: 'Stratum', - desktop: { - StartupNotify: 'false', - Encoding: 'UTF-8', - MimeType: 'x-scheme-handler/deeplink' - }, - target: ['AppImage', 'rpm', 'deb'] - } -} - -const platform = 'WINDOWS' -builder - .build({ - targets: Platform[platform].createTarget(), - config: options - }) - .then((result) => { - console.log('----------------------------') - console.log('Platform:', platform) - console.log('Output:', JSON.stringify(result, null, 2)) - }) diff --git a/build.ts b/build.ts new file mode 100644 index 0000000..914b498 --- /dev/null +++ b/build.ts @@ -0,0 +1,72 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires +const builder = require('electron-builder') +const Platform = builder.Platform + +/** + * @type {import('electron-builder').Configuration} + */ +const options = { + appId: 'com.stratum.crunchyrolldownloader', + productName: 'Crunchyroll Downloader', + + compression: 'maximum', + removePackageScripts: true, + + nodeGypRebuild: true, + buildDependenciesFromSource: true, + + publish: { + provider: 'github', + releaseType: 'release' + }, + + directories: { + output: 'crunchyroll-downloader-output-${version}' + }, + + win: { + artifactName: 'crunchyroll-downloader-${version}-windows-installer.${ext}', + icon: 'public/favicon.ico', + target: [ + { + target: 'nsis', + arch: ['x64', 'ia32'] + } + ] + }, + nsis: { + deleteAppDataOnUninstall: true + }, + mac: { + category: 'public.app-category.entertainment', + hardenedRuntime: false, + gatekeeperAssess: false, + target: [ + { + target: 'default', + arch: ['x64', 'arm64'] + } + ] + }, + linux: { + maintainer: 'Stratum', + desktop: { + StartupNotify: 'false', + Encoding: 'UTF-8', + MimeType: 'x-scheme-handler/deeplink' + }, + target: ['AppImage', 'rpm', 'deb'] + } +} + +const platform = 'WINDOWS' +builder + .build({ + targets: Platform[platform].createTarget(), + config: options + }) + .then((result: any) => { + console.log('----------------------------') + console.log('Platform:', platform) + console.log('Output:', JSON.stringify(result, null, 2)) + }) diff --git a/components/ADN/ListAnimes.ts b/components/ADN/ListAnimes.ts index 02f63ce..06cc111 100644 --- a/components/ADN/ListAnimes.ts +++ b/components/ADN/ListAnimes.ts @@ -1,19 +1,16 @@ -import type { ADNSearchFetch } from "./Types"; +import type { ADNSearchFetch } from './Types' export async function searchADN(q: string) { - const { data: deData, error: deError } = await useFetch( - `https://gw.api.animationdigitalnetwork.fr/show/catalog`, - { - method: "GET", - headers: { - "x-target-distribution": 'de', - }, - query: { - "maxAgeCategory": "18", - "search": q - } + const { data: deData, error: deError } = await useFetch(`https://gw.api.animationdigitalnetwork.fr/show/catalog`, { + method: 'GET', + headers: { + 'x-target-distribution': 'de' + }, + query: { + maxAgeCategory: '18', + search: q } - ); + }) if (deError.value) { throw new Error(deError.value?.data.message as string) @@ -21,19 +18,16 @@ export async function searchADN(q: string) { if (!deData.value) return - const { data: frData, error: frError } = await useFetch( - `https://gw.api.animationdigitalnetwork.fr/show/catalog`, - { - method: "GET", - headers: { - "x-target-distribution": 'fr', - }, - query: { - "maxAgeCategory": "18", - "search": q - } + const { data: frData, error: frError } = await useFetch(`https://gw.api.animationdigitalnetwork.fr/show/catalog`, { + method: 'GET', + headers: { + 'x-target-distribution': 'fr' + }, + query: { + maxAgeCategory: '18', + search: q } - ); + }) if (frError.value) { throw new Error(frError.value?.data.message as string) @@ -41,22 +35,24 @@ export async function searchADN(q: string) { if (!frData.value) return - const deShows = deData.value.shows; - const frShows = frData.value.shows; + const deShows = deData.value.shows + const frShows = frData.value.shows - const mergeLanguagesOfDuplicates = (shows: { - id: number - url: string - title: string - image2x: string - episodeCount: number, - languages: Array - }[]) => { - shows.forEach(show => { - const existingShow = shows.find(s => s.id === show.id); + const mergeLanguagesOfDuplicates = ( + shows: { + id: number + url: string + title: string + image2x: string + episodeCount: number + languages: Array + }[] + ) => { + shows.forEach((show) => { + const existingShow = shows.find((s) => s.id === show.id) if (existingShow) { - const existingShowIndex = shows.findIndex(s=> s === existingShow); - const rawLanguages = [...show.languages, ...existingShow.languages]; + const existingShowIndex = shows.findIndex((s) => s === existingShow) + const rawLanguages = [...show.languages, ...existingShow.languages] const languages: Array = [] for (const l of rawLanguages) { @@ -66,13 +62,13 @@ export async function searchADN(q: string) { } show.languages = languages } - }); - return shows; - }; + }) + return shows + } - const allShows = mergeLanguagesOfDuplicates([...deShows, ...frShows]); + const allShows = mergeLanguagesOfDuplicates([...deShows, ...frShows]) - const unique = [...new Map(allShows.map((s) => [s.id, s])).values()]; + const unique = [...new Map(allShows.map((s) => [s.id, s])).values()] return unique } diff --git a/components/ADN/ListEpisodes.ts b/components/ADN/ListEpisodes.ts index 171cacb..a1f5e4e 100644 --- a/components/ADN/ListEpisodes.ts +++ b/components/ADN/ListEpisodes.ts @@ -1,18 +1,18 @@ import type { ADNEpisodes, ADNEpisodesFetch } from './Types' export async function getEpisodesWithShowIdADN(id: number, lang: 'de' | 'fr') { - const { data, error } = await useFetch(`https://gw.api.animationdigitalnetwork.fr/video/show/${id}?offset=0&limit=-1&order=asc`, { - method: 'GET', - headers: { - "x-target-distribution": lang, - }, - }) + const { data, error } = await useFetch(`https://gw.api.animationdigitalnetwork.fr/video/show/${id}?offset=0&limit=-1&order=asc`, { + method: 'GET', + headers: { + 'x-target-distribution': lang + } + }) - if (error.value || !data.value) { - console.log(error.value) - alert(error.value) - return - } + if (error.value || !data.value) { + console.log(error.value) + alert(error.value) + return + } - return data.value.videos + return data.value.videos } diff --git a/components/ADN/Types.ts b/components/ADN/Types.ts index 53621b4..f7b5d87 100644 --- a/components/ADN/Types.ts +++ b/components/ADN/Types.ts @@ -1,85 +1,85 @@ export interface ADNSearchFetch { - shows: Array<{ - id: number - url: string - title: string - image2x: string - episodeCount: number, - languages: Array - }> + shows: Array<{ + id: number + url: string + title: string + image2x: string + episodeCount: number + languages: Array + }> } export interface ADNEpisodesFetch { - videos: Array + videos: Array } export interface ADNEpisode { - id: number, - title: string, - name: string, - number: string, - shortNumber: string, - season: string, - reference: string, - type: string, - order: number, - image: string, - image2x: string, - summary: string, - releaseDate: string, - duration: number, - url: string, - urlPath: string, - embeddedUrl: string, - languages: Array, - qualities: Array, - rating: number, - ratingsCount: number, - commentsCount: number, - available: boolean, - download: boolean, - free: boolean, - freeWithAds: boolean, - show: { - id: number, - title: string, - type: string, - originalTitle: string, - shortTitle: string, - reference: string, - age: string, - languages: Array, - summary: string, - image: string, - image2x: string, - imageHorizontal: string, - imageHorizontal2x: string, - url: string, - urlPath: string, - episodeCount: number, - genres: Array, - copyright: string, - rating: number, - ratingsCount: number, - commentsCount: number, - qualities: Array, - simulcast: boolean, - free: boolean, - available: boolean, - download: boolean, - basedOn: string, - tagline: Array, - firstReleaseYear: string, - productionStudio: string, - countryOfOrigin: string, - productionTeam: Array<{ - role: string, - name: string, - }>, - nextVideoReleaseDate: string, + id: number + title: string + name: string + number: string + shortNumber: string + season: string + reference: string + type: string + order: number + image: string + image2x: string + summary: string + releaseDate: string + duration: number + url: string + urlPath: string + embeddedUrl: string + languages: Array + qualities: Array + rating: number + ratingsCount: number + commentsCount: number + available: boolean + download: boolean + free: boolean + freeWithAds: boolean + show: { + id: number + title: string + type: string + originalTitle: string + shortTitle: string + reference: string + age: string + languages: Array + summary: string + image: string + image2x: string + imageHorizontal: string + imageHorizontal2x: string + url: string + urlPath: string + episodeCount: number + genres: Array + copyright: string + rating: number + ratingsCount: number + commentsCount: number + qualities: Array + simulcast: boolean + free: boolean + available: boolean + download: boolean + basedOn: string + tagline: Array + firstReleaseYear: string + productionStudio: string + countryOfOrigin: string + productionTeam: Array<{ + role: string + name: string + }> + nextVideoReleaseDate: string + indexable: boolean + } indexable: boolean - } - indexable: boolean } -export interface ADNEpisodes extends Array {} \ No newline at end of file +export interface ADNEpisodes extends Array {} diff --git a/components/Crunchyroll/Account.ts b/components/Crunchyroll/Account.ts index bdab298..5f0c4ff 100644 --- a/components/Crunchyroll/Account.ts +++ b/components/Crunchyroll/Account.ts @@ -1,29 +1,29 @@ import type { CrunchyLogin } from './Types' export async function crunchyLogin() { - const { data, error } = await useFetch('http://localhost:8080/api/crunchyroll/login', { - method: 'POST' - }) + const { data, error } = await useFetch('http://localhost:8080/api/crunchyroll/login', { + method: 'POST' + }) - return { data, error } + return { data, error } } export async function checkAccount(service: string) { - const { data, error } = await useFetch(`http://localhost:8080/api/service/check/${service}`, { - method: 'GET' - }) + const { data, error } = await useFetch(`http://localhost:8080/api/service/check/${service}`, { + method: 'GET' + }) - return { data, error } + return { data, error } } export async function loginAccount(user: string, password: string, service: string) { - const { data, error } = await useFetch(`http://localhost:8080/api/service/login/${service}`, { - method: 'POST', - body: { - user: user, - password: password - } - }) + const { data, error } = await useFetch(`http://localhost:8080/api/service/login/${service}`, { + method: 'POST', + body: { + user: user, + password: password + } + }) - return { data, error } + return { data, error } } diff --git a/components/Crunchyroll/ListAnimes.ts b/components/Crunchyroll/ListAnimes.ts index 1d707ac..865c52c 100644 --- a/components/Crunchyroll/ListAnimes.ts +++ b/components/Crunchyroll/ListAnimes.ts @@ -3,87 +3,87 @@ import { crunchyLogin } from './Account' import type { CrunchyAnimeFetch, CrunchySearchFetch } from './Types' export async function searchCrunchy(q: string) { - const { data: token, error: tokenerror } = await crunchyLogin() + const { data: token, error: tokenerror } = await crunchyLogin() - if (!token.value) { - return - } - - const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/discover/search`, { - method: 'GET', - headers: { - Authorization: `Bearer ${token.value.access_token}` - }, - query: { - q: q, - n: 100, - type: 'series', - ratings: false + if (!token.value) { + return } - }) - if (error.value) { - console.error(error.value) - throw new Error(JSON.stringify(error.value)) - } - - if (!data.value) return - - var results: CrunchyrollSearchResults = [] - - for (const result of data.value.data[0].items) { - results.push({ - ID: result.id, - Url: `https://www.crunchyroll.com/series/${result.id}/${result.slug_title}`, - Title: result.title, - Description: result.description, - Dubs: result.series_metadata.audio_locales, - Subs: result.series_metadata.subtitle_locales, - Episodes: result.series_metadata.episode_count, - Seasons: result.series_metadata.season_count, - PEGI: result.series_metadata.maturity_ratings, - Year: result.series_metadata.series_launch_year, - Images: result.images + const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/discover/search`, { + method: 'GET', + headers: { + Authorization: `Bearer ${token.value.access_token}` + }, + query: { + q: q, + n: 100, + type: 'series', + ratings: false + } }) - } - return results + if (error.value) { + console.error(error.value) + throw new Error(JSON.stringify(error.value)) + } + + if (!data.value) return + + var results: CrunchyrollSearchResults = [] + + for (const result of data.value.data[0].items) { + results.push({ + ID: result.id, + Url: `https://www.crunchyroll.com/series/${result.id}/${result.slug_title}`, + Title: result.title, + Description: result.description, + Dubs: result.series_metadata.audio_locales, + Subs: result.series_metadata.subtitle_locales, + Episodes: result.series_metadata.episode_count, + Seasons: result.series_metadata.season_count, + PEGI: result.series_metadata.maturity_ratings, + Year: result.series_metadata.series_launch_year, + Images: result.images + }) + } + + return results } export async function getCRSeries(q: string) { - const { data: token, error: tokenerror } = await crunchyLogin() + const { data: token, error: tokenerror } = await crunchyLogin() - if (!token.value) { - return - } - - const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}`, { - method: 'GET', - headers: { - Authorization: `Bearer ${token.value.access_token}` + if (!token.value) { + return } - }) - if (error.value) { - console.error(error.value) - throw new Error(JSON.stringify(error.value)) - } + const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}`, { + method: 'GET', + headers: { + Authorization: `Bearer ${token.value.access_token}` + } + }) - if (!data.value) return + if (error.value) { + console.error(error.value) + throw new Error(JSON.stringify(error.value)) + } - const anime = data.value.data[0] + if (!data.value) return - return { - ID: anime.id, - Url: `https://www.crunchyroll.com/series/${anime.id}/${anime.slug_title}`, - Title: anime.title, - Description: anime.description, - Dubs: anime.audio_locales, - Subs: anime.subtitle_locales, - Episodes: anime.episode_count, - Seasons: anime.season_count, - PEGI: anime.maturity_ratings, - Year: anime.series_launch_year, - Images: anime.images - } + const anime = data.value.data[0] + + return { + ID: anime.id, + Url: `https://www.crunchyroll.com/series/${anime.id}/${anime.slug_title}`, + Title: anime.title, + Description: anime.description, + Dubs: anime.audio_locales, + Subs: anime.subtitle_locales, + Episodes: anime.episode_count, + Seasons: anime.season_count, + PEGI: anime.maturity_ratings, + Year: anime.series_launch_year, + Images: anime.images + } } diff --git a/components/Crunchyroll/ListEpisodes.ts b/components/Crunchyroll/ListEpisodes.ts index 144bb8c..0f70013 100644 --- a/components/Crunchyroll/ListEpisodes.ts +++ b/components/Crunchyroll/ListEpisodes.ts @@ -2,25 +2,25 @@ import { crunchyLogin } from './Account' import type { CrunchyEpisodesFetch } from './Types' export async function listEpisodeCrunchy(q: string) { - const { data: token, error: tokenerror } = await crunchyLogin() + const { data: token, error: tokenerror } = await crunchyLogin() - if (!token.value) { - return - } - - const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/seasons/${q}/episodes`, { - method: 'GET', - headers: { - Authorization: `Bearer ${token.value.access_token}` + if (!token.value) { + return } - }) - if (error.value) { - console.error(error.value) - throw new Error(JSON.stringify(error.value)) - } + const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/seasons/${q}/episodes`, { + method: 'GET', + headers: { + Authorization: `Bearer ${token.value.access_token}` + } + }) - if (!data.value) return + if (error.value) { + console.error(error.value) + throw new Error(JSON.stringify(error.value)) + } - return data.value.data + if (!data.value) return + + return data.value.data } diff --git a/components/Crunchyroll/ListSeasons.ts b/components/Crunchyroll/ListSeasons.ts index db1e8cd..cbb2257 100644 --- a/components/Crunchyroll/ListSeasons.ts +++ b/components/Crunchyroll/ListSeasons.ts @@ -2,27 +2,27 @@ import { crunchyLogin } from './Account' import type { CrunchySeasonsFetch } from './Types' export async function listSeasonCrunchy(q: string) { - const { data: token, error: tokenerror } = await crunchyLogin() + const { data: token, error: tokenerror } = await crunchyLogin() - if (!token.value) { - return - } - - console.log(q) - - const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}/seasons`, { - method: 'GET', - headers: { - Authorization: `Bearer ${token.value.access_token}` + if (!token.value) { + return } - }) - if (error.value) { - console.error(error.value) - throw new Error(JSON.stringify(error.value)) - } + console.log(q) - if (!data.value) return + const { data, error } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}/seasons`, { + method: 'GET', + headers: { + Authorization: `Bearer ${token.value.access_token}` + } + }) - return data.value.data + if (error.value) { + console.error(error.value) + throw new Error(JSON.stringify(error.value)) + } + + if (!data.value) return + + return data.value.data } diff --git a/components/Crunchyroll/Types.ts b/components/Crunchyroll/Types.ts index 864bf4a..c590416 100644 --- a/components/Crunchyroll/Types.ts +++ b/components/Crunchyroll/Types.ts @@ -1,18 +1,73 @@ export interface CrunchySearchFetch { - total: number - data: Array<{ - type: string - count: number - items: Array<{ - promo_description: string - title: string - promo_title: string - channel_id: string - slug_title: string - search_metadata: { - score: number - } - series_metadata: { + total: number + data: Array<{ + type: string + count: number + items: Array<{ + promo_description: string + title: string + promo_title: string + channel_id: string + slug_title: string + search_metadata: { + score: number + } + series_metadata: { + audio_locales: Array + availability_notes: string + episode_count: number + extended_description: string + extended_maturity_rating: string + is_dubbed: boolean + is_mature: boolean + is_simulcast: boolean + is_subbed: boolean + mature_blocked: boolean + maturity_ratings: Array + season_count: number + series_launch_year: number + subtitle_locales: Array + } + id: string + slug: string + external_id: string + description: string + new: boolean + images: { + poster_tall: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + poster_wide: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + } + linked_resource_key: string + type: string + }> + }> +} + +export interface CrunchyAnimeFetch { + total: number + data: Array<{ + promo_description: string + title: string + promo_title: string + channel_id: string + slug_title: string + search_metadata: { + score: number + } audio_locales: Array availability_notes: string episode_count: number @@ -27,212 +82,157 @@ export interface CrunchySearchFetch { season_count: number series_launch_year: number subtitle_locales: Array - } - id: string - slug: string - external_id: string - description: string - new: boolean - images: { - poster_tall: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - poster_wide: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - } - linked_resource_key: string - type: string + id: string + slug: string + external_id: string + description: string + new: boolean + images: { + poster_tall: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + poster_wide: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + } + linked_resource_key: string + type: string }> - }> -} - -export interface CrunchyAnimeFetch { - total: number - data: Array<{ - promo_description: string - title: string - promo_title: string - channel_id: string - slug_title: string - search_metadata: { - score: number - } - audio_locales: Array - availability_notes: string - episode_count: number - extended_description: string - extended_maturity_rating: string - is_dubbed: boolean - is_mature: boolean - is_simulcast: boolean - is_subbed: boolean - mature_blocked: boolean - maturity_ratings: Array - season_count: number - series_launch_year: number - subtitle_locales: Array - id: string - slug: string - external_id: string - description: string - new: boolean - images: { - poster_tall: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - poster_wide: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - } - linked_resource_key: string - type: string - }> } export interface CrunchyLogin { - access_token: string - refresh_token: string - expires_in: number - token_type: string - scope: string - country: string - account_id: string - profile_id: string + access_token: string + refresh_token: string + expires_in: number + token_type: string + scope: string + country: string + account_id: string + profile_id: string } export interface CrunchySeasonsFetch { - total: number - data: Array<{ - identifier: string - description: string - is_simulcast: boolean - subtitle_locales: Array - series_id: string - id: string - audio_locales: Array - title: string - versions: Array<{ - audio_locale: string - guid: string - original: boolean - variant: string + total: number + data: Array<{ + identifier: string + description: string + is_simulcast: boolean + subtitle_locales: Array + series_id: string + id: string + audio_locales: Array + title: string + versions: Array<{ + audio_locale: string + guid: string + original: boolean + variant: string + }> + season_sequence_number: number + season_number: number + maturity_ratings: Array + mature_blocked: boolean + channel_id: string + is_subbed: boolean + audio_locale: string + season_display_number: string + is_complete: boolean + season_tags: Array + is_mature: boolean + is_dubbed: boolean + slug_title: string + availability_notes: string + number_of_episodes: boolean }> - season_sequence_number: number - season_number: number - maturity_ratings: Array - mature_blocked: boolean - channel_id: string - is_subbed: boolean - audio_locale: string - season_display_number: string - is_complete: boolean - season_tags: Array - is_mature: boolean - is_dubbed: boolean - slug_title: string - availability_notes: string - number_of_episodes: boolean - }> - meta: { - versions_considered: boolean - } + meta: { + versions_considered: boolean + } } export interface CrunchyEpisodesFetch { - total: number - data: Array<{ - closed_captions_available: boolean - availability_notes: string - next_episode_title: string - upload_date: string - versions: Array<{ - audio_locale: string - guid: string - is_premium_only: boolean - media_guid: string - original: boolean - season_guid: string - variant: string - }> - season_slug_title: string - series_title: string - season_title: string - sequence_number: number - maturity_ratings: Array - slug_title: string - is_premium_only: boolean - availability_ends: string - identifier: string - recent_variant: string - free_available_date: string - subtitle_locales: Array - series_id: string - mature_blocked: boolean - duration_ms: number - availability_starts: string - audio_locale: string - images: { - thumbnail: Array< - Array<{ - height: number - source: string - type: string - width: number + total: number + data: Array<{ + closed_captions_available: boolean + availability_notes: string + next_episode_title: string + upload_date: string + versions: Array<{ + audio_locale: string + guid: string + is_premium_only: boolean + media_guid: string + original: boolean + season_guid: string + variant: string }> - > + season_slug_title: string + series_title: string + season_title: string + sequence_number: number + maturity_ratings: Array + slug_title: string + is_premium_only: boolean + availability_ends: string + identifier: string + recent_variant: string + free_available_date: string + subtitle_locales: Array + series_id: string + mature_blocked: boolean + duration_ms: number + availability_starts: string + audio_locale: string + images: { + thumbnail: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + } + season_sequence_number: number + season_id: string + episode_number: number + listing_id: string + available_date: string + channel_id: string + season_number: number + hd_flag: boolean + recent_audio_locale: string + available_offline: boolean + episode: string + is_subbed: boolean + media_type: string + is_clip: boolean + title: string + streams_link: string + slug: string + id: string + production_episode_id: string + is_dubbed: boolean + next_episode_id: string + series_slug_title: string + season_tags: Array + premium_date: string + is_mature: boolean + premium_available_date: string + description: string + episode_air_date: string + eligible_region: string + }> + meta: { + versions_considered: boolean } - season_sequence_number: number - season_id: string - episode_number: number - listing_id: string - available_date: string - channel_id: string - season_number: number - hd_flag: boolean - recent_audio_locale: string - available_offline: boolean - episode: string - is_subbed: boolean - media_type: string - is_clip: boolean - title: string - streams_link: string - slug: string - id: string - production_episode_id: string - is_dubbed: boolean - next_episode_id: string - series_slug_title: string - season_tags: Array - premium_date: string - is_mature: boolean - premium_available_date: string - description: string - episode_air_date: string - eligible_region: string - }> - meta: { - versions_considered: boolean - } } diff --git a/components/Episode/Types.ts b/components/Episode/Types.ts index 5ac4311..d8999ea 100644 --- a/components/Episode/Types.ts +++ b/components/Episode/Types.ts @@ -1,71 +1,73 @@ export interface CrunchyEpisode { - closed_captions_available: boolean, - availability_notes: string, - next_episode_title: string, - upload_date: string, + closed_captions_available: boolean + availability_notes: string + next_episode_title: string + upload_date: string versions: Array<{ - audio_locale: string, - guid: string, - is_premium_only: boolean, - media_guid: string, - original: boolean, - season_guid: string, + audio_locale: string + guid: string + is_premium_only: boolean + media_guid: string + original: boolean + season_guid: string variant: string - }>, - season_slug_title: string, - series_title: string, - season_title: string, - sequence_number: number, - maturity_ratings: Array, - slug_title: string, - is_premium_only: boolean, - availability_ends: string, - identifier: string, - recent_variant: string, - free_available_date: string, - subtitle_locales: Array, - series_id: string, - mature_blocked: boolean, - duration_ms: number, - availability_starts: string, - audio_locale: string, + }> + season_slug_title: string + series_title: string + season_title: string + sequence_number: number + maturity_ratings: Array + slug_title: string + is_premium_only: boolean + availability_ends: string + identifier: string + recent_variant: string + free_available_date: string + subtitle_locales: Array + series_id: string + mature_blocked: boolean + duration_ms: number + availability_starts: string + audio_locale: string images: { - thumbnail: Array> - }, - season_sequence_number: number, - season_id: string, - episode_number: number, - listing_id: string, - available_date: string, - channel_id: string, - season_number: number, - hd_flag: boolean, - recent_audio_locale: string, - available_offline: boolean, - episode: string, - is_subbed: boolean, - media_type: string, - is_clip: boolean, - title: string, - streams_link: string, - slug: string, - id: string, - production_episode_id: string, - is_dubbed: boolean, - next_episode_id: string, - series_slug_title: string, - season_tags: Array, - premium_date: string, - is_mature: boolean, - premium_available_date: string, - description: string, - episode_air_date: string, + thumbnail: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + } + season_sequence_number: number + season_id: string + episode_number: number + listing_id: string + available_date: string + channel_id: string + season_number: number + hd_flag: boolean + recent_audio_locale: string + available_offline: boolean + episode: string + is_subbed: boolean + media_type: string + is_clip: boolean + title: string + streams_link: string + slug: string + id: string + production_episode_id: string + is_dubbed: boolean + next_episode_id: string + series_slug_title: string + season_tags: Array + premium_date: string + is_mature: boolean + premium_available_date: string + description: string + episode_air_date: string eligible_region: string } -export interface CrunchyEpisodes extends Array {} \ No newline at end of file +export interface CrunchyEpisodes extends Array {} diff --git a/components/Functions/WindowHandler.ts b/components/Functions/WindowHandler.ts index 49578d8..37cd291 100644 --- a/components/Functions/WindowHandler.ts +++ b/components/Functions/WindowHandler.ts @@ -1,8 +1,8 @@ const isProduction = process.env.NODE_ENV !== 'development' export function openNewWindow(urlprod: string, urldev: string, w: string) { - const newWindow = window.open(isProduction ? urlprod : urldev, '_blank', w) - if (newWindow) { - newWindow.focus() - } -} \ No newline at end of file + const newWindow = window.open(isProduction ? urlprod : urldev, '_blank', w) + if (newWindow) { + newWindow.focus() + } +} diff --git a/components/MainHeader.vue b/components/MainHeader.vue index 48431de..6084fe2 100644 --- a/components/MainHeader.vue +++ b/components/MainHeader.vue @@ -1,32 +1,39 @@ diff --git a/components/Search/Types.ts b/components/Search/Types.ts index ab24023..6830a4b 100644 --- a/components/Search/Types.ts +++ b/components/Search/Types.ts @@ -1,43 +1,43 @@ export interface CrunchyrollSearchResult { - ID: string - Url: string - Title: string - Description: string - Dubs: Array - Subs: Array - Episodes: number - Seasons: number - PEGI: Array - Year: number - Images: { - poster_tall: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - poster_wide: Array< - Array<{ - height: number - source: string - type: string - width: number - }> - > - } + ID: string + Url: string + Title: string + Description: string + Dubs: Array + Subs: Array + Episodes: number + Seasons: number + PEGI: Array + Year: number + Images: { + poster_tall: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + poster_wide: Array< + Array<{ + height: number + source: string + type: string + width: number + }> + > + } } export interface CrunchyrollSearchResults extends Array {} export interface ADNSearchResult { - id: number - url: string - title: string - image2x: string - episodeCount: number - languages: Array + id: number + url: string + title: string + image2x: string + episodeCount: number + languages: Array } export interface ADNSearchResults extends Array {} diff --git a/components/Season/Types.ts b/components/Season/Types.ts index c2af8c2..3774de5 100644 --- a/components/Season/Types.ts +++ b/components/Season/Types.ts @@ -1,33 +1,33 @@ export interface CrunchySeason { - identifier: string - description: string - is_simulcast: boolean - subtitle_locales: Array - series_id: string - id: string - audio_locales: Array - title: string - versions: Array<{ + identifier: string + description: string + is_simulcast: boolean + subtitle_locales: Array + series_id: string + id: string + audio_locales: Array + title: string + versions: Array<{ + audio_locale: string + guid: string + original: boolean + variant: string + }> + season_sequence_number: number + season_number: number + maturity_ratings: Array + mature_blocked: boolean + channel_id: string + is_subbed: boolean audio_locale: string - guid: string - original: boolean - variant: string - }> - season_sequence_number: number - season_number: number - maturity_ratings: Array - mature_blocked: boolean - channel_id: string - is_subbed: boolean - audio_locale: string - season_display_number: string - is_complete: boolean - season_tags: Array - is_mature: boolean - is_dubbed: boolean - slug_title: string - availability_notes: string - number_of_episodes: boolean + season_display_number: string + is_complete: boolean + season_tags: Array + is_mature: boolean + is_dubbed: boolean + slug_title: string + availability_notes: string + number_of_episodes: boolean } export interface CrunchySeasons extends Array {} diff --git a/components/Updater.vue b/components/Updater.vue index a12ece3..8d7799e 100644 --- a/components/Updater.vue +++ b/components/Updater.vue @@ -1,25 +1,29 @@ diff --git a/package.json b/package.json index 8e250c0..aba8d07 100644 --- a/package.json +++ b/package.json @@ -1,67 +1,67 @@ { - "name": "crunchyroll-downloader", - "author": "Stratum", - "description": "Crunchyroll Downloader", - "version": "1.0.7", - "private": true, - "main": ".output/src/electron/background.js", - "repository": "https://github.com/stratuma/Crunchyroll-Downloader-v4.0", - "scripts": { - "dev": "nuxt dev -o", - "build": "nuxt generate", - "preview": "nuxt preview", - "postinstall": "nuxt prepare && electron-builder install-app-deps", - "transpile-src": "tsc -p ./src --outDir .output/src", - "dev:electron": "NODE_ENV=development concurrently --kill-others \"nuxt dev\" \"tsc-watch -p ./src --outDir .output/src --onSuccess 'electron ./.output/src/electron/background.js'\"", - "dev:electron:win": "set NODE_ENV=development& concurrently --kill-others \"nuxt dev\" \"tsc-watch -p ./src --outDir .output/src --onSuccess run.electron\"", - "build:electron": "pnpm build && pnpm transpile-src && node build.js" - }, - "devDependencies": { - "7zip-bin": "^5.2.0", - "@nuxtjs/eslint-config-typescript": "^12.1.0", - "@nuxtjs/google-fonts": "^3.2.0", - "@nuxtjs/tailwindcss": "^6.12.0", - "@pinia/nuxt": "^0.4.11", - "@types/express": "^4.17.21", - "concurrently": "^8.2.2", - "dotenv": "^16.4.5", - "electron": "^30.0.1", - "electron-builder": "^24.13.3", - "eslint": "^8.57.0", - "eslint-config-prettier": "^8.10.0", - "eslint-plugin-prettier": "^4.2.1", - "nuxt": "^3.11.2", - "nuxt-icon": "^0.6.10", - "prettier": "^2.8.8", - "sass": "^1.75.0", - "sass-loader": "^13.3.3", - "tsc-watch": "^6.2.0", - "typescript": "^5.4.5", - "wait-on": "^7.2.0" - }, - "dependencies": { - "@fastify/cors": "^9.0.1", - "@types/crypto-js": "^4.2.2", - "@types/fluent-ffmpeg": "^2.1.24", - "@types/node-cron": "^3.0.11", - "ass-compiler": "^0.1.11", - "crypto-js": "^4.2.0", - "electron-log": "^5.1.2", - "electron-settings": "^4.0.4", - "electron-updater": "^6.1.8", - "express": "^4.19.2", - "fastify": "^4.26.2", - "fluent-ffmpeg": "^2.1.2", - "jsencrypt": "^3.3.2", - "mpd-parser": "^1.3.0", - "node-cache": "^5.1.2", - "node-cron": "^3.0.3", - "sequelize": "^6.37.3", - "sqlite3": "5.1.6" - }, - "build": { - "extraResources": [ - "./ffmpeg/**" - ] - } + "name": "crunchyroll-downloader", + "author": "Stratum", + "description": "Crunchyroll Downloader", + "version": "1.0.7", + "private": true, + "main": ".output/src/electron/background.js", + "repository": "https://github.com/stratuma/Crunchyroll-Downloader-v4.0", + "scripts": { + "dev": "nuxt dev -o", + "build": "nuxt generate", + "preview": "nuxt preview", + "postinstall": "nuxt prepare && electron-builder install-app-deps", + "transpile-src": "tsc -p ./src --outDir .output/src", + "dev:electron": "NODE_ENV=development concurrently --kill-others \"nuxt dev\" \"tsc-watch -p ./src --outDir .output/src --onSuccess 'electron ./.output/src/electron/background.js'\"", + "dev:electron:win": "set NODE_ENV=development& concurrently --kill-others \"nuxt dev\" \"tsc-watch -p ./src --outDir .output/src --onSuccess run.electron\"", + "build:electron": "pnpm build && pnpm transpile-src && node build.ts", + "prettier:fix": "pnpm prettier src --write && pnpm prettier components --write && pnpm prettier pages --write && pnpm prettier build.ts --write" + }, + "devDependencies": { + "7zip-bin": "^5.2.0", + "@nuxtjs/eslint-config-typescript": "^12.1.0", + "@nuxtjs/google-fonts": "^3.2.0", + "@nuxtjs/tailwindcss": "^6.12.0", + "@pinia/nuxt": "^0.4.11", + "@types/express": "^4.17.21", + "concurrently": "^8.2.2", + "dotenv": "^16.4.5", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", + "eslint-config-prettier": "^8.10.0", + "eslint-plugin-prettier": "^4.2.1", + "nuxt": "^3.11.2", + "nuxt-icon": "^0.6.10", + "prettier": "^3.2.5", + "sass": "^1.75.0", + "sass-loader": "^13.3.3", + "tsc-watch": "^6.2.0", + "typescript": "^5.4.5", + "wait-on": "^7.2.0" + }, + "dependencies": { + "@fastify/cors": "^9.0.1", + "@types/crypto-js": "^4.2.2", + "@types/fluent-ffmpeg": "^2.1.24", + "@types/node-cron": "^3.0.11", + "ass-compiler": "^0.1.11", + "crypto-js": "^4.2.0", + "electron-log": "^5.1.2", + "electron-settings": "^4.0.4", + "electron-updater": "^6.1.8", + "express": "^4.19.2", + "fastify": "^4.26.2", + "fluent-ffmpeg": "^2.1.2", + "jsencrypt": "^3.3.2", + "mpd-parser": "^1.3.0", + "node-cache": "^5.1.2", + "node-cron": "^3.0.3", + "sequelize": "^6.37.3", + "sqlite3": "5.1.6" + }, + "build": { + "extraResources": [ + "./ffmpeg/**" + ] + } } diff --git a/pages/addanime.vue b/pages/addanime.vue index 70835a4..91d60be 100644 --- a/pages/addanime.vue +++ b/pages/addanime.vue @@ -1,202 +1,200 @@ diff --git a/pages/adnlogin.vue b/pages/adnlogin.vue index 36d5d0d..8787f00 100644 --- a/pages/adnlogin.vue +++ b/pages/adnlogin.vue @@ -1,28 +1,28 @@ diff --git a/pages/crunchylogin.vue b/pages/crunchylogin.vue index b25270a..da552bd 100644 --- a/pages/crunchylogin.vue +++ b/pages/crunchylogin.vue @@ -1,28 +1,28 @@ diff --git a/pages/index.vue b/pages/index.vue index 29048aa..2fdea73 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,70 +1,74 @@ diff --git a/pages/settings.vue b/pages/settings.vue index 7975d13..ab41643 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -1,19 +1,19 @@