feat: support sending "new episode" notifications to devices
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { EpisodeNumberSchema } from "~/types/schema";
|
||||
|
||||
export type Episode = z.infer<typeof Episode>;
|
||||
export const Episode = z.object({
|
||||
id: z.string(),
|
||||
number: EpisodeNumberSchema,
|
||||
title: z.string().nullish(),
|
||||
img: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
rating: z.number().int().nullish(),
|
||||
updatedAt: z.number().int().default(0).openapi({ format: "int64" }),
|
||||
});
|
||||
|
||||
export type EpisodesResponse = z.infer<typeof EpisodesResponse>;
|
||||
export const EpisodesResponse = z.object({
|
||||
providerId: z.string(),
|
||||
episodes: z.array(Episode),
|
||||
});
|
||||
@@ -3,17 +3,14 @@ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
||||
import { fetchFromMultipleSources } from "~/libs/fetchFromMultipleSources";
|
||||
import { readEnvVariable } from "~/libs/readEnvVariable";
|
||||
import type { Env } from "~/types/env";
|
||||
import { EpisodesResponseSchema } from "~/types/episode";
|
||||
import {
|
||||
AniListIdQuerySchema,
|
||||
ErrorResponse,
|
||||
ErrorResponseSchema,
|
||||
SuccessResponseSchema,
|
||||
} from "~/types/schema";
|
||||
|
||||
import { getEpisodesFromAnify } from "./anify";
|
||||
import { EpisodesResponse } from "./episode";
|
||||
|
||||
const EpisodesResponseSchema = SuccessResponseSchema(EpisodesResponse);
|
||||
|
||||
const route = createRoute({
|
||||
tags: ["aniplay", "episodes"],
|
||||
|
||||
@@ -2,19 +2,18 @@ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
||||
|
||||
import { readEnvVariable } from "~/libs/readEnvVariable";
|
||||
import type { Env } from "~/types/env";
|
||||
import {
|
||||
FetchUrlResponse,
|
||||
FetchUrlResponseSchema,
|
||||
} from "~/types/episode/fetch-url-response";
|
||||
import {
|
||||
AniListIdQuerySchema,
|
||||
ErrorResponse,
|
||||
ErrorResponseSchema,
|
||||
SuccessResponseSchema,
|
||||
} from "~/types/schema";
|
||||
|
||||
import { FetchUrlResponse as FetchUrlResponseSchema } from "./responseType";
|
||||
|
||||
const FetchUrlRequest = z.object({ id: z.string(), provider: z.string() });
|
||||
|
||||
const FetchUrlResponse = SuccessResponseSchema(FetchUrlResponseSchema);
|
||||
|
||||
const route = createRoute({
|
||||
tags: ["aniplay", "episodes"],
|
||||
summary: "Fetch stream URL for an episode",
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { SkippableSchema } from "~/types/schema";
|
||||
|
||||
export type FetchUrlResponse = z.infer<typeof FetchUrlResponse>;
|
||||
export const FetchUrlResponse = z.object({
|
||||
source: z.string(),
|
||||
subtitles: z.array(z.object({ url: z.string(), lang: z.string() })),
|
||||
audio: z.array(z.object({ url: z.string(), lang: z.string() })),
|
||||
intro: SkippableSchema,
|
||||
outro: SkippableSchema,
|
||||
headers: z.record(z.string()).optional(),
|
||||
});
|
||||
Reference in New Issue
Block a user