@learnpack/learnpack 5.0.215 → 5.0.231
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/README.md +44 -39
- package/lib/commands/publish.d.ts +1 -1
- package/lib/commands/publish.js +17 -9
- package/lib/commands/serve.js +94 -31
- package/lib/creatorDist/assets/{index-DxwqeFD3.js → index-BjBYI-9r.js} +4401 -4319
- package/lib/creatorDist/assets/{index-Bnq3eZ3T.css → index-DmpsXknz.css} +6 -0
- package/lib/creatorDist/index.html +2 -2
- package/lib/utils/api.d.ts +7 -0
- package/lib/utils/api.js +54 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
- package/src/commands/publish.ts +20 -8
- package/src/commands/serve.ts +109 -30
- package/src/creator/src/App.tsx +51 -9
- package/src/creator/src/components/FileUploader.tsx +35 -3
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +35 -20
- package/src/creator/src/locales/en.json +8 -3
- package/src/creator/src/locales/es.json +7 -2
- package/src/creator/src/utils/constants.ts +2 -1
- package/src/creator/src/utils/lib.ts +14 -1
- package/src/creator/src/utils/store.ts +10 -0
- package/src/creatorDist/assets/{index-DxwqeFD3.js → index-BjBYI-9r.js} +4401 -4319
- package/src/creatorDist/assets/{index-Bnq3eZ3T.css → index-DmpsXknz.css} +6 -0
- package/src/creatorDist/index.html +2 -2
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +373 -373
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/api.ts +80 -10
package/README.md
CHANGED
@@ -8,48 +8,52 @@ Create, sell or download and take learning amazing learning packages.
|
|
8
8
|
[](https://github.com/learnpack/learnpack-cli/blob/master/package.json)
|
9
9
|
|
10
10
|
<!-- toc -->
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
- [learnpack](#learnpack)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [Commands](#commands)
|
14
15
|
<!-- tocstop -->
|
15
16
|
|
16
17
|
# Usage
|
17
18
|
|
18
19
|
<!-- usage -->
|
20
|
+
|
19
21
|
```sh-session
|
20
22
|
$ npm install -g @learnpack/learnpack
|
21
23
|
$ learnpack COMMAND
|
22
24
|
running command...
|
23
25
|
$ learnpack (-v|--version|version)
|
24
|
-
@learnpack/learnpack/5.0.
|
26
|
+
@learnpack/learnpack/5.0.217 win32-x64 node-v22.15.0
|
25
27
|
$ learnpack --help [COMMAND]
|
26
28
|
USAGE
|
27
29
|
$ learnpack COMMAND
|
28
30
|
...
|
29
31
|
```
|
32
|
+
|
30
33
|
<!-- usagestop -->
|
31
34
|
|
32
35
|
# Commands
|
33
36
|
|
34
37
|
<!-- commands -->
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
38
|
+
|
39
|
+
- [`learnpack audit`](#learnpack-audit)
|
40
|
+
- [`learnpack breakToken`](#learnpack-breaktoken)
|
41
|
+
- [`learnpack clean`](#learnpack-clean)
|
42
|
+
- [`learnpack download [PACKAGE]`](#learnpack-download-package)
|
43
|
+
- [`learnpack help [COMMAND]`](#learnpack-help-command)
|
44
|
+
- [`learnpack init`](#learnpack-init)
|
45
|
+
- [`learnpack login [PACKAGE]`](#learnpack-login-package)
|
46
|
+
- [`learnpack logout [PACKAGE]`](#learnpack-logout-package)
|
47
|
+
- [`learnpack plugins`](#learnpack-plugins)
|
48
|
+
- [`learnpack plugins:install PLUGIN...`](#learnpack-pluginsinstall-plugin)
|
49
|
+
- [`learnpack plugins:link PLUGIN`](#learnpack-pluginslink-plugin)
|
50
|
+
- [`learnpack plugins:uninstall PLUGIN...`](#learnpack-pluginsuninstall-plugin)
|
51
|
+
- [`learnpack plugins:update`](#learnpack-pluginsupdate)
|
52
|
+
- [`learnpack publish`](#learnpack-publish)
|
53
|
+
- [`learnpack serve`](#learnpack-serve)
|
54
|
+
- [`learnpack start`](#learnpack-start)
|
55
|
+
- [`learnpack test [EXERCISESLUG]`](#learnpack-test-exerciseslug)
|
56
|
+
- [`learnpack translate`](#learnpack-translate)
|
53
57
|
|
54
58
|
## `learnpack audit`
|
55
59
|
|
@@ -69,7 +73,7 @@ DESCRIPTION
|
|
69
73
|
2. The command learnpack clean has been run. (Error)
|
70
74
|
3. If a markdown or test file doesn't have any content. (Error)
|
71
75
|
4. The links are accessing to valid servers. (Error)
|
72
|
-
5. The relative images are working (If they have the shortest path to the image or if the images exists in the
|
76
|
+
5. The relative images are working (If they have the shortest path to the image or if the images exists in the
|
73
77
|
assets). (Error)
|
74
78
|
6. The external images are working (If they are pointing to a valid server). (Error)
|
75
79
|
7. The exercises directory names are valid. (Error)
|
@@ -80,7 +84,7 @@ DESCRIPTION
|
|
80
84
|
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
81
85
|
```
|
82
86
|
|
83
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
87
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\audit.ts)_
|
84
88
|
|
85
89
|
## `learnpack breakToken`
|
86
90
|
|
@@ -95,7 +99,7 @@ OPTIONS
|
|
95
99
|
-y, --yes Skip all prompts and initialize an empty project
|
96
100
|
```
|
97
101
|
|
98
|
-
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
102
|
+
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\breakToken.ts)_
|
99
103
|
|
100
104
|
## `learnpack clean`
|
101
105
|
|
@@ -110,7 +114,7 @@ DESCRIPTION
|
|
110
114
|
Extra documentation goes here
|
111
115
|
```
|
112
116
|
|
113
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
117
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\clean.ts)_
|
114
118
|
|
115
119
|
## `learnpack download [PACKAGE]`
|
116
120
|
|
@@ -128,7 +132,7 @@ DESCRIPTION
|
|
128
132
|
Extra documentation goes here
|
129
133
|
```
|
130
134
|
|
131
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
135
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\download.ts)_
|
132
136
|
|
133
137
|
## `learnpack help [COMMAND]`
|
134
138
|
|
@@ -160,7 +164,7 @@ OPTIONS
|
|
160
164
|
-y, --yes Skip all prompts and initialize an empty project
|
161
165
|
```
|
162
166
|
|
163
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
167
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\init.ts)_
|
164
168
|
|
165
169
|
## `learnpack login [PACKAGE]`
|
166
170
|
|
@@ -178,7 +182,7 @@ DESCRIPTION
|
|
178
182
|
Extra documentation goes here
|
179
183
|
```
|
180
184
|
|
181
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
185
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\login.ts)_
|
182
186
|
|
183
187
|
## `learnpack logout [PACKAGE]`
|
184
188
|
|
@@ -196,7 +200,7 @@ DESCRIPTION
|
|
196
200
|
Extra documentation goes here
|
197
201
|
```
|
198
202
|
|
199
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
203
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\logout.ts)_
|
200
204
|
|
201
205
|
## `learnpack plugins`
|
202
206
|
|
@@ -236,15 +240,15 @@ DESCRIPTION
|
|
236
240
|
|
237
241
|
Installation of a user-installed plugin will override a core plugin.
|
238
242
|
|
239
|
-
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
|
240
|
-
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
|
243
|
+
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
|
244
|
+
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
|
241
245
|
the CLI without the need to patch and update the whole CLI.
|
242
246
|
|
243
247
|
ALIASES
|
244
248
|
$ learnpack plugins:add
|
245
249
|
|
246
250
|
EXAMPLES
|
247
|
-
$ learnpack plugins:install myplugin
|
251
|
+
$ learnpack plugins:install myplugin
|
248
252
|
$ learnpack plugins:install https://github.com/someuser/someplugin
|
249
253
|
$ learnpack plugins:install someuser/someplugin
|
250
254
|
```
|
@@ -269,7 +273,7 @@ OPTIONS
|
|
269
273
|
DESCRIPTION
|
270
274
|
Installation of a linked plugin will override a user-installed or core plugin.
|
271
275
|
|
272
|
-
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
276
|
+
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
273
277
|
command will override the user-installed or core plugin implementation. This is useful for development work.
|
274
278
|
|
275
279
|
EXAMPLE
|
@@ -328,7 +332,7 @@ OPTIONS
|
|
328
332
|
-s, --strict strict mode
|
329
333
|
```
|
330
334
|
|
331
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
335
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\publish.ts)_
|
332
336
|
|
333
337
|
## `learnpack serve`
|
334
338
|
|
@@ -345,7 +349,7 @@ OPTIONS
|
|
345
349
|
-y, --yes Skip all prompts and initialize an empty project
|
346
350
|
```
|
347
351
|
|
348
|
-
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
352
|
+
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\serve.ts)_
|
349
353
|
|
350
354
|
## `learnpack start`
|
351
355
|
|
@@ -367,7 +371,7 @@ OPTIONS
|
|
367
371
|
-y, --yes Skip all prompts and initialize an empty project
|
368
372
|
```
|
369
373
|
|
370
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
374
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\start.ts)_
|
371
375
|
|
372
376
|
## `learnpack test [EXERCISESLUG]`
|
373
377
|
|
@@ -384,7 +388,7 @@ OPTIONS
|
|
384
388
|
-y, --yes Skip all prompts and initialize an empty project
|
385
389
|
```
|
386
390
|
|
387
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
391
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\test.ts)_
|
388
392
|
|
389
393
|
## `learnpack translate`
|
390
394
|
|
@@ -398,7 +402,8 @@ OPTIONS
|
|
398
402
|
-y, --yes Skip all prompts and initialize an empty project
|
399
403
|
```
|
400
404
|
|
401
|
-
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
405
|
+
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.217/src\commands\translate.ts)_
|
406
|
+
|
402
407
|
<!-- commandsstop -->
|
403
408
|
|
404
409
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
@@ -2,7 +2,7 @@ import SessionCommand from "../utils/SessionCommand";
|
|
2
2
|
export declare const handleAssetCreation: (sessionPayload: {
|
3
3
|
token: string;
|
4
4
|
rigobotToken: string;
|
5
|
-
}, learnJson: any, learnpackDeployUrl: string) => Promise<void>;
|
5
|
+
}, learnJson: any, selectedLang: string, learnpackDeployUrl: string) => Promise<void>;
|
6
6
|
declare class BuildCommand extends SessionCommand {
|
7
7
|
static description: string;
|
8
8
|
static flags: {
|
package/lib/commands/publish.js
CHANGED
@@ -19,7 +19,15 @@ const prompts = require("prompts");
|
|
19
19
|
const rigoActions_1 = require("../utils/rigoActions");
|
20
20
|
const misc_1 = require("../utils/misc");
|
21
21
|
const uploadZipEndpont = api_1.RIGOBOT_HOST + "/v1/learnpack/upload";
|
22
|
-
const handleAssetCreation = async (sessionPayload, learnJson, learnpackDeployUrl) => {
|
22
|
+
const handleAssetCreation = async (sessionPayload, learnJson, selectedLang, learnpackDeployUrl) => {
|
23
|
+
const categories = {
|
24
|
+
us: 91,
|
25
|
+
es: 92,
|
26
|
+
};
|
27
|
+
let category = categories[selectedLang];
|
28
|
+
if (!category) {
|
29
|
+
category = 91;
|
30
|
+
}
|
23
31
|
try {
|
24
32
|
const user = await api_1.default.validateToken(sessionPayload.token);
|
25
33
|
const { exists } = await api_1.default.doesAssetExists(sessionPayload.token, learnJson.slug);
|
@@ -27,13 +35,13 @@ const handleAssetCreation = async (sessionPayload, learnJson, learnpackDeployUrl
|
|
27
35
|
console_1.default.info("Asset does not exist in this academy, creating it");
|
28
36
|
const asset = await api_1.default.createAsset(sessionPayload.token, {
|
29
37
|
slug: learnJson.slug,
|
30
|
-
title: learnJson.title
|
31
|
-
lang:
|
32
|
-
description: learnJson.description
|
38
|
+
title: learnJson.title[selectedLang],
|
39
|
+
lang: selectedLang,
|
40
|
+
description: learnJson.description[selectedLang],
|
33
41
|
learnpack_deploy_url: learnpackDeployUrl,
|
34
|
-
technologies:
|
42
|
+
technologies: learnJson.technologies,
|
35
43
|
url: learnpackDeployUrl,
|
36
|
-
category:
|
44
|
+
category: category,
|
37
45
|
owner: user.id,
|
38
46
|
author: user.id,
|
39
47
|
preview: learnJson.preview,
|
@@ -45,8 +53,8 @@ const handleAssetCreation = async (sessionPayload, learnJson, learnpackDeployUrl
|
|
45
53
|
console_1.default.info("Asset exists, updating it");
|
46
54
|
const asset = await api_1.default.updateAsset(sessionPayload.token, learnJson.slug, {
|
47
55
|
learnpack_deploy_url: learnpackDeployUrl,
|
48
|
-
title: learnJson.title
|
49
|
-
description: learnJson.description
|
56
|
+
title: learnJson.title[selectedLang],
|
57
|
+
description: learnJson.description[selectedLang],
|
50
58
|
});
|
51
59
|
await api_1.default.updateRigoAssetID(sessionPayload.rigobotToken, learnJson.slug, asset.id);
|
52
60
|
console_1.default.info("Asset updated with id", asset.id);
|
@@ -287,7 +295,7 @@ class BuildCommand extends SessionCommand_1.default {
|
|
287
295
|
console.log(res.data);
|
288
296
|
fs.unlinkSync(zipFilePath);
|
289
297
|
this.removeDirectory(buildDir);
|
290
|
-
await (0, exports.handleAssetCreation)(sessionPayload, learnJson, res.data.url);
|
298
|
+
await (0, exports.handleAssetCreation)(sessionPayload, learnJson, "us", res.data.url);
|
291
299
|
}
|
292
300
|
catch (error) {
|
293
301
|
if (axios_1.default.isAxiosError(error)) {
|
package/lib/commands/serve.js
CHANGED
@@ -71,7 +71,7 @@ const createLearnJson = (courseInfo) => {
|
|
71
71
|
exports.createLearnJson = createLearnJson;
|
72
72
|
const uploadFileToBucket = async (bucket, file, path) => {
|
73
73
|
const fileRef = bucket.file(path);
|
74
|
-
await fileRef.save(file);
|
74
|
+
await fileRef.save(Buffer.from(file, "utf8"));
|
75
75
|
};
|
76
76
|
const uploadImageToBucket = async (bucket, url, path) => {
|
77
77
|
const response = await fetch(url);
|
@@ -138,6 +138,7 @@ async function startExerciseGeneration(bucket, rigoToken, steps, packageContext,
|
|
138
138
|
const exSlug = (0, creatorUtilities_2.slugify)(exercise.id + "-" + exercise.title);
|
139
139
|
console.log("Starting generation of", exSlug);
|
140
140
|
const webhookUrl = `${process.env.HOST}/webhooks/${courseSlug}/exercise-processor/${exercise.id}/${rigoToken}`;
|
141
|
+
console.log("WEBHOOK URL", webhookUrl);
|
141
142
|
await (0, rigoActions_1.readmeCreator)(rigoToken, {
|
142
143
|
title: `${exercise.id} - ${exercise.title}`,
|
143
144
|
output_lang: packageContext.language || "en",
|
@@ -276,7 +277,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
276
277
|
const distPath = path.resolve(__dirname, "../creatorDist");
|
277
278
|
// Servir archivos estáticos
|
278
279
|
// app.use(express.static(distPath))
|
279
|
-
app.use(express.json());
|
280
|
+
app.use(express.json({ limit: "20mb" }));
|
280
281
|
app.use(cors());
|
281
282
|
const appPath = path.resolve(__dirname, "../ui/_app");
|
282
283
|
const tarPath = path.resolve(__dirname, "../ui/app.tar.gz");
|
@@ -390,6 +391,35 @@ class ServeCommand extends SessionCommand_1.default {
|
|
390
391
|
(0, creatorSocket_1.emitToNotification)(id, body);
|
391
392
|
res.json({ id, status: "SUCCESS" });
|
392
393
|
});
|
394
|
+
app.post("/webhooks/:courseSlug/images/:imageId", async (req, res) => {
|
395
|
+
const { courseSlug, imageId } = req.params;
|
396
|
+
const body = req.body;
|
397
|
+
console.log("RECEIVING IMAGE WEBHOOK", body);
|
398
|
+
const imageUrl = body.image_url;
|
399
|
+
const imagePath = `courses/${courseSlug}/.learn/assets/${imageId}`;
|
400
|
+
const imageFile = bucket.file(imagePath);
|
401
|
+
const [exists] = await imageFile.exists();
|
402
|
+
if (!exists) {
|
403
|
+
// Descargar la imagen
|
404
|
+
const response = await fetch(imageUrl);
|
405
|
+
if (!response.ok) {
|
406
|
+
return res.status(400).json({
|
407
|
+
status: "ERROR",
|
408
|
+
message: "No se pudo descargar la imagen",
|
409
|
+
});
|
410
|
+
}
|
411
|
+
const buffer = await response.arrayBuffer();
|
412
|
+
// Guardar la imagen en el bucket
|
413
|
+
await imageFile.save(new Uint8Array(buffer), {
|
414
|
+
contentType: "image/png",
|
415
|
+
});
|
416
|
+
}
|
417
|
+
(0, creatorSocket_1.emitToNotification)(imageId, {
|
418
|
+
status: "SUCCESS",
|
419
|
+
message: "Image generated successfully",
|
420
|
+
});
|
421
|
+
res.json({ status: "SUCCESS" });
|
422
|
+
});
|
393
423
|
app.post("/webhooks/:courseSlug/exercise-processor/:lessonID/:rigoToken", async (req, res) => {
|
394
424
|
// console.log("Receiving a webhook to exercise processor")
|
395
425
|
const { courseSlug, lessonID, rigoToken } = req.params;
|
@@ -700,33 +730,38 @@ class ServeCommand extends SessionCommand_1.default {
|
|
700
730
|
res.status(500).json({ error: error.message });
|
701
731
|
}
|
702
732
|
});
|
703
|
-
app.get("/test/:slug", (req, res) => {
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
733
|
+
// app.get("/test/:slug", (req, res) => {
|
734
|
+
// emitToCourse(req.params.slug, "course-creation", {
|
735
|
+
// lesson: "000-welcome-to-bird-domestication",
|
736
|
+
// status: "generating",
|
737
|
+
// log: "Hello",
|
738
|
+
// })
|
739
|
+
// emitToCourse(req.params.slug, "course-creation", {
|
740
|
+
// lesson: "000-welcome-to-bird-domestication",
|
741
|
+
// status: "generating",
|
742
|
+
// log: "Hello",
|
743
|
+
// })
|
744
|
+
// emitToCourse(req.params.slug, "course-creation", {
|
745
|
+
// lesson: "000-welcome-to-bird-domestication",
|
746
|
+
// status: "generating",
|
747
|
+
// log: "Hello broder",
|
748
|
+
// })
|
749
|
+
// emitToCourse(req.params.slug, "course-creation", {
|
750
|
+
// lesson: "000-welcome-to-bird-domestication",
|
751
|
+
// status: "done",
|
752
|
+
// log: "Hello broder",
|
753
|
+
// })
|
754
|
+
// emitToCourse(req.params.slug, "course-creation", {
|
755
|
+
// lesson: "other",
|
756
|
+
// status: "generating",
|
757
|
+
// log: "Hello",
|
758
|
+
// })
|
759
|
+
// res.send({ message: "Course creation started" })
|
760
|
+
// })
|
761
|
+
app.get("/technologies", async (req, res) => {
|
762
|
+
console.log("GET /technologies");
|
763
|
+
const technologies = await api_1.default.getCurrentTechnologies();
|
764
|
+
res.json(technologies);
|
730
765
|
});
|
731
766
|
app.get("/assets/:file", (req, res) => {
|
732
767
|
const file = path.join(localAppPath, req.params.file);
|
@@ -797,6 +832,35 @@ class ServeCommand extends SessionCommand_1.default {
|
|
797
832
|
slug: (0, creatorUtilities_2.slugify)(syllabus.courseInfo.title),
|
798
833
|
});
|
799
834
|
});
|
835
|
+
// app.post(
|
836
|
+
// "/check-latex/:courseSlug/:exerciseSlug/:lang",
|
837
|
+
// async (req, res) => {
|
838
|
+
// const { courseSlug, exerciseSlug, lang } = req.params
|
839
|
+
// const rigoToken = req.header("x-rigo-token")
|
840
|
+
// if (!rigoToken) {
|
841
|
+
// return res.status(400).json({ error: "Missing tokens" })
|
842
|
+
// }
|
843
|
+
// const exercise = await bucket.file(
|
844
|
+
// `courses/${courseSlug}/exercises/${exerciseSlug}/README.${lang}.md`
|
845
|
+
// )
|
846
|
+
// const [content] = await exercise.download()
|
847
|
+
// const headers = {
|
848
|
+
// Authorization: `Token ${rigoToken}`,
|
849
|
+
// }
|
850
|
+
// const response = await axios.get(
|
851
|
+
// `${RIGOBOT_HOST}/v1/prompting/completion/60865/`,
|
852
|
+
// {
|
853
|
+
// headers,
|
854
|
+
// }
|
855
|
+
// )
|
856
|
+
// console.log(response.data.parsed.content, "RESPONSE from Rigobot")
|
857
|
+
// res.json({
|
858
|
+
// message: "Exercise downloaded",
|
859
|
+
// completion: response.data,
|
860
|
+
// exercise: content.toString(),
|
861
|
+
// })
|
862
|
+
// }
|
863
|
+
// )
|
800
864
|
app.get("/courses/:courseSlug/syllabus", async (req, res) => {
|
801
865
|
try {
|
802
866
|
console.log("GET /courses/:courseSlug/syllabus");
|
@@ -959,9 +1023,8 @@ class ServeCommand extends SessionCommand_1.default {
|
|
959
1023
|
const rigoRes = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/learnpack/upload`, form, {
|
960
1024
|
headers: Object.assign(Object.assign({}, form.getHeaders()), { Authorization: `Token ${rigoToken}` }),
|
961
1025
|
});
|
962
|
-
await (0, publish_1.handleAssetCreation)({ token: bcToken, rigobotToken: rigoToken }, fullConfig.config, rigoRes.data.url);
|
1026
|
+
await (0, publish_1.handleAssetCreation)({ token: bcToken, rigobotToken: rigoToken }, fullConfig.config, selectedLang, rigoRes.data.url);
|
963
1027
|
rimraf.sync(tmpRoot);
|
964
|
-
console.log("RIGO RES", rigoRes.data);
|
965
1028
|
return res.json({ url: rigoRes.data.url });
|
966
1029
|
});
|
967
1030
|
archive.on("error", err => {
|