itube-specs 0.0.795 → 0.0.796

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.
Files changed (107) hide show
  1. package/composables/fetch/use-fetch-categories-by-letter.ts +15 -15
  2. package/composables/fetch/use-fetch-categories-by-phrase.ts +18 -18
  3. package/composables/fetch/use-fetch-categories-group-by-letter.ts +13 -13
  4. package/composables/fetch/use-fetch-channels-by-model.ts +18 -18
  5. package/composables/fetch/use-fetch-channels-by-name.ts +15 -15
  6. package/composables/fetch/use-fetch-channels-by-network-name.ts +30 -30
  7. package/composables/fetch/use-fetch-channels.ts +31 -31
  8. package/composables/fetch/use-fetch-dictionaries-countries.ts +13 -13
  9. package/composables/fetch/use-fetch-dictionaries-genders.ts +13 -13
  10. package/composables/fetch/use-fetch-groups-categories-lazy.ts +15 -15
  11. package/composables/fetch/use-fetch-groups-categories.ts +13 -13
  12. package/composables/fetch/use-fetch-model-by-name.ts +15 -15
  13. package/composables/fetch/use-fetch-models-by-category.ts +17 -17
  14. package/composables/fetch/use-fetch-models-by-channel.ts +17 -17
  15. package/composables/fetch/use-fetch-models-by-letter.ts +40 -40
  16. package/composables/fetch/use-fetch-models-by-phrases.ts +32 -32
  17. package/composables/fetch/use-fetch-models-by-tag.ts +1 -1
  18. package/composables/fetch/use-fetch-models-related.ts +24 -24
  19. package/composables/fetch/use-fetch-models.ts +38 -38
  20. package/composables/fetch/use-fetch-multi-suggest.ts +27 -27
  21. package/composables/fetch/use-fetch-playlists-by-id.ts +15 -15
  22. package/composables/fetch/use-fetch-playlists-by-niche.ts +30 -30
  23. package/composables/fetch/use-fetch-playlists-get-videos-by-id.ts +29 -29
  24. package/composables/fetch/use-fetch-related-searches.ts +11 -11
  25. package/composables/fetch/use-fetch-related-videos.ts +27 -27
  26. package/composables/fetch/use-fetch-top-chips-models.ts +15 -15
  27. package/composables/fetch/use-fetch-top-models.ts +19 -19
  28. package/composables/fetch/use-fetch-top-random-categories.ts +13 -13
  29. package/composables/fetch/use-fetch-top-random-full.ts +17 -17
  30. package/composables/fetch/use-fetch-video-referer-phrases.ts +34 -34
  31. package/composables/fetch/use-fetch-videos-by-categories.ts +34 -34
  32. package/composables/fetch/use-fetch-videos-by-channel.ts +34 -34
  33. package/composables/fetch/use-fetch-videos-by-model-and-channel.ts +40 -40
  34. package/composables/fetch/use-fetch-videos-by-model-and-tag.ts +40 -40
  35. package/composables/fetch/use-fetch-videos-by-model.ts +34 -34
  36. package/composables/fetch/use-fetch-videos-by-tag.ts +34 -34
  37. package/composables/fetch/use-fetch-videos-search-by-niche.ts +32 -32
  38. package/composables/use-api-fetcher-no-cache.ts +24 -24
  39. package/composables/use-api-fetcher.ts +19 -19
  40. package/composables/use-get-videos-filter-request.ts +28 -28
  41. package/composables/use-lang.ts +8 -8
  42. package/composables/use-meta.ts +54 -54
  43. package/composables/use-noindex.ts +8 -8
  44. package/composables/use-report-popup.ts +19 -19
  45. package/lib/contact-forms-scheme.ts +92 -92
  46. package/lib/contacts/report-issue-items.ts +3 -3
  47. package/lib/contacts/report-malware-items.ts +4 -4
  48. package/lib/contacts/report-reasons-items.ts +10 -10
  49. package/lib/contacts/report-wrong-items.ts +4 -4
  50. package/lib/report-forms-scheme.ts +259 -259
  51. package/lib/scheme/categories-navigation.ts +8 -8
  52. package/lib/scheme/select-added-items.ts +41 -41
  53. package/lib/scheme/select-duration-items.ts +35 -35
  54. package/nuxt.config.ts +18 -18
  55. package/package.json +1 -1
  56. package/runtime/constants/adverts.ts +5 -5
  57. package/runtime/constants/async-data.ts +57 -57
  58. package/runtime/constants/languages.ts +12 -12
  59. package/runtime/constants/niche.ts +3 -3
  60. package/runtime/constants/playlist-type.ts +2 -2
  61. package/runtime/utils/check-device-width.ts +18 -18
  62. package/runtime/utils/cleaners/clean-mini-category-card.ts +5 -5
  63. package/runtime/utils/cleaners/clean-model-card.ts +20 -20
  64. package/runtime/utils/cleaners/clean-video-data.ts +50 -50
  65. package/runtime/utils/converters/convert-date-to-timestamp.ts +22 -22
  66. package/runtime/utils/converters/convert-query-categories.ts +2 -2
  67. package/runtime/utils/converters/convert-string-array-to-chips.ts +6 -6
  68. package/runtime/utils/converters/convert-string.ts +0 -0
  69. package/runtime/utils/server/age.ts +55 -55
  70. package/runtime/utils/server/api-helper.ts +26 -26
  71. package/runtime/utils/server/get-url-with-proxied-params.ts +3 -3
  72. package/runtime/utils/server/server-api-helper.ts +15 -15
  73. package/runtime/utils/validate-email.ts +2 -2
  74. package/services/api/categories.service.ts +222 -222
  75. package/services/api/dictionaries.service.ts +28 -28
  76. package/services/api/models.service.ts +297 -297
  77. package/types/authorization-forms.d.ts +8 -8
  78. package/types/burger-menu-item.d.ts +5 -5
  79. package/types/change-email-form.d.ts +1 -1
  80. package/types/change-password-form.d.ts +2 -2
  81. package/types/chips-item.d.ts +8 -8
  82. package/types/contacts-scheme.d.ts +9 -9
  83. package/types/country.d.ts +5 -5
  84. package/types/fluid-player.d.ts +176 -176
  85. package/types/gender.d.ts +4 -4
  86. package/types/group-categories.d.ts +10 -10
  87. package/types/info-chips.d.ts +2 -2
  88. package/types/model-card.d.ts +15 -15
  89. package/types/model-filter-payload.d.ts +2 -2
  90. package/types/model-filter.d.ts +10 -10
  91. package/types/model-group.d.ts +4 -4
  92. package/types/model-tag.d.ts +3 -3
  93. package/types/playlist-short.d.ts +2 -2
  94. package/types/playlist-video-form.d.ts +7 -7
  95. package/types/popular-tags.d.ts +2 -2
  96. package/types/raw/raw-playlist-user.d.ts +20 -20
  97. package/types/raw/raw-thumbs-urls.d.ts +2 -2
  98. package/types/raw/raw-video-card.d.ts +70 -70
  99. package/types/raw/raw-video-data.d.ts +50 -50
  100. package/types/recovery-password-form.d.ts +2 -2
  101. package/types/report-request.d.ts +2 -2
  102. package/types/report-scheme.d.ts +18 -18
  103. package/types/request-filters.d.ts +10 -10
  104. package/types/request-pagination.d.ts +2 -2
  105. package/types/search-top-models.d.ts +4 -4
  106. package/types/site.d.ts +15 -15
  107. package/types/thumbs-urls.d.ts +1 -1
@@ -3,78 +3,78 @@ import { getClientHeaders } from './get-client-headers';
3
3
 
4
4
  /** Возвращает true если пользователь находится в регионе где требуется верификация возраста (GB, штат KS). */
5
5
  export async function isGeoMatch(event, _config) {
6
- const AGE_VERIFY_REGIONS = ['KS'];
7
- const AGE_VERIFY_COUNTRIES = ['GB'];
6
+ const AGE_VERIFY_REGIONS = ['KS'];
7
+ const AGE_VERIFY_COUNTRIES = ['GB'];
8
8
 
9
- const headers = getClientHeaders(event);
10
- const countryCode = headers[ 'countryCode' ];
11
- const stateCode = headers[ 'stateCode' ];
9
+ const headers = getClientHeaders(event);
10
+ const countryCode = headers[ 'countryCode' ];
11
+ const stateCode = headers[ 'stateCode' ];
12
12
 
13
- return AGE_VERIFY_COUNTRIES.includes(countryCode)
14
- || AGE_VERIFY_REGIONS.includes(stateCode);
13
+ return AGE_VERIFY_COUNTRIES.includes(countryCode)
14
+ || AGE_VERIFY_REGIONS.includes(stateCode);
15
15
  }
16
16
 
17
17
  /** Проверяет через API прошёл ли пользователь верификацию возраста по session_id из cookie или контекста. */
18
18
  export async function isAgeVerified(event, config) {
19
- const apiUrl = config.public.apiDomain;
20
- const sessionId = getCookie(event, 'session_id') || event?.context.sessionId;
19
+ const apiUrl = config.public.apiDomain;
20
+ const sessionId = getCookie(event, 'session_id') || event?.context.sessionId;
21
21
 
22
- const res: any = await $fetch(`${apiUrl}/v1/user/is-age-verified`, {
23
- method: 'GET',
24
- params: {
25
- session_id: sessionId,
26
- },
27
- headers: {
28
- 'x-domain': config.public.xDomain,
29
- 'X-Cache-Time': 259200,
30
- 'Content-Type': 'application/json',
31
- },
32
- parseResponse: JSON.parse
33
- });
22
+ const res: any = await $fetch(`${apiUrl}/v1/user/is-age-verified`, {
23
+ method: 'GET',
24
+ params: {
25
+ session_id: sessionId,
26
+ },
27
+ headers: {
28
+ 'x-domain': config.public.xDomain,
29
+ 'X-Cache-Time': 259200,
30
+ 'Content-Type': 'application/json',
31
+ },
32
+ parseResponse: JSON.parse
33
+ });
34
34
 
35
- return res.data === true;
35
+ return res.data === true;
36
36
  }
37
37
 
38
38
  /**
39
- * Запрашивает у API URL для редиректа на страницу верификации возраста.
40
- * @param backPath - путь на который вернуть пользователя после верификации
41
- * @returns URL редиректа и countryCode пользователя
42
- */
39
+ * Запрашивает у API URL для редиректа на страницу верификации возраста.
40
+ * @param backPath - путь на который вернуть пользователя после верификации
41
+ * @returns URL редиректа и countryCode пользователя
42
+ */
43
43
  export async function getAgeValidationUrl(event, backPath: string, config) {
44
- const sessionId = event.context?.sessionId || getCookie(event, 'session_id');
45
- const apiUrl = config.public.apiDomain;
44
+ const sessionId = event.context?.sessionId || getCookie(event, 'session_id');
45
+ const apiUrl = config.public.apiDomain;
46
46
 
47
- const headers = getClientHeaders(event);
47
+ const headers = getClientHeaders(event);
48
48
 
49
- const countryCode = headers[ 'countryCode' ];
50
- const stateCode = headers[ 'stateCode' ];
51
- const remoteIP = headers[ 'remoteIP' ];
52
- const userAgent = headers[ 'userAgent' ];
49
+ const countryCode = headers[ 'countryCode' ];
50
+ const stateCode = headers[ 'stateCode' ];
51
+ const remoteIP = headers[ 'remoteIP' ];
52
+ const userAgent = headers[ 'userAgent' ];
53
53
 
54
- const siteUrl = `https://${config.public.xDomain}`;
55
- const callbackURL = `${siteUrl}/bff/age/verify`;
54
+ const siteUrl = `https://${config.public.xDomain}`;
55
+ const callbackURL = `${siteUrl}/bff/age/verify`;
56
56
 
57
- const resRaw: any = await $fetch(`${apiUrl}/v1/user/age-validation-url`, {
58
- method: 'POST',
59
- body: {
60
- backURL: `${siteUrl}${backPath}`,
61
- callbackURL,
62
- countryCode,
63
- stateCode,
64
- remoteIP,
65
- sessionId,
66
- userAgent,
67
- },
68
- headers: {
69
- 'x-domain': config.public.xDomain,
70
- 'X-Cache-Time': 259200,
71
- 'Content-Type': 'application/json',
72
- },
73
- });
57
+ const resRaw: any = await $fetch(`${apiUrl}/v1/user/age-validation-url`, {
58
+ method: 'POST',
59
+ body: {
60
+ backURL: `${siteUrl}${backPath}`,
61
+ callbackURL,
62
+ countryCode,
63
+ stateCode,
64
+ remoteIP,
65
+ sessionId,
66
+ userAgent,
67
+ },
68
+ headers: {
69
+ 'x-domain': config.public.xDomain,
70
+ 'X-Cache-Time': 259200,
71
+ 'Content-Type': 'application/json',
72
+ },
73
+ });
74
74
 
75
- const res: any = typeof resRaw === 'string' ? JSON.parse(resRaw) : resRaw;
75
+ const res: any = typeof resRaw === 'string' ? JSON.parse(resRaw) : resRaw;
76
76
 
77
- const url = typeof res?.data === 'string' ? res.data : '';
77
+ const url = typeof res?.data === 'string' ? res.data : '';
78
78
 
79
- return { url, countryCode };
79
+ return { url, countryCode };
80
80
  }
@@ -2,33 +2,33 @@ import type { NitroFetchOptions } from "nitropack/types";
2
2
 
3
3
  /** Клиентский хелпер для запросов через BFF (/bff prefix). Автоматически добавляет x-domain заголовок. */
4
4
  export class ApiHelper {
5
- /**
6
- * @param path - путь без /bff префикса, например `/videos/list`
7
- * @param fetchOptions - стандартные опции $fetch
8
- * @param runtimeConfig - useRuntimeConfig() для получения xDomain
9
- */
10
- static async fetch<T>(
11
- path: string,
12
- fetchOptions: NitroFetchOptions<string>,
13
- runtimeConfig: { public: { xDomain: string } },
14
- ): Promise<T> {
15
- const headers: Record<string, string> = {
16
- ...(fetchOptions.headers as Record<string, string> || {}),
17
- 'x-domain': runtimeConfig.public.xDomain,
18
- };
5
+ /**
6
+ * @param path - путь без /bff префикса, например `/videos/list`
7
+ * @param fetchOptions - стандартные опции $fetch
8
+ * @param runtimeConfig - useRuntimeConfig() для получения xDomain
9
+ */
10
+ static async fetch<T>(
11
+ path: string,
12
+ fetchOptions: NitroFetchOptions<string>,
13
+ runtimeConfig: { public: { xDomain: string } },
14
+ ): Promise<T> {
15
+ const headers: Record<string, string> = {
16
+ ...(fetchOptions.headers as Record<string, string> || {}),
17
+ 'x-domain': runtimeConfig.public.xDomain,
18
+ };
19
19
 
20
- const method = String(fetchOptions.method || 'GET').toUpperCase();
21
- // Повторяем только идемпотентные методы; POST/PUT/DELETE не ретраим — риск дубля действия
22
- const isIdempotent = method === 'GET' || method === 'HEAD';
20
+ const method = String(fetchOptions.method || 'GET').toUpperCase();
21
+ // Повторяем только идемпотентные методы; POST/PUT/DELETE не ретраим — риск дубля действия
22
+ const isIdempotent = method === 'GET' || method === 'HEAD';
23
23
 
24
- const res = await $fetch(`/bff${path}`, {
25
- ...fetchOptions,
26
- retry: isIdempotent ? 2 : 0,
27
- retryDelay: 300,
28
- retryStatusCodes: [408, 425, 429, 500, 502, 503, 504],
29
- headers,
30
- } as any);
24
+ const res = await $fetch(`/bff${path}`, {
25
+ ...fetchOptions,
26
+ retry: isIdempotent ? 2 : 0,
27
+ retryDelay: 300,
28
+ retryStatusCodes: [408, 425, 429, 500, 502, 503, 504],
29
+ headers,
30
+ } as any);
31
31
 
32
- return res as T;
33
- }
32
+ return res as T;
33
+ }
34
34
  }
@@ -1,7 +1,7 @@
1
1
  /** Копирует query-параметры из текущего запроса (event) в переданный URL. Используется для проксирования запросов с сохранением параметров. */
2
2
  export function getUrlWithProxiedParams(url: string, event) {
3
- const _url = new URL(url);
4
- _url.search = new URLSearchParams(getQuery(event));
3
+ const _url = new URL(url);
4
+ _url.search = new URLSearchParams(getQuery(event));
5
5
 
6
- return _url.toString();
6
+ return _url.toString();
7
7
  }
@@ -4,20 +4,20 @@ import type { FetchOptions } from "ofetch";
4
4
 
5
5
  /** Серверный хелпер для запросов к внешнему API. Проксирует заголовки клиента и разворачивает `response.data`. */
6
6
  export class ServerApiHelper {
7
- /**
8
- * @param url - полный URL внешнего API
9
- * @param event - H3Event для проброса заголовков клиента
10
- * @param requestOptions - дополнительные опции fetch (method, body и т.д.)
11
- */
12
- public static async fetch<T>(url: string, event: H3Event, requestOptions?: FetchOptions): Promise<T> {
13
- try {
14
- const response = await $fetch<{ data: T }>(url, {
15
- headers: getHeaders(event),
16
- ...requestOptions,
17
- });
18
- return response.data;
19
- } catch (error: any) {
20
- throw new Error(`Cannot fetch ${url}: ${error?.data ?? error?.message ?? error}`);
21
- }
7
+ /**
8
+ * @param url - полный URL внешнего API
9
+ * @param event - H3Event для проброса заголовков клиента
10
+ * @param requestOptions - дополнительные опции fetch (method, body и т.д.)
11
+ */
12
+ public static async fetch<T>(url: string, event: H3Event, requestOptions?: FetchOptions): Promise<T> {
13
+ try {
14
+ const response = await $fetch<{ data: T }>(url, {
15
+ headers: getHeaders(event),
16
+ ...requestOptions,
17
+ });
18
+ return response.data;
19
+ } catch (error: any) {
20
+ throw new Error(`Cannot fetch ${url}: ${error?.data ?? error?.message ?? error}`);
22
21
  }
22
+ }
23
23
  }
@@ -1,5 +1,5 @@
1
1
  /** Возвращает true если строка является валидным email-адресом. */
2
2
  export function validateEmail(value: string) {
3
- const re = /^[\w&*+-]+(?:\.[\w&*+-]+)*@(?:[\da-z-]+\.)+[a-z]{2,}$/i;
4
- return Boolean(value) && re.test(String(value).toLowerCase());
3
+ const re = /^[\w&*+-]+(?:\.[\w&*+-]+)*@(?:[\da-z-]+\.)+[a-z]{2,}$/i;
4
+ return Boolean(value) && re.test(String(value).toLowerCase());
5
5
  };