Jellyseerr Integration

## Note this is early stages of said integration. Things will change!
series and season working

- added jellyseerr git submodule
- augmentations
- working jellyseerr search integration
- working jellyseerr requests & updated interceptors to persist cookies from every response
This commit is contained in:
herrrta
2024-12-21 20:26:25 -05:00
parent 78b7425c6b
commit 9f12ee027f
24 changed files with 1368 additions and 52 deletions

2
augmentations/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from "./number";
export * from "./mmkv";

17
augmentations/mmkv.ts Normal file
View File

@@ -0,0 +1,17 @@
import {MMKV} from "react-native-mmkv";
declare module "react-native-mmkv" {
interface MMKV {
get<T>(key: string): T | undefined
setAny(key: string, value: any | undefined): void
}
}
MMKV.prototype.get = function <T> (key: string): T | undefined {
const serializedItem = this.getString(key);
return serializedItem ? JSON.parse(serializedItem) : undefined;
}
MMKV.prototype.setAny = function (key: string, value: any | undefined): void {
this.set(key, JSON.stringify(value));
}

22
augmentations/number.ts Normal file
View File

@@ -0,0 +1,22 @@
declare global {
interface Number {
bytesToReadable(): string;
}
}
Number.prototype.bytesToReadable = function () {
const bytes = this.valueOf();
const gb = bytes / 1e9;
if (gb >= 1) return `${gb.toFixed(2)} GB`;
const mb = bytes / 1024.0 / 1024.0;
if (mb >= 1) return `${mb.toFixed(2)} MB`;
const kb = bytes / 1024.0;
if (kb >= 1) return `${kb.toFixed(2)} KB`;
return `${bytes.toFixed(2)} B`;
}
export {};