Use @peertube/peertube-types
This commit is contained in:
parent
8ed5c72945
commit
1fe5ef9ef5
|
@ -13,6 +13,7 @@
|
|||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.20.5",
|
||||
"@peertube/peertube-types": "^5.0.0",
|
||||
"@popperjs/core": "^2.11.6",
|
||||
"@sipec/vue3-tags-input": "^3.0.4",
|
||||
"@types/axios": "^0.14.0",
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import axios from 'axios'
|
||||
import { ResultList, VideoPlaylistsSearchQuery } from '../../../PeerTube/shared/models'
|
||||
import { VideoChannelsSearchQuery } from '../../../PeerTube/shared/models/search/video-channels-search-query.model'
|
||||
import { VideosSearchQuery } from '../../../PeerTube/shared/models/search/videos-search-query.model'
|
||||
import { ResultList, VideoChannelsSearchQuery, VideoPlaylistsSearchQuery, VideosSearchQuery } from '@peertube/peertube-types'
|
||||
import { EnhancedVideoChannel } from '../../../server/types/channel.model'
|
||||
import { EnhancedPlaylist } from '../../../server/types/playlist.model'
|
||||
import { EnhancedVideo } from '../../../server/types/video.model'
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
import Pagination from '../components/Pagination.vue'
|
||||
import SearchInput from '../components/SearchInput.vue'
|
||||
import SortButton from '../components/SortButton.vue'
|
||||
import { VideoChannelsSearchQuery, ResultList, VideosSearchQuery } from '../../../PeerTube/shared/models'
|
||||
import { VideoChannelsSearchQuery, ResultList, VideosSearchQuery } from '@peertube/peertube-types'
|
||||
import Nprogress from 'nprogress'
|
||||
import { EnhancedPlaylist } from '../../../server/types/playlist.model'
|
||||
import { PlaylistsSearchQuery } from '../../../server/types/search-query/playlist-search.model'
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
"skipLibCheck": true,
|
||||
"lib": ["esnext", "dom"],
|
||||
"paths": {
|
||||
"@shared/*": [ "../PeerTube/shared/*" ],
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
|
|
2825
client/yarn.lock
2825
client/yarn.lock
File diff suppressed because it is too large
Load Diff
|
@ -45,6 +45,7 @@
|
|||
"source-map-support": "^0.5.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@peertube/peertube-types": "^5.0.0",
|
||||
"@types/async": "^3.2.13",
|
||||
"@types/body-parser": "^1.19.2",
|
||||
"@types/config": "^3.3.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import express from 'express'
|
||||
import { ResultList } from '../../PeerTube/shared/models/common/result-list.model'
|
||||
import { ResultList } from '@peertube/peertube-types'
|
||||
|
||||
function badRequest (req: express.Request, res: express.Response) {
|
||||
return res.type('json').status(400).end()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ResultList } from '../../../PeerTube/shared/models'
|
||||
import { ResultList } from '@peertube/peertube-types'
|
||||
import { CONFIG } from '../../initializers/constants'
|
||||
import { CommonSearch } from '../../types/search-query/common-search.model'
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ function buildVideosMapping () {
|
|||
}
|
||||
|
||||
function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo | DBVideoDetails {
|
||||
return {
|
||||
const video = {
|
||||
id: v.id,
|
||||
uuid: v.uuid,
|
||||
shortUUID: v.shortUUID,
|
||||
|
@ -402,13 +402,21 @@ function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo |
|
|||
},
|
||||
|
||||
name: v.name,
|
||||
|
||||
truncatedDescription: v.truncatedDescription,
|
||||
description: v.description,
|
||||
|
||||
waitTranscoding: v.waitTranscoding,
|
||||
|
||||
duration: v.duration,
|
||||
|
||||
thumbnailPath: v.thumbnailPath,
|
||||
previewPath: v.previewPath,
|
||||
embedPath: v.embedPath,
|
||||
|
||||
|
||||
views: v.views,
|
||||
viewers: v.viewers,
|
||||
likes: v.likes,
|
||||
dislikes: v.dislikes,
|
||||
|
||||
|
@ -418,11 +426,30 @@ function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo |
|
|||
host: v.host,
|
||||
url: v.url,
|
||||
|
||||
files: v.files,
|
||||
streamingPlaylists: v.streamingPlaylists,
|
||||
|
||||
tags: (v as IndexableVideoDetails).tags ? (v as IndexableVideoDetails).tags : undefined,
|
||||
|
||||
account: formatActorForDB(v.account),
|
||||
channel: formatActorForDB(v.channel)
|
||||
}
|
||||
|
||||
if (isVideoDetails(v)) {
|
||||
return {
|
||||
...video,
|
||||
trackerUrls: v.trackerUrls,
|
||||
|
||||
descriptionPath: v.descriptionPath,
|
||||
|
||||
support: v.support,
|
||||
|
||||
commentsEnabled: v.commentsEnabled,
|
||||
downloadEnabled: v.downloadEnabled,
|
||||
}
|
||||
}
|
||||
|
||||
return video
|
||||
}
|
||||
|
||||
function formatVideoForAPI (v: DBVideoDetails, fromHost?: string): EnhancedVideo {
|
||||
|
@ -457,6 +484,7 @@ function formatVideoForAPI (v: DBVideoDetails, fromHost?: string): EnhancedVideo
|
|||
|
||||
name: v.name,
|
||||
description: v.description,
|
||||
truncatedDescription: v.truncatedDescription,
|
||||
duration: v.duration,
|
||||
|
||||
tags: v.tags,
|
||||
|
@ -475,6 +503,7 @@ function formatVideoForAPI (v: DBVideoDetails, fromHost?: string): EnhancedVideo
|
|||
isLocal: fromHost && fromHost === v.host,
|
||||
|
||||
views: v.views,
|
||||
viewers: v.viewers,
|
||||
likes: v.likes,
|
||||
dislikes: v.dislikes,
|
||||
|
||||
|
@ -492,3 +521,9 @@ export {
|
|||
formatVideoForAPI,
|
||||
buildVideosMapping
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function isVideoDetails (video: IndexableVideo | IndexableVideoDetails): video is IndexableVideoDetails {
|
||||
return (video as IndexableVideoDetails).commentsEnabled !== undefined
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MappingProperty, PropertyName } from '@elastic/elasticsearch/lib/api/types'
|
||||
import { AccountSummary, VideoChannelSummary } from '../../../../PeerTube/shared/models'
|
||||
import { AccountSummary, VideoChannelSummary } from '@peertube/peertube-types'
|
||||
import { AdditionalActorAttributes } from '../../../types/actor.model'
|
||||
import { formatActorImageForDB } from './'
|
||||
import { buildActorImageMapping, formatActorImageForAPI, formatActorImagesForAPI, formatActorImagesForDB } from './elastic-search-avatar'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MappingProperty, PropertyName } from '@elastic/elasticsearch/lib/api/types'
|
||||
import { ActorImage } from '../../../../PeerTube/shared/models'
|
||||
import { ActorImage } from '@peertube/peertube-types'
|
||||
import { buildUrl } from '../../../helpers/utils'
|
||||
|
||||
function formatActorImageForAPI (image?: ActorImage) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { IndexablePlaylist } from 'server/types/playlist.model'
|
||||
import { ResultList, Video, VideoChannel, VideoDetails, VideoPlaylist } from '@shared/models'
|
||||
import { ResultList, Video, VideoChannel, VideoDetails, VideoPlaylist } from '@peertube/peertube-types'
|
||||
import { doRequestWithRetries } from '../../helpers/requests'
|
||||
import { INDEXER_COUNT, REQUESTS } from '../../initializers/constants'
|
||||
import { IndexableChannel } from '../../types/channel.model'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ActorImage } from '../../PeerTube/shared/models'
|
||||
import { ActorImage } from '@peertube/peertube-types'
|
||||
|
||||
export type AdditionalActorAttributes = {
|
||||
handle: string
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Account, VideoChannel, VideoChannelSummary } from '../../PeerTube/shared/models'
|
||||
import { Account, VideoChannel, VideoChannelSummary } from '@peertube/peertube-types'
|
||||
import { ActorImageExtended, AdditionalActorAttributes } from './actor.model'
|
||||
import { IndexableDoc } from './indexable-doc.model'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AccountSummary, VideoChannelSummary, VideoPlaylist } from '../../PeerTube/shared/models'
|
||||
import { AccountSummary, VideoChannelSummary, VideoPlaylist } from '@peertube/peertube-types'
|
||||
import { AdditionalActorAttributes } from './actor.model'
|
||||
import { IndexableDoc } from './indexable-doc.model'
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import {
|
||||
VideoChannelsSearchQuery as PeerTubeChannelsSearchQuery
|
||||
} from '../../../PeerTube/shared/models/search/video-channels-search-query.model'
|
||||
import { VideoChannelsSearchQuery as PeerTubeChannelsSearchQuery } from '@peertube/peertube-types'
|
||||
import { CommonSearch } from './common-search.model'
|
||||
|
||||
export type ChannelsSearchQuery = PeerTubeChannelsSearchQuery & CommonSearch
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { VideoPlaylistsSearchQuery as PeerTubePlaylistsSearchQuery } from '../../../PeerTube/shared/models'
|
||||
import { VideoPlaylistsSearchQuery as PeerTubePlaylistsSearchQuery } from '@peertube/peertube-types'
|
||||
import { CommonSearch } from './common-search.model'
|
||||
|
||||
export type PlaylistsSearchQuery = PeerTubePlaylistsSearchQuery & CommonSearch
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { VideosSearchQuery as PeerTubeVideosSearchQuery } from '../../../PeerTube/shared/models/search/videos-search-query.model'
|
||||
import { VideosSearchQuery as PeerTubeVideosSearchQuery } from '@peertube/peertube-types'
|
||||
import { CommonSearch } from './common-search.model'
|
||||
|
||||
export type VideosSearchQuery = Omit<PeerTubeVideosSearchQuery, 'skipCount' | 'filter'> & CommonSearch & { boostLanguages: string[] }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
import { Account, AccountSummary, Video, VideoChannel, VideoChannelSummary, VideoDetails } from '../../PeerTube/shared/models'
|
||||
import { Account, AccountSummary, Video, VideoChannel, VideoChannelSummary, VideoDetails } from '@peertube/peertube-types'
|
||||
import { AdditionalActorAttributes } from './actor.model'
|
||||
import { IndexableDoc } from './indexable-doc.model'
|
||||
|
||||
|
|
|
@ -17,10 +17,7 @@
|
|||
"types": [
|
||||
"node"
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@shared/*": [ "PeerTube/shared/*" ]
|
||||
}
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
Loading…
Reference in New Issue