@learnpack/learnpack 5.0.244 → 5.0.250

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.
@@ -10,7 +10,7 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-BWHp9KF3.js"></script>
13
+ <script type="module" crossorigin src="/creator/assets/index-CZYzWk3G.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/creator/assets/index-DmpsXknz.css">
15
15
  </head>
16
16
  <body>
@@ -35,6 +35,7 @@ type TTechnology = {
35
35
  lang: string;
36
36
  };
37
37
  export declare const fetchTechnologies: () => Promise<any[]>;
38
+ declare function updateTechnologiesPeriodically(): Promise<void>;
38
39
  export declare const getCurrentTechnologies: () => TTechnology[];
39
40
  declare const _default: {
40
41
  login: (identification: string, password: string) => Promise<any>;
@@ -60,5 +61,6 @@ declare const _default: {
60
61
  updateRigoAssetID: (token: string, slug: string, asset_id: number) => Promise<any>;
61
62
  createRigoPackage: (token: string, slug: string, config: any) => Promise<any>;
62
63
  getCurrentTechnologies: () => TTechnology[];
64
+ updateTechnologiesPeriodically: typeof updateTechnologiesPeriodically;
63
65
  };
64
66
  export default _default;
package/lib/utils/api.js CHANGED
@@ -420,7 +420,7 @@ const getCategories = async (token) => {
420
420
  const updateRigoAssetID = async (token, slug, asset_id) => {
421
421
  const url = `${exports.RIGOBOT_HOST}/v1/learnpack/package/${slug}/`;
422
422
  const headers = {
423
- Authorization: `Token ${token}`,
423
+ Authorization: `Token ${token.trim()}`,
424
424
  };
425
425
  try {
426
426
  const response = await axios_1.default.put(url, { asset_id }, { headers });
@@ -492,7 +492,6 @@ async function updateTechnologiesPeriodically() {
492
492
  setTimeout(updateTechnologiesPeriodically, 24 * 60 * 60 * 1000);
493
493
  }
494
494
  }
495
- updateTechnologiesPeriodically();
496
495
  const getCurrentTechnologies = () => technologiesCache;
497
496
  exports.getCurrentTechnologies = getCurrentTechnologies;
498
497
  exports.default = {
@@ -513,4 +512,5 @@ exports.default = {
513
512
  updateRigoAssetID,
514
513
  createRigoPackage,
515
514
  getCurrentTechnologies: exports.getCurrentTechnologies,
515
+ updateTechnologiesPeriodically,
516
516
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
4
- "version": "5.0.244",
4
+ "version": "5.0.250",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -219,7 +219,7 @@ const createMultiLangAsset = async (
219
219
 
220
220
  // eslint-disable-next-line no-await-in-loop
221
221
  const asset = await handleAssetCreation(
222
- { token: bcToken, rigobotToken: rigoToken },
222
+ { token: bcToken, rigobotToken: rigoToken.trim() },
223
223
  courseJson,
224
224
  lang,
225
225
  deployUrl,
@@ -229,12 +229,6 @@ const createMultiLangAsset = async (
229
229
 
230
230
  all_translations.push(asset.slug)
231
231
  }
232
- // const languageCodes = new Set(languageCodes)
233
- // const asset = await api.createAsset(rigoToken, {
234
- // slug: courseSlug,
235
- // title: courseJson.title,
236
- // description: courseJson.description,
237
- // })
238
232
  }
239
233
 
240
234
  async function startExerciseGeneration(
@@ -340,6 +334,8 @@ export default class ServeCommand extends SessionCommand {
340
334
  process.exit(1)
341
335
  }
342
336
 
337
+ await api.updateTechnologiesPeriodically()
338
+
343
339
  const credentials = JSON.parse(crendsEnv)
344
340
  const bucketStorage = new Storage({
345
341
  credentials,
@@ -1399,6 +1395,7 @@ export default class ServeCommand extends SessionCommand {
1399
1395
  app.post("/actions/publish/:slug", async (req, res) => {
1400
1396
  try {
1401
1397
  const { slug } = req.params
1398
+ const { currentLanguage } = req.body
1402
1399
  const rigoToken = req.header("x-rigo-token")
1403
1400
  const bcToken = req.header("x-breathecode-token")
1404
1401
  // const { academyId, categoryId } = req.body
@@ -1414,8 +1411,6 @@ export default class ServeCommand extends SessionCommand {
1414
1411
  slug
1415
1412
  )
1416
1413
 
1417
- // const fixedSlug = fixSlugLength(slug)
1418
-
1419
1414
  const prefix = `courses/${slug}/`
1420
1415
  const tmpRoot = path.join(os.tmpdir(), `learnpack-${slug}`)
1421
1416
  const buildRoot = path.join(tmpRoot, "build")
@@ -1518,7 +1513,7 @@ export default class ServeCommand extends SessionCommand {
1518
1513
  {
1519
1514
  headers: {
1520
1515
  ...form.getHeaders(),
1521
- Authorization: `Token ${rigoToken.trim()}`,
1516
+ Authorization: "Token " + rigoToken.trim(),
1522
1517
  },
1523
1518
  }
1524
1519
  )
@@ -25,7 +25,7 @@ import { Sidebar } from "./Sidebar"
25
25
  import Login from "../Login"
26
26
  import { useNavigate } from "react-router"
27
27
  import { ParamsChecker } from "../ParamsChecker"
28
- import { randomUUID, slugify } from "../../utils/creatorUtils"
28
+ import { randomUUID } from "../../utils/creatorUtils"
29
29
  import { RIGO_FLOAT_GIF } from "../../utils/constants"
30
30
  import { useTranslation } from "react-i18next"
31
31
  import NotificationListener from "../NotificationListener"
@@ -212,9 +212,7 @@ const SyllabusEditor: React.FC = () => {
212
212
 
213
213
  const timeout = setTimeout(() => {
214
214
  cleanAll()
215
- window.location.href = `/preview/${slugify(
216
- syllabus.courseInfo.title || ""
217
- )}?token=${auth.bcToken}&language=${syllabus.courseInfo.language}`
215
+ window.location.href = `/preview/${syllabus.courseInfo.slug}?token=${auth.bcToken}&language=${syllabus.courseInfo.language}`
218
216
  }, 8000)
219
217
  try {
220
218
  await createCourse(syllabus, tokenToUse, auth.bcToken)
@@ -19,8 +19,9 @@ export const publicInteractiveCreation = async (
19
19
  const webhookUrl = `${
20
20
  DEV_MODE
21
21
  ? "https://9cw5zmww-3000.use2.devtunnels.ms"
22
- : window.location.origin
23
- // "https://9cw5zmww-3000.use2.devtunnels.ms"
22
+ : // TODO: remove this
23
+ // : window.location.origin
24
+ "https://9cw5zmww-3000.use2.devtunnels.ms"
24
25
  }/notifications/${randomUID}`
25
26
 
26
27
  const response = await axios.post(