@learnpack/learnpack 5.0.307 → 5.0.308
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/lib/commands/publish.js +6 -2
- package/lib/commands/serve.js +105 -30
- package/lib/utils/api.d.ts +4 -1
- package/lib/utils/api.js +3 -3
- package/package.json +1 -1
- package/src/commands/publish.ts +20 -22
- package/src/commands/serve.ts +152 -56
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +2815 -2798
- package/src/ui/_app/learnpack.svg +7 -7
- package/src/ui/_app/sw.js +59 -59
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/api.ts +38 -42
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M4 10.8271V22.3184C4 23.0446 4.38793 23.7155 5.01755 24.0786L14.9824 29.8242C15.6121 30.1873 16.3879 30.1873 17.0176 29.8242L26.9824 24.0786C27.6121 23.7155 28 23.0446 28 22.3184V10.8271C28 10.1009 27.6121 9.42998 26.9824 9.0669L17.0176 3.32114C16.3879 2.95806 15.6121 2.95806 14.9824 3.32114L5.01755 9.0669C4.38793 9.42983 4 10.1009 4 10.8271Z" fill="#00041A"/>
|
|
3
|
-
<path d="M15.9799 24.627C15.8632 24.6896 15.7224 24.688 15.607 24.6229L8.0148 20.3429C7.75702 20.1975 7.43799 20.3836 7.43799 20.6793C7.43799 20.8152 7.50954 20.9411 7.62625 21.0109L15.6296 25.7894C15.7496 25.861 15.8988 25.8624 16.0201 25.7932L24.367 21.0254C24.5 20.9494 24.5753 20.8024 24.5596 20.6503C24.5356 20.4167 24.5137 20.0937 24.5676 20.0293L15.9799 24.627Z" fill="white"/>
|
|
4
|
-
<path d="M24.5708 20.0291L24.5925 20.0176C24.5842 20.0176 24.5771 20.0218 24.5708 20.0291Z" fill="white"/>
|
|
5
|
-
<path d="M24.2608 22.2883L15.8274 27.0176L7.31846 22.1585C7.07286 22.0182 6.92116 21.7573 6.92116 21.4746V19.5681C6.92116 19.2047 7.31237 18.9754 7.63015 19.1523L15.836 23.7249L25.5691 18.2171C25.6739 18.1578 25.6648 18.0039 25.5538 17.9573L24.4218 17.4822C23.6861 17.1734 22.852 17.2021 22.1393 17.5606L15.836 20.7318L9.54557 17.6348C8.72425 17.2303 7.76107 17.2317 6.94085 17.6382C6.28341 17.964 5.86768 18.6336 5.86768 19.3665V20.9276C5.86768 21.8003 6.32903 22.6082 7.08114 23.0524L15.8274 28.2184L26.057 22.356L25.5817 22.1821C25.1471 22.0229 24.6643 22.0618 24.2608 22.2882V22.2883Z" fill="#0097CF"/>
|
|
6
|
-
<path d="M26.5421 11.2556L15.9895 5.16C15.8945 5.10524 15.7774 5.10555 15.6828 5.16078L5.25698 11.2581C5.05262 11.3776 5.05684 11.6741 5.26448 11.7876L8.96534 13.8126V15.5122C8.96534 15.8275 9.13689 16.1178 9.41326 16.2702L15.4095 19.5777C15.6696 19.7211 15.9851 19.7217 16.2455 19.5789L22.2902 16.2696C22.5678 16.1176 22.7405 15.8265 22.7405 15.5102V13.8124L25.4213 12.381V16.1824C25.4213 16.3995 25.5977 16.5757 25.8151 16.5757H25.9842C26.2017 16.5757 26.3781 16.3995 26.3781 16.1824V11.8702L26.533 11.7875C26.7438 11.675 26.7488 11.3751 26.5419 11.2556H26.5421ZM24.8006 11.6904L15.9487 16.3479C15.887 16.3804 15.8132 16.38 15.7518 16.3471L7.0707 11.6979C6.9254 11.6202 6.92274 11.4132 7.06585 11.3316L15.7246 6.39138C15.7884 6.35503 15.8665 6.35456 15.9306 6.39029L24.8046 11.3224C24.9501 11.4032 24.9477 11.613 24.8004 11.6906L24.8006 11.6904Z" fill="white"/>
|
|
7
|
-
</svg>
|
|
1
|
+
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4 10.8271V22.3184C4 23.0446 4.38793 23.7155 5.01755 24.0786L14.9824 29.8242C15.6121 30.1873 16.3879 30.1873 17.0176 29.8242L26.9824 24.0786C27.6121 23.7155 28 23.0446 28 22.3184V10.8271C28 10.1009 27.6121 9.42998 26.9824 9.0669L17.0176 3.32114C16.3879 2.95806 15.6121 2.95806 14.9824 3.32114L5.01755 9.0669C4.38793 9.42983 4 10.1009 4 10.8271Z" fill="#00041A"/>
|
|
3
|
+
<path d="M15.9799 24.627C15.8632 24.6896 15.7224 24.688 15.607 24.6229L8.0148 20.3429C7.75702 20.1975 7.43799 20.3836 7.43799 20.6793C7.43799 20.8152 7.50954 20.9411 7.62625 21.0109L15.6296 25.7894C15.7496 25.861 15.8988 25.8624 16.0201 25.7932L24.367 21.0254C24.5 20.9494 24.5753 20.8024 24.5596 20.6503C24.5356 20.4167 24.5137 20.0937 24.5676 20.0293L15.9799 24.627Z" fill="white"/>
|
|
4
|
+
<path d="M24.5708 20.0291L24.5925 20.0176C24.5842 20.0176 24.5771 20.0218 24.5708 20.0291Z" fill="white"/>
|
|
5
|
+
<path d="M24.2608 22.2883L15.8274 27.0176L7.31846 22.1585C7.07286 22.0182 6.92116 21.7573 6.92116 21.4746V19.5681C6.92116 19.2047 7.31237 18.9754 7.63015 19.1523L15.836 23.7249L25.5691 18.2171C25.6739 18.1578 25.6648 18.0039 25.5538 17.9573L24.4218 17.4822C23.6861 17.1734 22.852 17.2021 22.1393 17.5606L15.836 20.7318L9.54557 17.6348C8.72425 17.2303 7.76107 17.2317 6.94085 17.6382C6.28341 17.964 5.86768 18.6336 5.86768 19.3665V20.9276C5.86768 21.8003 6.32903 22.6082 7.08114 23.0524L15.8274 28.2184L26.057 22.356L25.5817 22.1821C25.1471 22.0229 24.6643 22.0618 24.2608 22.2882V22.2883Z" fill="#0097CF"/>
|
|
6
|
+
<path d="M26.5421 11.2556L15.9895 5.16C15.8945 5.10524 15.7774 5.10555 15.6828 5.16078L5.25698 11.2581C5.05262 11.3776 5.05684 11.6741 5.26448 11.7876L8.96534 13.8126V15.5122C8.96534 15.8275 9.13689 16.1178 9.41326 16.2702L15.4095 19.5777C15.6696 19.7211 15.9851 19.7217 16.2455 19.5789L22.2902 16.2696C22.5678 16.1176 22.7405 15.8265 22.7405 15.5102V13.8124L25.4213 12.381V16.1824C25.4213 16.3995 25.5977 16.5757 25.8151 16.5757H25.9842C26.2017 16.5757 26.3781 16.3995 26.3781 16.1824V11.8702L26.533 11.7875C26.7438 11.675 26.7488 11.3751 26.5419 11.2556H26.5421ZM24.8006 11.6904L15.9487 16.3479C15.887 16.3804 15.8132 16.38 15.7518 16.3471L7.0707 11.6979C6.9254 11.6202 6.92274 11.4132 7.06585 11.3316L15.7246 6.39138C15.7884 6.35503 15.8665 6.35456 15.9306 6.39029L24.8046 11.3224C24.9501 11.4032 24.9477 11.613 24.8004 11.6906L24.8006 11.6904Z" fill="white"/>
|
|
7
|
+
</svg>
|
package/src/ui/_app/sw.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
self.addEventListener('install', (event) => {
|
|
2
|
-
console.log('Service Worker instalado');
|
|
3
|
-
event.waitUntil(
|
|
4
|
-
caches.open('app-cache').then(async (cache) => {
|
|
5
|
-
const urlsToCache = [
|
|
6
|
-
'/',
|
|
7
|
-
'/index.html',
|
|
8
|
-
'/logo-512.png',
|
|
9
|
-
'/logo-192.png',
|
|
10
|
-
'/manifest.webmanifest',
|
|
11
|
-
];
|
|
12
|
-
const cachePromises = urlsToCache.map(url =>
|
|
13
|
-
fetch(url).then(response => {
|
|
14
|
-
if (!response.ok) throw new Error(`Error al obtener: ${url}`);
|
|
15
|
-
return cache.put(url, response.clone());
|
|
16
|
-
}).catch(error => console.warn(error))
|
|
17
|
-
);
|
|
18
|
-
return Promise.all(cachePromises);
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
self.addEventListener('fetch', (event) => {
|
|
24
|
-
// Excluir solicitudes a /socket.io/ y otras URLs que no deben ser cacheadas
|
|
25
|
-
if (event.request.url.includes('/socket.io/') ||
|
|
26
|
-
event.request.url.includes('/api/') ||
|
|
27
|
-
event.request.url.includes('localhost') ||
|
|
28
|
-
event.request.url.includes('devtunnels')) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
event.respondWith(
|
|
33
|
-
caches.match(event.request).then((response) => {
|
|
34
|
-
if (response) {
|
|
35
|
-
return response;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Solo hacer fetch para recursos estáticos
|
|
39
|
-
if (event.request.method === 'GET' &&
|
|
40
|
-
(event.request.url.includes('.js') ||
|
|
41
|
-
event.request.url.includes('.css') ||
|
|
42
|
-
event.request.url.includes('.png') ||
|
|
43
|
-
event.request.url.includes('.jpg') ||
|
|
44
|
-
event.request.url.includes('.ico') ||
|
|
45
|
-
event.request.url.includes('.svg'))) {
|
|
46
|
-
return fetch(event.request).catch(() => {
|
|
47
|
-
// Si falla el fetch, devolver una respuesta básica
|
|
48
|
-
return new Response('Resource not available', { status: 404 });
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Para otras solicitudes, no interceptar
|
|
53
|
-
return fetch(event.request);
|
|
54
|
-
}).catch(() => {
|
|
55
|
-
// En caso de error, devolver respuesta básica
|
|
56
|
-
return new Response('Service worker error', { status: 500 });
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
});
|
|
1
|
+
self.addEventListener('install', (event) => {
|
|
2
|
+
console.log('Service Worker instalado');
|
|
3
|
+
event.waitUntil(
|
|
4
|
+
caches.open('app-cache').then(async (cache) => {
|
|
5
|
+
const urlsToCache = [
|
|
6
|
+
'/',
|
|
7
|
+
'/index.html',
|
|
8
|
+
'/logo-512.png',
|
|
9
|
+
'/logo-192.png',
|
|
10
|
+
'/manifest.webmanifest',
|
|
11
|
+
];
|
|
12
|
+
const cachePromises = urlsToCache.map(url =>
|
|
13
|
+
fetch(url).then(response => {
|
|
14
|
+
if (!response.ok) throw new Error(`Error al obtener: ${url}`);
|
|
15
|
+
return cache.put(url, response.clone());
|
|
16
|
+
}).catch(error => console.warn(error))
|
|
17
|
+
);
|
|
18
|
+
return Promise.all(cachePromises);
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
self.addEventListener('fetch', (event) => {
|
|
24
|
+
// Excluir solicitudes a /socket.io/ y otras URLs que no deben ser cacheadas
|
|
25
|
+
if (event.request.url.includes('/socket.io/') ||
|
|
26
|
+
event.request.url.includes('/api/') ||
|
|
27
|
+
event.request.url.includes('localhost') ||
|
|
28
|
+
event.request.url.includes('devtunnels')) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
event.respondWith(
|
|
33
|
+
caches.match(event.request).then((response) => {
|
|
34
|
+
if (response) {
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Solo hacer fetch para recursos estáticos
|
|
39
|
+
if (event.request.method === 'GET' &&
|
|
40
|
+
(event.request.url.includes('.js') ||
|
|
41
|
+
event.request.url.includes('.css') ||
|
|
42
|
+
event.request.url.includes('.png') ||
|
|
43
|
+
event.request.url.includes('.jpg') ||
|
|
44
|
+
event.request.url.includes('.ico') ||
|
|
45
|
+
event.request.url.includes('.svg'))) {
|
|
46
|
+
return fetch(event.request).catch(() => {
|
|
47
|
+
// Si falla el fetch, devolver una respuesta básica
|
|
48
|
+
return new Response('Resource not available', { status: 404 });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Para otras solicitudes, no interceptar
|
|
53
|
+
return fetch(event.request);
|
|
54
|
+
}).catch(() => {
|
|
55
|
+
// En caso de error, devolver respuesta básica
|
|
56
|
+
return new Response('Service worker error', { status: 500 });
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
});
|
package/src/ui/app.tar.gz
CHANGED
|
Binary file
|
package/src/utils/api.ts
CHANGED
|
@@ -15,17 +15,17 @@ export const RIGOBOT_REALTIME_HOST = "https://ai.4geeks.com"
|
|
|
15
15
|
// "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line
|
|
18
|
-
const _fetch = require("node-fetch")
|
|
18
|
+
const _fetch = require("node-fetch")
|
|
19
19
|
|
|
20
20
|
interface IHeaders {
|
|
21
|
-
"Content-Type"?: string
|
|
22
|
-
Authorization?: string
|
|
21
|
+
"Content-Type"?: string
|
|
22
|
+
Authorization?: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
interface IOptions {
|
|
26
|
-
headers?: IHeaders
|
|
27
|
-
method?: string
|
|
28
|
-
body?: string
|
|
26
|
+
headers?: IHeaders
|
|
27
|
+
method?: string
|
|
28
|
+
body?: string
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const fetch = async (
|
|
@@ -207,8 +207,8 @@ const getAllPackages = async ({
|
|
|
207
207
|
lang = "",
|
|
208
208
|
slug = "",
|
|
209
209
|
}: {
|
|
210
|
-
lang?: string
|
|
211
|
-
slug?: string
|
|
210
|
+
lang?: string
|
|
211
|
+
slug?: string
|
|
212
212
|
}) => {
|
|
213
213
|
try {
|
|
214
214
|
cli.action.start("Downloading packages...")
|
|
@@ -307,7 +307,7 @@ type TConsumableSlug =
|
|
|
307
307
|
| "ai-compilation"
|
|
308
308
|
| "ai-tutorial-generation"
|
|
309
309
|
| "ai-generation"
|
|
310
|
-
| "learnpack-publish"
|
|
310
|
+
| "learnpack-publish"
|
|
311
311
|
|
|
312
312
|
export const countConsumables = (
|
|
313
313
|
consumables: any,
|
|
@@ -346,10 +346,10 @@ export const getConsumable = async (
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
export interface TAcademy {
|
|
349
|
-
id: number
|
|
350
|
-
name: string
|
|
351
|
-
slug: string
|
|
352
|
-
timezone: string
|
|
349
|
+
id: number
|
|
350
|
+
name: string
|
|
351
|
+
slug: string
|
|
352
|
+
timezone: string
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
const neededPermissions = [
|
|
@@ -417,20 +417,20 @@ export const validateToken = async (token: string) => {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
type TAssetMissing = {
|
|
420
|
-
slug: string
|
|
421
|
-
title: string
|
|
422
|
-
lang: string
|
|
423
|
-
url: string
|
|
424
|
-
description: string
|
|
425
|
-
learnpack_deploy_url: string
|
|
426
|
-
technologies: string[]
|
|
427
|
-
category: number | string
|
|
428
|
-
owner: number
|
|
429
|
-
author: number
|
|
430
|
-
preview: string
|
|
431
|
-
readme_raw: string
|
|
432
|
-
all_translations: string[]
|
|
433
|
-
}
|
|
420
|
+
slug: string
|
|
421
|
+
title: string
|
|
422
|
+
lang: string
|
|
423
|
+
url: string
|
|
424
|
+
description: string
|
|
425
|
+
learnpack_deploy_url: string
|
|
426
|
+
technologies: string[]
|
|
427
|
+
category: number | string
|
|
428
|
+
owner: number
|
|
429
|
+
author: number
|
|
430
|
+
preview: string
|
|
431
|
+
readme_raw: string
|
|
432
|
+
all_translations: string[]
|
|
433
|
+
}
|
|
434
434
|
|
|
435
435
|
export const createAsset = async (token: string, asset: TAssetMissing) => {
|
|
436
436
|
const body = {
|
|
@@ -532,25 +532,21 @@ const getCategories = async (token: string) => {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
const
|
|
535
|
+
const updateRigoPackage = async (
|
|
536
536
|
token: string,
|
|
537
537
|
slug: string,
|
|
538
|
-
|
|
538
|
+
updates: { asset_id?: number; new_slug?: string }
|
|
539
539
|
) => {
|
|
540
540
|
const cleanToken = token.replace(/[\n\r]/g, "")
|
|
541
541
|
|
|
542
542
|
const url = `${RIGOBOT_HOST}/v1/learnpack/package/${slug}/`
|
|
543
543
|
|
|
544
544
|
try {
|
|
545
|
-
const response = await axios.put(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
Authorization: "Token " + cleanToken,
|
|
551
|
-
},
|
|
552
|
-
}
|
|
553
|
-
)
|
|
545
|
+
const response = await axios.put(url, updates, {
|
|
546
|
+
headers: {
|
|
547
|
+
Authorization: "Token " + cleanToken,
|
|
548
|
+
},
|
|
549
|
+
})
|
|
554
550
|
return response.data
|
|
555
551
|
} catch (error) {
|
|
556
552
|
console.error("Failed to update Rigo package:", error)
|
|
@@ -580,9 +576,9 @@ const createRigoPackage = async (token: string, slug: string, config: any) => {
|
|
|
580
576
|
}
|
|
581
577
|
|
|
582
578
|
type TTechnology = {
|
|
583
|
-
slug: string
|
|
584
|
-
lang: string
|
|
585
|
-
}
|
|
579
|
+
slug: string
|
|
580
|
+
lang: string
|
|
581
|
+
}
|
|
586
582
|
|
|
587
583
|
let technologiesCache: TTechnology[] = []
|
|
588
584
|
|
|
@@ -662,7 +658,7 @@ export default {
|
|
|
662
658
|
doesAssetExists,
|
|
663
659
|
updateAsset,
|
|
664
660
|
getCategories,
|
|
665
|
-
|
|
661
|
+
updateRigoPackage,
|
|
666
662
|
createRigoPackage,
|
|
667
663
|
getCurrentTechnologies,
|
|
668
664
|
updateTechnologiesPeriodically,
|