itube-specs 0.0.371 → 0.0.373

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.
@@ -89,7 +89,7 @@ const isActive = computed(() => {
89
89
  }
90
90
 
91
91
  const current = route.path.replace(/^\/|\/$/g, '');
92
- const target = targetPath.value.replace(/^\/|\/$/g, '');
92
+ const target = generateLink(targetPath.value).replace(/^\/|\/$/g, '');
93
93
 
94
94
  return current === target;
95
95
  });
@@ -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
- if (process.server) {
17
- const event = useRequestEvent();
18
- if (event && event.node.req.headers['user-agent']) {
19
- headers['User-Agent'] = event.node.req.headers['user-agent'];
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
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.371",
4
+ "version": "0.0.373",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -25,4 +25,5 @@ export const cleanVideoData = (data: IRawVideoData): IVideoData => ({
25
25
  videoUrl: data.video_url || '',
26
26
  isDeleted: data.is_deleted || false,
27
27
  thumbNum: data.thumb_number || 0,
28
+ description: data.description || '',
28
29
  })
@@ -10,7 +10,7 @@ export interface IRawVideoData {
10
10
  is_hd: boolean; // unused
11
11
  title: string;
12
12
  header: string;
13
- description: string; // unused
13
+ description: string;
14
14
  views: number;
15
15
  likes: number;
16
16
  dislikes: number; // unused
@@ -34,4 +34,5 @@ export interface IVideoData {
34
34
  videoUrl: string;
35
35
  isDeleted: boolean;
36
36
  thumbNum: number;
37
+ description: string;
37
38
  }