aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.ts2
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html2
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.html2
-rw-r--r--client/src/app/+my-library/+my-video-channels/my-video-channels.component.html4
-rw-r--r--client/src/app/+my-library/my-subscriptions/my-subscriptions.component.html6
-rw-r--r--client/src/app/+remote-interaction/remote-interaction.component.ts2
-rw-r--r--client/src/app/+search/search.component.ts2
-rw-r--r--client/src/app/+video-channels/video-channels.component.ts2
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.html2
-rw-r--r--client/src/app/+videos/+video-watch/video-avatar-channel.component.html4
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.html6
-rw-r--r--client/src/app/+videos/video-list/overview/video-overview.component.html2
-rw-r--r--client/src/app/app-routing.module.ts31
-rw-r--r--client/src/app/menu/menu.component.html2
-rw-r--r--client/src/app/root.component.ts44
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts2
-rw-r--r--client/src/app/shared/shared-main/account/actor.service.ts37
-rw-r--r--client/src/app/shared/shared-main/account/index.ts1
-rw-r--r--client/src/app/shared/shared-main/shared-main.module.ts3
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.model.ts2
-rw-r--r--client/src/app/shared/shared-video-comment/video-comment.model.ts2
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.html8
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html2
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html2
24 files changed, 140 insertions, 32 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
index 7e916e122..e146a5cd2 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
@@ -139,6 +139,6 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
139 } 139 }
140 140
141 getVideoChannelLink (videoChannel: VideoChannel) { 141 getVideoChannelLink (videoChannel: VideoChannel) {
142 return [ '/video-channels', videoChannel.nameWithHost ] 142 return [ '/c', videoChannel.nameWithHost ]
143 } 143 }
144} 144}
diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html
index 5e92c0f36..772ebf272 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.component.html
+++ b/client/src/app/+admin/users/user-edit/user-edit.component.html
@@ -10,7 +10,7 @@
10 <ng-container *ngIf="!isCreation()"> 10 <ng-container *ngIf="!isCreation()">
11 <li class="breadcrumb-item active" i18n>Edit</li> 11 <li class="breadcrumb-item active" i18n>Edit</li>
12 <li class="breadcrumb-item active" aria-current="page"> 12 <li class="breadcrumb-item active" aria-current="page">
13 <a *ngIf="user" [routerLink]="[ '/accounts', user?.username ]">{{ user?.username }}</a> 13 <a *ngIf="user" [routerLink]="[ '/a', user?.username ]">{{ user?.username }}</a>
14 </li> 14 </li>
15 </ng-container> 15 </ng-container>
16 </ol> 16 </ol>
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html
index 44d8a7e87..5b4f35c77 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.html
+++ b/client/src/app/+admin/users/user-list/user-list.component.html
@@ -87,7 +87,7 @@
87 </td> 87 </td>
88 88
89 <td *ngIf="isSelected('username')"> 89 <td *ngIf="isSelected('username')">
90 <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/accounts/' + user.username ]"> 90 <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/a/' + user.username ]">
91 <div class="chip two-lines"> 91 <div class="chip two-lines">
92 <my-actor-avatar [account]="user?.account" size="32"></my-actor-avatar> 92 <my-actor-avatar [account]="user?.account" size="32"></my-actor-avatar>
93 <div> 93 <div>
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html
index e41cbe921..9f139b4f2 100644
--- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html
+++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html
@@ -17,10 +17,10 @@
17 17
18<div class="video-channels"> 18<div class="video-channels">
19 <div *ngFor="let videoChannel of videoChannels; let i = index" class="video-channel"> 19 <div *ngFor="let videoChannel of videoChannels; let i = index" class="video-channel">
20 <my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/video-channels', videoChannel.nameWithHost ]"></my-actor-avatar> 20 <my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/c', videoChannel.nameWithHost ]"></my-actor-avatar>
21 21
22 <div class="video-channel-info"> 22 <div class="video-channel-info">
23 <a [routerLink]="[ '/video-channels', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page"> 23 <a [routerLink]="[ '/c', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
24 <div class="video-channel-display-name">{{ videoChannel.displayName }}</div> 24 <div class="video-channel-display-name">{{ videoChannel.displayName }}</div>
25 <div class="video-channel-name">{{ videoChannel.nameWithHost }}</div> 25 <div class="video-channel-name">{{ videoChannel.nameWithHost }}</div>
26 </a> 26 </a>
diff --git a/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.html b/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.html
index f91cebacf..1bd459059 100644
--- a/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.html
+++ b/client/src/app/+my-library/my-subscriptions/my-subscriptions.component.html
@@ -14,17 +14,17 @@
14 14
15<div class="video-channels" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> 15<div class="video-channels" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()">
16 <div *ngFor="let videoChannel of videoChannels" class="video-channel"> 16 <div *ngFor="let videoChannel of videoChannels" class="video-channel">
17 <my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/video-channels', videoChannel.nameWithHost ]"></my-actor-avatar> 17 <my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/c', videoChannel.nameWithHost ]"></my-actor-avatar>
18 18
19 <div class="video-channel-info"> 19 <div class="video-channel-info">
20 <a [routerLink]="[ '/video-channels', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page"> 20 <a [routerLink]="[ '/c', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
21 <div class="video-channel-display-name">{{ videoChannel.displayName }}</div> 21 <div class="video-channel-display-name">{{ videoChannel.displayName }}</div>
22 <div class="video-channel-name">{{ videoChannel.nameWithHost }}</div> 22 <div class="video-channel-name">{{ videoChannel.nameWithHost }}</div>
23 </a> 23 </a>
24 24
25 <div i18n class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div> 25 <div i18n class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div>
26 26
27 <a [routerLink]="[ '/accounts', videoChannel.ownerBy ]" i18n-title title="Owner account page" class="actor-owner"> 27 <a [routerLink]="[ '/a', videoChannel.ownerBy ]" i18n-title title="Owner account page" class="actor-owner">
28 <span i18n>Created by {{ videoChannel.ownerBy }}</span> 28 <span i18n>Created by {{ videoChannel.ownerBy }}</span>
29 29
30 <my-actor-avatar [account]="videoChannel.ownerAccount" size="18"></my-actor-avatar> 30 <my-actor-avatar [account]="videoChannel.ownerAccount" size="18"></my-actor-avatar>
diff --git a/client/src/app/+remote-interaction/remote-interaction.component.ts b/client/src/app/+remote-interaction/remote-interaction.component.ts
index e24607b24..3ebe62f49 100644
--- a/client/src/app/+remote-interaction/remote-interaction.component.ts
+++ b/client/src/app/+remote-interaction/remote-interaction.component.ts
@@ -43,7 +43,7 @@ export class RemoteInteractionComponent implements OnInit {
43 } else if (channelResult.data.length !== 0) { 43 } else if (channelResult.data.length !== 0) {
44 const channel = new VideoChannel(channelResult.data[0]) 44 const channel = new VideoChannel(channelResult.data[0])
45 45
46 redirectUrl = '/video-channels/' + channel.nameWithHost 46 redirectUrl = '/c/' + channel.nameWithHost
47 } else { 47 } else {
48 this.error = $localize`Cannot access to the remote resource` 48 this.error = $localize`Cannot access to the remote resource`
49 return 49 return
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts
index dcf654b7a..4381659e1 100644
--- a/client/src/app/+search/search.component.ts
+++ b/client/src/app/+search/search.component.ts
@@ -213,7 +213,7 @@ export class SearchComponent implements OnInit, OnDestroy {
213 const linkType = this.getVideoLinkType() 213 const linkType = this.getVideoLinkType()
214 214
215 if (linkType === 'internal') { 215 if (linkType === 'internal') {
216 return [ '/video-channels', channel.nameWithHost ] 216 return [ '/c', channel.nameWithHost ]
217 } 217 }
218 218
219 if (linkType === 'lazy-load') { 219 if (linkType === 'lazy-load') {
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts
index 41fdb5e79..3833d9c54 100644
--- a/client/src/app/+video-channels/video-channels.component.ts
+++ b/client/src/app/+video-channels/video-channels.component.ts
@@ -112,7 +112,7 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
112 } 112 }
113 113
114 getAccountUrl () { 114 getAccountUrl () {
115 return [ '/accounts', this.videoChannel.ownerBy ] 115 return [ '/a', this.videoChannel.ownerBy ]
116 } 116 }
117 117
118 private loadChannelVideosCount () { 118 private loadChannelVideosCount () {
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
index d7ba40ef6..fc0d66ffd 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment.component.html
+++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
@@ -11,7 +11,7 @@
11 11
12 <div class="comment-account-date"> 12 <div class="comment-account-date">
13 <div class="comment-account"> 13 <div class="comment-account">
14 <a [routerLink]="[ '/accounts', comment.by ]"> 14 <a [routerLink]="[ '/a', comment.by ]">
15 <span class="comment-account-name" [ngClass]="{ 'video-author': video.account.id === comment.account.id }"> 15 <span class="comment-account-name" [ngClass]="{ 'video-author': video.account.id === comment.account.id }">
16 {{ comment.account.displayName }} 16 {{ comment.account.displayName }}
17 </span> 17 </span>
diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
index 5f149cbd1..5a7221858 100644
--- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
+++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
@@ -1,11 +1,11 @@
1<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }"> 1<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }">
2 <my-actor-avatar 2 <my-actor-avatar
3 class="channel" [channel]="video.channel" 3 class="channel" [channel]="video.channel"
4 [internalHref]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle" 4 [internalHref]="[ '/c', video.byVideoChannel ]" [title]="channelLinkTitle"
5 ></my-actor-avatar> 5 ></my-actor-avatar>
6 6
7 <my-actor-avatar 7 <my-actor-avatar
8 class="account" [account]="video.account" 8 class="account" [account]="video.account"
9 [internalHref]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle"> 9 [internalHref]="[ '/a', video.byAccount ]" [title]="accountLinkTitle">
10 </my-actor-avatar> 10 </my-actor-avatar>
11</div> 11</div>
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html
index 4779602d2..bb41fba77 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.html
+++ b/client/src/app/+videos/+video-watch/video-watch.component.html
@@ -183,16 +183,16 @@
183 183
184 <div class="video-info-channel-left-links ml-1"> 184 <div class="video-info-channel-left-links ml-1">
185 <ng-container *ngIf="!isChannelDisplayNameGeneric()"> 185 <ng-container *ngIf="!isChannelDisplayNameGeneric()">
186 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" i18n-title title="Channel page"> 186 <a [routerLink]="[ '/c', video.byVideoChannel ]" i18n-title title="Channel page">
187 {{ video.channel.displayName }} 187 {{ video.channel.displayName }}
188 </a> 188 </a>
189 <a [routerLink]="[ '/accounts', video.byAccount ]" i18n-title title="Account page"> 189 <a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page">
190 <span i18n>By {{ video.byAccount }}</span> 190 <span i18n>By {{ video.byAccount }}</span>
191 </a> 191 </a>
192 </ng-container> 192 </ng-container>
193 193
194 <ng-container *ngIf="isChannelDisplayNameGeneric()"> 194 <ng-container *ngIf="isChannelDisplayNameGeneric()">
195 <a [routerLink]="[ '/accounts', video.byAccount ]" class="single-link" i18n-title title="Account page"> 195 <a [routerLink]="[ '/a', video.byAccount ]" class="single-link" i18n-title title="Account page">
196 <span i18n>{{ video.byAccount }}</span> 196 <span i18n>{{ video.byAccount }}</span>
197 </a> 197 </a>
198 </ng-container> 198 </ng-container>
diff --git a/client/src/app/+videos/video-list/overview/video-overview.component.html b/client/src/app/+videos/video-list/overview/video-overview.component.html
index e21bffb6c..d3c602aa5 100644
--- a/client/src/app/+videos/video-list/overview/video-overview.component.html
+++ b/client/src/app/+videos/video-list/overview/video-overview.component.html
@@ -32,7 +32,7 @@
32 32
33 <div class="section channel videos" *ngFor="let object of overview.channels"> 33 <div class="section channel videos" *ngFor="let object of overview.channels">
34 <div class="section-title"> 34 <div class="section-title">
35 <a [routerLink]="[ '/video-channels', buildVideoChannelBy(object) ]"> 35 <a [routerLink]="[ '/c', buildVideoChannelBy(object) ]">
36 <my-actor-avatar [channel]="buildVideoChannel(object)"></my-actor-avatar> 36 <my-actor-avatar [channel]="buildVideoChannel(object)"></my-actor-avatar>
37 37
38 <h2 class="section-title">{{ object.channel.displayName }}</h2> 38 <h2 class="section-title">{{ object.channel.displayName }}</h2>
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index 4e3cce590..4619c4046 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -1,10 +1,11 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' 2import { RouteReuseStrategy, RouterModule, Routes, UrlMatchResult, UrlSegment } from '@angular/router'
3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4import { MenuGuards } from '@app/core/routing/menu-guard.service' 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n' 5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6import { MetaGuard, PreloadSelectedModulesList } from './core' 6import { MetaGuard, PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component' 7import { EmptyComponent } from './empty.component'
8import { RootComponent } from './root.component'
8 9
9const routes: Routes = [ 10const routes: Routes = [
10 { 11 {
@@ -34,12 +35,12 @@ const routes: Routes = [
34 canActivateChild: [ MetaGuard ] 35 canActivateChild: [ MetaGuard ]
35 }, 36 },
36 { 37 {
37 path: 'accounts', 38 path: 'a',
38 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule), 39 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule),
39 canActivateChild: [ MetaGuard ] 40 canActivateChild: [ MetaGuard ]
40 }, 41 },
41 { 42 {
42 path: 'video-channels', 43 path: 'c',
43 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule), 44 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
44 canActivateChild: [ MetaGuard ] 45 canActivateChild: [ MetaGuard ]
45 }, 46 },
@@ -83,6 +84,30 @@ const routes: Routes = [
83 redirectTo: 'videos/watch/playlist' 84 redirectTo: 'videos/watch/playlist'
84 }, 85 },
85 { 86 {
87 path: 'accounts',
88 redirectTo: 'a'
89 },
90 {
91 path: 'video-channels',
92 redirectTo: 'c'
93 },
94 {
95 matcher: (url): UrlMatchResult => {
96 // Matches /@:actorName
97 if (url.length === 1 && url[0].path.match(/^@[\w]+$/gm)) {
98 return {
99 consumed: url,
100 posParams: {
101 actorName: new UrlSegment(url[0].path.substr(1), {})
102 }
103 }
104 }
105
106 return null
107 },
108 component: RootComponent
109 },
110 {
86 path: '', 111 path: '',
87 component: EmptyComponent // Avoid 404, app component will redirect dynamically 112 component: EmptyComponent // Avoid 404, app component will redirect dynamically
88 } 113 }
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index fcc0bc21a..2c2c4f260 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -18,7 +18,7 @@
18 </div> 18 </div>
19 19
20 <div ngbDropdownMenu> 20 <div ngbDropdownMenu>
21 <a *ngIf="user.account" ngbDropdownItem ngbDropdownToggle class="dropdown-item" [routerLink]="[ '/accounts', user.account.nameWithHost ]" 21 <a *ngIf="user.account" ngbDropdownItem ngbDropdownToggle class="dropdown-item" [routerLink]="[ '/a', user.account.nameWithHost ]"
22 #profile (click)="onActiveLinkScrollToAnchor(profile)"> 22 #profile (click)="onActiveLinkScrollToAnchor(profile)">
23 <my-global-icon iconName="go" aria-hidden="true"></my-global-icon> <ng-container i18n>Public profile</ng-container> 23 <my-global-icon iconName="go" aria-hidden="true"></my-global-icon> <ng-container i18n>Public profile</ng-container>
24 </a> 24 </a>
diff --git a/client/src/app/root.component.ts b/client/src/app/root.component.ts
new file mode 100644
index 000000000..5a09e50d1
--- /dev/null
+++ b/client/src/app/root.component.ts
@@ -0,0 +1,44 @@
1import { Component, OnInit } from '@angular/core'
2import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators'
3import { ActivatedRoute, Router } from '@angular/router'
4import { RestExtractor } from '@app/core'
5import { ActorService } from '@app/shared/shared-main/account'
6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
7
8@Component({
9 selector: 'my-root',
10 template: ''
11})
12export class RootComponent implements OnInit {
13 constructor (
14 private actorService: ActorService,
15 private route: ActivatedRoute,
16 private restExtractor: RestExtractor,
17 private router: Router
18 ) {
19 }
20
21 ngOnInit () {
22 this.route.params
23 .pipe(
24 map(params => params[ 'actorName' ]),
25 distinctUntilChanged(),
26 switchMap(actorName => this.actorService.getActorType(actorName)),
27 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [
28 HttpStatusCode.BAD_REQUEST_400,
29 HttpStatusCode.NOT_FOUND_404
30 ]))
31 )
32 .subscribe(actorType => {
33 const actorName = this.route.snapshot.params[ 'actorName' ]
34
35 if (actorType === 'Account') {
36 this.router.navigate([ `/a/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
37 }
38
39 if (actorType === 'VideoChannel') {
40 this.router.navigate([ `/c/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
41 }
42 })
43 }
44}
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index 4dc2b4f10..07b9dddba 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -124,7 +124,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
124 } 124 }
125 125
126 getAccountUrl (abuse: ProcessedAbuse) { 126 getAccountUrl (abuse: ProcessedAbuse) {
127 return '/accounts/' + abuse.flaggedAccount.nameWithHost 127 return '/a/' + abuse.flaggedAccount.nameWithHost
128 } 128 }
129 129
130 getVideoEmbed (abuse: AdminAbuse) { 130 getVideoEmbed (abuse: AdminAbuse) {
diff --git a/client/src/app/shared/shared-main/account/actor.service.ts b/client/src/app/shared/shared-main/account/actor.service.ts
new file mode 100644
index 000000000..464ed4519
--- /dev/null
+++ b/client/src/app/shared/shared-main/account/actor.service.ts
@@ -0,0 +1,37 @@
1import { Observable, ReplaySubject } from 'rxjs'
2import { catchError, map, tap } from 'rxjs/operators'
3import { HttpClient } from '@angular/common/http'
4import { Injectable } from '@angular/core'
5import { RestExtractor } from '@app/core'
6import { Account as ServerAccount, VideoChannel as ServerVideoChannel } from '@shared/models'
7import { environment } from '../../../../environments/environment'
8
9type KeysOfUnion<T> = T extends T ? keyof T: never
10type ServerActor = KeysOfUnion<ServerAccount | ServerVideoChannel>
11
12@Injectable()
13export class ActorService {
14 static BASE_ACTOR_API_URL = environment.apiUrl + '/api/v1/actors/'
15
16 actorLoaded = new ReplaySubject<string>(1)
17
18 constructor (
19 private authHttp: HttpClient,
20 private restExtractor: RestExtractor
21 ) {}
22
23 getActorType (actorName: string): Observable<string> {
24 return this.authHttp.get<ServerActor>(ActorService.BASE_ACTOR_API_URL + actorName)
25 .pipe(
26 map(actorHash => {
27 if (actorHash[ 'userId' ]) {
28 return 'Account'
29 }
30
31 return 'VideoChannel'
32 }),
33 tap(actor => this.actorLoaded.next(actor)),
34 catchError(res => this.restExtractor.handleError(res))
35 )
36 }
37}
diff --git a/client/src/app/shared/shared-main/account/index.ts b/client/src/app/shared/shared-main/account/index.ts
index b80ddb9f5..c6cdcd574 100644
--- a/client/src/app/shared/shared-main/account/index.ts
+++ b/client/src/app/shared/shared-main/account/index.ts
@@ -1,3 +1,4 @@
1export * from './account.model' 1export * from './account.model'
2export * from './account.service' 2export * from './account.service'
3export * from './actor.model' 3export * from './actor.model'
4export * from './actor.service'
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts
index f9b6085cf..f06f25ca5 100644
--- a/client/src/app/shared/shared-main/shared-main.module.ts
+++ b/client/src/app/shared/shared-main/shared-main.module.ts
@@ -17,7 +17,7 @@ import {
17import { LoadingBarModule } from '@ngx-loading-bar/core' 17import { LoadingBarModule } from '@ngx-loading-bar/core'
18import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client' 18import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
19import { SharedGlobalIconModule } from '../shared-icons' 19import { SharedGlobalIconModule } from '../shared-icons'
20import { AccountService } from './account' 20import { AccountService, ActorService } from './account'
21import { 21import {
22 AutofocusDirective, 22 AutofocusDirective,
23 BytesPipe, 23 BytesPipe,
@@ -161,6 +161,7 @@ import { VideoChannelService } from './video-channel'
161 AUTH_INTERCEPTOR_PROVIDER, 161 AUTH_INTERCEPTOR_PROVIDER,
162 162
163 AccountService, 163 AccountService,
164 ActorService,
164 165
165 UserHistoryService, 166 UserHistoryService,
166 UserNotificationService, 167 UserNotificationService,
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts
index ed5791794..002a01583 100644
--- a/client/src/app/shared/shared-main/users/user-notification.model.ts
+++ b/client/src/app/shared/shared-main/users/user-notification.model.ts
@@ -242,7 +242,7 @@ export class UserNotification implements UserNotificationServer {
242 } 242 }
243 243
244 private buildAccountUrl (account: { name: string, host: string }) { 244 private buildAccountUrl (account: { name: string, host: string }) {
245 return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host) 245 return '/a/' + Actor.CREATE_BY_STRING(account.name, account.host)
246 } 246 }
247 247
248 private buildVideoImportUrl () { 248 private buildVideoImportUrl () {
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts
index 9a4e3954e..1a2fe03db 100644
--- a/client/src/app/shared/shared-video-comment/video-comment.model.ts
+++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts
@@ -95,7 +95,7 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel {
95 if (this.account) { 95 if (this.account) {
96 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) 96 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
97 97
98 this.account.localUrl = '/accounts/' + this.by 98 this.account.localUrl = '/a/' + this.by
99 } 99 }
100 } 100 }
101} 101}
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
index 645be92bd..6c34123ed 100644
--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
@@ -12,12 +12,12 @@
12 <div class="d-flex video-miniature-meta"> 12 <div class="d-flex video-miniature-meta">
13 <my-actor-avatar 13 <my-actor-avatar
14 *ngIf="displayOptions.avatar && displayOwnerVideoChannel()" [title]="channelLinkTitle" 14 *ngIf="displayOptions.avatar && displayOwnerVideoChannel()" [title]="channelLinkTitle"
15 [channel]="video.channel" [size]="actorImageSize" [internalHref]="[ '/video-channels', video.byVideoChannel ]" 15 [channel]="video.channel" [size]="actorImageSize" [internalHref]="[ '/c', video.byVideoChannel ]"
16 ></my-actor-avatar> 16 ></my-actor-avatar>
17 17
18 <my-actor-avatar 18 <my-actor-avatar
19 *ngIf="displayOptions.avatar && displayOwnerAccount()" [title]="channelLinkTitle" 19 *ngIf="displayOptions.avatar && displayOwnerAccount()" [title]="channelLinkTitle"
20 [account]="video.account" [size]="actorImageSize" [internalHref]="[ '/video-channels', video.byVideoChannel ]" 20 [account]="video.account" [size]="actorImageSize" [internalHref]="[ '/c', video.byVideoChannel ]"
21 ></my-actor-avatar> 21 ></my-actor-avatar>
22 22
23 <div class="w-100 d-flex flex-column"> 23 <div class="w-100 d-flex flex-column">
@@ -39,10 +39,10 @@
39 </span> 39 </span>
40 </span> 40 </span>
41 41
42 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/video-channels', video.byVideoChannel ]"> 42 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
43 {{ video.byAccount }} 43 {{ video.byAccount }}
44 </a> 44 </a>
45 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/video-channels', video.byVideoChannel ]"> 45 <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
46 {{ video.byVideoChannel }} 46 {{ video.byVideoChannel }}
47 </a> 47 </a>
48 48
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
index ec004a407..e74f58f47 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.html
@@ -20,7 +20,7 @@
20 [attr.title]="playlistElement.video.name" 20 [attr.title]="playlistElement.video.name"
21 >{{ playlistElement.video.name }}</a> 21 >{{ playlistElement.video.name }}</a>
22 22
23 <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', playlistElement.video.byAccount ]"> 23 <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/a', playlistElement.video.byAccount ]">
24 {{ playlistElement.video.byAccount }} 24 {{ playlistElement.video.byAccount }}
25 </a> 25 </a>
26 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ playlistElement.video.byAccount }}</span> 26 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ playlistElement.video.byAccount }}</span>
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
index f50f95003..81c36e6fe 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
@@ -19,7 +19,7 @@
19 {{ playlist.displayName }} 19 {{ playlist.displayName }}
20 </a> 20 </a>
21 21
22 <a i18n [routerLink]="[ '/video-channels', playlist.videoChannelBy ]" class="by" *ngIf="displayChannel && playlist.videoChannelBy"> 22 <a i18n [routerLink]="[ '/c', playlist.videoChannelBy ]" class="by" *ngIf="displayChannel && playlist.videoChannelBy">
23 {{ playlist.videoChannelBy }} 23 {{ playlist.videoChannelBy }}
24 </a> 24 </a>
25 25