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:
33
server/types/plex-api.d.ts
vendored
33
server/types/plex-api.d.ts
vendored
@@ -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>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user