aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-01 20:36:27 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-01 20:36:27 +0200
commita840d396093ef968f9512862197ac166a1ff9921 (patch)
treef7e4c93ee3ae8a44bd14fd1f7c74234eef7469ef
parent575fdcece562b914149f89f5a5b96ab206648f09 (diff)
downloadPeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.gz
PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.zst
PeerTube-a840d396093ef968f9512862197ac166a1ff9921.zip
Add authentication tokens to make friends/quit friends
-rw-r--r--client/app/app.component.ts11
-rw-r--r--client/app/friends/friend.service.ts10
-rw-r--r--client/app/login/index.ts (renamed from client/app/users/login/index.ts)0
-rw-r--r--client/app/login/login.component.html (renamed from client/app/users/login/login.component.html)0
-rw-r--r--client/app/login/login.component.ts (renamed from client/app/users/login/login.component.ts)7
-rw-r--r--client/app/shared/index.ts5
-rw-r--r--client/app/shared/search/index.ts3
-rw-r--r--client/app/shared/search/search-field.type.ts (renamed from client/app/shared/search-field.type.ts)0
-rw-r--r--client/app/shared/search/search.component.html (renamed from client/app/shared/search.component.html)0
-rw-r--r--client/app/shared/search/search.component.ts (renamed from client/app/shared/search.component.ts)2
-rw-r--r--client/app/shared/search/search.model.ts (renamed from client/app/shared/search.model.ts)0
-rw-r--r--client/app/shared/users/auth-status.model.ts (renamed from client/app/users/shared/auth-status.model.ts)0
-rw-r--r--client/app/shared/users/auth.service.ts (renamed from client/app/users/shared/auth.service.ts)0
-rw-r--r--client/app/shared/users/index.ts (renamed from client/app/users/shared/index.ts)0
-rw-r--r--client/app/shared/users/token.model.ts (renamed from client/app/users/shared/token.model.ts)0
-rw-r--r--client/app/shared/users/user.model.ts (renamed from client/app/users/shared/user.model.ts)0
-rw-r--r--client/app/users/index.ts2
-rw-r--r--client/app/users/login/login.component.scss0
-rw-r--r--client/app/videos/shared/video.service.ts2
-rw-r--r--client/app/videos/video-add/video-add.component.ts2
-rw-r--r--client/app/videos/video-list/video-list.component.ts3
-rw-r--r--client/app/videos/video-list/video-miniature.component.ts2
-rw-r--r--client/tsconfig.json22
23 files changed, 37 insertions, 34 deletions
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';
3import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; 3import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
4 4
5import { FriendService } from './friends/index'; 5import { FriendService } from './friends/index';
6import { Search, SearchComponent } from './shared/index'; 6import { LoginComponent } from './login/index';
7import { 7import {
8 UserLoginComponent,
9 AuthService, 8 AuthService,
10 AuthStatus 9 AuthStatus,
11} from './users/index'; 10 Search,
11 SearchComponent
12} from './shared/index';
12import { 13import {
13 VideoAddComponent, 14 VideoAddComponent,
14 VideoListComponent, 15 VideoListComponent,
@@ -20,7 +21,7 @@ import {
20 { 21 {
21 path: '/users/login', 22 path: '/users/login',
22 name: 'UserLogin', 23 name: 'UserLogin',
23 component: UserLoginComponent 24 component: LoginComponent
24 }, 25 },
25 { 26 {
26 path: '/videos/list', 27 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';
2import { Http, Response } from '@angular/http'; 2import { Http, Response } from '@angular/http';
3import { Observable } from 'rxjs/Rx'; 3import { Observable } from 'rxjs/Rx';
4 4
5import { AuthService } from '../shared/index';
6
5@Injectable() 7@Injectable()
6export class FriendService { 8export class FriendService {
7 private static BASE_FRIEND_URL: string = '/api/v1/pods/'; 9 private static BASE_FRIEND_URL: string = '/api/v1/pods/';
8 10
9 constructor (private http: Http) {} 11 constructor (private http: Http, private authService: AuthService) {}
10 12
11 makeFriends() { 13 makeFriends() {
12 return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends') 14 const headers = this.authService.getRequestHeader();
15 return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends', { headers })
13 .map(res => res.status) 16 .map(res => res.status)
14 .catch(this.handleError); 17 .catch(this.handleError);
15 } 18 }
16 19
17 quitFriends() { 20 quitFriends() {
18 return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends') 21 const headers = this.authService.getRequestHeader();
22 return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends', { headers })
19 .map(res => res.status) 23 .map(res => res.status)
20 .catch(this.handleError); 24 .catch(this.handleError);
21 } 25 }
diff --git a/client/app/users/login/index.ts b/client/app/login/index.ts
index 69c16441f..69c16441f 100644
--- a/client/app/users/login/index.ts
+++ b/client/app/login/index.ts
diff --git a/client/app/users/login/login.component.html b/client/app/login/login.component.html
index 940694515..940694515 100644
--- a/client/app/users/login/login.component.html
+++ b/client/app/login/login.component.html
diff --git a/client/app/users/login/login.component.ts b/client/app/login/login.component.ts
index 09c5f1af7..50f598d92 100644
--- a/client/app/users/login/login.component.ts
+++ b/client/app/login/login.component.ts
@@ -4,12 +4,11 @@ import { Router } from '@angular/router-deprecated';
4import { AuthService, AuthStatus, User } from '../shared/index'; 4import { AuthService, AuthStatus, User } from '../shared/index';
5 5
6@Component({ 6@Component({
7 selector: 'my-user-login', 7 selector: 'my-login',
8 styleUrls: [ 'client/app/users/login/login.component.css' ], 8 templateUrl: 'client/app/login/login.component.html'
9 templateUrl: 'client/app/users/login/login.component.html'
10}) 9})
11 10
12export class UserLoginComponent { 11export class LoginComponent {
13 constructor( 12 constructor(
14 private authService: AuthService, 13 private authService: AuthService,
15 private router: Router 14 private router: Router
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 @@
1export * from './search-field.type'; 1export * from './search/index';
2export * from './search.component'; 2export * from './users/index'
3export * from './search.model';
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 @@
1export * from './search-field.type';
2export * from './search.component';
3export * from './search.model';
diff --git a/client/app/shared/search-field.type.ts b/client/app/shared/search/search-field.type.ts
index 846236290..846236290 100644
--- a/client/app/shared/search-field.type.ts
+++ b/client/app/shared/search/search-field.type.ts
diff --git a/client/app/shared/search.component.html b/client/app/shared/search/search.component.html
index fb13ac72e..fb13ac72e 100644
--- a/client/app/shared/search.component.html
+++ b/client/app/shared/search/search.component.html
diff --git a/client/app/shared/search.component.ts b/client/app/shared/search/search.component.ts
index e1e30b9af..d541cd0d6 100644
--- a/client/app/shared/search.component.ts
+++ b/client/app/shared/search/search.component.ts
@@ -7,7 +7,7 @@ import { SearchField } from './search-field.type';
7 7
8@Component({ 8@Component({
9 selector: 'my-search', 9 selector: 'my-search',
10 templateUrl: 'client/app/shared/search.component.html', 10 templateUrl: 'client/app/shared/search/search.component.html',
11 directives: [ DROPDOWN_DIRECTIVES ] 11 directives: [ DROPDOWN_DIRECTIVES ]
12}) 12})
13 13
diff --git a/client/app/shared/search.model.ts b/client/app/shared/search/search.model.ts
index 932a6566c..932a6566c 100644
--- a/client/app/shared/search.model.ts
+++ b/client/app/shared/search/search.model.ts
diff --git a/client/app/users/shared/auth-status.model.ts b/client/app/shared/users/auth-status.model.ts
index f646bd4cf..f646bd4cf 100644
--- a/client/app/users/shared/auth-status.model.ts
+++ b/client/app/shared/users/auth-status.model.ts
diff --git a/client/app/users/shared/auth.service.ts b/client/app/shared/users/auth.service.ts
index d63fe38f3..d63fe38f3 100644
--- a/client/app/users/shared/auth.service.ts
+++ b/client/app/shared/users/auth.service.ts
diff --git a/client/app/users/shared/index.ts b/client/app/shared/users/index.ts
index c6816b3c6..c6816b3c6 100644
--- a/client/app/users/shared/index.ts
+++ b/client/app/shared/users/index.ts
diff --git a/client/app/users/shared/token.model.ts b/client/app/shared/users/token.model.ts
index 021c83fad..021c83fad 100644
--- a/client/app/users/shared/token.model.ts
+++ b/client/app/shared/users/token.model.ts
diff --git a/client/app/users/shared/user.model.ts b/client/app/shared/users/user.model.ts
index ca0a5f26c..ca0a5f26c 100644
--- a/client/app/users/shared/user.model.ts
+++ b/client/app/shared/users/user.model.ts
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 @@
1export * from './login/index';
2export * from './shared/index';
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
--- a/client/app/users/login/login.component.scss
+++ /dev/null
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';
5import { Pagination } from './pagination.model'; 5import { Pagination } from './pagination.model';
6import { Search } from '../../shared/index'; 6import { Search } from '../../shared/index';
7import { SortField } from './sort-field.type'; 7import { SortField } from './sort-field.type';
8import { AuthService } from '../../users/index'; 8import { AuthService } from '../../shared/index';
9import { Video } from './video.model'; 9import { Video } from './video.model';
10 10
11@Injectable() 11@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';
7import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 7import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
8import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar'; 8import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
9 9
10import { AuthService, User } from '../../users/index'; 10import { AuthService, User } from '../../shared/index';
11 11
12@Component({ 12@Component({
13 selector: 'my-videos-add', 13 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 {
10 Video, 10 Video,
11 VideoService 11 VideoService
12} from '../shared/index'; 12} from '../shared/index';
13import { Search, SearchField } from '../../shared/index'; 13import { AuthService, Search, SearchField, User } from '../../shared/index';
14import { AuthService, User } from '../../users/index';
15import { VideoMiniatureComponent } from './video-miniature.component'; 14import { VideoMiniatureComponent } from './video-miniature.component';
16import { VideoSortComponent } from './video-sort.component'; 15import { VideoSortComponent } from './video-sort.component';
17 16
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';
3import { ROUTER_DIRECTIVES } from '@angular/router-deprecated'; 3import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
4 4
5import { Video, VideoService } from '../shared/index'; 5import { Video, VideoService } from '../shared/index';
6import { User } from '../../users/index'; 6import { User } from '../../shared/index';
7 7
8@Component({ 8@Component({
9 selector: 'my-video-miniature', 9 selector: 'my-video-miniature',
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 24583f6c3..a8b8269a4 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -23,18 +23,18 @@
23 "app/app.component.ts", 23 "app/app.component.ts",
24 "app/friends/friend.service.ts", 24 "app/friends/friend.service.ts",
25 "app/friends/index.ts", 25 "app/friends/index.ts",
26 "app/login/index.ts",
27 "app/login/login.component.ts",
26 "app/shared/index.ts", 28 "app/shared/index.ts",
27 "app/shared/search-field.type.ts", 29 "app/shared/search/index.ts",
28 "app/shared/search.component.ts", 30 "app/shared/search/search-field.type.ts",
29 "app/shared/search.model.ts", 31 "app/shared/search/search.component.ts",
30 "app/users/index.ts", 32 "app/shared/search/search.model.ts",
31 "app/users/login/index.ts", 33 "app/shared/users/auth-status.model.ts",
32 "app/users/login/login.component.ts", 34 "app/shared/users/auth.service.ts",
33 "app/users/shared/auth-status.model.ts", 35 "app/shared/users/index.ts",
34 "app/users/shared/auth.service.ts", 36 "app/shared/users/token.model.ts",
35 "app/users/shared/index.ts", 37 "app/shared/users/user.model.ts",
36 "app/users/shared/token.model.ts",
37 "app/users/shared/user.model.ts",
38 "app/videos/index.ts", 38 "app/videos/index.ts",
39 "app/videos/shared/index.ts", 39 "app/videos/shared/index.ts",
40 "app/videos/shared/loader/index.ts", 40 "app/videos/shared/loader/index.ts",