import { VideoFile } from '@shared/models/videos/video-file.model'
import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
import * as validator from 'validator'
-import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation
const indexes: (ModelIndexesOptions & { where?: WhereOptions })[] = [
WITH_WEBTORRENT_FILES = 'WITH_WEBTORRENT_FILES',
WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE',
WITH_BLACKLISTED = 'WITH_BLACKLISTED',
- WITH_BLOCKLIST = 'WITH_BLOCKLIST',
WITH_USER_HISTORY = 'WITH_USER_HISTORY',
WITH_STREAMING_PLAYLISTS = 'WITH_STREAMING_PLAYLISTS',
WITH_USER_ID = 'WITH_USER_ID',
query.subQuery = false
}
- if (options.filter || options.accountId || options.videoChannelId) {
+ if (options.filter && (options.filter === 'local' || options.filter === 'all-local')) {
+ whereAnd.push({
+ remote: false
+ })
+ }
+
+ if (options.accountId || options.videoChannelId) {
const videoChannelInclude: IncludeOptions = {
attributes: [],
model: VideoChannelModel.unscoped(),
}
}
- if (options.filter || options.accountId) {
+ if (options.accountId) {
const accountInclude: IncludeOptions = {
attributes: [],
model: AccountModel.unscoped(),
required: true
}
- if (options.filter) {
- accountInclude.include = [
- {
- attributes: [],
- model: ActorModel.unscoped(),
- required: true,
- where: VideoModel.buildActorWhereWithFilter(options.filter)
- }
- ]
- }
-
- if (options.accountId) {
- accountInclude.where = { id: options.accountId }
- }
-
+ accountInclude.where = { id: options.accountId }
videoChannelInclude.include = [ accountInclude ]
}
}
return query
- },
- [ScopeNames.WITH_BLOCKLIST]: {
-
},
[ ScopeNames.WITH_THUMBNAILS ]: {
include: [
}
}
- private static buildActorWhereWithFilter (filter?: VideoFilter) {
- if (filter && (filter === 'local' || filter === 'all-local')) {
- return {
- serverId: null
- }
- }
-
- return {}
- }
-
private static async getAvailableForApi (
query: FindOptions & { where?: null }, // Forbid where field in query
options: AvailableForListIDsOptions,