Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add authentication tokens to make friends/quit friends

Chocobozzza840d396093e
diff --git a/client/app/app.component.ts b/client/app/app.component.ts
index d29448296c..94924a47ab 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 bdfa7baeca..d3684f08db 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/users/login/index.ts b/client/app/login/index.ts
similarity index 100%
rename from client/app/users/login/index.ts
rename to client/app/login/index.ts
diff --git a/client/app/users/login/login.component.html b/client/app/login/login.component.html
similarity index 100%
rename from client/app/users/login/login.component.html
rename to client/app/login/login.component.html
diff --git a/client/app/users/login/login.component.ts b/client/app/login/login.component.ts
similarity index 80%
rename from client/app/users/login/login.component.ts
rename to client/app/login/login.component.ts
index 09c5f1af70..50f598d926 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';
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'
+ selector: 'my-login',
+ templateUrl: 'client/app/login/login.component.html'
})
-export class UserLoginComponent {
+export class LoginComponent {
constructor(
private authService: AuthService,
private router: Router
diff --git a/client/app/shared/index.ts b/client/app/shared/index.ts
index a49a4f1a95..ad3ee00981 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/index.ts b/client/app/shared/search/index.ts
new file mode 100644
index 0000000000..a49a4f1a95
--- /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-field.type.ts b/client/app/shared/search/search-field.type.ts
similarity index 100%
rename from client/app/shared/search-field.type.ts
rename to 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
similarity index 100%
rename from client/app/shared/search.component.html
rename to client/app/shared/search/search.component.html
diff --git a/client/app/shared/search.component.ts b/client/app/shared/search/search.component.ts
similarity index 93%
rename from client/app/shared/search.component.ts
rename to client/app/shared/search/search.component.ts
index e1e30b9af0..d541cd0d60 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';
@Component({
selector: 'my-search',
- templateUrl: 'client/app/shared/search.component.html',
+ templateUrl: 'client/app/shared/search/search.component.html',
directives: [ DROPDOWN_DIRECTIVES ]
})
diff --git a/client/app/shared/search.model.ts b/client/app/shared/search/search.model.ts
similarity index 100%
rename from client/app/shared/search.model.ts
rename to 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
similarity index 100%
rename from client/app/users/shared/auth-status.model.ts
rename to 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
similarity index 100%
rename from client/app/users/shared/auth.service.ts
rename to client/app/shared/users/auth.service.ts
diff --git a/client/app/users/shared/index.ts b/client/app/shared/users/index.ts
similarity index 100%
rename from client/app/users/shared/index.ts
rename to client/app/shared/users/index.ts
diff --git a/client/app/users/shared/token.model.ts b/client/app/shared/users/token.model.ts
similarity index 100%
rename from client/app/users/shared/token.model.ts
rename to 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
similarity index 100%
rename from client/app/users/shared/user.model.ts
rename to 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 4f08b8bc7e..0000000000
--- 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/login.component.scss b/client/app/users/login/login.component.scss
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/client/app/videos/shared/video.service.ts b/client/app/videos/shared/video.service.ts
index 7b6519f007..a786b2ab26 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 619a4f4d86..e17b1b0f6b 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 6322860be8..baca00deb1 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 3baa1ddd64..11b828ca6a 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',
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 24583f6c3e..a8b8269a49 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -23,18 +23,18 @@
"app/app.component.ts",
"app/friends/friend.service.ts",
"app/friends/index.ts",
+ "app/login/index.ts",
+ "app/login/login.component.ts",
"app/shared/index.ts",
- "app/shared/search-field.type.ts",
- "app/shared/search.component.ts",
- "app/shared/search.model.ts",
- "app/users/index.ts",
- "app/users/login/index.ts",
- "app/users/login/login.component.ts",
- "app/users/shared/auth-status.model.ts",
- "app/users/shared/auth.service.ts",
- "app/users/shared/index.ts",
- "app/users/shared/token.model.ts",
- "app/users/shared/user.model.ts",
+ "app/shared/search/index.ts",
+ "app/shared/search/search-field.type.ts",
+ "app/shared/search/search.component.ts",
+ "app/shared/search/search.model.ts",
+ "app/shared/users/auth-status.model.ts",
+ "app/shared/users/auth.service.ts",
+ "app/shared/users/index.ts",
+ "app/shared/users/token.model.ts",
+ "app/shared/users/user.model.ts",
"app/videos/index.ts",
"app/videos/shared/index.ts",
"app/videos/shared/loader/index.ts",