refactor(api): replace plex-api package with internal implementation (#2335)

Removes plex-api dependency and its type declarations. Then extends the ExternalApi class for
PlexAPI implementation to mimick the exact same old behaviour. This should resolve the security
vulnerabilities in transitive dependencies: form-data(critical), request (moderate, deprecated),
tough-cookie (moderate), xml2js (moderate). Plex-api itself is also no longer maintained.
This commit is contained in:
fallenbagel
2026-01-27 00:52:44 +05:00
committed by GitHub
parent 6031fab3b4
commit f627a8e9db
5 changed files with 51 additions and 294 deletions

View File

@@ -1,33 +0,0 @@
declare module 'plex-api' {
export default class PlexAPI {
constructor(intiialOptions: {
hostname: string;
port: number;
token?: string;
https?: boolean;
timeout?: number;
authenticator: {
authenticate: (
_plexApi: PlexAPI,
cb: (err?: string, token?: string) => void
) => void;
};
options: {
identifier: string;
product: string;
deviceName: string;
platform: string;
};
requestOptions?: Record<string, string | number>;
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
query: <T extends Record<string, any>>(
endpoint:
| string
| {
uri: string;
extraHeaders?: Record<string, string | number>;
}
) => Promise<T>;
}
}