@churchapps/content-providers 0.6.1 → 0.7.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 +21 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
isContentFolder: () => isContentFolder,
|
|
45
45
|
navigateToPath: () => navigateToPath,
|
|
46
46
|
registerProvider: () => registerProvider,
|
|
47
|
+
setProviderSecret: () => setProviderSecret,
|
|
47
48
|
toAuthData: () => toAuthData
|
|
48
49
|
});
|
|
49
50
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -251,6 +252,13 @@ var ApiHelper = class {
|
|
|
251
252
|
}
|
|
252
253
|
};
|
|
253
254
|
|
|
255
|
+
// src/helpers/ProviderSecrets.ts
|
|
256
|
+
var secrets = {};
|
|
257
|
+
var setProviderSecret = (providerId, secret) => {
|
|
258
|
+
secrets[providerId] = secret;
|
|
259
|
+
};
|
|
260
|
+
var getProviderSecret = (providerId) => secrets[providerId] || "";
|
|
261
|
+
|
|
254
262
|
// src/providers/BaseProvider.ts
|
|
255
263
|
var BaseProvider = class {
|
|
256
264
|
constructor() {
|
|
@@ -16305,7 +16313,7 @@ function registerProvider(provider) {
|
|
|
16305
16313
|
|
|
16306
16314
|
// src/providers/goCurriculum/data.json
|
|
16307
16315
|
var data_default4 = {
|
|
16308
|
-
|
|
16316
|
+
catalog: []
|
|
16309
16317
|
};
|
|
16310
16318
|
|
|
16311
16319
|
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
@@ -16326,7 +16334,10 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16326
16334
|
apiBase: "https://gocurriculum.com",
|
|
16327
16335
|
oauthBase: "https://gocurriculum.com/oauth",
|
|
16328
16336
|
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
16329
|
-
|
|
16337
|
+
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
16338
|
+
get clientSecret() {
|
|
16339
|
+
return getProviderSecret("gocurriculum");
|
|
16340
|
+
},
|
|
16330
16341
|
scopes: ["basic"]
|
|
16331
16342
|
};
|
|
16332
16343
|
this.data = data_default4;
|
|
@@ -16351,23 +16362,23 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16351
16362
|
async browse(path, auth) {
|
|
16352
16363
|
if (!await this.verifyAuth(auth)) return [];
|
|
16353
16364
|
const { segments, depth } = parsePath(path);
|
|
16354
|
-
if (depth === 0) return this.data.
|
|
16355
|
-
const collection = this.data.
|
|
16365
|
+
if (depth === 0) return this.data.catalog.map((c) => createFolder(c.id, c.name, `/${c.id}`, c.thumbnail));
|
|
16366
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16356
16367
|
if (!collection) return [];
|
|
16357
|
-
if (depth === 1) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${collection.id}/${l.id}`, l.
|
|
16368
|
+
if (depth === 1) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
16358
16369
|
if (depth === 2) return this.getLessonFiles(collection, segments[1]);
|
|
16359
16370
|
return [];
|
|
16360
16371
|
}
|
|
16361
16372
|
getLessonFiles(collection, lessonId) {
|
|
16362
16373
|
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
16363
16374
|
if (!lesson) return [];
|
|
16364
|
-
return lesson.
|
|
16375
|
+
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 }));
|
|
16365
16376
|
}
|
|
16366
16377
|
async getPlaylist(path, auth, _resolution) {
|
|
16367
16378
|
if (!await this.verifyAuth(auth)) return null;
|
|
16368
16379
|
const { segments, depth } = parsePath(path);
|
|
16369
16380
|
if (depth !== 2) return null;
|
|
16370
|
-
const collection = this.data.
|
|
16381
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16371
16382
|
if (!collection) return null;
|
|
16372
16383
|
const files = this.getLessonFiles(collection, segments[1]);
|
|
16373
16384
|
return files.length > 0 ? files : null;
|
|
@@ -16377,7 +16388,7 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16377
16388
|
if (depth !== 2) return null;
|
|
16378
16389
|
const files = await this.getPlaylist(path, auth);
|
|
16379
16390
|
if (!files) return null;
|
|
16380
|
-
const collection = this.data.
|
|
16391
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16381
16392
|
const lesson = collection?.lessons.find((l) => l.id === segments[1]);
|
|
16382
16393
|
return filesToInstructions(lesson?.name || "Lesson", files);
|
|
16383
16394
|
}
|
|
@@ -16480,7 +16491,7 @@ function getAvailableProviders(ids) {
|
|
|
16480
16491
|
}
|
|
16481
16492
|
|
|
16482
16493
|
// src/index.ts
|
|
16483
|
-
var VERSION = true ? "0.
|
|
16494
|
+
var VERSION = true ? "0.7.0" : "dev";
|
|
16484
16495
|
// Annotate the CommonJS export names for ESM import in node:
|
|
16485
16496
|
0 && (module.exports = {
|
|
16486
16497
|
APlayProvider,
|
|
@@ -16507,6 +16518,7 @@ var VERSION = true ? "0.6.1" : "dev";
|
|
|
16507
16518
|
isContentFolder,
|
|
16508
16519
|
navigateToPath,
|
|
16509
16520
|
registerProvider,
|
|
16521
|
+
setProviderSecret,
|
|
16510
16522
|
toAuthData
|
|
16511
16523
|
});
|
|
16512
16524
|
//# sourceMappingURL=index.cjs.map
|