aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-13 12:16:00 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-13 12:16:00 +0100
commitc16ce1de8e8c21ad2136335d3b0b7d230e6d2f24 (patch)
treee5177a26dae755833122c4ef73744c2a7f9b53fc /client/src/app
parent80deae8d198f6a376b477d780e76966f8fbb72ce (diff)
downloadPeerTube-c16ce1de8e8c21ad2136335d3b0b7d230e6d2f24.tar.gz
PeerTube-c16ce1de8e8c21ad2136335d3b0b7d230e6d2f24.tar.zst
PeerTube-c16ce1de8e8c21ad2136335d3b0b7d230e6d2f24.zip
Client: add basic aot support
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/account/account.service.ts2
-rw-r--r--client/src/app/admin/friends/shared/friend.service.ts2
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.ts1
-rw-r--r--client/src/app/admin/requests/shared/request.service.ts2
-rw-r--r--client/src/app/admin/users/shared/user.service.ts2
-rw-r--r--client/src/app/app.component.ts2
-rw-r--r--client/src/app/app.module.ts3
-rw-r--r--client/src/app/app.service.ts20
-rw-r--r--client/src/app/core/auth/auth.service.ts2
-rw-r--r--client/src/app/environment.ts13
-rw-r--r--client/src/app/shared/auth/auth-http.service.ts8
-rw-r--r--client/src/app/videos/shared/video.service.ts2
-rw-r--r--client/src/app/videos/video-watch/video-magnet.component.html2
-rw-r--r--client/src/app/videos/video-watch/video-share.component.html2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts3
15 files changed, 44 insertions, 22 deletions
diff --git a/client/src/app/account/account.service.ts b/client/src/app/account/account.service.ts
index 0635c2533..046690347 100644
--- a/client/src/app/account/account.service.ts
+++ b/client/src/app/account/account.service.ts
@@ -1,4 +1,6 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import 'rxjs/add/operator/catch';
3import 'rxjs/add/operator/map';
2 4
3import { AuthService } from '../core'; 5import { AuthService } from '../core';
4import { AuthHttp, RestExtractor } from '../shared'; 6import { AuthHttp, RestExtractor } from '../shared';
diff --git a/client/src/app/admin/friends/shared/friend.service.ts b/client/src/app/admin/friends/shared/friend.service.ts
index 85ac04ba0..e97459385 100644
--- a/client/src/app/admin/friends/shared/friend.service.ts
+++ b/client/src/app/admin/friends/shared/friend.service.ts
@@ -1,5 +1,7 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Observable } from 'rxjs/Observable'; 2import { Observable } from 'rxjs/Observable';
3import 'rxjs/add/operator/catch';
4import 'rxjs/add/operator/map';
3 5
4import { Friend } from './friend.model'; 6import { Friend } from './friend.model';
5import { AuthHttp, RestExtractor, ResultList } from '../../../shared'; 7import { AuthHttp, RestExtractor, ResultList } from '../../../shared';
diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.ts b/client/src/app/admin/requests/request-stats/request-stats.component.ts
index 9e2af219c..66075e4b5 100644
--- a/client/src/app/admin/requests/request-stats/request-stats.component.ts
+++ b/client/src/app/admin/requests/request-stats/request-stats.component.ts
@@ -1,3 +1,4 @@
1import { setInterval } from 'timers'
1import { Component, OnInit, OnDestroy } from '@angular/core'; 2import { Component, OnInit, OnDestroy } from '@angular/core';
2 3
3import { RequestService, RequestStats } from '../shared'; 4import { RequestService, RequestStats } from '../shared';
diff --git a/client/src/app/admin/requests/shared/request.service.ts b/client/src/app/admin/requests/shared/request.service.ts
index aeec37448..55b28bcfc 100644
--- a/client/src/app/admin/requests/shared/request.service.ts
+++ b/client/src/app/admin/requests/shared/request.service.ts
@@ -1,5 +1,7 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Observable } from 'rxjs/Observable'; 2import { Observable } from 'rxjs/Observable';
3import 'rxjs/add/operator/catch';
4import 'rxjs/add/operator/map';
3 5
4import { RequestStats } from './request-stats.model'; 6import { RequestStats } from './request-stats.model';
5import { AuthHttp, RestExtractor } from '../../../shared'; 7import { AuthHttp, RestExtractor } from '../../../shared';
diff --git a/client/src/app/admin/users/shared/user.service.ts b/client/src/app/admin/users/shared/user.service.ts
index 13be553c0..d9005b213 100644
--- a/client/src/app/admin/users/shared/user.service.ts
+++ b/client/src/app/admin/users/shared/user.service.ts
@@ -1,4 +1,6 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import 'rxjs/add/operator/catch';
3import 'rxjs/add/operator/map';
2 4
3import { AuthHttp, RestExtractor, ResultList, User } from '../../../shared'; 5import { AuthHttp, RestExtractor, ResultList, User } from '../../../shared';
4 6
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index ce4fc04ff..3f2f1ace0 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,7 +1,7 @@
1import { Component, ViewContainerRef } from '@angular/core'; 1import { Component, ViewContainerRef } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { MetaService } from 'ng2-meta'; 4import { MetaService } from 'ng2-meta/src';
5@Component({ 5@Component({
6 selector: 'my-app', 6 selector: 'my-app',
7 templateUrl: './app.component.html', 7 templateUrl: './app.component.html',
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index e9bb800f4..fb71787c4 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -2,7 +2,8 @@ import { ApplicationRef, NgModule } from '@angular/core';
2import { BrowserModule } from '@angular/platform-browser'; 2import { BrowserModule } from '@angular/platform-browser';
3import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; 3import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
4 4
5import { MetaModule, MetaConfig } from 'ng2-meta'; 5import { MetaModule, MetaConfig } from 'ng2-meta/src';
6import 'bootstrap-loader';
6 7
7import { ENV_PROVIDERS } from './environment'; 8import { ENV_PROVIDERS } from './environment';
8import { AppRoutingModule } from './app-routing.module'; 9import { AppRoutingModule } from './app-routing.module';
diff --git a/client/src/app/app.service.ts b/client/src/app/app.service.ts
index 033c21900..9b582e472 100644
--- a/client/src/app/app.service.ts
+++ b/client/src/app/app.service.ts
@@ -1,35 +1,35 @@
1
2import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
3 2
3export type InternalStateType = {
4 [key: string]: any
5};
6
4@Injectable() 7@Injectable()
5export class AppState { 8export class AppState {
6 _state = { };
7 9
8 constructor() { ; } 10 public _state: InternalStateType = { };
9 11
10 // already return a clone of the current state 12 // already return a clone of the current state
11 get state() { 13 public get state() {
12 return this._state = this._clone(this._state); 14 return this._state = this._clone(this._state);
13 } 15 }
14 // never allow mutation 16 // never allow mutation
15 set state(value) { 17 public set state(value) {
16 throw new Error('do not mutate the `.state` directly'); 18 throw new Error('do not mutate the `.state` directly');
17 } 19 }
18 20
19 21 public get(prop?: any) {
20 get(prop?: any) {
21 // use our state getter for the clone 22 // use our state getter for the clone
22 const state = this.state; 23 const state = this.state;
23 return state.hasOwnProperty(prop) ? state[prop] : state; 24 return state.hasOwnProperty(prop) ? state[prop] : state;
24 } 25 }
25 26
26 set(prop: string, value: any) { 27 public set(prop: string, value: any) {
27 // internally mutate our state 28 // internally mutate our state
28 return this._state[prop] = value; 29 return this._state[prop] = value;
29 } 30 }
30 31
31 32 private _clone(object: InternalStateType) {
32 _clone(object) {
33 // simple object clone 33 // simple object clone
34 return JSON.parse(JSON.stringify( object )); 34 return JSON.parse(JSON.stringify( object ));
35 } 35 }
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 1f0e322a9..bc276ed99 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -3,6 +3,8 @@ import { Headers, Http, Response, URLSearchParams } from '@angular/http';
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
4import { Observable } from 'rxjs/Observable'; 4import { Observable } from 'rxjs/Observable';
5import { Subject } from 'rxjs/Subject'; 5import { Subject } from 'rxjs/Subject';
6import 'rxjs/add/operator/map';
7import 'rxjs/add/operator/mergeMap';
6 8
7// Do not use the barrel (dependency loop) 9// Do not use the barrel (dependency loop)
8import { AuthStatus } from '../../shared/auth/auth-status.model'; 10import { AuthStatus } from '../../shared/auth/auth-status.model';
diff --git a/client/src/app/environment.ts b/client/src/app/environment.ts
index 8bba89c4e..929e09490 100644
--- a/client/src/app/environment.ts
+++ b/client/src/app/environment.ts
@@ -4,19 +4,24 @@
4import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; 4import { enableDebugTools, disableDebugTools } from '@angular/platform-browser';
5import { enableProdMode, ApplicationRef } from '@angular/core'; 5import { enableProdMode, ApplicationRef } from '@angular/core';
6// Environment Providers 6// Environment Providers
7let PROVIDERS = [ 7let PROVIDERS: any[] = [
8 // common env directives 8 // common env directives
9]; 9];
10 10
11// Angular debug tools in the dev console 11// Angular debug tools in the dev console
12// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md 12// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
13let _decorateModuleRef = function identity(value) { return value; }; 13let _decorateModuleRef = function identity<T>(value: T): T { return value; };
14 14
15if ('production' === ENV) { 15if ('production' === ENV) {
16 // Production
17 disableDebugTools();
18 enableProdMode(); 16 enableProdMode();
19 17
18 // Production
19 _decorateModuleRef = (modRef: any) => {
20 disableDebugTools();
21
22 return modRef;
23 };
24
20 PROVIDERS = [ 25 PROVIDERS = [
21 ...PROVIDERS, 26 ...PROVIDERS,
22 // custom providers in production 27 // custom providers in production
diff --git a/client/src/app/shared/auth/auth-http.service.ts b/client/src/app/shared/auth/auth-http.service.ts
index 602726570..c4114aa02 100644
--- a/client/src/app/shared/auth/auth-http.service.ts
+++ b/client/src/app/shared/auth/auth-http.service.ts
@@ -80,12 +80,14 @@ export class AuthHttp extends Http {
80 } 80 }
81} 81}
82 82
83export function useFactory(backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) {
84 return new AuthHttp(backend, defaultOptions, authService);
85}
86
83export const AUTH_HTTP_PROVIDERS = [ 87export const AUTH_HTTP_PROVIDERS = [
84 { 88 {
85 provide: AuthHttp, 89 provide: AuthHttp,
86 useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => { 90 useFactory,
87 return new AuthHttp(backend, defaultOptions, authService);
88 },
89 deps: [ XHRBackend, RequestOptions, AuthService ] 91 deps: [ XHRBackend, RequestOptions, AuthService ]
90 }, 92 },
91]; 93];
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts
index f173ef06b..9d79b2f5e 100644
--- a/client/src/app/videos/shared/video.service.ts
+++ b/client/src/app/videos/shared/video.service.ts
@@ -1,6 +1,8 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Http } from '@angular/http'; 2import { Http } from '@angular/http';
3import { Observable } from 'rxjs/Observable'; 3import { Observable } from 'rxjs/Observable';
4import 'rxjs/add/operator/catch';
5import 'rxjs/add/operator/map';
4 6
5import { Search } from '../../shared'; 7import { Search } from '../../shared';
6import { SortField } from './sort-field.type'; 8import { SortField } from './sort-field.type';
diff --git a/client/src/app/videos/video-watch/video-magnet.component.html b/client/src/app/videos/video-watch/video-magnet.component.html
index 9108c7258..3fa82f1be 100644
--- a/client/src/app/videos/video-watch/video-magnet.component.html
+++ b/client/src/app/videos/video-watch/video-magnet.component.html
@@ -3,7 +3,7 @@
3 <div class="modal-content modal-lg"> 3 <div class="modal-content modal-lg">
4 4
5 <div class="modal-header"> 5 <div class="modal-header">
6 <button type="button" class="close" aria-label="Close" (click)="hideModal()"> 6 <button type="button" class="close" aria-label="Close" (click)="hide()">
7 <span aria-hidden="true">&times;</span> 7 <span aria-hidden="true">&times;</span>
8 </button> 8 </button>
9 <h4 class="modal-title">Magnet Uri</h4> 9 <h4 class="modal-title">Magnet Uri</h4>
diff --git a/client/src/app/videos/video-watch/video-share.component.html b/client/src/app/videos/video-watch/video-share.component.html
index 1c2fac1d7..88f59c063 100644
--- a/client/src/app/videos/video-watch/video-share.component.html
+++ b/client/src/app/videos/video-watch/video-share.component.html
@@ -3,7 +3,7 @@
3 <div class="modal-content"> 3 <div class="modal-content">
4 4
5 <div class="modal-header"> 5 <div class="modal-header">
6 <button type="button" class="close" aria-label="Close" (click)="hideModal()"> 6 <button type="button" class="close" aria-label="Close" (click)="hide()">
7 <span aria-hidden="true">&times;</span> 7 <span aria-hidden="true">&times;</span>
8 </button> 8 </button>
9 <h4 class="modal-title">Share</h4> 9 <h4 class="modal-title">Share</h4>
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index afc6fe01c..14aae9895 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,7 +1,8 @@
1import { setInterval, setTimeout } from 'timers'
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; 2import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 3import { ActivatedRoute } from '@angular/router';
3 4
4import { MetaService } from 'ng2-meta'; 5import { MetaService } from 'ng2-meta/src';
5import * as videojs from 'video.js'; 6import * as videojs from 'video.js';
6 7
7import { VideoMagnetComponent } from './video-magnet.component'; 8import { VideoMagnetComponent } from './video-magnet.component';