1
1
import { makeControls } from '@/entrypoint/controls' ;
2
- import { getBuiltinEmbeds , getBuiltinSources } from '@/entrypoint/providers' ;
2
+ import { getBuiltinEmbeds , getBuiltinExternalSources , getBuiltinSources } from '@/entrypoint/providers' ;
3
3
import { Targets , getTargetFeatures } from '@/entrypoint/utils/targets' ;
4
4
import { Fetcher } from '@/fetchers/types' ;
5
5
import { getProviders } from '@/providers/get' ;
@@ -19,6 +19,9 @@ export interface ProviderMakerOptions {
19
19
// the device that the stream will be played on
20
20
consistentIpForRequests ?: boolean ;
21
21
22
+ // used to add built in sources which aren't used by default aka external sources
23
+ externalSources ?: 'all' | string [ ] ;
24
+
22
25
// This is temporary
23
26
proxyStreams ?: boolean ;
24
27
}
@@ -29,9 +32,21 @@ export function makeProviders(ops: ProviderMakerOptions) {
29
32
ops . consistentIpForRequests ?? false ,
30
33
ops . proxyStreams ,
31
34
) ;
35
+
36
+ const sources = [ ...getBuiltinSources ( ) ] ;
37
+
38
+ if ( ops . externalSources === 'all' ) sources . push ( ...getBuiltinExternalSources ( ) ) ;
39
+ else {
40
+ ops . externalSources ?. forEach ( ( source ) => {
41
+ const matchingSource = getBuiltinExternalSources ( ) . find ( ( v ) => v . id === source ) ;
42
+ if ( ! matchingSource ) return ;
43
+ sources . push ( matchingSource ) ;
44
+ } ) ;
45
+ }
46
+
32
47
const list = getProviders ( features , {
33
48
embeds : getBuiltinEmbeds ( ) ,
34
- sources : getBuiltinSources ( ) ,
49
+ sources,
35
50
} ) ;
36
51
37
52
return makeControls ( {
0 commit comments