Make the client compile too
This commit is contained in:
parent
8e69648749
commit
1e1265b36c
|
@ -5,7 +5,6 @@ import { MetaGuard } from '@ngx-meta/core'
|
||||||
|
|
||||||
import { AdminComponent } from './admin.component'
|
import { AdminComponent } from './admin.component'
|
||||||
import { FriendsRoutes } from './friends'
|
import { FriendsRoutes } from './friends'
|
||||||
import { RequestSchedulersRoutes } from './request-schedulers'
|
|
||||||
import { UsersRoutes } from './users'
|
import { UsersRoutes } from './users'
|
||||||
import { VideoAbusesRoutes } from './video-abuses'
|
import { VideoAbusesRoutes } from './video-abuses'
|
||||||
import { VideoBlacklistRoutes } from './video-blacklist'
|
import { VideoBlacklistRoutes } from './video-blacklist'
|
||||||
|
@ -23,7 +22,6 @@ const adminRoutes: Routes = [
|
||||||
pathMatch: 'full'
|
pathMatch: 'full'
|
||||||
},
|
},
|
||||||
...FriendsRoutes,
|
...FriendsRoutes,
|
||||||
...RequestSchedulersRoutes,
|
|
||||||
...UsersRoutes,
|
...UsersRoutes,
|
||||||
...VideoAbusesRoutes,
|
...VideoAbusesRoutes,
|
||||||
...VideoBlacklistRoutes
|
...VideoBlacklistRoutes
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { NgModule } from '@angular/core'
|
||||||
import { AdminComponent } from './admin.component'
|
import { AdminComponent } from './admin.component'
|
||||||
import { AdminRoutingModule } from './admin-routing.module'
|
import { AdminRoutingModule } from './admin-routing.module'
|
||||||
import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends'
|
import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends'
|
||||||
import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers'
|
|
||||||
import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users'
|
import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users'
|
||||||
import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
|
import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
|
||||||
import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist'
|
import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist'
|
||||||
|
@ -22,9 +21,6 @@ import { SharedModule } from '../shared'
|
||||||
FriendAddComponent,
|
FriendAddComponent,
|
||||||
FriendListComponent,
|
FriendListComponent,
|
||||||
|
|
||||||
RequestSchedulersComponent,
|
|
||||||
RequestSchedulersStatsComponent,
|
|
||||||
|
|
||||||
UsersComponent,
|
UsersComponent,
|
||||||
UserAddComponent,
|
UserAddComponent,
|
||||||
UserUpdateComponent,
|
UserUpdateComponent,
|
||||||
|
@ -43,7 +39,6 @@ import { SharedModule } from '../shared'
|
||||||
|
|
||||||
providers: [
|
providers: [
|
||||||
FriendService,
|
FriendService,
|
||||||
RequestSchedulersService,
|
|
||||||
UserService
|
UserService
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -91,7 +91,7 @@ export class FriendAddComponent implements OnInit {
|
||||||
res => {
|
res => {
|
||||||
if (res === false) return
|
if (res === false) return
|
||||||
|
|
||||||
this.friendService.makeFriends(notEmptyHosts).subscribe(
|
this.friendService.follow(notEmptyHosts).subscribe(
|
||||||
status => {
|
status => {
|
||||||
this.notificationsService.success('Success', 'Make friends request sent!')
|
this.notificationsService.success('Success', 'Make friends request sent!')
|
||||||
// Wait requests between pods
|
// Wait requests between pods
|
||||||
|
|
|
@ -74,7 +74,7 @@ export class FriendListComponent extends RestTable implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected loadData () {
|
protected loadData () {
|
||||||
this.friendService.getFriends(this.pagination, this.sort)
|
this.friendService.getFollowing(this.pagination, this.sort)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
resultList => {
|
resultList => {
|
||||||
this.friends = resultList.data
|
this.friends = resultList.data
|
||||||
|
|
|
@ -12,7 +12,7 @@ export const FriendsRoutes: Routes = [
|
||||||
component: FriendsComponent,
|
component: FriendsComponent,
|
||||||
canActivate: [ UserRightGuard ],
|
canActivate: [ UserRightGuard ],
|
||||||
data: {
|
data: {
|
||||||
userRight: UserRight.MANAGE_PODS
|
userRight: UserRight.MANAGE_PEERTUBE_FOLLOW
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,21 +19,21 @@ export class FriendService {
|
||||||
private restExtractor: RestExtractor
|
private restExtractor: RestExtractor
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
getFriends (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> {
|
getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> {
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination, sort)
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
||||||
|
|
||||||
return this.authHttp.get<ResultList<Pod>>(FriendService.BASE_FRIEND_URL, { params })
|
return this.authHttp.get<ResultList<Account>>(API_URL + '/followers', { params })
|
||||||
.map(res => this.restExtractor.convertResultListDateToHuman(res))
|
.map(res => this.restExtractor.convertResultListDateToHuman(res))
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
makeFriends (notEmptyHosts: String[]) {
|
follow (notEmptyHosts: String[]) {
|
||||||
const body = {
|
const body = {
|
||||||
hosts: notEmptyHosts
|
hosts: notEmptyHosts
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'make-friends', body)
|
return this.authHttp.post(API_URL + '/follow', body)
|
||||||
.map(this.restExtractor.extractDataBool)
|
.map(this.restExtractor.extractDataBool)
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export * from './request-schedulers-stats'
|
|
||||||
export * from './shared'
|
|
||||||
export * from './request-schedulers.component'
|
|
||||||
export * from './request-schedulers.routes'
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './request-schedulers-stats.component'
|
|
|
@ -1,46 +0,0 @@
|
||||||
<div class="row">
|
|
||||||
<div class="content-padding">
|
|
||||||
|
|
||||||
<h3>Requests stats</h3>
|
|
||||||
|
|
||||||
<ng-template [ngIf]="stats">
|
|
||||||
<div *ngFor="let requestSchedulerName of statsTitles | keys" class="col-lg-4 col-md-12">
|
|
||||||
<div class="panel panel-default" *ngIf="stats[requestSchedulerName] !== null">
|
|
||||||
<div class="panel-heading">{{ statsTitles[requestSchedulerName] }}</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="requests-general">
|
|
||||||
<div>
|
|
||||||
<span class="label-description">Remaining requests:</span>
|
|
||||||
{{ stats[requestSchedulerName].totalRequests }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<span class="label-description">Interval seconds between requests:</span>
|
|
||||||
{{ stats[requestSchedulerName].secondsInterval }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<span class="label-description">Remaining time before the scheduled request:</span>
|
|
||||||
{{ stats[requestSchedulerName].remainingSeconds }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="requests-limit">
|
|
||||||
<div>
|
|
||||||
<span class="label-description">Maximum number of different pods for a scheduled request:</span>
|
|
||||||
{{ stats[requestSchedulerName].requestsLimitPods }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<span class="label-description">Maximum number of requests per pod for a scheduled request:</span>
|
|
||||||
{{ stats[requestSchedulerName].requestsLimitPerPod }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ng-template>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,8 +0,0 @@
|
||||||
.label-description {
|
|
||||||
font-weight: bold;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.requests-limit {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core'
|
|
||||||
|
|
||||||
import { NotificationsService } from 'angular2-notifications'
|
|
||||||
|
|
||||||
import { RequestSchedulersService, RequestSchedulerStatsAttributes } from '../shared'
|
|
||||||
import { RequestSchedulerStats } from '../../../../../../shared'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'my-request-schedulers-stats',
|
|
||||||
templateUrl: './request-schedulers-stats.component.html',
|
|
||||||
styleUrls: [ './request-schedulers-stats.component.scss' ]
|
|
||||||
})
|
|
||||||
export class RequestSchedulersStatsComponent implements OnInit, OnDestroy {
|
|
||||||
statsTitles = {
|
|
||||||
requestScheduler: 'Basic request scheduler',
|
|
||||||
requestVideoEventScheduler: 'Video events request scheduler',
|
|
||||||
requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler'
|
|
||||||
}
|
|
||||||
|
|
||||||
stats: RequestSchedulerStats
|
|
||||||
|
|
||||||
private intervals: { [ id: string ]: number } = {
|
|
||||||
requestScheduler: null,
|
|
||||||
requestVideoEventScheduler: null,
|
|
||||||
requestVideoQaduScheduler: null
|
|
||||||
}
|
|
||||||
|
|
||||||
private timeouts: { [ id: string ]: number } = {
|
|
||||||
requestScheduler: null,
|
|
||||||
requestVideoEventScheduler: null,
|
|
||||||
requestVideoQaduScheduler: null
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor (
|
|
||||||
private notificationsService: NotificationsService,
|
|
||||||
private requestService: RequestSchedulersService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
ngOnInit () {
|
|
||||||
this.getStats()
|
|
||||||
this.runIntervals()
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy () {
|
|
||||||
Object.keys(this.stats).forEach(requestSchedulerName => {
|
|
||||||
if (this.intervals[requestSchedulerName] !== null) {
|
|
||||||
window.clearInterval(this.intervals[requestSchedulerName])
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.timeouts[requestSchedulerName] !== null) {
|
|
||||||
window.clearTimeout(this.timeouts[requestSchedulerName])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getStats () {
|
|
||||||
this.requestService.getStats().subscribe(
|
|
||||||
stats => this.stats = stats,
|
|
||||||
|
|
||||||
err => this.notificationsService.error('Error', err.message)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private runIntervals () {
|
|
||||||
Object.keys(this.intervals).forEach(requestSchedulerName => {
|
|
||||||
this.intervals[requestSchedulerName] = window.setInterval(() => {
|
|
||||||
const stats: RequestSchedulerStatsAttributes = this.stats[requestSchedulerName]
|
|
||||||
|
|
||||||
stats.remainingMilliSeconds -= 1000
|
|
||||||
|
|
||||||
if (stats.remainingMilliSeconds <= 0) {
|
|
||||||
this.timeouts[requestSchedulerName] = window.setTimeout(() => this.getStats(), stats.remainingMilliSeconds + 100)
|
|
||||||
}
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { Component } from '@angular/core'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: '<router-outlet></router-outlet>'
|
|
||||||
})
|
|
||||||
export class RequestSchedulersComponent {
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
import { Routes } from '@angular/router'
|
|
||||||
|
|
||||||
import { UserRightGuard } from '../../core'
|
|
||||||
import { UserRight } from '../../../../../shared'
|
|
||||||
import { RequestSchedulersComponent } from './request-schedulers.component'
|
|
||||||
import { RequestSchedulersStatsComponent } from './request-schedulers-stats'
|
|
||||||
|
|
||||||
export const RequestSchedulersRoutes: Routes = [
|
|
||||||
{
|
|
||||||
path: 'requests',
|
|
||||||
component: RequestSchedulersComponent,
|
|
||||||
canActivate: [ UserRightGuard ],
|
|
||||||
data: {
|
|
||||||
userRight: UserRight.MANAGE_REQUEST_SCHEDULERS
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
redirectTo: 'stats',
|
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'stats',
|
|
||||||
component: RequestSchedulersStatsComponent,
|
|
||||||
data: {
|
|
||||||
meta: {
|
|
||||||
title: 'Request stats'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,2 +0,0 @@
|
||||||
export * from './request-schedulers-stats-attributes.model'
|
|
||||||
export * from './request-schedulers.service'
|
|
|
@ -1,37 +0,0 @@
|
||||||
import { RequestSchedulerStatsAttributes as FormattedRequestSchedulerStatsAttributes } from '../../../../../../shared'
|
|
||||||
|
|
||||||
export interface Request {
|
|
||||||
request: any
|
|
||||||
to: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RequestSchedulerStatsAttributes implements FormattedRequestSchedulerStatsAttributes {
|
|
||||||
requestsLimitPods: number
|
|
||||||
requestsLimitPerPod: number
|
|
||||||
milliSecondsInterval: number
|
|
||||||
remainingMilliSeconds: number
|
|
||||||
totalRequests: number
|
|
||||||
|
|
||||||
constructor (hash: {
|
|
||||||
requestsLimitPods: number,
|
|
||||||
requestsLimitPerPod: number,
|
|
||||||
milliSecondsInterval: number,
|
|
||||||
remainingMilliSeconds: number,
|
|
||||||
totalRequests: number
|
|
||||||
}) {
|
|
||||||
this.requestsLimitPods = hash.requestsLimitPods
|
|
||||||
this.requestsLimitPerPod = hash.requestsLimitPerPod
|
|
||||||
this.milliSecondsInterval = hash.milliSecondsInterval
|
|
||||||
this.remainingMilliSeconds = hash.remainingMilliSeconds
|
|
||||||
this.totalRequests = hash.totalRequests
|
|
||||||
}
|
|
||||||
|
|
||||||
get remainingSeconds () {
|
|
||||||
return Math.floor(this.remainingMilliSeconds / 1000)
|
|
||||||
}
|
|
||||||
|
|
||||||
get secondsInterva () {
|
|
||||||
return Math.floor(this.milliSecondsInterval / 1000)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
import { Injectable } from '@angular/core'
|
|
||||||
import { HttpClient } from '@angular/common/http'
|
|
||||||
import { Observable } from 'rxjs/Observable'
|
|
||||||
import 'rxjs/add/operator/catch'
|
|
||||||
import 'rxjs/add/operator/map'
|
|
||||||
|
|
||||||
import { RequestSchedulerStats } from '../../../../../../shared'
|
|
||||||
import { RestExtractor } from '../../../shared'
|
|
||||||
import { RequestSchedulerStatsAttributes } from './request-schedulers-stats-attributes.model'
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class RequestSchedulersService {
|
|
||||||
private static BASE_REQUEST_URL = API_URL + '/api/v1/request-schedulers/'
|
|
||||||
|
|
||||||
constructor (
|
|
||||||
private authHttp: HttpClient,
|
|
||||||
private restExtractor: RestExtractor
|
|
||||||
) {}
|
|
||||||
|
|
||||||
getStats () {
|
|
||||||
return this.authHttp.get<RequestSchedulerStats>(RequestSchedulersService.BASE_REQUEST_URL + 'stats')
|
|
||||||
.map(res => this.buildRequestObjects(res))
|
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
|
||||||
}
|
|
||||||
|
|
||||||
private buildRequestObjects (data: RequestSchedulerStats) {
|
|
||||||
const requestSchedulers: { [ id: string ]: RequestSchedulerStatsAttributes } = {}
|
|
||||||
|
|
||||||
Object.keys(data).forEach(requestSchedulerName => {
|
|
||||||
requestSchedulers[requestSchedulerName] = new RequestSchedulerStatsAttributes(data[requestSchedulerName])
|
|
||||||
})
|
|
||||||
|
|
||||||
return requestSchedulers
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,7 +42,7 @@ interface UserLoginWithUserInformation extends UserLogin {
|
||||||
displayNSFW: boolean
|
displayNSFW: boolean
|
||||||
email: string
|
email: string
|
||||||
videoQuota: number
|
videoQuota: number
|
||||||
author: {
|
account: {
|
||||||
id: number
|
id: number
|
||||||
uuid: string
|
uuid: string
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ export class AuthService {
|
||||||
this.user.displayNSFW = res.displayNSFW
|
this.user.displayNSFW = res.displayNSFW
|
||||||
this.user.role = res.role
|
this.user.role = res.role
|
||||||
this.user.videoChannels = res.videoChannels
|
this.user.videoChannels = res.videoChannels
|
||||||
this.user.author = res.author
|
this.user.account = res.account
|
||||||
|
|
||||||
this.user.save()
|
this.user.save()
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ export class AuthService {
|
||||||
displayNSFW: res.displayNSFW,
|
displayNSFW: res.displayNSFW,
|
||||||
email: res.email,
|
email: res.email,
|
||||||
videoQuota: res.videoQuota,
|
videoQuota: res.videoQuota,
|
||||||
author: res.author,
|
account: res.account,
|
||||||
videoChannels: res.videoChannels
|
videoChannels: res.videoChannels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ export class AuthService {
|
||||||
displayNSFW: obj.displayNSFW,
|
displayNSFW: obj.displayNSFW,
|
||||||
videoQuota: obj.videoQuota,
|
videoQuota: obj.videoQuota,
|
||||||
videoChannels: obj.videoChannels,
|
videoChannels: obj.videoChannels,
|
||||||
author: obj.author
|
account: obj.account
|
||||||
}
|
}
|
||||||
const hashTokens = {
|
const hashTokens = {
|
||||||
accessToken: obj.access_token,
|
accessToken: obj.access_token,
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
List friends
|
List friends
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a *ngIf="hasRequestsStatRight()" routerLink="/admin/requests/stats" routerLinkActive="active">
|
|
||||||
<span class="hidden-xs glyphicon glyphicon-stats"></span>
|
|
||||||
Request stats
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active">
|
<a *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active">
|
||||||
<span class="hidden-xs glyphicon glyphicon-alert"></span>
|
<span class="hidden-xs glyphicon glyphicon-alert"></span>
|
||||||
Video abuses
|
Video abuses
|
||||||
|
|
|
@ -16,11 +16,7 @@ export class MenuAdminComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasFriendsRight () {
|
hasFriendsRight () {
|
||||||
return this.auth.getUser().hasRight(UserRight.MANAGE_PODS)
|
return this.auth.getUser().hasRight(UserRight.MANAGE_PEERTUBE_FOLLOW)
|
||||||
}
|
|
||||||
|
|
||||||
hasRequestsStatRight () {
|
|
||||||
return this.auth.getUser().hasRight(UserRight.MANAGE_REQUEST_SCHEDULERS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasVideoAbusesRight () {
|
hasVideoAbusesRight () {
|
||||||
|
|
|
@ -16,8 +16,7 @@ export class MenuComponent implements OnInit {
|
||||||
|
|
||||||
private routesPerRight = {
|
private routesPerRight = {
|
||||||
[UserRight.MANAGE_USERS]: '/admin/users',
|
[UserRight.MANAGE_USERS]: '/admin/users',
|
||||||
[UserRight.MANAGE_PODS]: '/admin/friends',
|
[UserRight.MANAGE_PEERTUBE_FOLLOW]: '/admin/friends',
|
||||||
[UserRight.MANAGE_REQUEST_SCHEDULERS]: '/admin/requests/stats',
|
|
||||||
[UserRight.MANAGE_VIDEO_ABUSES]: '/admin/video-abuses',
|
[UserRight.MANAGE_VIDEO_ABUSES]: '/admin/video-abuses',
|
||||||
[UserRight.MANAGE_VIDEO_BLACKLIST]: '/admin/video-blacklist'
|
[UserRight.MANAGE_VIDEO_BLACKLIST]: '/admin/video-blacklist'
|
||||||
}
|
}
|
||||||
|
@ -59,8 +58,7 @@ export class MenuComponent implements OnInit {
|
||||||
|
|
||||||
const adminRights = [
|
const adminRights = [
|
||||||
UserRight.MANAGE_USERS,
|
UserRight.MANAGE_USERS,
|
||||||
UserRight.MANAGE_PODS,
|
UserRight.MANAGE_PEERTUBE_FOLLOW,
|
||||||
UserRight.MANAGE_REQUEST_SCHEDULERS,
|
|
||||||
UserRight.MANAGE_VIDEO_ABUSES,
|
UserRight.MANAGE_VIDEO_ABUSES,
|
||||||
UserRight.MANAGE_VIDEO_BLACKLIST
|
UserRight.MANAGE_VIDEO_BLACKLIST
|
||||||
]
|
]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export type SearchField = 'name' | 'author' | 'host' | 'tags'
|
export type SearchField = 'name' | 'account' | 'host' | 'tags'
|
||||||
|
|
|
@ -14,8 +14,8 @@ import { SearchService } from './search.service'
|
||||||
export class SearchComponent implements OnInit {
|
export class SearchComponent implements OnInit {
|
||||||
fieldChoices = {
|
fieldChoices = {
|
||||||
name: 'Name',
|
name: 'Name',
|
||||||
author: 'Author',
|
account: 'Account',
|
||||||
host: 'Pod Host',
|
host: 'Host',
|
||||||
tags: 'Tags'
|
tags: 'Tags'
|
||||||
}
|
}
|
||||||
searchCriteria: Search = {
|
searchCriteria: Search = {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export type UserConstructorHash = {
|
||||||
videoQuota?: number,
|
videoQuota?: number,
|
||||||
displayNSFW?: boolean,
|
displayNSFW?: boolean,
|
||||||
createdAt?: Date,
|
createdAt?: Date,
|
||||||
author?: {
|
account?: {
|
||||||
id: number
|
id: number
|
||||||
uuid: string
|
uuid: string
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@ export class User implements UserServerModel {
|
||||||
role: UserRole
|
role: UserRole
|
||||||
displayNSFW: boolean
|
displayNSFW: boolean
|
||||||
videoQuota: number
|
videoQuota: number
|
||||||
author: {
|
account: {
|
||||||
id: number
|
id: number
|
||||||
uuid: string
|
uuid: string
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export class User implements UserServerModel {
|
||||||
this.username = hash.username
|
this.username = hash.username
|
||||||
this.email = hash.email
|
this.email = hash.email
|
||||||
this.role = hash.role
|
this.role = hash.role
|
||||||
this.author = hash.author
|
this.account = hash.account
|
||||||
|
|
||||||
if (hash.videoChannels !== undefined) {
|
if (hash.videoChannels !== undefined) {
|
||||||
this.videoChannels = hash.videoChannels
|
this.videoChannels = hash.videoChannels
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row video-small-blocks">
|
<div class="row video-small-blocks">
|
||||||
<div class="col-xs-5 col-xs-3 col-md-3 video-small-block video-small-block-author">
|
<div class="col-xs-5 col-xs-3 col-md-3 video-small-block video-small-block-account">
|
||||||
<a class="option" title="Access to all videos of this user" [routerLink]="['/videos/list', { field: 'author', search: video.author }]">
|
<a class="option" title="Access to all videos of this user" [routerLink]="['/videos/list', { field: 'account', search: video.account }]">
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
<span class="video-small-block-text">{{ video.by }}</span>
|
<span class="video-small-block-text">{{ video.by }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-small-block-author, .video-small-block-more {
|
.video-small-block-account, .video-small-block-more {
|
||||||
a.option {
|
a.option {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@
|
||||||
font-size: 18px !important;
|
font-size: 18px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-small-block-author {
|
.video-small-block-account {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@
|
||||||
font-size: 10px !important;
|
font-size: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-small-block-author {
|
.video-small-block-account {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from '../../../../../shared'
|
} from '../../../../../shared'
|
||||||
|
|
||||||
export class VideoDetails extends Video implements VideoDetailsServerModel {
|
export class VideoDetails extends Video implements VideoDetailsServerModel {
|
||||||
author: string
|
account: string
|
||||||
by: string
|
by: string
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
updatedAt: Date
|
updatedAt: Date
|
||||||
|
@ -71,7 +71,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
isRemovableBy (user: AuthUser) {
|
isRemovableBy (user: AuthUser) {
|
||||||
return user && this.isLocal === true && (this.author === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
|
return user && this.isLocal === true && (this.account === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
|
||||||
}
|
}
|
||||||
|
|
||||||
isBlackistableBy (user: AuthUser) {
|
isBlackistableBy (user: AuthUser) {
|
||||||
|
@ -79,6 +79,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
isUpdatableBy (user: AuthUser) {
|
isUpdatableBy (user: AuthUser) {
|
||||||
return user && this.isLocal === true && user.username === this.author
|
return user && this.isLocal === true && user.username === this.account
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Video as VideoServerModel } from '../../../../../shared'
|
||||||
import { User } from '../../shared'
|
import { User } from '../../shared'
|
||||||
|
|
||||||
export class Video implements VideoServerModel {
|
export class Video implements VideoServerModel {
|
||||||
author: string
|
account: string
|
||||||
by: string
|
by: string
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
updatedAt: Date
|
updatedAt: Date
|
||||||
|
@ -32,8 +32,8 @@ export class Video implements VideoServerModel {
|
||||||
dislikes: number
|
dislikes: number
|
||||||
nsfw: boolean
|
nsfw: boolean
|
||||||
|
|
||||||
private static createByString (author: string, podHost: string) {
|
private static createByString (account: string, podHost: string) {
|
||||||
return author + '@' + podHost
|
return account + '@' + podHost
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createDurationString (duration: number) {
|
private static createDurationString (duration: number) {
|
||||||
|
@ -52,7 +52,7 @@ export class Video implements VideoServerModel {
|
||||||
absoluteAPIUrl = window.location.origin
|
absoluteAPIUrl = window.location.origin
|
||||||
}
|
}
|
||||||
|
|
||||||
this.author = hash.author
|
this.account = hash.account
|
||||||
this.createdAt = new Date(hash.createdAt.toString())
|
this.createdAt = new Date(hash.createdAt.toString())
|
||||||
this.categoryLabel = hash.categoryLabel
|
this.categoryLabel = hash.categoryLabel
|
||||||
this.category = hash.category
|
this.category = hash.category
|
||||||
|
@ -80,7 +80,7 @@ export class Video implements VideoServerModel {
|
||||||
this.dislikes = hash.dislikes
|
this.dislikes = hash.dislikes
|
||||||
this.nsfw = hash.nsfw
|
this.nsfw = hash.nsfw
|
||||||
|
|
||||||
this.by = Video.createByString(hash.author, hash.podHost)
|
this.by = Video.createByString(hash.account, hash.podHost)
|
||||||
}
|
}
|
||||||
|
|
||||||
isVideoNSFWForUser (user: User) {
|
isVideoNSFWForUser (user: User) {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a [routerLink]="['/videos/list', { field: 'author', search: video.author, sort: currentSort }]" class="video-miniature-author">{{ video.by }}</a>
|
<a [routerLink]="['/videos/list', { field: 'account', search: video.account, sort: currentSort }]" class="video-miniature-account">{{ video.by }}</a>
|
||||||
<span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span>
|
<span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-miniature-author, .video-miniature-created-at {
|
.video-miniature-account, .video-miniature-created-at {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 1px;
|
margin-left: 1px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-miniature-author {
|
.video-miniature-account {
|
||||||
transition: color 0.2s;
|
transition: color 0.2s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
Loading…
Reference in New Issue