From a840d396093ef968f9512862197ac166a1ff9921 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 1 Jun 2016 20:36:27 +0200 Subject: Add authentication tokens to make friends/quit friends --- client/app/app.component.ts | 11 ++- client/app/friends/friend.service.ts | 10 +- client/app/login/index.ts | 1 + client/app/login/login.component.html | 14 +++ client/app/login/login.component.ts | 36 +++++++ client/app/shared/index.ts | 5 +- client/app/shared/search-field.type.ts | 1 - client/app/shared/search.component.html | 17 ---- client/app/shared/search.component.ts | 46 --------- client/app/shared/search.model.ts | 6 -- client/app/shared/search/index.ts | 3 + client/app/shared/search/search-field.type.ts | 1 + client/app/shared/search/search.component.html | 17 ++++ client/app/shared/search/search.component.ts | 46 +++++++++ client/app/shared/search/search.model.ts | 6 ++ client/app/shared/users/auth-status.model.ts | 4 + client/app/shared/users/auth.service.ts | 108 +++++++++++++++++++++ client/app/shared/users/index.ts | 4 + client/app/shared/users/token.model.ts | 32 ++++++ client/app/shared/users/user.model.ts | 20 ++++ client/app/users/index.ts | 2 - client/app/users/login/index.ts | 1 - client/app/users/login/login.component.html | 14 --- client/app/users/login/login.component.scss | 0 client/app/users/login/login.component.ts | 37 ------- client/app/users/shared/auth-status.model.ts | 4 - client/app/users/shared/auth.service.ts | 108 --------------------- client/app/users/shared/index.ts | 4 - client/app/users/shared/token.model.ts | 32 ------ client/app/users/shared/user.model.ts | 20 ---- client/app/videos/shared/video.service.ts | 2 +- client/app/videos/video-add/video-add.component.ts | 2 +- .../app/videos/video-list/video-list.component.ts | 3 +- .../videos/video-list/video-miniature.component.ts | 2 +- 34 files changed, 311 insertions(+), 308 deletions(-) create mode 100644 client/app/login/index.ts create mode 100644 client/app/login/login.component.html create mode 100644 client/app/login/login.component.ts delete mode 100644 client/app/shared/search-field.type.ts delete mode 100644 client/app/shared/search.component.html delete mode 100644 client/app/shared/search.component.ts delete mode 100644 client/app/shared/search.model.ts create mode 100644 client/app/shared/search/index.ts create mode 100644 client/app/shared/search/search-field.type.ts create mode 100644 client/app/shared/search/search.component.html create mode 100644 client/app/shared/search/search.component.ts create mode 100644 client/app/shared/search/search.model.ts create mode 100644 client/app/shared/users/auth-status.model.ts create mode 100644 client/app/shared/users/auth.service.ts create mode 100644 client/app/shared/users/index.ts create mode 100644 client/app/shared/users/token.model.ts create mode 100644 client/app/shared/users/user.model.ts delete mode 100644 client/app/users/index.ts delete mode 100644 client/app/users/login/index.ts delete mode 100644 client/app/users/login/login.component.html delete mode 100644 client/app/users/login/login.component.scss delete mode 100644 client/app/users/login/login.component.ts delete mode 100644 client/app/users/shared/auth-status.model.ts delete mode 100644 client/app/users/shared/auth.service.ts delete mode 100644 client/app/users/shared/index.ts delete mode 100644 client/app/users/shared/token.model.ts delete mode 100644 client/app/users/shared/user.model.ts (limited to 'client/app') diff --git a/client/app/app.component.ts b/client/app/app.component.ts index d29448296..94924a47a 100644 --- a/client/app/app.component.ts +++ b/client/app/app.component.ts @@ -3,12 +3,13 @@ import { HTTP_PROVIDERS } from '@angular/http'; import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; import { FriendService } from './friends/index'; -import { Search, SearchComponent } from './shared/index'; +import { LoginComponent } from './login/index'; import { - UserLoginComponent, AuthService, - AuthStatus -} from './users/index'; + AuthStatus, + Search, + SearchComponent +} from './shared/index'; import { VideoAddComponent, VideoListComponent, @@ -20,7 +21,7 @@ import { { path: '/users/login', name: 'UserLogin', - component: UserLoginComponent + component: LoginComponent }, { path: '/videos/list', diff --git a/client/app/friends/friend.service.ts b/client/app/friends/friend.service.ts index bdfa7baec..d3684f08d 100644 --- a/client/app/friends/friend.service.ts +++ b/client/app/friends/friend.service.ts @@ -2,20 +2,24 @@ import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; +import { AuthService } from '../shared/index'; + @Injectable() export class FriendService { private static BASE_FRIEND_URL: string = '/api/v1/pods/'; - constructor (private http: Http) {} + constructor (private http: Http, private authService: AuthService) {} makeFriends() { - return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends') + const headers = this.authService.getRequestHeader(); + return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends', { headers }) .map(res => res.status) .catch(this.handleError); } quitFriends() { - return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends') + const headers = this.authService.getRequestHeader(); + return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends', { headers }) .map(res => res.status) .catch(this.handleError); } diff --git a/client/app/login/index.ts b/client/app/login/index.ts new file mode 100644 index 000000000..69c16441f --- /dev/null +++ b/client/app/login/index.ts @@ -0,0 +1 @@ +export * from './login.component'; diff --git a/client/app/login/login.component.html b/client/app/login/login.component.html new file mode 100644 index 000000000..940694515 --- /dev/null +++ b/client/app/login/login.component.html @@ -0,0 +1,14 @@ +

Login

+
+
+ + +
+ +
+ + +
+ + +
diff --git a/client/app/login/login.component.ts b/client/app/login/login.component.ts new file mode 100644 index 000000000..50f598d92 --- /dev/null +++ b/client/app/login/login.component.ts @@ -0,0 +1,36 @@ +import { Component } from '@angular/core'; +import { Router } from '@angular/router-deprecated'; + +import { AuthService, AuthStatus, User } from '../shared/index'; + +@Component({ + selector: 'my-login', + templateUrl: 'client/app/login/login.component.html' +}) + +export class LoginComponent { + constructor( + private authService: AuthService, + private router: Router + ) {} + + login(username: string, password: string) { + this.authService.login(username, password).subscribe( + result => { + const user = new User(username, result); + user.save(); + + this.authService.setStatus(AuthStatus.LoggedIn); + + this.router.navigate(['VideosList']); + }, + error => { + if (error.error === 'invalid_grant') { + alert('Credentials are invalid.'); + } else { + alert(`${error.error}: ${error.error_description}`); + } + } + ); + } +} diff --git a/client/app/shared/index.ts b/client/app/shared/index.ts index a49a4f1a9..ad3ee0098 100644 --- a/client/app/shared/index.ts +++ b/client/app/shared/index.ts @@ -1,3 +1,2 @@ -export * from './search-field.type'; -export * from './search.component'; -export * from './search.model'; +export * from './search/index'; +export * from './users/index' diff --git a/client/app/shared/search-field.type.ts b/client/app/shared/search-field.type.ts deleted file mode 100644 index 846236290..000000000 --- a/client/app/shared/search-field.type.ts +++ /dev/null @@ -1 +0,0 @@ -export type SearchField = "name" | "author" | "podUrl" | "magnetUri"; diff --git a/client/app/shared/search.component.html b/client/app/shared/search.component.html deleted file mode 100644 index fb13ac72e..000000000 --- a/client/app/shared/search.component.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- - -
- - -
diff --git a/client/app/shared/search.component.ts b/client/app/shared/search.component.ts deleted file mode 100644 index e1e30b9af..000000000 --- a/client/app/shared/search.component.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component, EventEmitter, Output } from '@angular/core'; - -import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; - -import { Search } from './search.model'; -import { SearchField } from './search-field.type'; - -@Component({ - selector: 'my-search', - templateUrl: 'client/app/shared/search.component.html', - directives: [ DROPDOWN_DIRECTIVES ] -}) - -export class SearchComponent { - @Output() search = new EventEmitter(); - - fieldChoices = { - name: 'Name', - author: 'Author', - podUrl: 'Pod Url', - magnetUri: 'Magnet Uri' - }; - searchCriterias: Search = { - field: 'name', - value: '' - }; - - get choiceKeys() { - return Object.keys(this.fieldChoices); - } - - choose($event: MouseEvent, choice: SearchField) { - $event.preventDefault(); - $event.stopPropagation(); - - this.searchCriterias.field = choice; - } - - doSearch() { - this.search.emit(this.searchCriterias); - } - - getStringChoice(choiceKey: SearchField) { - return this.fieldChoices[choiceKey]; - } -} diff --git a/client/app/shared/search.model.ts b/client/app/shared/search.model.ts deleted file mode 100644 index 932a6566c..000000000 --- a/client/app/shared/search.model.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { SearchField } from './search-field.type'; - -export interface Search { - field: SearchField; - value: string; -} diff --git a/client/app/shared/search/index.ts b/client/app/shared/search/index.ts new file mode 100644 index 000000000..a49a4f1a9 --- /dev/null +++ b/client/app/shared/search/index.ts @@ -0,0 +1,3 @@ +export * from './search-field.type'; +export * from './search.component'; +export * from './search.model'; diff --git a/client/app/shared/search/search-field.type.ts b/client/app/shared/search/search-field.type.ts new file mode 100644 index 000000000..846236290 --- /dev/null +++ b/client/app/shared/search/search-field.type.ts @@ -0,0 +1 @@ +export type SearchField = "name" | "author" | "podUrl" | "magnetUri"; diff --git a/client/app/shared/search/search.component.html b/client/app/shared/search/search.component.html new file mode 100644 index 000000000..fb13ac72e --- /dev/null +++ b/client/app/shared/search/search.component.html @@ -0,0 +1,17 @@ +
+
+ + +
+ + +
diff --git a/client/app/shared/search/search.component.ts b/client/app/shared/search/search.component.ts new file mode 100644 index 000000000..d541cd0d6 --- /dev/null +++ b/client/app/shared/search/search.component.ts @@ -0,0 +1,46 @@ +import { Component, EventEmitter, Output } from '@angular/core'; + +import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; + +import { Search } from './search.model'; +import { SearchField } from './search-field.type'; + +@Component({ + selector: 'my-search', + templateUrl: 'client/app/shared/search/search.component.html', + directives: [ DROPDOWN_DIRECTIVES ] +}) + +export class SearchComponent { + @Output() search = new EventEmitter(); + + fieldChoices = { + name: 'Name', + author: 'Author', + podUrl: 'Pod Url', + magnetUri: 'Magnet Uri' + }; + searchCriterias: Search = { + field: 'name', + value: '' + }; + + get choiceKeys() { + return Object.keys(this.fieldChoices); + } + + choose($event: MouseEvent, choice: SearchField) { + $event.preventDefault(); + $event.stopPropagation(); + + this.searchCriterias.field = choice; + } + + doSearch() { + this.search.emit(this.searchCriterias); + } + + getStringChoice(choiceKey: SearchField) { + return this.fieldChoices[choiceKey]; + } +} diff --git a/client/app/shared/search/search.model.ts b/client/app/shared/search/search.model.ts new file mode 100644 index 000000000..932a6566c --- /dev/null +++ b/client/app/shared/search/search.model.ts @@ -0,0 +1,6 @@ +import { SearchField } from './search-field.type'; + +export interface Search { + field: SearchField; + value: string; +} diff --git a/client/app/shared/users/auth-status.model.ts b/client/app/shared/users/auth-status.model.ts new file mode 100644 index 000000000..f646bd4cf --- /dev/null +++ b/client/app/shared/users/auth-status.model.ts @@ -0,0 +1,4 @@ +export enum AuthStatus { + LoggedIn, + LoggedOut +} diff --git a/client/app/shared/users/auth.service.ts b/client/app/shared/users/auth.service.ts new file mode 100644 index 000000000..d63fe38f3 --- /dev/null +++ b/client/app/shared/users/auth.service.ts @@ -0,0 +1,108 @@ +import { Injectable } from '@angular/core'; +import { Headers, Http, RequestOptions, Response, URLSearchParams } from '@angular/http'; +import { Observable, Subject } from 'rxjs/Rx'; + +import { AuthStatus } from './auth-status.model'; +import { User } from './user.model'; + +@Injectable() +export class AuthService { + private static BASE_CLIENT_URL = '/api/v1/users/client'; + private static BASE_LOGIN_URL = '/api/v1/users/token'; + + loginChangedSource: Observable; + + private clientId: string; + private clientSecret: string; + private loginChanged: Subject; + + constructor(private http: Http) { + this.loginChanged = new Subject(); + this.loginChangedSource = this.loginChanged.asObservable(); + + // Fetch the client_id/client_secret + // FIXME: save in local storage? + this.http.get(AuthService.BASE_CLIENT_URL) + .map(res => res.json()) + .catch(this.handleError) + .subscribe( + result => { + this.clientId = result.client_id; + this.clientSecret = result.client_secret; + console.log('Client credentials loaded.'); + }, + error => { + alert(error); + } + ); + } + + getAuthRequestOptions(): RequestOptions { + return new RequestOptions({ headers: this.getRequestHeader() }); + } + + getRequestHeader() { + return new Headers({ 'Authorization': `${this.getTokenType()} ${this.getToken()}` }); + } + + getToken() { + return localStorage.getItem('access_token'); + } + + getTokenType() { + return localStorage.getItem('token_type'); + } + + getUser(): User { + if (this.isLoggedIn() === false) { + return null; + } + + const user = User.load(); + + return user; + } + + isLoggedIn() { + if (this.getToken()) { + return true; + } else { + return false; + } + } + + login(username: string, password: string) { + let body = new URLSearchParams(); + body.set('client_id', this.clientId); + body.set('client_secret', this.clientSecret); + body.set('response_type', 'code'); + body.set('grant_type', 'password'); + body.set('scope', 'upload'); + body.set('username', username); + body.set('password', password); + + let headers = new Headers(); + headers.append('Content-Type', 'application/x-www-form-urlencoded'); + + let options = { + headers: headers + }; + + return this.http.post(AuthService.BASE_LOGIN_URL, body.toString(), options) + .map(res => res.json()) + .catch(this.handleError); + } + + logout() { + // TODO make HTTP request + } + + setStatus(status: AuthStatus) { + this.loginChanged.next(status); + } + + private handleError (error: Response) { + console.error(error); + return Observable.throw(error.json() || { error: 'Server error' }); + } +} diff --git a/client/app/shared/users/index.ts b/client/app/shared/users/index.ts new file mode 100644 index 000000000..c6816b3c6 --- /dev/null +++ b/client/app/shared/users/index.ts @@ -0,0 +1,4 @@ +export * from './auth-status.model'; +export * from './auth.service'; +export * from './token.model'; +export * from './user.model'; diff --git a/client/app/shared/users/token.model.ts b/client/app/shared/users/token.model.ts new file mode 100644 index 000000000..021c83fad --- /dev/null +++ b/client/app/shared/users/token.model.ts @@ -0,0 +1,32 @@ +export class Token { + access_token: string; + refresh_token: string; + token_type: string; + + static load() { + return new Token({ + access_token: localStorage.getItem('access_token'), + refresh_token: localStorage.getItem('refresh_token'), + token_type: localStorage.getItem('token_type') + }); + } + + constructor(hash?: any) { + if (hash) { + this.access_token = hash.access_token; + this.refresh_token = hash.refresh_token; + + if (hash.token_type === 'bearer') { + this.token_type = 'Bearer'; + } else { + this.token_type = hash.token_type; + } + } + } + + save() { + localStorage.setItem('access_token', this.access_token); + localStorage.setItem('refresh_token', this.refresh_token); + localStorage.setItem('token_type', this.token_type); + } +} diff --git a/client/app/shared/users/user.model.ts b/client/app/shared/users/user.model.ts new file mode 100644 index 000000000..ca0a5f26c --- /dev/null +++ b/client/app/shared/users/user.model.ts @@ -0,0 +1,20 @@ +import { Token } from './token.model'; + +export class User { + username: string; + token: Token; + + static load() { + return new User(localStorage.getItem('username'), Token.load()); + } + + constructor(username: string, hash_token: any) { + this.username = username; + this.token = new Token(hash_token); + } + + save() { + localStorage.setItem('username', this.username); + this.token.save(); + } +} diff --git a/client/app/users/index.ts b/client/app/users/index.ts deleted file mode 100644 index 4f08b8bc7..000000000 --- a/client/app/users/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './login/index'; -export * from './shared/index'; diff --git a/client/app/users/login/index.ts b/client/app/users/login/index.ts deleted file mode 100644 index 69c16441f..000000000 --- a/client/app/users/login/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './login.component'; diff --git a/client/app/users/login/login.component.html b/client/app/users/login/login.component.html deleted file mode 100644 index 940694515..000000000 --- a/client/app/users/login/login.component.html +++ /dev/null @@ -1,14 +0,0 @@ -

Login

-
-
- - -
- -
- - -
- - -
diff --git a/client/app/users/login/login.component.scss b/client/app/users/login/login.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/client/app/users/login/login.component.ts b/client/app/users/login/login.component.ts deleted file mode 100644 index 09c5f1af7..000000000 --- a/client/app/users/login/login.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router-deprecated'; - -import { AuthService, AuthStatus, User } from '../shared/index'; - -@Component({ - selector: 'my-user-login', - styleUrls: [ 'client/app/users/login/login.component.css' ], - templateUrl: 'client/app/users/login/login.component.html' -}) - -export class UserLoginComponent { - constructor( - private authService: AuthService, - private router: Router - ) {} - - login(username: string, password: string) { - this.authService.login(username, password).subscribe( - result => { - const user = new User(username, result); - user.save(); - - this.authService.setStatus(AuthStatus.LoggedIn); - - this.router.navigate(['VideosList']); - }, - error => { - if (error.error === 'invalid_grant') { - alert('Credentials are invalid.'); - } else { - alert(`${error.error}: ${error.error_description}`); - } - } - ); - } -} diff --git a/client/app/users/shared/auth-status.model.ts b/client/app/users/shared/auth-status.model.ts deleted file mode 100644 index f646bd4cf..000000000 --- a/client/app/users/shared/auth-status.model.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum AuthStatus { - LoggedIn, - LoggedOut -} diff --git a/client/app/users/shared/auth.service.ts b/client/app/users/shared/auth.service.ts deleted file mode 100644 index d63fe38f3..000000000 --- a/client/app/users/shared/auth.service.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Headers, Http, RequestOptions, Response, URLSearchParams } from '@angular/http'; -import { Observable, Subject } from 'rxjs/Rx'; - -import { AuthStatus } from './auth-status.model'; -import { User } from './user.model'; - -@Injectable() -export class AuthService { - private static BASE_CLIENT_URL = '/api/v1/users/client'; - private static BASE_LOGIN_URL = '/api/v1/users/token'; - - loginChangedSource: Observable; - - private clientId: string; - private clientSecret: string; - private loginChanged: Subject; - - constructor(private http: Http) { - this.loginChanged = new Subject(); - this.loginChangedSource = this.loginChanged.asObservable(); - - // Fetch the client_id/client_secret - // FIXME: save in local storage? - this.http.get(AuthService.BASE_CLIENT_URL) - .map(res => res.json()) - .catch(this.handleError) - .subscribe( - result => { - this.clientId = result.client_id; - this.clientSecret = result.client_secret; - console.log('Client credentials loaded.'); - }, - error => { - alert(error); - } - ); - } - - getAuthRequestOptions(): RequestOptions { - return new RequestOptions({ headers: this.getRequestHeader() }); - } - - getRequestHeader() { - return new Headers({ 'Authorization': `${this.getTokenType()} ${this.getToken()}` }); - } - - getToken() { - return localStorage.getItem('access_token'); - } - - getTokenType() { - return localStorage.getItem('token_type'); - } - - getUser(): User { - if (this.isLoggedIn() === false) { - return null; - } - - const user = User.load(); - - return user; - } - - isLoggedIn() { - if (this.getToken()) { - return true; - } else { - return false; - } - } - - login(username: string, password: string) { - let body = new URLSearchParams(); - body.set('client_id', this.clientId); - body.set('client_secret', this.clientSecret); - body.set('response_type', 'code'); - body.set('grant_type', 'password'); - body.set('scope', 'upload'); - body.set('username', username); - body.set('password', password); - - let headers = new Headers(); - headers.append('Content-Type', 'application/x-www-form-urlencoded'); - - let options = { - headers: headers - }; - - return this.http.post(AuthService.BASE_LOGIN_URL, body.toString(), options) - .map(res => res.json()) - .catch(this.handleError); - } - - logout() { - // TODO make HTTP request - } - - setStatus(status: AuthStatus) { - this.loginChanged.next(status); - } - - private handleError (error: Response) { - console.error(error); - return Observable.throw(error.json() || { error: 'Server error' }); - } -} diff --git a/client/app/users/shared/index.ts b/client/app/users/shared/index.ts deleted file mode 100644 index c6816b3c6..000000000 --- a/client/app/users/shared/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './auth-status.model'; -export * from './auth.service'; -export * from './token.model'; -export * from './user.model'; diff --git a/client/app/users/shared/token.model.ts b/client/app/users/shared/token.model.ts deleted file mode 100644 index 021c83fad..000000000 --- a/client/app/users/shared/token.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -export class Token { - access_token: string; - refresh_token: string; - token_type: string; - - static load() { - return new Token({ - access_token: localStorage.getItem('access_token'), - refresh_token: localStorage.getItem('refresh_token'), - token_type: localStorage.getItem('token_type') - }); - } - - constructor(hash?: any) { - if (hash) { - this.access_token = hash.access_token; - this.refresh_token = hash.refresh_token; - - if (hash.token_type === 'bearer') { - this.token_type = 'Bearer'; - } else { - this.token_type = hash.token_type; - } - } - } - - save() { - localStorage.setItem('access_token', this.access_token); - localStorage.setItem('refresh_token', this.refresh_token); - localStorage.setItem('token_type', this.token_type); - } -} diff --git a/client/app/users/shared/user.model.ts b/client/app/users/shared/user.model.ts deleted file mode 100644 index ca0a5f26c..000000000 --- a/client/app/users/shared/user.model.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Token } from './token.model'; - -export class User { - username: string; - token: Token; - - static load() { - return new User(localStorage.getItem('username'), Token.load()); - } - - constructor(username: string, hash_token: any) { - this.username = username; - this.token = new Token(hash_token); - } - - save() { - localStorage.setItem('username', this.username); - this.token.save(); - } -} diff --git a/client/app/videos/shared/video.service.ts b/client/app/videos/shared/video.service.ts index 7b6519f00..a786b2ab2 100644 --- a/client/app/videos/shared/video.service.ts +++ b/client/app/videos/shared/video.service.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs/Rx'; import { Pagination } from './pagination.model'; import { Search } from '../../shared/index'; import { SortField } from './sort-field.type'; -import { AuthService } from '../../users/index'; +import { AuthService } from '../../shared/index'; import { Video } from './video.model'; @Injectable() diff --git a/client/app/videos/video-add/video-add.component.ts b/client/app/videos/video-add/video-add.component.ts index 619a4f4d8..e17b1b0f6 100644 --- a/client/app/videos/video-add/video-add.component.ts +++ b/client/app/videos/video-add/video-add.component.ts @@ -7,7 +7,7 @@ import { Router } from '@angular/router-deprecated'; import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar'; -import { AuthService, User } from '../../users/index'; +import { AuthService, User } from '../../shared/index'; @Component({ selector: 'my-videos-add', diff --git a/client/app/videos/video-list/video-list.component.ts b/client/app/videos/video-list/video-list.component.ts index 6322860be..baca00deb 100644 --- a/client/app/videos/video-list/video-list.component.ts +++ b/client/app/videos/video-list/video-list.component.ts @@ -10,8 +10,7 @@ import { Video, VideoService } from '../shared/index'; -import { Search, SearchField } from '../../shared/index'; -import { AuthService, User } from '../../users/index'; +import { AuthService, Search, SearchField, User } from '../../shared/index'; import { VideoMiniatureComponent } from './video-miniature.component'; import { VideoSortComponent } from './video-sort.component'; diff --git a/client/app/videos/video-list/video-miniature.component.ts b/client/app/videos/video-list/video-miniature.component.ts index 3baa1ddd6..11b828ca6 100644 --- a/client/app/videos/video-list/video-miniature.component.ts +++ b/client/app/videos/video-list/video-miniature.component.ts @@ -3,7 +3,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; import { ROUTER_DIRECTIVES } from '@angular/router-deprecated'; import { Video, VideoService } from '../shared/index'; -import { User } from '../../users/index'; +import { User } from '../../shared/index'; @Component({ selector: 'my-video-miniature', -- cgit v1.2.3