diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-13 12:16:00 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-13 12:16:00 +0100 |
commit | c16ce1de8e8c21ad2136335d3b0b7d230e6d2f24 (patch) | |
tree | e5177a26dae755833122c4ef73744c2a7f9b53fc /client/src/app | |
parent | 80deae8d198f6a376b477d780e76966f8fbb72ce (diff) | |
download | PeerTube-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.ts | 2 | ||||
-rw-r--r-- | client/src/app/admin/friends/shared/friend.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/admin/requests/request-stats/request-stats.component.ts | 1 | ||||
-rw-r--r-- | client/src/app/admin/requests/shared/request.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/admin/users/shared/user.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/app.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/app.module.ts | 3 | ||||
-rw-r--r-- | client/src/app/app.service.ts | 20 | ||||
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/environment.ts | 13 | ||||
-rw-r--r-- | client/src/app/shared/auth/auth-http.service.ts | 8 | ||||
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-magnet.component.html | 2 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-share.component.html | 2 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.ts | 3 |
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 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import 'rxjs/add/operator/catch'; | ||
3 | import 'rxjs/add/operator/map'; | ||
2 | 4 | ||
3 | import { AuthService } from '../core'; | 5 | import { AuthService } from '../core'; |
4 | import { AuthHttp, RestExtractor } from '../shared'; | 6 | import { 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 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { Observable } from 'rxjs/Observable'; | 2 | import { Observable } from 'rxjs/Observable'; |
3 | import 'rxjs/add/operator/catch'; | ||
4 | import 'rxjs/add/operator/map'; | ||
3 | 5 | ||
4 | import { Friend } from './friend.model'; | 6 | import { Friend } from './friend.model'; |
5 | import { AuthHttp, RestExtractor, ResultList } from '../../../shared'; | 7 | import { 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 @@ | |||
1 | import { setInterval } from 'timers' | ||
1 | import { Component, OnInit, OnDestroy } from '@angular/core'; | 2 | import { Component, OnInit, OnDestroy } from '@angular/core'; |
2 | 3 | ||
3 | import { RequestService, RequestStats } from '../shared'; | 4 | import { 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 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { Observable } from 'rxjs/Observable'; | 2 | import { Observable } from 'rxjs/Observable'; |
3 | import 'rxjs/add/operator/catch'; | ||
4 | import 'rxjs/add/operator/map'; | ||
3 | 5 | ||
4 | import { RequestStats } from './request-stats.model'; | 6 | import { RequestStats } from './request-stats.model'; |
5 | import { AuthHttp, RestExtractor } from '../../../shared'; | 7 | import { 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 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import 'rxjs/add/operator/catch'; | ||
3 | import 'rxjs/add/operator/map'; | ||
2 | 4 | ||
3 | import { AuthHttp, RestExtractor, ResultList, User } from '../../../shared'; | 5 | import { 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 @@ | |||
1 | import { Component, ViewContainerRef } from '@angular/core'; | 1 | import { Component, ViewContainerRef } from '@angular/core'; |
2 | import { Router } from '@angular/router'; | 2 | import { Router } from '@angular/router'; |
3 | 3 | ||
4 | import { MetaService } from 'ng2-meta'; | 4 | import { 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'; | |||
2 | import { BrowserModule } from '@angular/platform-browser'; | 2 | import { BrowserModule } from '@angular/platform-browser'; |
3 | import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; | 3 | import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; |
4 | 4 | ||
5 | import { MetaModule, MetaConfig } from 'ng2-meta'; | 5 | import { MetaModule, MetaConfig } from 'ng2-meta/src'; |
6 | import 'bootstrap-loader'; | ||
6 | 7 | ||
7 | import { ENV_PROVIDERS } from './environment'; | 8 | import { ENV_PROVIDERS } from './environment'; |
8 | import { AppRoutingModule } from './app-routing.module'; | 9 | import { 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 | |||
2 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
3 | 2 | ||
3 | export type InternalStateType = { | ||
4 | [key: string]: any | ||
5 | }; | ||
6 | |||
4 | @Injectable() | 7 | @Injectable() |
5 | export class AppState { | 8 | export 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'; | |||
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | import { Observable } from 'rxjs/Observable'; | 4 | import { Observable } from 'rxjs/Observable'; |
5 | import { Subject } from 'rxjs/Subject'; | 5 | import { Subject } from 'rxjs/Subject'; |
6 | import 'rxjs/add/operator/map'; | ||
7 | import 'rxjs/add/operator/mergeMap'; | ||
6 | 8 | ||
7 | // Do not use the barrel (dependency loop) | 9 | // Do not use the barrel (dependency loop) |
8 | import { AuthStatus } from '../../shared/auth/auth-status.model'; | 10 | import { 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 @@ | |||
4 | import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; | 4 | import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; |
5 | import { enableProdMode, ApplicationRef } from '@angular/core'; | 5 | import { enableProdMode, ApplicationRef } from '@angular/core'; |
6 | // Environment Providers | 6 | // Environment Providers |
7 | let PROVIDERS = [ | 7 | let 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 |
13 | let _decorateModuleRef = function identity(value) { return value; }; | 13 | let _decorateModuleRef = function identity<T>(value: T): T { return value; }; |
14 | 14 | ||
15 | if ('production' === ENV) { | 15 | if ('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 | ||
83 | export function useFactory(backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) { | ||
84 | return new AuthHttp(backend, defaultOptions, authService); | ||
85 | } | ||
86 | |||
83 | export const AUTH_HTTP_PROVIDERS = [ | 87 | export 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 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { Http } from '@angular/http'; | 2 | import { Http } from '@angular/http'; |
3 | import { Observable } from 'rxjs/Observable'; | 3 | import { Observable } from 'rxjs/Observable'; |
4 | import 'rxjs/add/operator/catch'; | ||
5 | import 'rxjs/add/operator/map'; | ||
4 | 6 | ||
5 | import { Search } from '../../shared'; | 7 | import { Search } from '../../shared'; |
6 | import { SortField } from './sort-field.type'; | 8 | import { 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">×</span> | 7 | <span aria-hidden="true">×</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">×</span> | 7 | <span aria-hidden="true">×</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 @@ | |||
1 | import { setInterval, setTimeout } from 'timers' | ||
1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; | 2 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
2 | import { ActivatedRoute } from '@angular/router'; | 3 | import { ActivatedRoute } from '@angular/router'; |
3 | 4 | ||
4 | import { MetaService } from 'ng2-meta'; | 5 | import { MetaService } from 'ng2-meta/src'; |
5 | import * as videojs from 'video.js'; | 6 | import * as videojs from 'video.js'; |
6 | 7 | ||
7 | import { VideoMagnetComponent } from './video-magnet.component'; | 8 | import { VideoMagnetComponent } from './video-magnet.component'; |