itube-specs 0.0.372 → 0.0.374
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.
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { useRoute } from 'vue-router';
|
|
2
1
|
import { EAsyncData, ELanguage } from '../runtime';
|
|
3
2
|
import type { IVideoData } from '../types';
|
|
4
3
|
|
|
5
4
|
export const useFetchVideo = async (
|
|
6
|
-
apiMethod: (...args: any[]) => Promise<IVideoData
|
|
5
|
+
apiMethod: (...args: any[]) => Promise<IVideoData>,
|
|
7
6
|
) => {
|
|
8
7
|
const { locale } = useI18n();
|
|
9
8
|
const lang = locale.value as ELanguage;
|
|
10
9
|
const slug = useSlug();
|
|
11
10
|
const key = EAsyncData.Video;
|
|
12
11
|
const stateKey = computed(() => `data-${key}-${slug.value}-${lang}`);
|
|
13
|
-
let headers = {} as HeadersInit & { 'User-Agent': string };
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const headers: Record<string, string> = {};
|
|
14
|
+
|
|
15
|
+
const event = useRequestEvent();
|
|
16
|
+
if (event) {
|
|
17
|
+
const ua = event.node.req.headers['user-agent'];
|
|
18
|
+
if (ua) headers['user-agent'] = ua;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (process.client && !headers['user-agent']) {
|
|
22
|
+
headers['user-agent'] = navigator.userAgent;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
const { data, status, error } = await useAsyncData<IVideoData>(
|
|
@@ -28,6 +30,7 @@ export const useFetchVideo = async (
|
|
|
28
30
|
lang,
|
|
29
31
|
slug.value,
|
|
30
32
|
undefined,
|
|
33
|
+
headers,
|
|
31
34
|
)(),
|
|
32
35
|
);
|
|
33
36
|
|
|
@@ -60,7 +60,11 @@ export const useSeoLinks = (baseDomain: string, alonePage: boolean = false, i18n
|
|
|
60
60
|
links.push(
|
|
61
61
|
...otherLocales.map((locale) => {
|
|
62
62
|
const localeCode = typeof locale === 'string' ? locale : locale.code;
|
|
63
|
-
const
|
|
63
|
+
const langMap: Record<string, string> = {
|
|
64
|
+
jp: 'ja',
|
|
65
|
+
ch: 'zh'
|
|
66
|
+
};
|
|
67
|
+
const hreflang = langMap[localeCode] || localeCode;
|
|
64
68
|
return {
|
|
65
69
|
rel: 'alternate',
|
|
66
70
|
hreflang,
|