ActivityPub-federated video streaming platform using P2P directly in your web browser
Formated -> Formatted
Chocobozzz0aef76c479bc
diff --git a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.tsindex 6e19a0e447..c4abf3d4db 100644--- a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts+++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts@@ -1,11 +1,11 @@-import { RequestSchedulerStatsAttributes as FormatedRequestSchedulerStatsAttributes } from '../../../../../../shared'+import { RequestSchedulerStatsAttributes as FormattedRequestSchedulerStatsAttributes } from '../../../../../../shared'export interface Request {request: anyto: any}-export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerStatsAttributes {+export class RequestSchedulerStatsAttributes implements FormattedRequestSchedulerStatsAttributes {requestsLimitPods: numberrequestsLimitPerPod: numbermilliSecondsInterval: numberdiff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.tsindex 916b131d9a..e1fa4b7e8b 100644--- a/server/controllers/api/pods.ts+++ b/server/controllers/api/pods.ts@@ -5,7 +5,7 @@ import { CONFIG } from '../../initializers'import {logger,getMyPublicCert,- getFormatedObjects+ getFormattedObjects} from '../../helpers'import {sendOwnedVideosToPod,@@ -25,7 +25,7 @@ import {import {PodInstance} from '../../models'-import { Pod as FormatedPod } from '../../../shared'+import { Pod as FormattedPod } from '../../../shared'const podsRouter = express.Router()@@ -81,7 +81,7 @@ function addPods (req: express.Request, res: express.Response, next: express.Nexfunction listPods (req: express.Request, res: express.Response, next: express.NextFunction) {db.Pod.list()- .then(podsList => res.json(getFormatedObjects<FormatedPod, PodInstance>(podsList, podsList.length)))+ .then(podsList => res.json(getFormattedObjects<FormattedPod, PodInstance>(podsList, podsList.length))).catch(err => next(err))}diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.tsindex f50dbc9a31..04d8851855 100644--- a/server/controllers/api/users.ts+++ b/server/controllers/api/users.ts@@ -2,7 +2,7 @@ import * as express from 'express'import { database as db } from '../../initializers/database'import { USER_ROLES } from '../../initializers'-import { logger, getFormatedObjects } from '../../helpers'+import { logger, getFormattedObjects } from '../../helpers'import {authenticate,ensureIsAdmin,@@ -17,7 +17,7 @@ import {setUsersSort,token} from '../../middlewares'-import { UserVideoRate as FormatedUserVideoRate, UserCreate, UserUpdate } from '../../../shared'+import { UserVideoRate as FormattedUserVideoRate, UserCreate, UserUpdate } from '../../../shared'const usersRouter = express.Router()@@ -95,7 +95,7 @@ function createUser (req: express.Request, res: express.Response, next: express.function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) {db.User.loadByUsername(res.locals.oauth.token.user.username)- .then(user => res.json(user.toFormatedJSON()))+ .then(user => res.json(user.toFormattedJSON())).catch(err => next(err))}@@ -106,7 +106,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:db.UserVideoRate.load(userId, videoId, null).then(ratingObj => {const rating = ratingObj ? ratingObj.type : 'none'- const json: FormatedUserVideoRate = {+ const json: FormattedUserVideoRate = {videoId,rating}@@ -118,7 +118,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) {db.User.listForApi(req.query.start, req.query.count, req.query.sort).then(resultList => {- res.json(getFormatedObjects(resultList.data, resultList.total))+ res.json(getFormattedObjects(resultList.data, resultList.total))}).catch(err => next(err))}diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.tsindex 5cf0303fbf..c9313d5f5b 100644--- a/server/controllers/api/videos/abuse.ts+++ b/server/controllers/api/videos/abuse.ts@@ -4,7 +4,7 @@ import { database as db } from '../../../initializers/database'import * as friends from '../../../lib/friends'import {logger,- getFormatedObjects,+ getFormattedObjects,retryTransactionWrapper} from '../../../helpers'import {@@ -46,7 +46,7 @@ export {function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort)- .then(result => res.json(getFormatedObjects(result.data, result.total)))+ .then(result => res.json(getFormattedObjects(result.data, result.total))).catch(err => next(err))}diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.tsindex d71a132ed0..f639df098a 100644--- a/server/controllers/api/videos/index.ts+++ b/server/controllers/api/videos/index.ts@@ -36,7 +36,7 @@ import {logger,retryTransactionWrapper,generateRandomString,- getFormatedObjects,+ getFormattedObjects,renamePromise} from '../../../helpers'import { TagInstance } from '../../../models'@@ -386,12 +386,12 @@ function getVideo (req: express.Request, res: express.Response, next: express.Ne}// Do not wait the view system- res.json(videoInstance.toFormatedJSON())+ res.json(videoInstance.toFormattedJSON())}function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) {db.Video.listForApi(req.query.start, req.query.count, req.query.sort)- .then(result => res.json(getFormatedObjects(result.data, result.total)))+ .then(result => res.json(getFormattedObjects(result.data, result.total))).catch(err => next(err))}@@ -408,6 +408,6 @@ function removeVideo (req: express.Request, res: express.Response, next: expressfunction searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {db.Video.searchAndPopulateAuthorAndPodAndTags(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort)- .then(result => res.json(getFormatedObjects(result.data, result.total)))+ .then(result => res.json(getFormattedObjects(result.data, result.total))).catch(err => next(err))}diff --git a/server/helpers/utils.ts b/server/helpers/utils.tsindex f326210f32..af5be0c69d 100644--- a/server/helpers/utils.ts+++ b/server/helpers/utils.ts@@ -14,19 +14,19 @@ function generateRandomString (size: number) {}interface FormatableToJSON {- toFormatedJSON ()+ toFormattedJSON ()}-function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {- const formatedObjects: U[] = []+function getFormattedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {+ const formattedObjects: U[] = []objects.forEach(object => {- formatedObjects.push(object.toFormatedJSON())+ formattedObjects.push(object.toFormattedJSON())})const res: ResultList<U> = {total: objectsTotal,- data: formatedObjects+ data: formattedObjects}return res@@ -52,6 +52,6 @@ function isSignupAllowed () {export {badRequest,generateRandomString,- getFormatedObjects,+ getFormattedObjects,isSignupAllowed}diff --git a/server/lib/friends.ts b/server/lib/friends.tsindex bd3ff97a59..3f0ce3f33f 100644--- a/server/lib/friends.ts+++ b/server/lib/friends.ts@@ -42,7 +42,7 @@ import {RemoteVideoRemoveData,RemoteVideoReportAbuseData,ResultList,- Pod as FormatedPod+ Pod as FormattedPod} from '../../shared'type QaduParam = { videoId: number, type: RequestVideoQaduType }@@ -332,7 +332,7 @@ function computeWinningPods (hosts: string[], podsScore: { [ host: string ]: num}function getForeignPodsList (host: string) {- return new Promise< ResultList<FormatedPod> >((res, rej) => {+ return new Promise< ResultList<FormattedPod> >((res, rej) => {const path = '/api/' + API_VERSION + '/pods'request.get(REMOTE_SCHEME.HTTP + '://' + host + path, (err, response, body) => {diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.tsindex 340d4f1a78..8b0b72167d 100644--- a/server/models/pod/pod-interface.ts+++ b/server/models/pod/pod-interface.ts@@ -2,10 +2,10 @@ import * as Sequelize from 'sequelize'import * as Promise from 'bluebird'// Don't use barrel, import just what we need-import { Pod as FormatedPod } from '../../../shared/models/pods/pod.model'+import { Pod as FormattedPod } from '../../../shared/models/pods/pod.model'export namespace PodMethods {- export type ToFormatedJSON = (this: PodInstance) => FormatedPod+ export type ToFormattedJSON = (this: PodInstance) => FormattedPodexport type CountAll = () => Promise<number>@@ -53,7 +53,7 @@ export interface PodInstance extends PodClass, PodAttributes, Sequelize.InstancecreatedAt: DateupdatedAt: Date- toFormatedJSON: PodMethods.ToFormatedJSON,+ toFormattedJSON: PodMethods.ToFormattedJSON,}export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {}diff --git a/server/models/pod/pod.ts b/server/models/pod/pod.tsindex e1088977f1..56918e358f 100644--- a/server/models/pod/pod.ts+++ b/server/models/pod/pod.ts@@ -13,7 +13,7 @@ import {} from './pod-interface'let Pod: Sequelize.Model<PodInstance, PodAttributes>-let toFormatedJSON: PodMethods.ToFormatedJSON+let toFormattedJSON: PodMethods.ToFormattedJSONlet countAll: PodMethods.CountAlllet incrementScores: PodMethods.IncrementScoreslet list: PodMethods.List@@ -86,7 +86,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DaupdatePodsScore,removeAll]- const instanceMethods = [ toFormatedJSON ]+ const instanceMethods = [ toFormattedJSON ]addMethodsToModel(Pod, classMethods, instanceMethods)return Pod@@ -94,7 +94,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da// ------------------------------ METHODS -------------------------------toFormatedJSON = function (this: PodInstance) {+toFormattedJSON = function (this: PodInstance) {const json = {id: this.id,host: this.host,diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.tsindex 9bd3d2ebb2..0b97a8f6d1 100644--- a/server/models/user/user-interface.ts+++ b/server/models/user/user-interface.ts@@ -2,14 +2,14 @@ import * as Sequelize from 'sequelize'import * as Promise from 'bluebird'// Don't use barrel, import just what we need-import { User as FormatedUser } from '../../../shared/models/users/user.model'+import { User as FormattedUser } from '../../../shared/models/users/user.model'import { UserRole } from '../../../shared/models/users/user-role.type'import { ResultList } from '../../../shared/models/result-list.model'export namespace UserMethods {export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean>- export type ToFormatedJSON = (this: UserInstance) => FormatedUser+ export type ToFormattedJSON = (this: UserInstance) => FormattedUserexport type IsAdmin = (this: UserInstance) => booleanexport type CountTotal = () => Promise<number>@@ -29,7 +29,7 @@ export namespace UserMethods {export interface UserClass {isPasswordMatch: UserMethods.IsPasswordMatch,- toFormatedJSON: UserMethods.ToFormatedJSON,+ toFormattedJSON: UserMethods.ToFormattedJSON,isAdmin: UserMethods.IsAdmin,countTotal: UserMethods.CountTotal,@@ -55,7 +55,7 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.InstaupdatedAt: DateisPasswordMatch: UserMethods.IsPasswordMatch- toFormatedJSON: UserMethods.ToFormatedJSON+ toFormattedJSON: UserMethods.ToFormattedJSONisAdmin: UserMethods.IsAdmin}diff --git a/server/models/user/user.ts b/server/models/user/user.tsindex bda95d2f62..e1b9339883 100644--- a/server/models/user/user.ts+++ b/server/models/user/user.ts@@ -21,7 +21,7 @@ import {let User: Sequelize.Model<UserInstance, UserAttributes>let isPasswordMatch: UserMethods.IsPasswordMatch-let toFormatedJSON: UserMethods.ToFormatedJSON+let toFormattedJSON: UserMethods.ToFormattedJSONlet isAdmin: UserMethods.IsAdminlet countTotal: UserMethods.CountTotallet getByUsername: UserMethods.GetByUsername@@ -108,7 +108,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da]const instanceMethods = [isPasswordMatch,- toFormatedJSON,+ toFormattedJSON,isAdmin]addMethodsToModel(User, classMethods, instanceMethods)@@ -129,7 +129,7 @@ isPasswordMatch = function (this: UserInstance, password: string) {return comparePassword(password, this.password)}-toFormatedJSON = function (this: UserInstance) {+toFormattedJSON = function (this: UserInstance) {return {id: this.id,username: this.username,diff --git a/server/models/video/video-abuse-interface.ts b/server/models/video/video-abuse-interface.tsindex fa45aa5f90..abc82f7ac0 100644--- a/server/models/video/video-abuse-interface.ts+++ b/server/models/video/video-abuse-interface.ts@@ -5,10 +5,10 @@ import { PodInstance } from '../pod'import { ResultList } from '../../../shared'// Don't use barrel, import just what we need-import { VideoAbuse as FormatedVideoAbuse } from '../../../shared/models/videos/video-abuse.model'+import { VideoAbuse as FormattedVideoAbuse } from '../../../shared/models/videos/video-abuse.model'export namespace VideoAbuseMethods {- export type ToFormatedJSON = (this: VideoAbuseInstance) => FormatedVideoAbuse+ export type ToFormattedJSON = (this: VideoAbuseInstance) => FormattedVideoAbuseexport type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoAbuseInstance> >}@@ -30,7 +30,7 @@ export interface VideoAbuseInstance extends VideoAbuseClass, VideoAbuseAttributePod: PodInstance- toFormatedJSON: VideoAbuseMethods.ToFormatedJSON+ toFormattedJSON: VideoAbuseMethods.ToFormattedJSON}export interface VideoAbuseModel extends VideoAbuseClass, Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> {}diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.tsindex df92609c05..ebc63e7a05 100644--- a/server/models/video/video-abuse.ts+++ b/server/models/video/video-abuse.ts@@ -12,7 +12,7 @@ import {} from './video-abuse-interface'let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>-let toFormatedJSON: VideoAbuseMethods.ToFormatedJSON+let toFormattedJSON: VideoAbuseMethods.ToFormattedJSONlet listForApi: VideoAbuseMethods.ListForApiexport default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {@@ -57,7 +57,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DalistForApi]const instanceMethods = [- toFormatedJSON+ toFormattedJSON]addMethodsToModel(VideoAbuse, classMethods, instanceMethods)@@ -66,7 +66,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da// ------------------------------ METHODS -------------------------------toFormatedJSON = function (this: VideoAbuseInstance) {+toFormattedJSON = function (this: VideoAbuseInstance) {let reporterPodHostif (this.Pod) {diff --git a/server/models/video/video-blacklist-interface.ts b/server/models/video/video-blacklist-interface.tsindex cd9f19363c..ba48b1b6e0 100644--- a/server/models/video/video-blacklist-interface.ts+++ b/server/models/video/video-blacklist-interface.ts@@ -4,10 +4,10 @@ import * as Promise from 'bluebird'import { ResultList } from '../../../shared'// Don't use barrel, import just what we need-import { BlacklistedVideo as FormatedBlacklistedVideo } from '../../../shared/models/videos/video-blacklist.model'+import { BlacklistedVideo as FormattedBlacklistedVideo } from '../../../shared/models/videos/video-blacklist.model'export namespace BlacklistedVideoMethods {- export type ToFormatedJSON = (this: BlacklistedVideoInstance) => FormatedBlacklistedVideo+ export type ToFormattedJSON = (this: BlacklistedVideoInstance) => FormattedBlacklistedVideoexport type CountTotal = () => Promise<number>@@ -21,7 +21,7 @@ export namespace BlacklistedVideoMethods {}export interface BlacklistedVideoClass {- toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON+ toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSONcountTotal: BlacklistedVideoMethods.CountTotallist: BlacklistedVideoMethods.ListlistForApi: BlacklistedVideoMethods.ListForApi@@ -39,7 +39,7 @@ export interface BlacklistedVideoInstancecreatedAt: DateupdatedAt: Date- toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON+ toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON}export interface BlacklistedVideoModeldiff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.tsindex 4d1b45aa57..dc49852b66 100644--- a/server/models/video/video-blacklist.ts+++ b/server/models/video/video-blacklist.ts@@ -9,7 +9,7 @@ import {} from './video-blacklist-interface'let BlacklistedVideo: Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes>-let toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON+let toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSONlet countTotal: BlacklistedVideoMethods.CountTotallet list: BlacklistedVideoMethods.Listlet listForApi: BlacklistedVideoMethods.ListForApi@@ -39,7 +39,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DaloadByVideoId]const instanceMethods = [- toFormatedJSON+ toFormattedJSON]addMethodsToModel(BlacklistedVideo, classMethods, instanceMethods)@@ -48,7 +48,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da// ------------------------------ METHODS -------------------------------toFormatedJSON = function (this: BlacklistedVideoInstance) {+toFormattedJSON = function (this: BlacklistedVideoInstance) {return {id: this.id,videoId: this.videoId,diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.tsindex 976c70b5e3..cc214fd60a 100644--- a/server/models/video/video-interface.ts+++ b/server/models/video/video-interface.ts@@ -6,17 +6,17 @@ import { TagAttributes, TagInstance } from './tag-interface'import { VideoFileAttributes, VideoFileInstance } from './video-file-interface'// Don't use barrel, import just what we need-import { Video as FormatedVideo } from '../../../shared/models/videos/video.model'+import { Video as FormattedVideo } from '../../../shared/models/videos/video.model'import { ResultList } from '../../../shared/models/result-list.model'-export type FormatedRemoteVideoFile = {+export type FormattedRemoteVideoFile = {infoHash: stringresolution: numberextname: stringsize: number}-export type FormatedAddRemoteVideo = {+export type FormattedAddRemoteVideo = {uuid: stringname: stringcategory: number@@ -33,10 +33,10 @@ export type FormatedAddRemoteVideo = {views: numberlikes: numberdislikes: number- files: FormatedRemoteVideoFile[]+ files: FormattedRemoteVideoFile[]}-export type FormatedUpdateRemoteVideo = {+export type FormattedUpdateRemoteVideo = {uuid: stringname: stringcategory: number@@ -52,14 +52,14 @@ export type FormatedUpdateRemoteVideo = {views: numberlikes: numberdislikes: number- files: FormatedRemoteVideoFile[]+ files: FormattedRemoteVideoFile[]}export namespace VideoMethods {export type GetThumbnailName = (this: VideoInstance) => stringexport type GetPreviewName = (this: VideoInstance) => stringexport type IsOwned = (this: VideoInstance) => boolean- export type ToFormatedJSON = (this: VideoInstance) => FormatedVideo+ export type ToFormattedJSON = (this: VideoInstance) => FormattedVideoexport type GenerateMagnetUri = (this: VideoInstance, videoFile: VideoFileInstance) => stringexport type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string@@ -69,8 +69,8 @@ export namespace VideoMethods {export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => stringexport type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>- export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormatedAddRemoteVideo>- export type ToUpdateRemoteJSON = (this: VideoInstance) => FormatedUpdateRemoteVideo+ export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormattedAddRemoteVideo>+ export type ToUpdateRemoteJSON = (this: VideoInstance) => FormattedUpdateRemoteVideoexport type TranscodeVideofile = (this: VideoInstance, inputVideoFile: VideoFileInstance) => Promise<void>@@ -159,7 +159,7 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.InremoveThumbnail: VideoMethods.RemoveThumbnailremoveTorrent: VideoMethods.RemoveTorrenttoAddRemoteJSON: VideoMethods.ToAddRemoteJSON- toFormatedJSON: VideoMethods.ToFormatedJSON+ toFormattedJSON: VideoMethods.ToFormattedJSONtoUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSONtranscodeVideofile: VideoMethods.TranscodeVideofilediff --git a/server/models/video/video.ts b/server/models/video/video.tsindex 1e4bdf51c9..b3ca1e6680 100644--- a/server/models/video/video.ts+++ b/server/models/video/video.ts@@ -52,7 +52,7 @@ let getThumbnailName: VideoMethods.GetThumbnailNamelet getPreviewName: VideoMethods.GetPreviewNamelet getTorrentFileName: VideoMethods.GetTorrentFileNamelet isOwned: VideoMethods.IsOwned-let toFormatedJSON: VideoMethods.ToFormatedJSON+let toFormattedJSON: VideoMethods.ToFormattedJSONlet toAddRemoteJSON: VideoMethods.ToAddRemoteJSONlet toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSONlet transcodeVideofile: VideoMethods.TranscodeVideofile@@ -257,7 +257,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DaremoveThumbnail,removeTorrent,toAddRemoteJSON,- toFormatedJSON,+ toFormattedJSON,toUpdateRemoteJSON,transcodeVideofile]@@ -414,7 +414,7 @@ generateMagnetUri = function (this: VideoInstance, videoFile: VideoFileInstance)return magnetUtil.encode(magnetHash)}-toFormatedJSON = function (this: VideoInstance) {+toFormattedJSON = function (this: VideoInstance) {let podHostif (this.Author.Pod) {