erudit 3.0.0-dev.2 → 3.0.0-dev.3
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/app/composables/bitranContent.ts +3 -1
- package/app/scripts/preview/data/unique.ts +1 -0
- package/nuxt.config.ts +1 -1
- package/package.json +3 -3
- package/server/api/bitran/content/[location].ts +1 -0
- package/server/api/language/phrase/[phraseId].ts +2 -2
- package/server/api/preview/unique/[location].ts +3 -1
|
@@ -28,7 +28,9 @@ export async function useBitranContent(
|
|
|
28
28
|
nuxtApp.runWithContext(() => prerenderRoutes(apiRoute));
|
|
29
29
|
// @ts-ignore
|
|
30
30
|
contentPromise = (async () => {
|
|
31
|
-
content.value = (await $fetch(apiRoute
|
|
31
|
+
content.value = (await $fetch(apiRoute, {
|
|
32
|
+
responseType: 'json',
|
|
33
|
+
})) as BitranContent;
|
|
32
34
|
return content;
|
|
33
35
|
})();
|
|
34
36
|
});
|
|
@@ -28,6 +28,7 @@ export async function buildUnique(
|
|
|
28
28
|
|
|
29
29
|
const serverData = (await $fetch(
|
|
30
30
|
`/api/preview/unique/${encodeBitranLocation(linkTarget._absoluteStrLocation!)}`,
|
|
31
|
+
{ responseType: 'json' },
|
|
31
32
|
)) as any;
|
|
32
33
|
const productName = serverData.bitran.productName;
|
|
33
34
|
const customTitle = serverData.productTitle;
|
package/nuxt.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erudit",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "🤓 CMS for perfect educational sites.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"directory": "packages/erudit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"erudit-cli": "3.0.0-dev.
|
|
15
|
-
"erudit-cog": "3.0.0-dev.
|
|
14
|
+
"erudit-cli": "3.0.0-dev.3",
|
|
15
|
+
"erudit-cog": "3.0.0-dev.3",
|
|
16
16
|
"@bitran-js/core": "1.0.0-dev.7",
|
|
17
17
|
"@bitran-js/transpiler": "1.0.0-dev.7",
|
|
18
18
|
"@bitran-js/renderer-vue": "1.0.0-dev.7",
|
|
@@ -2,6 +2,7 @@ import { parseUrlLocation } from '@server/bitran/location';
|
|
|
2
2
|
import { getBitranContent } from '@server/bitran/content';
|
|
3
3
|
|
|
4
4
|
export default defineEventHandler(async (event) => {
|
|
5
|
+
setResponseHeader(event, 'Content-Type', 'application/json; charset=utf-8');
|
|
5
6
|
const location = parseUrlLocation(getRouterParam(event, 'location') || '');
|
|
6
7
|
return await getBitranContent(location);
|
|
7
8
|
});
|
|
@@ -2,12 +2,12 @@ import type { EruditPhraseId } from '@shared/types/language';
|
|
|
2
2
|
import { ERUDIT_SERVER } from '@server/global';
|
|
3
3
|
|
|
4
4
|
export default defineEventHandler((event) => {
|
|
5
|
+
setResponseHeader(event, 'Content-Type', 'text/plain; charset=utf-8');
|
|
6
|
+
|
|
5
7
|
const phraseId = getRouterParam(event, 'phraseId');
|
|
6
8
|
const phrase =
|
|
7
9
|
ERUDIT_SERVER.LANGUAGE?.phrases?.[phraseId as EruditPhraseId];
|
|
8
10
|
|
|
9
|
-
setResponseHeader(event, 'content-type', 'text/plain');
|
|
10
|
-
|
|
11
11
|
if (typeof phrase === 'string') return phrase;
|
|
12
12
|
else if (typeof phrase === 'function')
|
|
13
13
|
return '~!~FUNC~!~' + 'return ' + phrase.toString();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BitranContent } from 'bitran';
|
|
1
|
+
import type { BitranContent } from '@bitran-js/renderer-vue';
|
|
2
2
|
|
|
3
3
|
import { parseUrlLocation } from '@server/bitran/location';
|
|
4
4
|
import { getLocationContext } from '@server/content/context';
|
|
@@ -21,6 +21,8 @@ interface ReturnType {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export default defineEventHandler<Promise<ReturnType>>(async (event) => {
|
|
24
|
+
setResponseHeader(event, 'Content-Type', 'application/json; charset=utf-8');
|
|
25
|
+
|
|
24
26
|
const location = parseUrlLocation(getRouterParam(event, 'location') || '');
|
|
25
27
|
|
|
26
28
|
const context = await getLocationContext(location);
|