Merge branch 'dev' into pr/14

This commit is contained in:
Jorrin
2023-12-25 22:41:25 +01:00
45 changed files with 3646 additions and 6006 deletions

View File

@@ -6,6 +6,7 @@ import { EmbedOutput, SourcererOutput } from '@/providers/base';
import { ProviderList } from '@/providers/get';
import { ScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors';
import { isValidStream } from '@/utils/valid';
export type IndividualSourceRunnerOptions = {
features: FeatureMap;
@@ -50,7 +51,7 @@ export async function scrapeInvidualSource(
});
// stream doesn't satisfy the feature flags, so gets removed in output
if (output?.stream && !flagsAllowedInFeatures(ops.features, output.stream.flags)) {
if (output?.stream && (!isValidStream(output.stream) || !flagsAllowedInFeatures(ops.features, output.stream.flags))) {
output.stream = undefined;
}
@@ -89,7 +90,9 @@ export async function scrapeIndividualEmbed(
},
});
if (!isValidStream(output.stream)) throw new NotFoundError('stream is incomplete');
if (!flagsAllowedInFeatures(ops.features, output.stream.flags))
throw new NotFoundError("stream doesn't satisfy target feature flags");
return output;
}