@churchapps/content-providers 0.13.1 → 0.14.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/dist/index.cjs +140 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +139 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -610,6 +610,77 @@ declare function servicesToInstances(services: MdnsService[], port?: number): Pr
|
|
|
610
610
|
declare function networkInstanceToAuth(instance: NetworkInstance): ContentProviderAuthData;
|
|
611
611
|
declare function authToNetworkInstance(auth?: ContentProviderAuthData | null): NetworkInstance | null;
|
|
612
612
|
|
|
613
|
+
interface GoCurriculumPlaylistItem {
|
|
614
|
+
title: string;
|
|
615
|
+
file: string;
|
|
616
|
+
url: string;
|
|
617
|
+
mediaType?: string;
|
|
618
|
+
duration?: number;
|
|
619
|
+
thumbnail?: string;
|
|
620
|
+
shareUrl?: string;
|
|
621
|
+
}
|
|
622
|
+
interface GoCurriculumResource {
|
|
623
|
+
title: string;
|
|
624
|
+
file: string;
|
|
625
|
+
url: string;
|
|
626
|
+
shareUrl?: string;
|
|
627
|
+
}
|
|
628
|
+
interface GoCurriculumLesson {
|
|
629
|
+
id: string;
|
|
630
|
+
name: string;
|
|
631
|
+
thumbnail?: string;
|
|
632
|
+
bigIdea?: string;
|
|
633
|
+
bibleBasis?: string;
|
|
634
|
+
keyVerse?: string;
|
|
635
|
+
playlist: GoCurriculumPlaylistItem[];
|
|
636
|
+
resources?: GoCurriculumResource[];
|
|
637
|
+
}
|
|
638
|
+
interface GoCurriculumCollection {
|
|
639
|
+
id: string;
|
|
640
|
+
name: string;
|
|
641
|
+
thumbnail?: string;
|
|
642
|
+
lessons: GoCurriculumLesson[];
|
|
643
|
+
}
|
|
644
|
+
interface GoCurriculumData {
|
|
645
|
+
generatedAt?: string;
|
|
646
|
+
provider?: {
|
|
647
|
+
name?: string;
|
|
648
|
+
};
|
|
649
|
+
catalog: GoCurriculumCollection[];
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
type GoCurriculumCatalogLoader = (groupId: string, auth: ContentProviderAuthData) => Promise<GoCurriculumData | null>;
|
|
653
|
+
declare class GoCurriculumProvider extends BaseProvider {
|
|
654
|
+
private readonly oauthHelper;
|
|
655
|
+
private readonly verifiedTokens;
|
|
656
|
+
readonly id = "gocurriculum";
|
|
657
|
+
readonly name = "Go Curriculum";
|
|
658
|
+
readonly logos: ProviderLogos;
|
|
659
|
+
readonly config: ContentProviderConfig;
|
|
660
|
+
private data;
|
|
661
|
+
private dataFetchedAt;
|
|
662
|
+
private loadCatalog;
|
|
663
|
+
setCatalogLoader(loader: GoCurriculumCatalogLoader): void;
|
|
664
|
+
private getData;
|
|
665
|
+
private getCollection;
|
|
666
|
+
getCatalog(groupId: string, auth?: ContentProviderAuthData | null): Promise<GoCurriculumData | null>;
|
|
667
|
+
readonly requiresAuth = true;
|
|
668
|
+
readonly authTypes: AuthType[];
|
|
669
|
+
readonly capabilities: ProviderCapabilities;
|
|
670
|
+
private verifyAuth;
|
|
671
|
+
browse(path?: string | null, auth?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
672
|
+
private getLessonFiles;
|
|
673
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
674
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
675
|
+
generateCodeVerifier(): string;
|
|
676
|
+
buildAuthUrl(codeVerifier: string, redirectUri: string, state?: string): Promise<{
|
|
677
|
+
url: string;
|
|
678
|
+
challengeMethod: string;
|
|
679
|
+
}>;
|
|
680
|
+
buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
|
|
681
|
+
exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
682
|
+
}
|
|
683
|
+
|
|
613
684
|
/** Browses Life.Church's kids curriculum from a static catalog (series → units → lessons), plus a weekly scheduled lesson index. */
|
|
614
685
|
declare class LifeChurchProvider extends BaseProvider {
|
|
615
686
|
readonly id = "lifechurch";
|
|
@@ -653,4 +724,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
653
724
|
*/
|
|
654
725
|
declare const VERSION: string;
|
|
655
726
|
|
|
656
|
-
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, FREESHOW_REST_PORT, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, type FreeShowDiscoverer, FreeShowProvider, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MdnsService, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, type NetworkInstance, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, authToNetworkInstance, servicesToInstances as freeShowServicesToInstances, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, networkInstanceToAuth, registerProvider, setProviderSecret, toAuthData };
|
|
727
|
+
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, FREESHOW_REST_PORT, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, type FreeShowDiscoverer, FreeShowProvider, type GoCurriculumCatalogLoader, type GoCurriculumData, GoCurriculumProvider, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MdnsService, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, type NetworkInstance, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, authToNetworkInstance, servicesToInstances as freeShowServicesToInstances, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, networkInstanceToAuth, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.d.ts
CHANGED
|
@@ -610,6 +610,77 @@ declare function servicesToInstances(services: MdnsService[], port?: number): Pr
|
|
|
610
610
|
declare function networkInstanceToAuth(instance: NetworkInstance): ContentProviderAuthData;
|
|
611
611
|
declare function authToNetworkInstance(auth?: ContentProviderAuthData | null): NetworkInstance | null;
|
|
612
612
|
|
|
613
|
+
interface GoCurriculumPlaylistItem {
|
|
614
|
+
title: string;
|
|
615
|
+
file: string;
|
|
616
|
+
url: string;
|
|
617
|
+
mediaType?: string;
|
|
618
|
+
duration?: number;
|
|
619
|
+
thumbnail?: string;
|
|
620
|
+
shareUrl?: string;
|
|
621
|
+
}
|
|
622
|
+
interface GoCurriculumResource {
|
|
623
|
+
title: string;
|
|
624
|
+
file: string;
|
|
625
|
+
url: string;
|
|
626
|
+
shareUrl?: string;
|
|
627
|
+
}
|
|
628
|
+
interface GoCurriculumLesson {
|
|
629
|
+
id: string;
|
|
630
|
+
name: string;
|
|
631
|
+
thumbnail?: string;
|
|
632
|
+
bigIdea?: string;
|
|
633
|
+
bibleBasis?: string;
|
|
634
|
+
keyVerse?: string;
|
|
635
|
+
playlist: GoCurriculumPlaylistItem[];
|
|
636
|
+
resources?: GoCurriculumResource[];
|
|
637
|
+
}
|
|
638
|
+
interface GoCurriculumCollection {
|
|
639
|
+
id: string;
|
|
640
|
+
name: string;
|
|
641
|
+
thumbnail?: string;
|
|
642
|
+
lessons: GoCurriculumLesson[];
|
|
643
|
+
}
|
|
644
|
+
interface GoCurriculumData {
|
|
645
|
+
generatedAt?: string;
|
|
646
|
+
provider?: {
|
|
647
|
+
name?: string;
|
|
648
|
+
};
|
|
649
|
+
catalog: GoCurriculumCollection[];
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
type GoCurriculumCatalogLoader = (groupId: string, auth: ContentProviderAuthData) => Promise<GoCurriculumData | null>;
|
|
653
|
+
declare class GoCurriculumProvider extends BaseProvider {
|
|
654
|
+
private readonly oauthHelper;
|
|
655
|
+
private readonly verifiedTokens;
|
|
656
|
+
readonly id = "gocurriculum";
|
|
657
|
+
readonly name = "Go Curriculum";
|
|
658
|
+
readonly logos: ProviderLogos;
|
|
659
|
+
readonly config: ContentProviderConfig;
|
|
660
|
+
private data;
|
|
661
|
+
private dataFetchedAt;
|
|
662
|
+
private loadCatalog;
|
|
663
|
+
setCatalogLoader(loader: GoCurriculumCatalogLoader): void;
|
|
664
|
+
private getData;
|
|
665
|
+
private getCollection;
|
|
666
|
+
getCatalog(groupId: string, auth?: ContentProviderAuthData | null): Promise<GoCurriculumData | null>;
|
|
667
|
+
readonly requiresAuth = true;
|
|
668
|
+
readonly authTypes: AuthType[];
|
|
669
|
+
readonly capabilities: ProviderCapabilities;
|
|
670
|
+
private verifyAuth;
|
|
671
|
+
browse(path?: string | null, auth?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
672
|
+
private getLessonFiles;
|
|
673
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
674
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
675
|
+
generateCodeVerifier(): string;
|
|
676
|
+
buildAuthUrl(codeVerifier: string, redirectUri: string, state?: string): Promise<{
|
|
677
|
+
url: string;
|
|
678
|
+
challengeMethod: string;
|
|
679
|
+
}>;
|
|
680
|
+
buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
|
|
681
|
+
exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
682
|
+
}
|
|
683
|
+
|
|
613
684
|
/** Browses Life.Church's kids curriculum from a static catalog (series → units → lessons), plus a weekly scheduled lesson index. */
|
|
614
685
|
declare class LifeChurchProvider extends BaseProvider {
|
|
615
686
|
readonly id = "lifechurch";
|
|
@@ -653,4 +724,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
653
724
|
*/
|
|
654
725
|
declare const VERSION: string;
|
|
655
726
|
|
|
656
|
-
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, FREESHOW_REST_PORT, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, type FreeShowDiscoverer, FreeShowProvider, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MdnsService, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, type NetworkInstance, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, authToNetworkInstance, servicesToInstances as freeShowServicesToInstances, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, networkInstanceToAuth, registerProvider, setProviderSecret, toAuthData };
|
|
727
|
+
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, FREESHOW_REST_PORT, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, type FreeShowDiscoverer, FreeShowProvider, type GoCurriculumCatalogLoader, type GoCurriculumData, GoCurriculumProvider, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MdnsService, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, type NetworkInstance, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, authToNetworkInstance, servicesToInstances as freeShowServicesToInstances, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, networkInstanceToAuth, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.js
CHANGED
|
@@ -12737,6 +12737,143 @@ var FreeShowProvider = class extends BaseProvider {
|
|
|
12737
12737
|
}
|
|
12738
12738
|
};
|
|
12739
12739
|
|
|
12740
|
+
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
12741
|
+
var GROUPS = [
|
|
12742
|
+
{ id: "elementary", name: "Elementary" },
|
|
12743
|
+
{ id: "preschool", name: "Preschool" }
|
|
12744
|
+
];
|
|
12745
|
+
var CATALOG_TTL_MS = 60 * 60 * 1e3;
|
|
12746
|
+
async function loadFromFeed(groupId) {
|
|
12747
|
+
let url;
|
|
12748
|
+
try {
|
|
12749
|
+
url = JSON.parse(getProviderSecret("gocurriculumFeeds") || "{}")[groupId];
|
|
12750
|
+
} catch {
|
|
12751
|
+
return null;
|
|
12752
|
+
}
|
|
12753
|
+
if (!url) return null;
|
|
12754
|
+
const response = await fetch(url);
|
|
12755
|
+
return response.ok ? await response.json() : null;
|
|
12756
|
+
}
|
|
12757
|
+
var GoCurriculumProvider = class extends BaseProvider {
|
|
12758
|
+
constructor() {
|
|
12759
|
+
super(...arguments);
|
|
12760
|
+
this.oauthHelper = new OAuthHelper();
|
|
12761
|
+
this.verifiedTokens = /* @__PURE__ */ new Set();
|
|
12762
|
+
this.id = "gocurriculum";
|
|
12763
|
+
this.name = "Go Curriculum";
|
|
12764
|
+
this.logos = {
|
|
12765
|
+
light: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png",
|
|
12766
|
+
dark: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png"
|
|
12767
|
+
};
|
|
12768
|
+
this.config = {
|
|
12769
|
+
id: "gocurriculum",
|
|
12770
|
+
name: "Go Curriculum",
|
|
12771
|
+
apiBase: "https://gocurriculum.com",
|
|
12772
|
+
oauthBase: "https://gocurriculum.com/oauth",
|
|
12773
|
+
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
12774
|
+
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
12775
|
+
get clientSecret() {
|
|
12776
|
+
return getProviderSecret("gocurriculum");
|
|
12777
|
+
},
|
|
12778
|
+
scopes: ["basic"]
|
|
12779
|
+
};
|
|
12780
|
+
this.data = {};
|
|
12781
|
+
this.dataFetchedAt = 0;
|
|
12782
|
+
this.loadCatalog = loadFromFeed;
|
|
12783
|
+
this.requiresAuth = true;
|
|
12784
|
+
this.authTypes = ["oauth_pkce"];
|
|
12785
|
+
this.capabilities = { browse: true, playlist: true, instructions: true, mediaLicensing: false };
|
|
12786
|
+
}
|
|
12787
|
+
setCatalogLoader(loader) {
|
|
12788
|
+
this.loadCatalog = loader;
|
|
12789
|
+
this.dataFetchedAt = 0;
|
|
12790
|
+
}
|
|
12791
|
+
async getData(groupId, auth) {
|
|
12792
|
+
if (Date.now() - this.dataFetchedAt >= CATALOG_TTL_MS) {
|
|
12793
|
+
await Promise.all(GROUPS.map(async (g) => {
|
|
12794
|
+
try {
|
|
12795
|
+
const data = await this.loadCatalog(g.id, auth);
|
|
12796
|
+
if (data) this.data[g.id] = data;
|
|
12797
|
+
} catch {
|
|
12798
|
+
}
|
|
12799
|
+
}));
|
|
12800
|
+
if (GROUPS.every((g) => this.data[g.id])) this.dataFetchedAt = Date.now();
|
|
12801
|
+
}
|
|
12802
|
+
return this.data[groupId];
|
|
12803
|
+
}
|
|
12804
|
+
async getCollection(segments, auth) {
|
|
12805
|
+
return (await this.getData(segments[0], auth))?.catalog.find((c) => c.id === segments[1]);
|
|
12806
|
+
}
|
|
12807
|
+
// what a server host returns to a device host's setCatalogLoader
|
|
12808
|
+
async getCatalog(groupId, auth) {
|
|
12809
|
+
if (!auth || !await this.verifyAuth(auth)) return null;
|
|
12810
|
+
return await this.getData(groupId, auth) || null;
|
|
12811
|
+
}
|
|
12812
|
+
// ponytail: any valid login unlocks everything for the pilot — per-tier (MemberPress) filtering waits on Go's membership endpoint
|
|
12813
|
+
async verifyAuth(auth) {
|
|
12814
|
+
const token = auth?.access_token;
|
|
12815
|
+
if (!token) return false;
|
|
12816
|
+
if (this.verifiedTokens.has(token)) return true;
|
|
12817
|
+
try {
|
|
12818
|
+
const response = await fetch(`${this.config.oauthBase}/me`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ access_token: token }).toString() });
|
|
12819
|
+
if (!response.ok) return false;
|
|
12820
|
+
this.verifiedTokens.add(token);
|
|
12821
|
+
return true;
|
|
12822
|
+
} catch {
|
|
12823
|
+
return false;
|
|
12824
|
+
}
|
|
12825
|
+
}
|
|
12826
|
+
async browse(path, auth) {
|
|
12827
|
+
if (!auth || !await this.verifyAuth(auth)) return [];
|
|
12828
|
+
const { segments, depth } = parsePath(path);
|
|
12829
|
+
if (depth === 0) return GROUPS.map((g) => createFolder(g.id, g.name, `/${g.id}`));
|
|
12830
|
+
if (depth === 1) return ((await this.getData(segments[0], auth))?.catalog || []).map((c) => createFolder(c.id, c.name, `/${segments[0]}/${c.id}`, c.thumbnail));
|
|
12831
|
+
const collection = await this.getCollection(segments, auth);
|
|
12832
|
+
if (!collection) return [];
|
|
12833
|
+
if (depth === 2) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${segments[0]}/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
12834
|
+
if (depth === 3) return this.getLessonFiles(collection, segments[2]);
|
|
12835
|
+
return [];
|
|
12836
|
+
}
|
|
12837
|
+
getLessonFiles(collection, lessonId) {
|
|
12838
|
+
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
12839
|
+
if (!lesson) return [];
|
|
12840
|
+
return lesson.playlist.map((f) => createFile(slugify(f.file), f.title, f.url, { mediaType: detectMediaType(`${f.url} ${f.file}`, f.mediaType), thumbnail: f.thumbnail || lesson.thumbnail || collection.thumbnail, seconds: f.duration }));
|
|
12841
|
+
}
|
|
12842
|
+
async getPlaylist(path, auth, _resolution) {
|
|
12843
|
+
if (!auth || !await this.verifyAuth(auth)) return null;
|
|
12844
|
+
const { segments, depth } = parsePath(path);
|
|
12845
|
+
if (depth !== 3) return null;
|
|
12846
|
+
const collection = await this.getCollection(segments, auth);
|
|
12847
|
+
if (!collection) return null;
|
|
12848
|
+
const files = this.getLessonFiles(collection, segments[2]);
|
|
12849
|
+
return files.length > 0 ? files : null;
|
|
12850
|
+
}
|
|
12851
|
+
async getInstructions(path, auth) {
|
|
12852
|
+
const { segments, depth } = parsePath(path);
|
|
12853
|
+
if (depth !== 3) return null;
|
|
12854
|
+
const files = await this.getPlaylist(path, auth);
|
|
12855
|
+
if (!files || !auth) return null;
|
|
12856
|
+
const collection = await this.getCollection(segments, auth);
|
|
12857
|
+
const lesson = collection?.lessons.find((l) => l.id === segments[2]);
|
|
12858
|
+
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
12859
|
+
const downloads = (lesson?.resources || []).filter((r) => r.url && !isPlaylistMedia(r.url, void 0, r.file)).map((r) => ({ id: slugify(r.file || r.title), title: r.title || r.file, url: r.url }));
|
|
12860
|
+
if (downloads.length > 0) instructions.downloads = downloads;
|
|
12861
|
+
return instructions;
|
|
12862
|
+
}
|
|
12863
|
+
generateCodeVerifier() {
|
|
12864
|
+
return this.oauthHelper.generateCodeVerifier();
|
|
12865
|
+
}
|
|
12866
|
+
async buildAuthUrl(codeVerifier, redirectUri, state) {
|
|
12867
|
+
return this.oauthHelper.buildAuthUrl(this.config, codeVerifier, redirectUri, state || this.id);
|
|
12868
|
+
}
|
|
12869
|
+
buildAuthUrlFromChallenge(codeChallenge, redirectUri, state) {
|
|
12870
|
+
return this.oauthHelper.buildAuthUrlFromChallenge(this.config, codeChallenge, redirectUri, state);
|
|
12871
|
+
}
|
|
12872
|
+
async exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
12873
|
+
return this.oauthHelper.exchangeCodeForTokens(this.config, this.id, code, codeVerifier, redirectUri);
|
|
12874
|
+
}
|
|
12875
|
+
};
|
|
12876
|
+
|
|
12740
12877
|
// src/providers/lifeChurch/data.json
|
|
12741
12878
|
var data_default3 = {
|
|
12742
12879
|
generatedAt: "2026-05-09T20:14:53.089Z",
|
|
@@ -16544,122 +16681,6 @@ function registerProvider(provider) {
|
|
|
16544
16681
|
providerRegistry.set(provider.id, provider);
|
|
16545
16682
|
}
|
|
16546
16683
|
|
|
16547
|
-
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
16548
|
-
var FEEDS = [
|
|
16549
|
-
{ id: "elementary", name: "Elementary", url: "https://dl.dropboxusercontent.com/scl/fi/xortbrs2nk49wemscubpu/data.json?rlkey=gnzxyrauhud7xtjlejrs8ysp7" },
|
|
16550
|
-
{ id: "preschool", name: "Preschool", url: "https://dl.dropboxusercontent.com/scl/fi/1cdovbglp5rpfmb9mdg2s/data.json?rlkey=miwsssb0o7i2wdijrdc7jjqcl" }
|
|
16551
|
-
];
|
|
16552
|
-
var CATALOG_TTL_MS = 60 * 60 * 1e3;
|
|
16553
|
-
var GoCurriculumProvider = class extends BaseProvider {
|
|
16554
|
-
constructor() {
|
|
16555
|
-
super(...arguments);
|
|
16556
|
-
this.oauthHelper = new OAuthHelper();
|
|
16557
|
-
this.verifiedTokens = /* @__PURE__ */ new Set();
|
|
16558
|
-
this.id = "gocurriculum";
|
|
16559
|
-
this.name = "Go Curriculum";
|
|
16560
|
-
this.logos = {
|
|
16561
|
-
light: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png",
|
|
16562
|
-
dark: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png"
|
|
16563
|
-
};
|
|
16564
|
-
this.config = {
|
|
16565
|
-
id: "gocurriculum",
|
|
16566
|
-
name: "Go Curriculum",
|
|
16567
|
-
apiBase: "https://gocurriculum.com",
|
|
16568
|
-
oauthBase: "https://gocurriculum.com/oauth",
|
|
16569
|
-
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
16570
|
-
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
16571
|
-
get clientSecret() {
|
|
16572
|
-
return getProviderSecret("gocurriculum");
|
|
16573
|
-
},
|
|
16574
|
-
scopes: ["basic"]
|
|
16575
|
-
};
|
|
16576
|
-
this.data = {};
|
|
16577
|
-
this.dataFetchedAt = 0;
|
|
16578
|
-
this.requiresAuth = true;
|
|
16579
|
-
this.authTypes = ["oauth_pkce"];
|
|
16580
|
-
this.capabilities = { browse: true, playlist: true, instructions: true, mediaLicensing: false };
|
|
16581
|
-
}
|
|
16582
|
-
async getData(groupId) {
|
|
16583
|
-
if (Date.now() - this.dataFetchedAt >= CATALOG_TTL_MS) {
|
|
16584
|
-
await Promise.all(FEEDS.map(async (f) => {
|
|
16585
|
-
try {
|
|
16586
|
-
const response = await fetch(f.url);
|
|
16587
|
-
if (response.ok) this.data[f.id] = await response.json();
|
|
16588
|
-
} catch {
|
|
16589
|
-
}
|
|
16590
|
-
}));
|
|
16591
|
-
if (FEEDS.every((f) => this.data[f.id])) this.dataFetchedAt = Date.now();
|
|
16592
|
-
}
|
|
16593
|
-
return this.data[groupId];
|
|
16594
|
-
}
|
|
16595
|
-
async getCollection(segments) {
|
|
16596
|
-
return (await this.getData(segments[0]))?.catalog.find((c) => c.id === segments[1]);
|
|
16597
|
-
}
|
|
16598
|
-
// ponytail: any valid login unlocks everything for the pilot — per-tier (MemberPress) filtering waits on Go's membership endpoint
|
|
16599
|
-
async verifyAuth(auth) {
|
|
16600
|
-
const token = auth?.access_token;
|
|
16601
|
-
if (!token) return false;
|
|
16602
|
-
if (this.verifiedTokens.has(token)) return true;
|
|
16603
|
-
try {
|
|
16604
|
-
const response = await fetch(`${this.config.oauthBase}/me`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ access_token: token }).toString() });
|
|
16605
|
-
if (!response.ok) return false;
|
|
16606
|
-
this.verifiedTokens.add(token);
|
|
16607
|
-
return true;
|
|
16608
|
-
} catch {
|
|
16609
|
-
return false;
|
|
16610
|
-
}
|
|
16611
|
-
}
|
|
16612
|
-
async browse(path, auth) {
|
|
16613
|
-
if (!await this.verifyAuth(auth)) return [];
|
|
16614
|
-
const { segments, depth } = parsePath(path);
|
|
16615
|
-
if (depth === 0) return FEEDS.map((f) => createFolder(f.id, f.name, `/${f.id}`));
|
|
16616
|
-
if (depth === 1) return ((await this.getData(segments[0]))?.catalog || []).map((c) => createFolder(c.id, c.name, `/${segments[0]}/${c.id}`, c.thumbnail));
|
|
16617
|
-
const collection = await this.getCollection(segments);
|
|
16618
|
-
if (!collection) return [];
|
|
16619
|
-
if (depth === 2) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${segments[0]}/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
16620
|
-
if (depth === 3) return this.getLessonFiles(collection, segments[2]);
|
|
16621
|
-
return [];
|
|
16622
|
-
}
|
|
16623
|
-
getLessonFiles(collection, lessonId) {
|
|
16624
|
-
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
16625
|
-
if (!lesson) return [];
|
|
16626
|
-
return lesson.playlist.map((f) => createFile(slugify(f.file), f.title, f.url, { mediaType: detectMediaType(`${f.url} ${f.file}`, f.mediaType), thumbnail: f.thumbnail || lesson.thumbnail || collection.thumbnail, seconds: f.duration }));
|
|
16627
|
-
}
|
|
16628
|
-
async getPlaylist(path, auth, _resolution) {
|
|
16629
|
-
if (!await this.verifyAuth(auth)) return null;
|
|
16630
|
-
const { segments, depth } = parsePath(path);
|
|
16631
|
-
if (depth !== 3) return null;
|
|
16632
|
-
const collection = await this.getCollection(segments);
|
|
16633
|
-
if (!collection) return null;
|
|
16634
|
-
const files = this.getLessonFiles(collection, segments[2]);
|
|
16635
|
-
return files.length > 0 ? files : null;
|
|
16636
|
-
}
|
|
16637
|
-
async getInstructions(path, auth) {
|
|
16638
|
-
const { segments, depth } = parsePath(path);
|
|
16639
|
-
if (depth !== 3) return null;
|
|
16640
|
-
const files = await this.getPlaylist(path, auth);
|
|
16641
|
-
if (!files) return null;
|
|
16642
|
-
const collection = await this.getCollection(segments);
|
|
16643
|
-
const lesson = collection?.lessons.find((l) => l.id === segments[2]);
|
|
16644
|
-
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
16645
|
-
const downloads = (lesson?.resources || []).filter((r) => r.url && !isPlaylistMedia(r.url, void 0, r.file)).map((r) => ({ id: slugify(r.file || r.title), title: r.title || r.file, url: r.url }));
|
|
16646
|
-
if (downloads.length > 0) instructions.downloads = downloads;
|
|
16647
|
-
return instructions;
|
|
16648
|
-
}
|
|
16649
|
-
generateCodeVerifier() {
|
|
16650
|
-
return this.oauthHelper.generateCodeVerifier();
|
|
16651
|
-
}
|
|
16652
|
-
async buildAuthUrl(codeVerifier, redirectUri, state) {
|
|
16653
|
-
return this.oauthHelper.buildAuthUrl(this.config, codeVerifier, redirectUri, state || this.id);
|
|
16654
|
-
}
|
|
16655
|
-
buildAuthUrlFromChallenge(codeChallenge, redirectUri, state) {
|
|
16656
|
-
return this.oauthHelper.buildAuthUrlFromChallenge(this.config, codeChallenge, redirectUri, state);
|
|
16657
|
-
}
|
|
16658
|
-
async exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
16659
|
-
return this.oauthHelper.exchangeCodeForTokens(this.config, this.id, code, codeVerifier, redirectUri);
|
|
16660
|
-
}
|
|
16661
|
-
};
|
|
16662
|
-
|
|
16663
16684
|
// src/providers/googledrive/GoogleDriveProvider.ts
|
|
16664
16685
|
var FOLDER_MIME = "application/vnd.google-apps.folder";
|
|
16665
16686
|
var MAX_PAGINATION_CALLS2 = 10;
|
|
@@ -17004,7 +17025,7 @@ function getAvailableProviders(ids) {
|
|
|
17004
17025
|
}
|
|
17005
17026
|
|
|
17006
17027
|
// src/index.ts
|
|
17007
|
-
var VERSION = true ? "0.
|
|
17028
|
+
var VERSION = true ? "0.14.0" : "dev";
|
|
17008
17029
|
export {
|
|
17009
17030
|
APlayProvider,
|
|
17010
17031
|
B1ChurchProvider,
|
|
@@ -17015,6 +17036,7 @@ export {
|
|
|
17015
17036
|
DropboxProvider,
|
|
17016
17037
|
FREESHOW_REST_PORT,
|
|
17017
17038
|
FreeShowProvider,
|
|
17039
|
+
GoCurriculumProvider,
|
|
17018
17040
|
HighVoltageKidsProvider,
|
|
17019
17041
|
JesusFilmProvider,
|
|
17020
17042
|
LessonsChurchProvider,
|