fix: adjust idPrefixes handling to improve compatibility in most cases

This commit is contained in:
Viren070
2025-06-20 16:52:20 +01:00
parent a5f32df451
commit 7fa8ba71fb
+17 -7
View File
@@ -766,19 +766,29 @@ export class AIOStreams {
// in this case, stremio assumes we only support that resource for the specified id prefix and then
// will not send a request to AIOStreams for other id prefixes even though our other addon that didn't specify
// an id prefix technically says it supports all ids
// leaving idPrefixes as null/undefined causes various odd issues with stremio even though it says it is optional.
// therefore, we set it as normal, but if there comes an addon that doesn't support any id prefixes, we set it to null
// this fixes issues in most cases as most addons do provide idPrefixes
if (existing) {
existing.types = [...new Set([...existing.types, ...resource.types])];
// if (resource.idPrefixes) {
// existing.idPrefixes = existing.idPrefixes || [];
// existing.idPrefixes = [
// ...new Set([...existing.idPrefixes, ...resource.idPrefixes]),
// ];
// }
if (resource.idPrefixes) {
existing.idPrefixes = existing.idPrefixes || [];
existing.idPrefixes = [
...new Set([...existing.idPrefixes, ...resource.idPrefixes]),
];
} else {
// if an addon for this type does not provide idPrefixes, we set it to null
// to ensure it works with at least some platforms on stremio rather than none.
existing.idPrefixes = null;
}
} else {
this.finalResources.push({
...resource,
// explicitly set to null
idPrefixes: null,
idPrefixes: resource.idPrefixes?.length
? resource.idPrefixes
: null,
// idPrefixes: resource.idPrefixes
// ? [...resource.idPrefixes]
// : undefined,