diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/search/search-video-channels.ts | 5 | ||||
-rw-r--r-- | server/controllers/api/search/search-video-playlists.ts | 5 | ||||
-rw-r--r-- | server/controllers/api/search/search-videos.ts | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts index d615ff9ed..1d2a9d235 100644 --- a/server/controllers/api/search/search-video-channels.ts +++ b/server/controllers/api/search/search-video-channels.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { sanitizeUrl } from '@server/helpers/core-utils' | 2 | import { sanitizeUrl } from '@server/helpers/core-utils' |
3 | import { pickSearchChannelQuery } from '@server/helpers/query' | 3 | import { pickSearchChannelQuery } from '@server/helpers/query' |
4 | import { doJSONRequest, findLatestRedirection } from '@server/helpers/requests' | 4 | import { doJSONRequest } from '@server/helpers/requests' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { WEBSERVER } from '@server/initializers/constants' | 6 | import { WEBSERVER } from '@server/initializers/constants' |
7 | import { findLatestAPRedirection } from '@server/lib/activitypub/activity' | ||
7 | import { Hooks } from '@server/lib/plugins/hooks' | 8 | import { Hooks } from '@server/lib/plugins/hooks' |
8 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 9 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
9 | import { getServerActor } from '@server/models/application/application' | 10 | import { getServerActor } from '@server/models/application/application' |
@@ -126,7 +127,7 @@ async function searchVideoChannelURI (search: string, res: express.Response) { | |||
126 | 127 | ||
127 | if (isUserAbleToSearchRemoteURI(res)) { | 128 | if (isUserAbleToSearchRemoteURI(res)) { |
128 | try { | 129 | try { |
129 | const latestUri = await findLatestRedirection(uri, { activityPub: true }) | 130 | const latestUri = await findLatestAPRedirection(uri) |
130 | 131 | ||
131 | const actor = await getOrCreateAPActor(latestUri, 'all', true, true) | 132 | const actor = await getOrCreateAPActor(latestUri, 'all', true, true) |
132 | videoChannel = actor.VideoChannel | 133 | videoChannel = actor.VideoChannel |
diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts index e76d65fde..97aeeaba9 100644 --- a/server/controllers/api/search/search-video-playlists.ts +++ b/server/controllers/api/search/search-video-playlists.ts | |||
@@ -3,10 +3,11 @@ import { sanitizeUrl } from '@server/helpers/core-utils' | |||
3 | import { isUserAbleToSearchRemoteURI } from '@server/helpers/express-utils' | 3 | import { isUserAbleToSearchRemoteURI } from '@server/helpers/express-utils' |
4 | import { logger } from '@server/helpers/logger' | 4 | import { logger } from '@server/helpers/logger' |
5 | import { pickSearchPlaylistQuery } from '@server/helpers/query' | 5 | import { pickSearchPlaylistQuery } from '@server/helpers/query' |
6 | import { doJSONRequest, findLatestRedirection } from '@server/helpers/requests' | 6 | import { doJSONRequest } from '@server/helpers/requests' |
7 | import { getFormattedObjects } from '@server/helpers/utils' | 7 | import { getFormattedObjects } from '@server/helpers/utils' |
8 | import { CONFIG } from '@server/initializers/config' | 8 | import { CONFIG } from '@server/initializers/config' |
9 | import { WEBSERVER } from '@server/initializers/constants' | 9 | import { WEBSERVER } from '@server/initializers/constants' |
10 | import { findLatestAPRedirection } from '@server/lib/activitypub/activity' | ||
10 | import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' | 11 | import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' |
11 | import { Hooks } from '@server/lib/plugins/hooks' | 12 | import { Hooks } from '@server/lib/plugins/hooks' |
12 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 13 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
@@ -105,7 +106,7 @@ async function searchVideoPlaylistsURI (search: string, res: express.Response) { | |||
105 | 106 | ||
106 | if (isUserAbleToSearchRemoteURI(res)) { | 107 | if (isUserAbleToSearchRemoteURI(res)) { |
107 | try { | 108 | try { |
108 | const url = await findLatestRedirection(search, { activityPub: true }) | 109 | const url = await findLatestAPRedirection(search) |
109 | 110 | ||
110 | videoPlaylist = await getOrCreateAPVideoPlaylist(url) | 111 | videoPlaylist = await getOrCreateAPVideoPlaylist(url) |
111 | } catch (err) { | 112 | } catch (err) { |
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts index d0ab7f12a..b33064335 100644 --- a/server/controllers/api/search/search-videos.ts +++ b/server/controllers/api/search/search-videos.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { sanitizeUrl } from '@server/helpers/core-utils' | 2 | import { sanitizeUrl } from '@server/helpers/core-utils' |
3 | import { pickSearchVideoQuery } from '@server/helpers/query' | 3 | import { pickSearchVideoQuery } from '@server/helpers/query' |
4 | import { doJSONRequest, findLatestRedirection } from '@server/helpers/requests' | 4 | import { doJSONRequest } from '@server/helpers/requests' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { WEBSERVER } from '@server/initializers/constants' | 6 | import { WEBSERVER } from '@server/initializers/constants' |
7 | import { findLatestAPRedirection } from '@server/lib/activitypub/activity' | ||
7 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' | 8 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' |
8 | import { Hooks } from '@server/lib/plugins/hooks' | 9 | import { Hooks } from '@server/lib/plugins/hooks' |
9 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 10 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
@@ -141,7 +142,7 @@ async function searchVideoURI (url: string, res: express.Response) { | |||
141 | } | 142 | } |
142 | 143 | ||
143 | const result = await getOrCreateAPVideo({ | 144 | const result = await getOrCreateAPVideo({ |
144 | videoObject: await findLatestRedirection(url, { activityPub: true }), | 145 | videoObject: await findLatestAPRedirection(url), |
145 | syncParam | 146 | syncParam |
146 | }) | 147 | }) |
147 | video = result ? result.video : undefined | 148 | video = result ? result.video : undefined |