mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix: url encode extra values
This commit is contained in:
@@ -644,12 +644,22 @@ export const AddonCatalogResponseSchema = z.object({
|
||||
export type AddonCatalogResponse = z.infer<typeof AddonCatalogResponseSchema>;
|
||||
export type AddonCatalog = z.infer<typeof AddonCatalogSchema>;
|
||||
|
||||
export const ExtrasTypesSchema = z.enum(['skip', 'genre', 'search']);
|
||||
export const ExtrasTypesSchema = z.enum([
|
||||
'skip',
|
||||
'genre',
|
||||
'search',
|
||||
'filename',
|
||||
'videoHash',
|
||||
'videoSize',
|
||||
]);
|
||||
export type ExtrasTypes = z.infer<typeof ExtrasTypesSchema>;
|
||||
export const ExtrasSchema = z.object({
|
||||
skip: z.coerce.number().optional(),
|
||||
genre: z.string().optional(),
|
||||
search: z.string().optional(),
|
||||
filename: z.string().optional(),
|
||||
videoHash: z.string().optional(),
|
||||
videoSize: z.coerce.number().optional(),
|
||||
});
|
||||
export type Extras = z.infer<typeof ExtrasSchema>;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getTimeTakenSincePoint,
|
||||
maskSensitiveInfo,
|
||||
Cache,
|
||||
CatalogExtras,
|
||||
ExtrasParser,
|
||||
TMDBMetadata,
|
||||
Metadata,
|
||||
makeUrlLogSafe,
|
||||
@@ -318,7 +318,7 @@ export class AIOStreams {
|
||||
// reset the type from the request (which is the overriden type) to the actual type
|
||||
type = modification.type;
|
||||
}
|
||||
const parsedExtras = new CatalogExtras(extras);
|
||||
const parsedExtras = new ExtrasParser(extras);
|
||||
logger.debug(`Parsed extras: ${JSON.stringify(parsedExtras)}`);
|
||||
if (parsedExtras.genre === 'None') {
|
||||
logger.debug(`Genre extra is None, removing genre extra`);
|
||||
@@ -592,6 +592,8 @@ export class AIOStreams {
|
||||
}
|
||||
}
|
||||
}
|
||||
const parsedExtras = new ExtrasParser(extras);
|
||||
logger.debug(`Parsed extras: ${JSON.stringify(parsedExtras)}`);
|
||||
|
||||
// Request subtitles from all supported addons in parallel
|
||||
let errors: AIOStreamsError[] = this.addonInitialisationErrors.map(
|
||||
@@ -608,7 +610,7 @@ export class AIOStreams {
|
||||
const subtitles = await new Wrapper(addon).getSubtitles(
|
||||
type,
|
||||
id,
|
||||
extras
|
||||
parsedExtras.toString()
|
||||
);
|
||||
if (subtitles) {
|
||||
allSubtitles.push(...subtitles);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Extras, ExtrasSchema, ExtrasTypesSchema } from '../db/schemas';
|
||||
|
||||
export class CatalogExtras {
|
||||
export class ExtrasParser {
|
||||
private extras: Partial<Extras>;
|
||||
|
||||
constructor(extras?: string) {
|
||||
@@ -13,7 +13,7 @@ export class CatalogExtras {
|
||||
}
|
||||
const mapped = extras.split('&').map((e) => {
|
||||
const [key, value] = e.split('=');
|
||||
return { key, value };
|
||||
return { key, value: encodeURIComponent(value) };
|
||||
});
|
||||
const extrasObject = Object.fromEntries(
|
||||
mapped.map(({ key, value }) => {
|
||||
@@ -12,5 +12,5 @@ export * from './config';
|
||||
export * from './languages';
|
||||
export * from './dsu';
|
||||
export * from './startup';
|
||||
export * from './catalogExtras';
|
||||
export * from './extras';
|
||||
export * from './rpdb';
|
||||
|
||||
Reference in New Issue
Block a user