react-native-consumet 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/androidTest/java/com/consumet/TestSupport.kt +12 -6
- package/android/src/androidTest/java/com/consumet/WebViewContractTest.kt +30 -2
- package/android/src/main/java/com/consumet/HttpRequestModule.kt +27 -13
- package/ios/Consumet.mm +42 -19
- package/lib/commonjs/NativeConsumet.ts +13 -8
- package/lib/commonjs/extension-registry.json +33 -62
- package/lib/commonjs/extension-registry.json.sig +1 -1
- package/lib/commonjs/extractors/gofile.js +47 -10
- package/lib/commonjs/extractors/gofile.js.map +1 -1
- package/lib/commonjs/extractors/hubcloud.js +49 -42
- package/lib/commonjs/extractors/hubcloud.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/index.js +9 -1
- package/lib/commonjs/models/index.js.map +1 -1
- package/lib/commonjs/models/meta-error.js +6 -3
- package/lib/commonjs/models/meta-error.js.map +1 -1
- package/lib/commonjs/models/provider-error.js +54 -0
- package/lib/commonjs/models/provider-error.js.map +1 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +88 -23
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/commonjs/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
- package/lib/commonjs/providers/anime/anikoto/hianime.js.map +1 -0
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +110 -18
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/index.js +1 -9
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/reanime/create-reanime.js +6 -2
- package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -1
- package/lib/commonjs/providers/common/concurrency.js +38 -0
- package/lib/commonjs/providers/common/concurrency.js.map +1 -0
- package/lib/commonjs/providers/common/errors.js +77 -0
- package/lib/commonjs/providers/common/errors.js.map +1 -0
- package/lib/commonjs/providers/common/servers.js +9 -3
- package/lib/commonjs/providers/common/servers.js.map +1 -1
- package/lib/commonjs/providers/common/ttl-cache.js +59 -0
- package/lib/commonjs/providers/common/ttl-cache.js.map +1 -0
- package/lib/commonjs/providers/manga/asurascans.js +29 -7
- package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist-media.js +23 -13
- package/lib/commonjs/providers/meta/anilist-media.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +25 -14
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/commonjs/providers/meta/mal.js +3 -3
- package/lib/commonjs/providers/meta/mal.js.map +1 -1
- package/lib/commonjs/providers/meta/shared.js +7 -2
- package/lib/commonjs/providers/meta/shared.js.map +1 -1
- package/lib/commonjs/providers/meta/tmdb.js +151 -45
- package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
- package/lib/commonjs/providers/movies/index.js +0 -4
- package/lib/commonjs/providers/movies/index.js.map +1 -1
- package/lib/commonjs/providers/movies/multimovies/create-multimovies.js +2 -1
- package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -1
- package/lib/commonjs/providers/movies/multistream/create-multistream.js +1 -1
- package/lib/commonjs/providers/movies/multistream/create-multistream.js.map +1 -1
- package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
- package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
- package/lib/commonjs/providers/movies/site-paths.js +3 -2
- package/lib/commonjs/providers/movies/site-paths.js.map +1 -1
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +95 -44
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/commonjs/providers/provider-class.js +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +90 -11
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +54 -18
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/extension-modules.js +136 -24
- package/lib/commonjs/utils/extension-modules.js.map +1 -1
- package/lib/commonjs/utils/registry-schema.js +3 -2
- package/lib/commonjs/utils/registry-schema.js.map +1 -1
- package/lib/commonjs/utils/tmdb.js +53 -8
- package/lib/commonjs/utils/tmdb.js.map +1 -1
- package/lib/module/NativeConsumet.ts +13 -8
- package/lib/module/extension-registry.json +33 -62
- package/lib/module/extension-registry.json.sig +1 -1
- package/lib/module/extractors/gofile.js +47 -10
- package/lib/module/extractors/gofile.js.map +1 -1
- package/lib/module/extractors/hubcloud.js +49 -42
- package/lib/module/extractors/hubcloud.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/index.js +1 -0
- package/lib/module/models/index.js.map +1 -1
- package/lib/module/models/meta-error.js +7 -3
- package/lib/module/models/meta-error.js.map +1 -1
- package/lib/module/models/provider-error.js +49 -0
- package/lib/module/models/provider-error.js.map +1 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/anikoto/create-anikoto.js +89 -23
- package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/module/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
- package/lib/module/providers/anime/anikoto/hianime.js.map +1 -0
- package/lib/module/providers/anime/animepahe/create-animepahe.js +111 -18
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/index.js +1 -9
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/reanime/create-reanime.js +6 -2
- package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -1
- package/lib/module/providers/common/concurrency.js +34 -0
- package/lib/module/providers/common/concurrency.js.map +1 -0
- package/lib/module/providers/common/errors.js +70 -0
- package/lib/module/providers/common/errors.js.map +1 -0
- package/lib/module/providers/common/servers.js +10 -3
- package/lib/module/providers/common/servers.js.map +1 -1
- package/lib/module/providers/common/ttl-cache.js +54 -0
- package/lib/module/providers/common/ttl-cache.js.map +1 -0
- package/lib/module/providers/manga/asurascans.js +29 -7
- package/lib/module/providers/manga/asurascans.js.map +1 -1
- package/lib/module/providers/meta/anilist-media.js +23 -13
- package/lib/module/providers/meta/anilist-media.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +26 -15
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/module/providers/meta/mal.js +3 -3
- package/lib/module/providers/meta/mal.js.map +1 -1
- package/lib/module/providers/meta/shared.js +8 -3
- package/lib/module/providers/meta/shared.js.map +1 -1
- package/lib/module/providers/meta/tmdb.js +153 -47
- package/lib/module/providers/meta/tmdb.js.map +1 -1
- package/lib/module/providers/movies/index.js +0 -4
- package/lib/module/providers/movies/index.js.map +1 -1
- package/lib/module/providers/movies/multimovies/create-multimovies.js +2 -1
- package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -1
- package/lib/module/providers/movies/multistream/create-multistream.js +1 -1
- package/lib/module/providers/movies/multistream/create-multistream.js.map +1 -1
- package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
- package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
- package/lib/module/providers/movies/site-paths.js +3 -2
- package/lib/module/providers/movies/site-paths.js.map +1 -1
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js +95 -44
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/module/providers/provider-class.js +1 -1
- package/lib/module/utils/ExtractorManager.js +89 -11
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +54 -18
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/extension-modules.js +136 -24
- package/lib/module/utils/extension-modules.js.map +1 -1
- package/lib/module/utils/registry-schema.js +3 -2
- package/lib/module/utils/registry-schema.js.map +1 -1
- package/lib/module/utils/tmdb.js +51 -7
- package/lib/module/utils/tmdb.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +13 -8
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/gofile.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/meta-error.d.ts +4 -1
- package/lib/typescript/commonjs/src/models/meta-error.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-error.d.ts +32 -0
- package/lib/typescript/commonjs/src/models/provider-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/types.d.ts +27 -0
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/{module/src/providers/anime → commonjs/src/providers/anime/anikoto}/hianime.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +0 -6
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts +8 -0
- package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/common/errors.d.ts +36 -0
- package/lib/typescript/commonjs/src/providers/common/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/common/servers.d.ts +2 -1
- package/lib/typescript/commonjs/src/providers/common/servers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts +21 -0
- package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts +19 -7
- package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts +14 -7
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/mal.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/meta/shared.d.ts +4 -1
- package/lib/typescript/commonjs/src/providers/meta/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts +65 -6
- package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts +0 -3
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts +3 -2
- package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/provider-class.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +29 -1
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +19 -5
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-modules.d.ts +33 -8
- package/lib/typescript/commonjs/src/utils/extension-modules.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/registry-schema.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/registry-schema.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/tmdb.d.ts +18 -3
- package/lib/typescript/commonjs/src/utils/tmdb.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeConsumet.d.ts +13 -8
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/gofile.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/hubcloud.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/module/src/models/index.d.ts +1 -0
- package/lib/typescript/module/src/models/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/meta-error.d.ts +4 -1
- package/lib/typescript/module/src/models/meta-error.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-error.d.ts +32 -0
- package/lib/typescript/module/src/models/provider-error.d.ts.map +1 -0
- package/lib/typescript/module/src/models/types.d.ts +27 -0
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/providers/anime → module/src/providers/anime/anikoto}/hianime.d.ts +2 -2
- package/lib/typescript/module/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/index.d.ts +0 -6
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/common/concurrency.d.ts +8 -0
- package/lib/typescript/module/src/providers/common/concurrency.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/common/errors.d.ts +36 -0
- package/lib/typescript/module/src/providers/common/errors.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/common/servers.d.ts +2 -1
- package/lib/typescript/module/src/providers/common/servers.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/common/ttl-cache.d.ts +21 -0
- package/lib/typescript/module/src/providers/common/ttl-cache.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist-media.d.ts +19 -7
- package/lib/typescript/module/src/providers/meta/anilist-media.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts +14 -7
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/mal.d.ts +1 -1
- package/lib/typescript/module/src/providers/meta/shared.d.ts +4 -1
- package/lib/typescript/module/src/providers/meta/shared.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/tmdb.d.ts +65 -6
- package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/index.d.ts +0 -3
- package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/site-paths.d.ts +3 -2
- package/lib/typescript/module/src/providers/movies/site-paths.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/provider-class.d.ts +1 -1
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts +29 -1
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +19 -5
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-modules.d.ts +33 -8
- package/lib/typescript/module/src/utils/extension-modules.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/registry-schema.d.ts +1 -1
- package/lib/typescript/module/src/utils/registry-schema.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/tmdb.d.ts +18 -3
- package/lib/typescript/module/src/utils/tmdb.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeConsumet.ts +13 -8
- package/src/extension-registry.json +33 -62
- package/src/extension-registry.json.sig +1 -1
- package/src/extractors/gofile.ts +52 -11
- package/src/extractors/hubcloud.ts +62 -49
- package/src/index.tsx +4 -1
- package/src/models/extension-manifest.ts +3 -0
- package/src/models/index.ts +1 -0
- package/src/models/meta-error.ts +7 -3
- package/src/models/provider-error.ts +57 -0
- package/src/models/types.ts +23 -0
- package/src/providers/anime/anikoto/create-anikoto.ts +73 -25
- package/src/providers/anime/{hianime.ts → anikoto/hianime.ts} +5 -5
- package/src/providers/anime/animepahe/create-animepahe.ts +101 -19
- package/src/providers/anime/index.ts +0 -8
- package/src/providers/anime/reanime/create-reanime.ts +8 -1
- package/src/providers/common/concurrency.ts +32 -0
- package/src/providers/common/errors.ts +84 -0
- package/src/providers/common/servers.ts +7 -3
- package/src/providers/common/ttl-cache.ts +65 -0
- package/src/providers/manga/asurascans.ts +31 -7
- package/src/providers/meta/anilist-media.ts +20 -15
- package/src/providers/meta/anilist.ts +23 -13
- package/src/providers/meta/mal.ts +3 -3
- package/src/providers/meta/shared.ts +10 -3
- package/src/providers/meta/tmdb.ts +173 -38
- package/src/providers/movies/index.ts +0 -4
- package/src/providers/movies/multimovies/create-multimovies.ts +1 -0
- package/src/providers/movies/multistream/create-multistream.ts +1 -1
- package/src/providers/movies/netflixmirror/create-netflixmirror.ts +49 -11
- package/src/providers/movies/site-paths.ts +3 -2
- package/src/providers/movies/vegamovies/create-vegamovies.ts +93 -42
- package/src/providers/provider-class.ts +1 -1
- package/src/utils/ExtractorManager.ts +97 -11
- package/src/utils/ProviderManager.ts +74 -22
- package/src/utils/extension-modules.ts +145 -32
- package/src/utils/registry-schema.ts +2 -1
- package/src/utils/tmdb.ts +53 -7
- package/lib/commonjs/providers/anime/anineko/anineko.js +0 -11
- package/lib/commonjs/providers/anime/anineko/anineko.js.map +0 -1
- package/lib/commonjs/providers/anime/anineko/create-anineko.js +0 -358
- package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +0 -1
- package/lib/commonjs/providers/anime/hianime.js.map +0 -1
- package/lib/commonjs/providers/anime/zoro/create-zoro.js +0 -362
- package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +0 -1
- package/lib/commonjs/providers/anime/zoro/zoro.js +0 -11
- package/lib/commonjs/providers/anime/zoro/zoro.js.map +0 -1
- package/lib/commonjs/providers/movies/himovies/create-himovies.js +0 -231
- package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +0 -1
- package/lib/commonjs/providers/movies/himovies/himovies.js +0 -11
- package/lib/commonjs/providers/movies/himovies/himovies.js.map +0 -1
- package/lib/module/providers/anime/anineko/anineko.js +0 -7
- package/lib/module/providers/anime/anineko/anineko.js.map +0 -1
- package/lib/module/providers/anime/anineko/create-anineko.js +0 -354
- package/lib/module/providers/anime/anineko/create-anineko.js.map +0 -1
- package/lib/module/providers/anime/hianime.js.map +0 -1
- package/lib/module/providers/anime/zoro/create-zoro.js +0 -358
- package/lib/module/providers/anime/zoro/create-zoro.js.map +0 -1
- package/lib/module/providers/anime/zoro/zoro.js +0 -7
- package/lib/module/providers/anime/zoro/zoro.js.map +0 -1
- package/lib/module/providers/movies/himovies/create-himovies.js +0 -227
- package/lib/module/providers/movies/himovies/create-himovies.js.map +0 -1
- package/lib/module/providers/movies/himovies/himovies.js +0 -7
- package/lib/module/providers/movies/himovies/himovies.js.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +0 -52
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/hianime.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +0 -49
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts +0 -28
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +0 -5
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +0 -52
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/hianime.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +0 -49
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +0 -5
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts +0 -28
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +0 -5
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +0 -1
- package/src/providers/anime/anineko/anineko.ts +0 -6
- package/src/providers/anime/anineko/create-anineko.ts +0 -394
- package/src/providers/anime/zoro/create-zoro.ts +0 -398
- package/src/providers/anime/zoro/zoro.ts +0 -6
- package/src/providers/movies/himovies/create-himovies.ts +0 -252
- package/src/providers/movies/himovies/himovies.ts +0 -6
|
@@ -19,7 +19,14 @@ import type {
|
|
|
19
19
|
ProviderType,
|
|
20
20
|
} from '../models/extension-manifest';
|
|
21
21
|
import { IntegrityError, type ExecuteCodeOptions, type IntegrityOptions } from './extension-integrity';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
CompiledCodeCache,
|
|
24
|
+
deleteEntriesOf,
|
|
25
|
+
extensionGlobals,
|
|
26
|
+
fetchEntryCode,
|
|
27
|
+
memoiseLoad,
|
|
28
|
+
type ExtensionFactory,
|
|
29
|
+
} from './extension-modules';
|
|
23
30
|
import { assertCompatibleEntry, validateRegistry } from './registry-schema';
|
|
24
31
|
|
|
25
32
|
export interface ProviderLoadOptions {
|
|
@@ -65,7 +72,7 @@ const CATEGORIES: Record<ProviderType, { article: string; base?: abstract new ()
|
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
/** Registry ids of the providers in the bundled registry (test/unit/provider-manager.test.ts checks the lists). */
|
|
68
|
-
export type KnownAnimeProviderId = 'animepahe' | 'anikoto'
|
|
75
|
+
export type KnownAnimeProviderId = 'animepahe' | 'anikoto';
|
|
69
76
|
export type KnownMovieProviderId = 'vegamovies' | 'netflixmirror' | 'primemirror' | 'disneymirror';
|
|
70
77
|
|
|
71
78
|
/** Any registry id; known ids autocomplete, and providers added to a registry later still type-check. */
|
|
@@ -88,6 +95,10 @@ export type ProviderOfCategory<C extends ProviderType> = C extends 'anime'
|
|
|
88
95
|
[M in (typeof REQUIRED_PROVIDER_METHODS)[C][number]]: (...args: any[]) => Promise<any>;
|
|
89
96
|
};
|
|
90
97
|
|
|
98
|
+
/** The compiled-code key of an entry: its lowercased id and its factory name. */
|
|
99
|
+
const compileKeyOf = (metadata: { id?: unknown; factoryName?: unknown }) =>
|
|
100
|
+
`${String(metadata?.id ?? metadata?.factoryName).toLowerCase()}|${metadata?.factoryName}`;
|
|
101
|
+
|
|
91
102
|
export class ProviderManager {
|
|
92
103
|
private providerContext: ProviderContext;
|
|
93
104
|
private extractorManager: ExtractorManager;
|
|
@@ -133,7 +144,7 @@ export class ProviderManager {
|
|
|
133
144
|
return this.extensions.filter((ext) => ext.category === category);
|
|
134
145
|
}
|
|
135
146
|
|
|
136
|
-
/** The registry entry for an id or name, case-insensitive ('
|
|
147
|
+
/** The registry entry for an id or name, case-insensitive ('anikoto' or 'AniKoto'). */
|
|
137
148
|
getExtensionMetadata(extensionId: string): ExtensionManifest {
|
|
138
149
|
if (!extensionId) throw new Error('Extension id/name is required');
|
|
139
150
|
const manifest = this.byKey.get(extensionId.toLowerCase());
|
|
@@ -143,7 +154,9 @@ export class ProviderManager {
|
|
|
143
154
|
|
|
144
155
|
/**
|
|
145
156
|
* Load an extension by id or name. Concurrent and later calls for the same extension and base URL
|
|
146
|
-
* share one load; a failed load is retried on the next call.
|
|
157
|
+
* share one load; a failed load is retried on the next call. Code this manager already verified
|
|
158
|
+
* against the entry's sha256 (run by executeProviderCode, or by an entry with the same code) isn't
|
|
159
|
+
* downloaded again. The entry's extractors start loading at the same time (ExtractorManager.prefetch).
|
|
147
160
|
*/
|
|
148
161
|
async loadExtension<T extends string>(
|
|
149
162
|
extensionId: T,
|
|
@@ -156,25 +169,40 @@ export class ProviderManager {
|
|
|
156
169
|
// Keyed on the hash, so a new version is loaded again, and on the base URL override, which
|
|
157
170
|
// builds a different instance.
|
|
158
171
|
const key = `${metadata.id.toLowerCase()}|${metadata.sha256 ?? ''}|${options.baseUrl ?? ''}`;
|
|
159
|
-
return memoiseLoad(this.loads, key, async () =>
|
|
160
|
-
this.
|
|
161
|
-
|
|
172
|
+
return memoiseLoad(this.loads, key, async () => {
|
|
173
|
+
const compiled = this.compiled.lookup(compileKeyOf(metadata), metadata.sha256, metadata.factoryName);
|
|
174
|
+
// The provider's own download goes out first, its extractors' right after it.
|
|
175
|
+
const code = compiled ? undefined : fetchEntryCode('provider', metadata.main);
|
|
176
|
+
this.extractorManager.prefetch(metadata.extractors);
|
|
177
|
+
if (compiled) return this.instantiate(() => compiled, metadata, options);
|
|
178
|
+
return this.executeProviderCode(await code!, metadata, options);
|
|
179
|
+
});
|
|
162
180
|
}
|
|
163
181
|
|
|
164
182
|
/**
|
|
165
183
|
* Forget a loaded extension (for every base URL) and its compiled code, so the next load
|
|
166
|
-
* fetches and runs it again.
|
|
184
|
+
* fetches and runs it again. Entries whose code has the same sha256 (the three NetMirror
|
|
185
|
+
* catalogs) share one compiled copy and its top-level state, so forgetting one forgets that copy
|
|
186
|
+
* and the other entries' loads and compiled code too. Extractors have their own:
|
|
187
|
+
* `getExtractorManager().invalidate(name)`.
|
|
167
188
|
*/
|
|
168
189
|
invalidate(extensionId: string): void {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
this.compiled.forget(id);
|
|
190
|
+
const metadata = this.byKey.get(extensionId.toLowerCase());
|
|
191
|
+
const id = (metadata?.id ?? extensionId).toLowerCase();
|
|
192
|
+
const forgotten = new Set([id, ...this.compiled.forget(id)]);
|
|
193
|
+
for (const sibling of this.siblingsOf(metadata?.sha256)) forgotten.add(sibling.id.toLowerCase());
|
|
194
|
+
for (const other of forgotten) {
|
|
195
|
+
deleteEntriesOf(this.loads, other);
|
|
196
|
+
this.compiled.forget(other);
|
|
197
|
+
}
|
|
172
198
|
}
|
|
173
199
|
|
|
174
200
|
/**
|
|
175
201
|
* Run an entry's provider code and build the provider with this manager's context. The code must
|
|
176
202
|
* match `metadata.sha256` unless `options.skipIntegrity` is set. Verified code is compiled once per
|
|
177
|
-
*
|
|
203
|
+
* sha256, shared by every entry with that sha256 (so they share its top-level state); each call
|
|
204
|
+
* returns a new instance, an instance of its category's base parser. Once the provider is built,
|
|
205
|
+
* the entry's extractors start loading (ExtractorManager.prefetch).
|
|
178
206
|
*
|
|
179
207
|
* @throws RegistryError before running anything if the entry needs a newer extension context
|
|
180
208
|
* @throws IntegrityError before running anything if the hash or factory name is invalid
|
|
@@ -186,17 +214,36 @@ export class ProviderManager {
|
|
|
186
214
|
): Promise<ProviderInstanceOf<T>> {
|
|
187
215
|
const id = String(metadata?.id ?? metadata?.factoryName);
|
|
188
216
|
assertCompatibleEntry(metadata);
|
|
217
|
+
const provider = this.instantiate(
|
|
218
|
+
() =>
|
|
219
|
+
this.compiled.compile(compileKeyOf(metadata), {
|
|
220
|
+
kind: 'provider',
|
|
221
|
+
id,
|
|
222
|
+
name: metadata.factoryName,
|
|
223
|
+
code,
|
|
224
|
+
entry: metadata,
|
|
225
|
+
globals: () => extensionGlobals('provider', id, this.providerContext),
|
|
226
|
+
siblings: () => this.siblingsOf(metadata.sha256).map((extension) => extension.factoryName),
|
|
227
|
+
skipIntegrity: options.skipIntegrity,
|
|
228
|
+
}),
|
|
229
|
+
metadata,
|
|
230
|
+
options
|
|
231
|
+
);
|
|
232
|
+
this.extractorManager.prefetch(metadata.extractors);
|
|
233
|
+
return provider;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Build the provider of an entry with the factory `factoryOf` gives (compiling it, say) and check
|
|
238
|
+
* it has its category's methods. Errors other than IntegrityError become provider code errors.
|
|
239
|
+
*/
|
|
240
|
+
private instantiate(
|
|
241
|
+
factoryOf: () => ExtensionFactory,
|
|
242
|
+
metadata: ExtensionManifest,
|
|
243
|
+
options: ProviderLoadOptions
|
|
244
|
+
): any {
|
|
189
245
|
try {
|
|
190
|
-
const
|
|
191
|
-
kind: 'provider',
|
|
192
|
-
id,
|
|
193
|
-
name: metadata.factoryName,
|
|
194
|
-
code,
|
|
195
|
-
entry: metadata,
|
|
196
|
-
globals: () => extensionGlobals('provider', id, this.providerContext),
|
|
197
|
-
skipIntegrity: options.skipIntegrity,
|
|
198
|
-
});
|
|
199
|
-
const instance = factory(this.providerContext, options.baseUrl ?? metadata.baseUrl);
|
|
246
|
+
const instance = factoryOf()(this.providerContext, options.baseUrl ?? metadata.baseUrl);
|
|
200
247
|
this.assertProviderOf(instance, metadata.category);
|
|
201
248
|
const base = CATEGORIES[metadata.category].base;
|
|
202
249
|
if (base && !(instance instanceof base)) Object.setPrototypeOf(instance, base.prototype);
|
|
@@ -208,6 +255,11 @@ export class ProviderManager {
|
|
|
208
255
|
}
|
|
209
256
|
}
|
|
210
257
|
|
|
258
|
+
/** The registry entries whose code has this sha256 (none without one). */
|
|
259
|
+
private siblingsOf(sha256: string | undefined): ExtensionManifest[] {
|
|
260
|
+
return sha256 ? this.extensions.filter((extension) => extension.sha256 === sha256) : [];
|
|
261
|
+
}
|
|
262
|
+
|
|
211
263
|
/** Throws unless the instance has the methods its category requires (REQUIRED_PROVIDER_METHODS). */
|
|
212
264
|
private assertProviderOf(instance: any, category: ProviderType): void {
|
|
213
265
|
const requiredMethods = (REQUIRED_PROVIDER_METHODS as Record<string, readonly string[] | undefined>)[category];
|
|
@@ -2,6 +2,7 @@ import { extensionEnums } from '../models/types';
|
|
|
2
2
|
import type { ExtractorContext, ProviderContext } from '../models';
|
|
3
3
|
import { MODELS_MODULE, UTILS_MODULE } from './runtime-modules';
|
|
4
4
|
import { assertValidIdentifier, verifyExtensionCode, type IntegrityOptions } from './extension-integrity';
|
|
5
|
+
import { IDENTIFIER_RE } from './registry-schema';
|
|
5
6
|
import { createExtensionFetch, fetchTextWithTimeout } from './fetch-with-timeout';
|
|
6
7
|
|
|
7
8
|
export type ExtensionKind = 'provider' | 'extractor';
|
|
@@ -23,6 +24,8 @@ export function createExtensionRequire(extensionId: string, modules: Record<stri
|
|
|
23
24
|
|
|
24
25
|
export type ExtensionFactory = (...args: any[]) => any;
|
|
25
26
|
|
|
27
|
+
const isIdentifier = (value: unknown): value is string => typeof value === 'string' && IDENTIFIER_RE.test(value);
|
|
28
|
+
|
|
26
29
|
/** The globals extension code runs with; each key becomes a local constant of that name. */
|
|
27
30
|
export type ExtensionGlobals = { exports: Record<string, any>; module: { exports: any } } & Record<string, unknown>;
|
|
28
31
|
|
|
@@ -73,34 +76,58 @@ export function extensionGlobals(
|
|
|
73
76
|
return globals;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export function evaluateExtensionCode(
|
|
79
|
+
/** The functions an evaluation of extension code provides, by the name they were asked for. */
|
|
80
|
+
export type ExtensionFactories = Map<string, ExtensionFactory | undefined>;
|
|
81
|
+
|
|
82
|
+
/** Extension code wrapped in a function that runs it and returns its top-level `names`, in order. */
|
|
83
|
+
function parseExtensionCode(
|
|
82
84
|
code: string,
|
|
83
|
-
|
|
84
|
-
globals: ExtensionGlobals
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
run = new Function(
|
|
91
|
-
'context',
|
|
92
|
-
`
|
|
85
|
+
names: readonly string[],
|
|
86
|
+
globals: ExtensionGlobals
|
|
87
|
+
): (context: ExtensionGlobals) => unknown[] {
|
|
88
|
+
return new Function(
|
|
89
|
+
'context',
|
|
90
|
+
`
|
|
93
91
|
${Object.keys(globals)
|
|
94
92
|
.map((key) => `const ${key} = context.${key};`)
|
|
95
93
|
.join('\n ')}
|
|
96
94
|
|
|
97
95
|
${code}
|
|
98
96
|
|
|
99
|
-
return typeof ${name} !== 'undefined' ? ${name} : undefined;
|
|
97
|
+
return [${names.map((name) => `typeof ${name} !== 'undefined' ? ${name} : undefined`).join(', ')}];
|
|
100
98
|
`
|
|
101
|
-
|
|
99
|
+
) as (context: ExtensionGlobals) => unknown[];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Run single-file extension code once and return the functions it provides for `names`. For each
|
|
104
|
+
* name: a top-level `function name`, `exports[name]`, `module.exports[name]`, or its default export;
|
|
105
|
+
* undefined when it provides none. `names[0]` is the one the caller needs; the others are looked up
|
|
106
|
+
* when the code also parses with them, and are missing from the result otherwise. Every name must
|
|
107
|
+
* be a valid identifier (assertValidIdentifier).
|
|
108
|
+
*/
|
|
109
|
+
export function evaluateExtensionCode(
|
|
110
|
+
code: string,
|
|
111
|
+
names: readonly string[],
|
|
112
|
+
globals: ExtensionGlobals,
|
|
113
|
+
kind: ExtensionKind
|
|
114
|
+
): ExtensionFactories {
|
|
115
|
+
const label = kind === 'provider' ? 'Provider' : 'Extractor';
|
|
116
|
+
const parseError = (syntaxError: any) =>
|
|
117
|
+
new Error(`Failed to parse ${kind} code: ${syntaxError.message}`, { cause: syntaxError });
|
|
118
|
+
let captured = names;
|
|
119
|
+
let run: (context: ExtensionGlobals) => unknown[];
|
|
120
|
+
try {
|
|
121
|
+
run = parseExtensionCode(code, captured, globals);
|
|
102
122
|
} catch (syntaxError: any) {
|
|
103
|
-
|
|
123
|
+
if (names.length <= 1) throw parseError(syntaxError);
|
|
124
|
+
// A name that can't be referenced (a reserved word, say) must not fail the one asked for.
|
|
125
|
+
captured = names.slice(0, 1);
|
|
126
|
+
try {
|
|
127
|
+
run = parseExtensionCode(code, captured, globals);
|
|
128
|
+
} catch (singleError: any) {
|
|
129
|
+
throw parseError(singleError);
|
|
130
|
+
}
|
|
104
131
|
}
|
|
105
132
|
|
|
106
133
|
// The top-level declaration comes first: it always binds its own name, while bundle export
|
|
@@ -113,9 +140,16 @@ export function evaluateExtensionCode(
|
|
|
113
140
|
} catch (execError: any) {
|
|
114
141
|
throw new Error(`${label} code execution failed: ${execError?.message ?? execError}`, { cause: execError });
|
|
115
142
|
}
|
|
143
|
+
// Not the list when the code returns early on its own (a top-level `return`).
|
|
144
|
+
const declaredAt = (index: number) => (Array.isArray(declared) ? declared[index] : undefined);
|
|
116
145
|
const { exports, module } = globals;
|
|
117
|
-
return
|
|
118
|
-
(
|
|
146
|
+
return new Map(
|
|
147
|
+
captured.map((name, index): [string, ExtensionFactory | undefined] => [
|
|
148
|
+
name,
|
|
149
|
+
[declaredAt(index), exports[name], module.exports?.[name], exports.default, module.exports?.default].find(
|
|
150
|
+
(candidate): candidate is ExtensionFactory => typeof candidate === 'function'
|
|
151
|
+
),
|
|
152
|
+
])
|
|
119
153
|
);
|
|
120
154
|
}
|
|
121
155
|
|
|
@@ -158,8 +192,14 @@ export async function fetchEntryCode(kind: ExtensionKind, main: string): Promise
|
|
|
158
192
|
return response.text;
|
|
159
193
|
}
|
|
160
194
|
|
|
195
|
+
/**
|
|
196
|
+
* One evaluation of verified code with a sha256: the functions it provides by name, and the keys
|
|
197
|
+
* compiled from it. Every key whose entry has that sha256 shares it, and so its top-level state.
|
|
198
|
+
*/
|
|
199
|
+
type SharedModule = { sha256: string; code: string; factories: ExtensionFactories; keys: Set<string> };
|
|
200
|
+
|
|
161
201
|
/** Compiled extension code, reused only for the same code and sha256 (one entry per key). */
|
|
162
|
-
type CompiledCode = { sha256: string; code: string; factory: ExtensionFactory };
|
|
202
|
+
type CompiledCode = { sha256: string; code: string; factory: ExtensionFactory; module?: SharedModule };
|
|
163
203
|
|
|
164
204
|
export interface CompileRequest {
|
|
165
205
|
kind: ExtensionKind;
|
|
@@ -170,40 +210,113 @@ export interface CompileRequest {
|
|
|
170
210
|
code: string;
|
|
171
211
|
entry: { id?: string; name?: string; sha256?: string };
|
|
172
212
|
globals: () => ExtensionGlobals;
|
|
173
|
-
/**
|
|
213
|
+
/**
|
|
214
|
+
* The function names of other entries whose code has the same sha256, also looked up when the
|
|
215
|
+
* code runs, so those entries get their function from the same run. Names that aren't plain
|
|
216
|
+
* identifiers are skipped.
|
|
217
|
+
*/
|
|
218
|
+
siblings?: () => readonly unknown[];
|
|
219
|
+
/** Run the code without checking it against `entry.sha256`; such code is never cached or shared. */
|
|
174
220
|
skipIntegrity?: boolean;
|
|
175
221
|
}
|
|
176
222
|
|
|
223
|
+
/** Whether a cache key belongs to the extension or extractor `id`: keys are `${id}` and `${id}|…`. */
|
|
224
|
+
const isKeyOf = (key: string, id: string) => key === id || key.startsWith(`${id}|`);
|
|
225
|
+
/** The id a cache key belongs to. */
|
|
226
|
+
const idOfKey = (key: string) => key.split('|')[0]!;
|
|
227
|
+
|
|
177
228
|
/**
|
|
178
229
|
* Turns verified registry code into the function it provides. The same code verified against the
|
|
179
|
-
* same hash runs from its compiled copy; unverified code is checked again on every call.
|
|
230
|
+
* same hash runs from its compiled copy; unverified code is checked again on every call. Verified
|
|
231
|
+
* code with a sha256 runs once per sha256: entries that share a bundle (same code, same hash) get
|
|
232
|
+
* their functions from one run, so they share its top-level state.
|
|
180
233
|
*/
|
|
181
234
|
export class CompiledCodeCache {
|
|
182
235
|
private compiled = new Map<string, CompiledCode>();
|
|
236
|
+
// By sha256
|
|
237
|
+
private modules = new Map<string, SharedModule>();
|
|
183
238
|
|
|
184
239
|
constructor(private integrityOptions: IntegrityOptions = {}) {}
|
|
185
240
|
|
|
241
|
+
/**
|
|
242
|
+
* The function `name` for `key`, when this cache has it from code verified against `sha256` (not
|
|
243
|
+
* empty): compiled for `key`, or provided by a run of code with that sha256 for another key.
|
|
244
|
+
* Undefined otherwise, without running anything.
|
|
245
|
+
*/
|
|
246
|
+
lookup(key: string, sha256: string | undefined, name: unknown): ExtensionFactory | undefined {
|
|
247
|
+
if (!sha256) return undefined;
|
|
248
|
+
const cached = this.compiled.get(key);
|
|
249
|
+
if (cached?.sha256 === sha256) return cached.factory;
|
|
250
|
+
const module = this.modules.get(sha256);
|
|
251
|
+
const factory = typeof name === 'string' ? module?.factories.get(name) : undefined;
|
|
252
|
+
if (!module || !factory) return undefined;
|
|
253
|
+
this.remember(key, { sha256, code: module.code, factory, module });
|
|
254
|
+
return factory;
|
|
255
|
+
}
|
|
256
|
+
|
|
186
257
|
compile(key: string, request: CompileRequest): ExtensionFactory {
|
|
187
258
|
const { kind, id, name, code, entry, skipIntegrity } = request;
|
|
188
259
|
assertValidIdentifier(name, kind === 'provider' ? 'factoryName' : 'extractor name', id);
|
|
189
260
|
const label = kind === 'provider' ? 'extension' : 'extractor code';
|
|
261
|
+
const notFound = () => new Error(`Factory function '${name}' not found in ${label}`);
|
|
190
262
|
|
|
191
263
|
const sha256 = entry.sha256 ?? '';
|
|
192
264
|
const cached = this.compiled.get(key);
|
|
193
265
|
if (cached?.sha256 === sha256 && cached.code === code) return cached.factory;
|
|
194
266
|
if (!skipIntegrity) verifyExtensionCode(code, entry, this.integrityOptions);
|
|
195
267
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
268
|
+
// Only verified code with a hash is shared.
|
|
269
|
+
const shareable = !skipIntegrity && sha256 !== '';
|
|
270
|
+
const shared = shareable ? this.modules.get(sha256) : undefined;
|
|
271
|
+
if (shared && shared.code === code && shared.factories.has(name)) {
|
|
272
|
+
const factory = shared.factories.get(name);
|
|
273
|
+
if (!factory) throw notFound();
|
|
274
|
+
this.remember(key, { sha256, code, factory, module: shared });
|
|
275
|
+
return factory;
|
|
199
276
|
}
|
|
200
|
-
|
|
277
|
+
|
|
278
|
+
const siblings = shareable ? (request.siblings?.() ?? []) : [];
|
|
279
|
+
const names = [name, ...siblings.filter((sibling): sibling is string => isIdentifier(sibling) && sibling !== name)];
|
|
280
|
+
const factories = evaluateExtensionCode(code, Array.from(new Set(names)), request.globals(), kind);
|
|
281
|
+
const factory = factories.get(name);
|
|
282
|
+
if (!factory) throw notFound();
|
|
283
|
+
if (skipIntegrity) return factory;
|
|
284
|
+
// When a shared run exists (one that lacks this name), this run stays this key's own.
|
|
285
|
+
const module = shareable && !shared ? { sha256, code, factories, keys: new Set<string>() } : undefined;
|
|
286
|
+
if (module) this.modules.set(sha256, module);
|
|
287
|
+
this.remember(key, { sha256, code, factory, module });
|
|
201
288
|
return factory;
|
|
202
289
|
}
|
|
203
290
|
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Forget the compiled code of one extension or extractor (keys `${id}` and `${id}|…`), the shared
|
|
293
|
+
* runs it came from, and the compiled code of every other key that came from those runs. Returns
|
|
294
|
+
* the ids of those other keys.
|
|
295
|
+
*/
|
|
296
|
+
forget(id: string): string[] {
|
|
297
|
+
const siblings = new Set<string>();
|
|
298
|
+
for (const [key, { module }] of Array.from(this.compiled.entries())) {
|
|
299
|
+
if (!isKeyOf(key, id) || !this.compiled.has(key)) continue;
|
|
300
|
+
this.compiled.delete(key);
|
|
301
|
+
if (!module) continue;
|
|
302
|
+
if (this.modules.get(module.sha256) === module) this.modules.delete(module.sha256);
|
|
303
|
+
for (const other of module.keys) {
|
|
304
|
+
this.compiled.delete(other);
|
|
305
|
+
if (!isKeyOf(other, id)) siblings.add(idOfKey(other));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return Array.from(siblings);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Store the compiled code of `key`, moving it off the shared run it had before. */
|
|
312
|
+
private remember(key: string, compiled: CompiledCode): void {
|
|
313
|
+
const previous = this.compiled.get(key)?.module;
|
|
314
|
+
if (previous && previous !== compiled.module) {
|
|
315
|
+
previous.keys.delete(key);
|
|
316
|
+
if (!previous.keys.size && this.modules.get(previous.sha256) === previous) this.modules.delete(previous.sha256);
|
|
317
|
+
}
|
|
318
|
+
this.compiled.set(key, compiled);
|
|
319
|
+
compiled.module?.keys.add(key);
|
|
207
320
|
}
|
|
208
321
|
}
|
|
209
322
|
|
|
@@ -225,6 +338,6 @@ export function memoiseLoad<T>(cache: Map<string, Promise<T>>, key: string, load
|
|
|
225
338
|
/** Delete the entries of one extension or extractor: keys `${id}` and `${id}|…`. */
|
|
226
339
|
export function deleteEntriesOf(cache: Map<string, unknown>, id: string): void {
|
|
227
340
|
for (const key of Array.from(cache.keys())) {
|
|
228
|
-
if (key
|
|
341
|
+
if (isKeyOf(key, id)) cache.delete(key);
|
|
229
342
|
}
|
|
230
343
|
}
|
|
@@ -34,7 +34,7 @@ export class RegistryError extends Error {
|
|
|
34
34
|
readonly code: RegistryErrorCode;
|
|
35
35
|
/** Extension id or extractor name, when the error is about one entry */
|
|
36
36
|
readonly id?: string;
|
|
37
|
-
/** Every problem found, e.g. `extensions[
|
|
37
|
+
/** Every problem found, e.g. `extensions[1] (anikoto): factoryName must be a JavaScript identifier` */
|
|
38
38
|
readonly issues: string[];
|
|
39
39
|
/** Version the registry or entry needs: its `schemaVersion` or `minContextVersion` */
|
|
40
40
|
readonly required?: number;
|
|
@@ -155,6 +155,7 @@ const EXTENSION_RULES: Record<string, Rule> = {
|
|
|
155
155
|
isSourceEmbed: flag.optional,
|
|
156
156
|
isSourceDirect: flag.optional,
|
|
157
157
|
haveMultiServers: flag.optional,
|
|
158
|
+
recommended: flag.optional,
|
|
158
159
|
};
|
|
159
160
|
|
|
160
161
|
const EXTRACTOR_RULES: Record<string, Rule> = {
|
package/src/utils/tmdb.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TvType, type IMovieInfo, type IMovieResult, type ISearch } from '../models';
|
|
1
|
+
import { MediaStatus, TvType, type IMovieInfo, type IMovieResult, type ISearch } from '../models';
|
|
2
2
|
import { emptySearch } from '../providers/common/search';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -58,8 +58,11 @@ export const resolveTmdbApiKey = (apiKey: string | undefined, className: string)
|
|
|
58
58
|
return SHARED_TMDB_API_KEY;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* A TMDB image URL at `size` (`w185`, `w342`, `w780`, `w1280`, `original`, ...); undefined when TMDB has no image.
|
|
63
|
+
* `original` is the uploaded file, often 2000 px and about 1 MB, so each image asks for the size apps show it at.
|
|
64
|
+
*/
|
|
65
|
+
export const tmdbImage = (path: string | null | undefined, size: string): string | undefined =>
|
|
63
66
|
path ? `https://image.tmdb.org/t/p/${size}${path}` : undefined;
|
|
64
67
|
|
|
65
68
|
/** A season poster or episode still in the two sizes apps show them at. */
|
|
@@ -96,13 +99,54 @@ export const tmdbMultiSearch = async (
|
|
|
96
99
|
export const mapTmdbResult = (result: any, mediaType?: TmdbMediaType): IMovieResult => ({
|
|
97
100
|
id: String(result.id),
|
|
98
101
|
title: result.title || result.name,
|
|
99
|
-
image: tmdbImage(result.poster_path),
|
|
102
|
+
image: tmdbImage(result.poster_path, 'w342'),
|
|
103
|
+
// The info's size, so opening the title finds the backdrop already loaded
|
|
104
|
+
cover: tmdbImage(result.backdrop_path, 'w1280'),
|
|
105
|
+
description: result.overview || undefined,
|
|
100
106
|
// Recommendations carry media_type; similar titles don't, and are of the requested type.
|
|
101
107
|
type: (result.media_type ?? mediaType) === 'movie' ? TvType.MOVIE : TvType.TVSERIES,
|
|
102
108
|
rating: result.vote_average || 0,
|
|
103
109
|
releaseDate: releaseYear(result),
|
|
104
110
|
});
|
|
105
111
|
|
|
112
|
+
const SHOW_STATUSES: Record<string, MediaStatus> = {
|
|
113
|
+
'Returning Series': MediaStatus.ONGOING,
|
|
114
|
+
'In Production': MediaStatus.ONGOING,
|
|
115
|
+
'Ended': MediaStatus.COMPLETED,
|
|
116
|
+
'Canceled': MediaStatus.COMPLETED,
|
|
117
|
+
'Planned': MediaStatus.NOT_YET_AIRED,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const MOVIE_STATUSES: Record<string, MediaStatus> = {
|
|
121
|
+
'Released': MediaStatus.COMPLETED,
|
|
122
|
+
'Rumored': MediaStatus.NOT_YET_AIRED,
|
|
123
|
+
'Planned': MediaStatus.NOT_YET_AIRED,
|
|
124
|
+
'In Production': MediaStatus.NOT_YET_AIRED,
|
|
125
|
+
'Post Production': MediaStatus.NOT_YET_AIRED,
|
|
126
|
+
'Canceled': MediaStatus.CANCELLED,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* TMDB's `status` of a show or movie as a MediaStatus: a show that is airing or between seasons is
|
|
131
|
+
* ONGOING, one that ended or was canceled COMPLETED; a released movie is COMPLETED, an unreleased
|
|
132
|
+
* one NOT_YET_AIRED. A status TMDB adds later is UNKNOWN; undefined when TMDB sends none.
|
|
133
|
+
*/
|
|
134
|
+
export const tmdbStatus = (status: unknown, mediaType: TmdbMediaType): MediaStatus | undefined => {
|
|
135
|
+
if (typeof status !== 'string' || !status) return undefined;
|
|
136
|
+
const statuses = mediaType === 'movie' ? MOVIE_STATUSES : SHOW_STATUSES;
|
|
137
|
+
return Object.prototype.hasOwnProperty.call(statuses, status) ? statuses[status] : MediaStatus.UNKNOWN;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* TMDB's `with_status` codes of the shows of each MediaStatus tmdbStatus gives (0 Returning Series,
|
|
142
|
+
* 1 Planned, 2 In Production, 3 Ended, 4 Canceled), for `/discover/tv`.
|
|
143
|
+
*/
|
|
144
|
+
export const TMDB_SHOW_STATUS_FILTERS: Partial<Record<MediaStatus, string>> = {
|
|
145
|
+
[MediaStatus.ONGOING]: '0|2',
|
|
146
|
+
[MediaStatus.COMPLETED]: '3|4',
|
|
147
|
+
[MediaStatus.NOT_YET_AIRED]: '1',
|
|
148
|
+
};
|
|
149
|
+
|
|
106
150
|
/** A list of TMDB results, or undefined when TMDB sent none. */
|
|
107
151
|
export const mapTmdbResults = (list: any, mediaType: TmdbMediaType): IMovieResult[] | undefined =>
|
|
108
152
|
list?.results?.length ? list.results.map((result: any) => mapTmdbResult(result, mediaType)) : undefined;
|
|
@@ -115,10 +159,12 @@ export const mapTmdbInfo = (data: any, mediaType: TmdbMediaType) => {
|
|
|
115
159
|
const video = data?.videos?.results?.[0];
|
|
116
160
|
return {
|
|
117
161
|
title: data?.title || data?.name,
|
|
118
|
-
|
|
119
|
-
|
|
162
|
+
// Large enough for the poster opened full screen
|
|
163
|
+
image: tmdbImage(data?.poster_path, 'w780'),
|
|
164
|
+
cover: tmdbImage(data?.backdrop_path, 'w1280'),
|
|
120
165
|
type: mediaType === 'movie' ? TvType.MOVIE : TvType.TVSERIES,
|
|
121
166
|
rating: data?.vote_average || 0,
|
|
167
|
+
status: tmdbStatus(data?.status, mediaType),
|
|
122
168
|
releaseDate: data?.release_date || data?.first_air_date,
|
|
123
169
|
description: data?.overview,
|
|
124
170
|
genres: data?.genres?.map((genre: { name: string }) => genre.name),
|
|
@@ -130,7 +176,7 @@ export const mapTmdbInfo = (data: any, mediaType: TmdbMediaType) => {
|
|
|
130
176
|
name: cast.name,
|
|
131
177
|
url: `https://www.themoviedb.org/person/${cast.id}`,
|
|
132
178
|
character: cast.character,
|
|
133
|
-
image: tmdbImage(cast.profile_path),
|
|
179
|
+
image: tmdbImage(cast.profile_path, 'w185'),
|
|
134
180
|
})),
|
|
135
181
|
trailer: video?.key
|
|
136
182
|
? { id: video.key, site: video.site, url: `https://www.youtube.com/watch?v=${video.key}` }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AniNeko = void 0;
|
|
7
|
-
var _index = require("../../../models/index.js");
|
|
8
|
-
var _providerClass = require("../../provider-class.js");
|
|
9
|
-
var _createAnineko = require("./create-anineko.js");
|
|
10
|
-
const AniNeko = exports.AniNeko = (0, _providerClass.providerClass)(_index.AnimeParser, _createAnineko.createAniNeko);
|
|
11
|
-
//# sourceMappingURL=anineko.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_index","require","_providerClass","_createAnineko","AniNeko","exports","providerClass","AnimeParser","createAniNeko"],"sourceRoot":"../../../../../src","sources":["providers/anime/anineko/anineko.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,MAAMG,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,IAAAE,4BAAa,EAACC,kBAAW,EAAEC,4BAAa,CAAC","ignoreList":[]}
|