erudit 4.3.1 → 4.3.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/app.vue +1 -0
- package/app/components/aside/major/PaneHolder.vue +3 -3
- package/app/components/aside/major/contentNav/items/Flags.vue +4 -8
- package/app/components/main/MainTopicPartPage.vue +3 -1
- package/app/composables/analytics.ts +15 -8
- package/app/composables/favicon.ts +62 -15
- package/app/composables/formatText.ts +9 -9
- package/app/composables/jsonLd.ts +101 -0
- package/app/composables/lastmod.ts +6 -0
- package/app/composables/og.ts +21 -0
- package/app/pages/book/[...bookId].vue +3 -1
- package/app/pages/group/[...groupId].vue +3 -1
- package/app/pages/page/[...pageId].vue +3 -1
- package/app/plugins/prerender.server.ts +1 -0
- package/modules/erudit/setup/runtimeConfig.ts +39 -3
- package/nuxt.config.ts +1 -1
- package/package.json +12 -11
- package/server/api/main/content/[...contentTypePath].ts +2 -0
- package/server/api/prerender/favicons.ts +31 -0
- package/server/erudit/build.ts +2 -0
- package/server/erudit/content/lastmod.ts +206 -0
- package/server/erudit/content/repository/lastmod.ts +12 -0
- package/server/erudit/db/schema/content.ts +1 -0
- package/server/erudit/favicon/convertToPng.ts +48 -0
- package/server/erudit/favicon/loadSource.ts +139 -0
- package/server/erudit/favicon/shared.ts +48 -0
- package/server/erudit/language/list/en.ts +0 -9
- package/server/erudit/language/list/ru.ts +2 -11
- package/server/erudit/repository.ts +2 -0
- package/server/routes/favicon/[...path].ts +89 -0
- package/server/routes/sitemap.xml.ts +19 -10
- package/shared/types/language.ts +0 -6
- package/shared/types/mainContent.ts +1 -0
- package/shared/types/runtimeConfig.ts +4 -1
- package/app/composables/lastChanged.ts +0 -61
package/shared/types/language.ts
CHANGED
|
@@ -34,12 +34,6 @@ export type LanguagePhrases = Phrases<{
|
|
|
34
34
|
no_content: string;
|
|
35
35
|
to_index: string;
|
|
36
36
|
about_textbook: string;
|
|
37
|
-
flag_title_dev: string;
|
|
38
|
-
flag_hint_dev: string;
|
|
39
|
-
flag_title_advanced: string;
|
|
40
|
-
flag_hint_advanced: string;
|
|
41
|
-
flag_title_secondary: string;
|
|
42
|
-
flag_hint_secondary: string;
|
|
43
37
|
ads_replacer: string;
|
|
44
38
|
direct_link: string;
|
|
45
39
|
direct_link_explain: string;
|
|
@@ -13,6 +13,10 @@ export interface EruditRuntimeConfig {
|
|
|
13
13
|
elements: string[];
|
|
14
14
|
countElements: (string | string[])[];
|
|
15
15
|
indexPage?: EruditIndexPage;
|
|
16
|
+
lastmod?: {
|
|
17
|
+
type: 'git' | 'custom';
|
|
18
|
+
scriptPath?: string;
|
|
19
|
+
};
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export interface EruditPublicRuntimeConfig {
|
|
@@ -27,7 +31,6 @@ export interface EruditPublicRuntimeConfig {
|
|
|
27
31
|
ads: boolean;
|
|
28
32
|
fakeApi: {
|
|
29
33
|
repository: boolean;
|
|
30
|
-
lastChanged: boolean | string;
|
|
31
34
|
};
|
|
32
35
|
analytics?: boolean;
|
|
33
36
|
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
type LastChangedSource =
|
|
2
|
-
| { type: 'date'; value: string }
|
|
3
|
-
| { type: 'github'; url: string; path: string };
|
|
4
|
-
|
|
5
|
-
function useLastChangedSource(
|
|
6
|
-
contentRelativePath: MaybeRefOrGetter<string | undefined>,
|
|
7
|
-
) {
|
|
8
|
-
return computed((): LastChangedSource | undefined => {
|
|
9
|
-
const path = toValue(contentRelativePath);
|
|
10
|
-
if (!path) return undefined;
|
|
11
|
-
|
|
12
|
-
const debug = ERUDIT.config.debug.fakeApi.lastChanged;
|
|
13
|
-
if (debug === true) return { type: 'date', value: '2024-01-15T12:00:00Z' };
|
|
14
|
-
if (typeof debug === 'string') return { type: 'date', value: debug };
|
|
15
|
-
|
|
16
|
-
const repo = ERUDIT.config.repository;
|
|
17
|
-
if (!repo || repo.type !== 'github') return undefined;
|
|
18
|
-
const parts = repo.name.split('/');
|
|
19
|
-
if (parts.length !== 2) return undefined;
|
|
20
|
-
const [owner, repoName] = parts;
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
type: 'github',
|
|
24
|
-
url: `https://api.github.com/repos/${owner}/${repoName}/commits`,
|
|
25
|
-
path: `content/${path}`,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function useLastChanged(
|
|
31
|
-
contentRelativePath: MaybeRefOrGetter<string | undefined>,
|
|
32
|
-
) {
|
|
33
|
-
const source = useLastChangedSource(contentRelativePath);
|
|
34
|
-
const date = ref<Date | undefined>(undefined);
|
|
35
|
-
|
|
36
|
-
onMounted(async () => {
|
|
37
|
-
const s = source.value;
|
|
38
|
-
if (!s) return;
|
|
39
|
-
|
|
40
|
-
if (s.type === 'date') {
|
|
41
|
-
date.value = new Date(s.value);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (s.type === 'github') {
|
|
46
|
-
try {
|
|
47
|
-
const data = await $fetch<any[]>(s.url, {
|
|
48
|
-
query: { path: s.path, per_page: 1 },
|
|
49
|
-
responseType: 'json',
|
|
50
|
-
});
|
|
51
|
-
if (Array.isArray(data) && data[0]?.commit?.committer?.date) {
|
|
52
|
-
date.value = new Date(data[0].commit.committer.date);
|
|
53
|
-
}
|
|
54
|
-
} catch {
|
|
55
|
-
// silently ignore API errors
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return date;
|
|
61
|
-
}
|