itube-specs 0.0.804 → 0.0.806
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/middleware/age.global.ts +25 -0
- package/middleware/auth.global.ts +35 -0
- package/middleware/normalize.global.ts +27 -0
- package/package.json +4 -1
- package/plugins/countries.server.ts +84 -0
- package/plugins/country.server.ts +7 -0
- package/plugins/mobile.server.ts +8 -0
- package/plugins/services.client.ts +17 -0
- package/server/api/age/verify.post.ts +15 -0
- package/server/api/authorization/change-email.post.ts +14 -0
- package/server/api/authorization/change-password.post.ts +14 -0
- package/server/api/authorization/confirm.get.ts +13 -0
- package/server/api/authorization/delete-profile.delete.ts +13 -0
- package/server/api/authorization/get-profile.get.ts +15 -0
- package/server/api/authorization/login.post.ts +14 -0
- package/server/api/authorization/password.post.ts +14 -0
- package/server/api/authorization/post-profile.post.ts +15 -0
- package/server/api/authorization/profile-avatar.delete.ts +13 -0
- package/server/api/authorization/recovery-password.post.ts +14 -0
- package/server/api/authorization/register.post.ts +14 -0
- package/server/api/categories/get-categories-by-name.get.ts +10 -0
- package/server/api/categories/get-categories-by-phrase.get.ts +30 -0
- package/server/api/categories/get-top-random-footer.get.ts +11 -0
- package/server/api/categories/get-top-random-full.get.ts +11 -0
- package/server/api/categories/get-top-random.get.ts +11 -0
- package/server/api/categories/group-categories.get.ts +23 -0
- package/server/api/categories/list-by-letter.post.ts +22 -0
- package/server/api/categories/list-grouped-by-letter-chips.get.ts +20 -0
- package/server/api/categories/list-grouped-by-letter.get.ts +14 -0
- package/server/api/categories/related-phrases-by-name.get.ts +8 -0
- package/server/api/channels/channels-by-model/[slug].get.ts +26 -0
- package/server/api/channels/channels-by-name/[slug].get.ts +16 -0
- package/server/api/channels/channels-by-network-name/[slug].get.ts +26 -0
- package/server/api/channels/channels.get.ts +25 -0
- package/server/api/contacts/email.post.ts +12 -0
- package/server/api/dictionaries/countries.get.ts +8 -0
- package/server/api/dictionaries/genders.get.ts +8 -0
- package/server/api/models/get-info-by-name.get.ts +10 -0
- package/server/api/models/get-models-by-phrase.get.ts +25 -0
- package/server/api/models/get-top-chips.get.ts +11 -0
- package/server/api/models/list-by-category/[category].get.ts +26 -0
- package/server/api/models/list-by-channel/[channel].get.ts +26 -0
- package/server/api/models/list-by-first-letter-chips.get.ts +11 -0
- package/server/api/models/list-by-first-letter.get.ts +18 -0
- package/server/api/models/list-by-niche.post.ts +30 -0
- package/server/api/models/list-by-tag/[tag].get.ts +26 -0
- package/server/api/models/related.get.ts +25 -0
- package/server/api/models/top.get.ts +18 -0
- package/server/api/playlist/delete-playlist/[id].delete.ts +12 -0
- package/server/api/playlist/delete-video/[pid]/[vid].delete.ts +18 -0
- package/server/api/playlist/get-playlist-by-id/[id].get.ts +16 -0
- package/server/api/playlist/get-playlist-videos-by-id/[id].get.ts +27 -0
- package/server/api/playlist/get-user-playlists.get.ts +49 -0
- package/server/api/playlist/playlist-dislike/[md].post.ts +13 -0
- package/server/api/playlist/playlist-like/[md].post.ts +13 -0
- package/server/api/playlist/playlist-view/[id].post.ts +13 -0
- package/server/api/playlist/playlists-list-by-niche.get.ts +25 -0
- package/server/api/playlist/post-playlist.post.ts +12 -0
- package/server/api/playlist/post-video.post.ts +12 -0
- package/server/api/playlist/refresh-playlist/[id].put.ts +13 -0
- package/server/api/search/multi-suggest.get.ts +14 -0
- package/server/api/search/phrases.get.ts +13 -0
- package/server/api/site/aabd.get.ts +16 -0
- package/server/api/site/index.get.ts +17 -0
- package/server/api/videos/get-related-videos-by-id/[id].get.ts +32 -0
- package/server/api/videos/get-related-videos-by-url/[url].get.ts +27 -0
- package/server/api/videos/get-video-by-id/[id].get.ts +30 -0
- package/server/api/videos/get-video-by-url/[url].get.ts +29 -0
- package/server/api/videos/list-by-niche-and-category.post.ts +29 -0
- package/server/api/videos/list-by-niche-and-channel.post.ts +29 -0
- package/server/api/videos/list-by-niche-and-model-and-channel.post.ts +29 -0
- package/server/api/videos/list-by-niche-and-model-and-tag.post.ts +29 -0
- package/server/api/videos/list-by-niche-and-model.post.ts +29 -0
- package/server/api/videos/list-by-niche-and-tag.post.ts +29 -0
- package/server/api/videos/list-by-niche.post.ts +32 -0
- package/server/api/videos/popular-tags-by-channel-name.get.ts +11 -0
- package/server/api/videos/popular-tags-by-model-name.get.ts +11 -0
- package/server/api/videos/referer-phrases-by-id/[id].get.ts +14 -0
- package/server/api/videos/referer-phrases-by-url/[id].get.ts +14 -0
- package/server/api/videos/send-video-abuse/[videoGuid].ts +13 -0
- package/server/api/videos/video-dislike/[md].post.ts +13 -0
- package/server/api/videos/video-like/[md].post.ts +13 -0
- package/server/api/videos/video-search-by-niche.ts +29 -0
- package/server/api/videos/video-view/[md].post.ts +13 -0
- package/server/plugins/metrics.ts +115 -0
- package/server/utils/metrics.ts +29 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IChannelCard, IRawChannelCard } from '../../../../types';
|
|
2
|
+
import { cleanChannelCard, getUrlWithProxiedParams } from '../../../../runtime';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const slug = getRouterParam(event, 'slug');
|
|
7
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/channels/by-network/${slug}`, event);
|
|
8
|
+
|
|
9
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
10
|
+
|
|
11
|
+
const rawData = await apiFetch(url, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: clientHeaders,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const items: IRawChannelCard[] = rawData.data?.items || [];
|
|
17
|
+
|
|
18
|
+
const cleanedItems: IChannelCard[] = items.map(cleanChannelCard);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
currentPage: rawData.data?.current_page,
|
|
22
|
+
allPages: rawData.data?.all_pages,
|
|
23
|
+
total: rawData.data?.total,
|
|
24
|
+
items: cleanedItems,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IChannelCard, IRawChannelCard } from '../../../types';
|
|
2
|
+
import { cleanChannelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/channels`, event);
|
|
7
|
+
|
|
8
|
+
const data = await cachedApiFetch<{
|
|
9
|
+
items?: IRawChannelCard[];
|
|
10
|
+
current_page?: number;
|
|
11
|
+
all_pages?: number;
|
|
12
|
+
total?: number;
|
|
13
|
+
}>(url, event, 600);
|
|
14
|
+
|
|
15
|
+
const items: IRawChannelCard[] = data?.items || [];
|
|
16
|
+
|
|
17
|
+
const cleanedItems: IChannelCard[] = items.map(cleanChannelCard);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
currentPage: data?.current_page,
|
|
21
|
+
allPages: data?.all_pages,
|
|
22
|
+
total: data?.total,
|
|
23
|
+
items: cleanedItems,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/contacts/email`, event);
|
|
6
|
+
|
|
7
|
+
return await apiFetch(url, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
10
|
+
body: JSON.stringify(await readBody(event)),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/countries`, event);
|
|
6
|
+
|
|
7
|
+
return await cachedApiFetch(url, event, 3600);
|
|
8
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/genders`, event);
|
|
6
|
+
|
|
7
|
+
return await cachedApiFetch(url, event, 3600);
|
|
8
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cleanModelInfo, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/get-info-by-name`, event);
|
|
6
|
+
|
|
7
|
+
const data = await cachedApiFetch(url, event, 300);
|
|
8
|
+
|
|
9
|
+
return cleanModelInfo(data);
|
|
10
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/search`, event);
|
|
7
|
+
|
|
8
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
9
|
+
|
|
10
|
+
const rawData = await apiFetch(url, {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
headers: clientHeaders,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const items: IRawModelCard[] = rawData.data?.items || [];
|
|
16
|
+
|
|
17
|
+
const cleanedItems: IModelCard[] = items.map(cleanModelCard);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
currentPage: rawData.data?.current_page,
|
|
21
|
+
allPages: rawData.data?.all_pages,
|
|
22
|
+
total: rawData.data?.total,
|
|
23
|
+
items: cleanedItems,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IRawModelCard, PaginatedResponse } from '../../../types';
|
|
2
|
+
import { convertModelCardToChips, getUrlWithProxiedParams } from '../../../runtime';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/top`, event);
|
|
7
|
+
|
|
8
|
+
const models = await cachedApiFetch<PaginatedResponse<IRawModelCard>>(url, event);
|
|
9
|
+
|
|
10
|
+
return convertModelCardToChips(models.items);
|
|
11
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard } from '../../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const category = getRouterParam(event, 'category');
|
|
7
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/list-by-category/${category}`, event);
|
|
8
|
+
|
|
9
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
10
|
+
|
|
11
|
+
const rawData = await apiFetch(url, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: clientHeaders,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const items: IRawModelCard[] = rawData.data?.items || [];
|
|
17
|
+
|
|
18
|
+
const cleanedItems: IModelCard[] = items.map(cleanModelCard);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
currentPage: rawData.data?.current_page,
|
|
22
|
+
allPages: rawData.data?.all_pages,
|
|
23
|
+
total: rawData.data?.total,
|
|
24
|
+
items: cleanedItems,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard } from '../../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const channel = getRouterParam(event, 'channel');
|
|
7
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/list-by-channel/${channel}`, event);
|
|
8
|
+
|
|
9
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
10
|
+
|
|
11
|
+
const rawData = await apiFetch(url, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: clientHeaders,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const items: IRawModelCard[] = rawData.data?.items || [];
|
|
17
|
+
|
|
18
|
+
const cleanedItems: IModelCard[] = items.map(cleanModelCard);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
currentPage: rawData.data?.current_page,
|
|
22
|
+
allPages: rawData.data?.all_pages,
|
|
23
|
+
total: rawData.data?.total,
|
|
24
|
+
items: cleanedItems,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IRawModelCard, PaginatedResponse } from '../../../types';
|
|
2
|
+
import { convertModelCardToChips, getUrlWithProxiedParams } from '../../../runtime';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/list-by-first-letter`, event);
|
|
7
|
+
|
|
8
|
+
const models = await cachedApiFetch<PaginatedResponse<IRawModelCard>>(url, event);
|
|
9
|
+
|
|
10
|
+
return convertModelCardToChips(models.items);
|
|
11
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard, PaginatedResponse } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/list-by-first-letter`, event);
|
|
7
|
+
|
|
8
|
+
const data = await cachedApiFetch<PaginatedResponse<IRawModelCard>>(url, event);
|
|
9
|
+
|
|
10
|
+
const cleanedItems: IModelCard[] = (data.items || []).map(cleanModelCard);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
currentPage: data.current_page,
|
|
14
|
+
allPages: data.all_pages,
|
|
15
|
+
total: data.total,
|
|
16
|
+
items: cleanedItems,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IModelFilter, IRawModelCard, IModelCard } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/filter`, event);
|
|
7
|
+
|
|
8
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
9
|
+
|
|
10
|
+
const body = await readBody(event);
|
|
11
|
+
|
|
12
|
+
const rawData = await apiFetch(url, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
headers: clientHeaders,
|
|
15
|
+
body: JSON.stringify(body),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const items: IRawModelCard[] = rawData?.data?.items || [];
|
|
19
|
+
const filters: IModelFilter[] = rawData?.data?.filters || [];
|
|
20
|
+
|
|
21
|
+
const cleanedItems: IModelCard[] = items && items.length > 0 ? items.map(cleanModelCard) : [];
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
currentPage: rawData?.data?.current_page,
|
|
25
|
+
allPages: rawData?.data?.all_pages,
|
|
26
|
+
total: rawData?.data?.total,
|
|
27
|
+
items: cleanedItems,
|
|
28
|
+
filters: filters,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard } from '../../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const tag = getRouterParam(event, 'tag');
|
|
7
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/list-by-tag/${tag}`, event);
|
|
8
|
+
|
|
9
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
10
|
+
|
|
11
|
+
const rawData = await apiFetch(url, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: clientHeaders,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const items: IRawModelCard[] = rawData.data?.items || [];
|
|
17
|
+
|
|
18
|
+
const cleanedItems: IModelCard[] = items.map(cleanModelCard);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
currentPage: rawData.data?.current_page,
|
|
22
|
+
allPages: rawData.data?.all_pages,
|
|
23
|
+
total: rawData.data?.total,
|
|
24
|
+
items: cleanedItems,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/related`, event);
|
|
7
|
+
|
|
8
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
9
|
+
|
|
10
|
+
const rawData = await apiFetch(url, {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
headers: clientHeaders,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const items: IRawModelCard[] = rawData.data?.items || [];
|
|
16
|
+
|
|
17
|
+
const cleanedItems: IModelCard[] = items.map(cleanModelCard);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
currentPage: rawData.data?.current_page,
|
|
21
|
+
allPages: rawData.data?.all_pages,
|
|
22
|
+
total: rawData.data?.total,
|
|
23
|
+
items: cleanedItems,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cleanModelCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IRawModelCard, IModelCard, PaginatedResponse } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/models/top`, event);
|
|
7
|
+
|
|
8
|
+
const data = await cachedApiFetch<PaginatedResponse<IRawModelCard>>(url, event);
|
|
9
|
+
|
|
10
|
+
const cleanedItems: IModelCard[] = (data?.items || []).map(cleanModelCard);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
currentPage: data?.current_page,
|
|
14
|
+
allPages: data?.all_pages,
|
|
15
|
+
total: data?.total,
|
|
16
|
+
items: cleanedItems,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const id = getRouterParam(event, 'id');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${id}`, event);
|
|
7
|
+
|
|
8
|
+
return await apiFetch(url, {
|
|
9
|
+
method: 'DELETE',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
|
|
6
|
+
const pid = getRouterParam(event, 'pid');
|
|
7
|
+
const vid = getRouterParam(event, 'vid');
|
|
8
|
+
|
|
9
|
+
const url = getUrlWithProxiedParams(
|
|
10
|
+
`${apiUrl}/v1/playlist/${pid}/video/${vid}`,
|
|
11
|
+
event
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return await apiFetch(url, {
|
|
15
|
+
method: 'DELETE',
|
|
16
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cleanPlaylistData, getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const id = getRouterParam(event, 'id');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${id}`, event);
|
|
7
|
+
|
|
8
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
9
|
+
|
|
10
|
+
const rawData = await apiFetch(url, {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
headers: clientHeaders,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return cleanPlaylistData(rawData.data);
|
|
16
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cleanPlaylistVideo, getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
import type { IRawPlaylistVideo, IVideoCard } from '../../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const id = getRouterParam(event, 'id');
|
|
7
|
+
|
|
8
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/video/list-by-playlist-id/${id}`, event);
|
|
9
|
+
|
|
10
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
11
|
+
|
|
12
|
+
const rawData = await apiFetch(url, {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
headers: clientHeaders,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const items: IRawPlaylistVideo[] = rawData?.data?.items || [];
|
|
18
|
+
|
|
19
|
+
const cleanedItems: IVideoCard[] = items.map(cleanPlaylistVideo);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
currentPage: rawData.data?.currentPage,
|
|
23
|
+
allPages: rawData.data?.allPages,
|
|
24
|
+
total: rawData.data?.total,
|
|
25
|
+
items: cleanedItems,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanPlaylistCard,
|
|
3
|
+
cleanUserPlaylistCard,
|
|
4
|
+
getUrlWithProxiedParams,
|
|
5
|
+
} from '../../../runtime';
|
|
6
|
+
import type { IRawPlaylistsUser, IPlaylistCard, IRawPlaylistCard, PaginatedResponse } from '../../../types';
|
|
7
|
+
|
|
8
|
+
export default defineEventHandler(async (event) => {
|
|
9
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
10
|
+
const playlistUrl = getUrlWithProxiedParams(`${apiUrl}/v1/playlist`, event);
|
|
11
|
+
const myPlaylistByNicheUrl = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/my-list-by-niche`, event);
|
|
12
|
+
|
|
13
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
14
|
+
|
|
15
|
+
const [playlistRaw, myPlaylistByNicheRaw] = await Promise.all([
|
|
16
|
+
apiFetch(playlistUrl, {
|
|
17
|
+
method: 'GET',
|
|
18
|
+
headers: clientHeaders,
|
|
19
|
+
}),
|
|
20
|
+
apiFetch(myPlaylistByNicheUrl, { method: 'GET', headers: clientHeaders }),
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const playlist = playlistRaw.data as PaginatedResponse<IRawPlaylistsUser>;
|
|
24
|
+
const myPlaylistByNiche = myPlaylistByNicheRaw.data as PaginatedResponse<IRawPlaylistCard>;
|
|
25
|
+
|
|
26
|
+
const playlistItems: IPlaylistCard[] = playlist?.playlists?.map(cleanUserPlaylistCard);
|
|
27
|
+
const myPlaylistByNicheItems: IPlaylistCard[] = myPlaylistByNiche?.items?.map(cleanPlaylistCard);
|
|
28
|
+
|
|
29
|
+
const items = playlistItems?.map((item) => {
|
|
30
|
+
const myPlaylist = myPlaylistByNicheItems?.find(
|
|
31
|
+
(subItem) => subItem.id === item.id
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
...item,
|
|
36
|
+
views: myPlaylist?.views,
|
|
37
|
+
searchTags: myPlaylist?.searchTags,
|
|
38
|
+
likes: myPlaylist?.likes,
|
|
39
|
+
dislikes: myPlaylist?.dislikes,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
currentPage: playlist?.currentPage,
|
|
45
|
+
allPages: playlist?.allPages,
|
|
46
|
+
total: playlist?.total,
|
|
47
|
+
items: items,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event): Promise<any> => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const md = getRouterParam(event, 'md');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${md}/dislike`, event);
|
|
7
|
+
|
|
8
|
+
return await apiFetch(url, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
body: JSON.stringify(await readBody(event)),
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event): Promise<any> => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const md = getRouterParam(event, 'md');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${md}/like`, event);
|
|
7
|
+
|
|
8
|
+
return await apiFetch(url, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
body: JSON.stringify(await readBody(event)),
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const id = getRouterParam(event, 'id');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${id}/view`, event);
|
|
7
|
+
|
|
8
|
+
return await apiFetch(url, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
body: JSON.stringify(await readBody(event)),
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cleanPlaylistCard, getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
import type { IRawPlaylistCard, IPlaylistCard } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/list-by-niche`, event);
|
|
7
|
+
|
|
8
|
+
const clientHeaders = event.node.req.headers as HeadersInit;
|
|
9
|
+
|
|
10
|
+
const rawData = await apiFetch(url, {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
headers: clientHeaders,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const items: IRawPlaylistCard[] = rawData.data?.items || [];
|
|
16
|
+
|
|
17
|
+
const cleanedItems: IPlaylistCard[] = items.map(cleanPlaylistCard);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
currentPage: rawData.data?.current_page,
|
|
21
|
+
allPages: rawData.data?.all_pages,
|
|
22
|
+
total: rawData.data?.total,
|
|
23
|
+
items: cleanedItems,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist`, event);
|
|
6
|
+
|
|
7
|
+
return await apiFetch(url, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
10
|
+
body: JSON.stringify(await readBody(event)),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/video`, event);
|
|
6
|
+
|
|
7
|
+
return await apiFetch(url, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
10
|
+
body: JSON.stringify(await readBody(event)),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const id = getRouterParam(event, 'id');
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/playlist/${id}`, event);
|
|
7
|
+
|
|
8
|
+
return await apiFetch(url, {
|
|
9
|
+
method: 'PUT',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
body: JSON.stringify(await readBody(event)),
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams, convertSnakeKeysToCamel } from '../../../runtime';
|
|
2
|
+
import type { IMultiSuggest } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
6
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v2/search/multi-suggest`, event);
|
|
7
|
+
|
|
8
|
+
const rawData = await apiFetch(url, {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
return convertSnakeKeysToCamel<IMultiSuggest>(rawData.data);
|
|
14
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getUrlWithProxiedParams } from '../../../runtime';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
const url = getUrlWithProxiedParams(`${apiUrl}/v1/search/phrases`, event);
|
|
6
|
+
|
|
7
|
+
const rawData = await apiFetch(url, {
|
|
8
|
+
method: 'GET',
|
|
9
|
+
headers: getRequestHeaders(event) as HeadersInit,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return rawData.data ?? [];
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SiteDataService } from '../../../services/site-data.service';
|
|
2
|
+
|
|
3
|
+
/* Нечитаемое имя для того, чтобы юзеры лишний раз не палили что за запрос */
|
|
4
|
+
|
|
5
|
+
export default defineEventHandler(() => {
|
|
6
|
+
const domains = [...SiteDataService.getAntiAdblokDomains() || []];
|
|
7
|
+
|
|
8
|
+
if (!domains || domains.length === 0) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const currentHour = new Date().getHours();
|
|
13
|
+
const index = currentHour % domains.length;
|
|
14
|
+
|
|
15
|
+
return domains[index];
|
|
16
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ISiteData, ISiteLanguagesResponse, ISiteNichesResponse, ISiteResponse } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export default defineEventHandler(async (event): Promise<ISiteData> => {
|
|
4
|
+
const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN;
|
|
5
|
+
|
|
6
|
+
const [siteData, languagesResponse, nichesResponse] = await Promise.all([
|
|
7
|
+
cachedApiFetch<ISiteResponse>(`${apiUrl}/v1/site`, event, 3600),
|
|
8
|
+
cachedApiFetch<ISiteLanguagesResponse>(`${apiUrl}/v1/site/languages`, event, 3600),
|
|
9
|
+
cachedApiFetch<ISiteNichesResponse>(`${apiUrl}/v1/site/niches`, event, 3600),
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
siteData,
|
|
14
|
+
languages: languagesResponse?.items || [],
|
|
15
|
+
niches: nichesResponse?.items || [],
|
|
16
|
+
};
|
|
17
|
+
});
|