diff options
Diffstat (limited to 'client/src')
21 files changed, 80 insertions, 63 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'; |
diff --git a/client/src/custom-typings.d.ts b/client/src/custom-typings.d.ts index 95787181f..7cb57b62b 100644 --- a/client/src/custom-typings.d.ts +++ b/client/src/custom-typings.d.ts | |||
@@ -46,6 +46,16 @@ import * as _ from 'lodash' | |||
46 | // support NodeJS modules without type definitions | 46 | // support NodeJS modules without type definitions |
47 | declare module '*'; | 47 | declare module '*'; |
48 | 48 | ||
49 | /* | ||
50 | // for legacy tslint etc to understand rename 'modern-lru' with your package | ||
51 | // then comment out `declare module '*';`. For each new module copy/paste | ||
52 | // this method of creating an `any` module type definition | ||
53 | declare module 'modern-lru' { | ||
54 | let x: any; | ||
55 | export = x; | ||
56 | } | ||
57 | */ | ||
58 | |||
49 | // Extra variables that live on Global that will be replaced by webpack DefinePlugin | 59 | // Extra variables that live on Global that will be replaced by webpack DefinePlugin |
50 | declare var ENV: string; | 60 | declare var ENV: string; |
51 | declare var HMR: boolean; | 61 | declare var HMR: boolean; |
@@ -56,8 +66,8 @@ interface SystemJS { | |||
56 | } | 66 | } |
57 | 67 | ||
58 | interface GlobalEnvironment { | 68 | interface GlobalEnvironment { |
59 | ENV; | 69 | ENV: string; |
60 | HMR; | 70 | HMR: boolean; |
61 | SystemJS: SystemJS; | 71 | SystemJS: SystemJS; |
62 | System: SystemJS; | 72 | System: SystemJS; |
63 | } | 73 | } |
@@ -76,7 +86,6 @@ type AsyncRoutes = { | |||
76 | FactoryPromise | 86 | FactoryPromise |
77 | }; | 87 | }; |
78 | 88 | ||
79 | |||
80 | type IdleCallbacks = Es6PromiseLoader | | 89 | type IdleCallbacks = Es6PromiseLoader | |
81 | Function | | 90 | Function | |
82 | FactoryEs6PromiseLoader | | 91 | FactoryEs6PromiseLoader | |
@@ -98,7 +107,6 @@ interface WebpackModule { | |||
98 | }; | 107 | }; |
99 | } | 108 | } |
100 | 109 | ||
101 | |||
102 | interface WebpackRequire { | 110 | interface WebpackRequire { |
103 | (id: string): any; | 111 | (id: string): any; |
104 | (paths: string[], callback: (...modules: any[]) => void): void; | 112 | (paths: string[], callback: (...modules: any[]) => void): void; |
@@ -114,7 +122,6 @@ interface ErrorStackTraceLimit { | |||
114 | stackTraceLimit: number; | 122 | stackTraceLimit: number; |
115 | } | 123 | } |
116 | 124 | ||
117 | |||
118 | // Extend typings | 125 | // Extend typings |
119 | interface NodeRequire extends WebpackRequire {} | 126 | interface NodeRequire extends WebpackRequire {} |
120 | interface ErrorConstructor extends ErrorStackTraceLimit {} | 127 | interface ErrorConstructor extends ErrorStackTraceLimit {} |
diff --git a/client/src/main.browser.aot.ts b/client/src/main.browser.aot.ts new file mode 100644 index 000000000..29ecf7349 --- /dev/null +++ b/client/src/main.browser.aot.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | import { platformBrowser } from '@angular/platform-browser'; | ||
2 | import { decorateModuleRef } from './app/environment'; | ||
3 | /* | ||
4 | * App Module | ||
5 | * our top level module that holds all of our components | ||
6 | */ | ||
7 | import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory'; | ||
8 | |||
9 | /* | ||
10 | * Bootstrap our Angular app with a top level NgModule | ||
11 | */ | ||
12 | export function main(): Promise<any> { | ||
13 | return platformBrowser() | ||
14 | .bootstrapModuleFactory(AppModuleNgFactory) | ||
15 | .then(decorateModuleRef) | ||
16 | .catch((err) => console.error(err)); | ||
17 | } | ||
18 | |||
19 | export function bootstrapDomReady() { | ||
20 | document.addEventListener('DOMContentLoaded', main); | ||
21 | } | ||
22 | |||
23 | bootstrapDomReady(); | ||
diff --git a/client/src/main.ts b/client/src/main.browser.ts index 70bf48537..70bf48537 100644 --- a/client/src/main.ts +++ b/client/src/main.browser.ts | |||
diff --git a/client/src/polyfills.ts b/client/src/polyfills.browser.ts index 65e211459..65e211459 100644 --- a/client/src/polyfills.ts +++ b/client/src/polyfills.browser.ts | |||
diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss index cdb486557..30588067f 100644 --- a/client/src/sass/application.scss +++ b/client/src/sass/application.scss | |||
@@ -1,4 +1,4 @@ | |||
1 | @import '../video.js/dist/video-js.css'; | 1 | @import '../../node_modules/video.js/dist/video-js.css'; |
2 | 2 | ||
3 | body { | 3 | body { |
4 | padding: 20px; | 4 | padding: 20px; |
diff --git a/client/src/vendor.ts b/client/src/vendor.ts deleted file mode 100644 index 436c58f48..000000000 --- a/client/src/vendor.ts +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | // For vendors for example jQuery, Lodash, angular2-jwt just import them here unless you plan on | ||
2 | // chunking vendors files for async loading. You would need to import the async loaded vendors | ||
3 | // at the entry point of the async loaded file. Also see custom-typings.d.ts as you also need to | ||
4 | // run `typings install x` where `x` is your module | ||
5 | |||
6 | // Angular 2 | ||
7 | import '@angular/platform-browser'; | ||
8 | import '@angular/platform-browser-dynamic'; | ||
9 | import '@angular/core'; | ||
10 | import '@angular/common'; | ||
11 | import '@angular/forms'; | ||
12 | import '@angular/http'; | ||
13 | import '@angular/router'; | ||
14 | |||
15 | import '@angularclass/hmr'; | ||
16 | |||
17 | // RxJS | ||
18 | import 'rxjs/Observable'; | ||
19 | import 'rxjs/Subject'; | ||
20 | import 'rxjs/ReplaySubject'; | ||
21 | import 'rxjs/add/operator/catch'; | ||
22 | import 'rxjs/add/operator/mergeMap'; | ||
23 | import 'rxjs/add/operator/map'; | ||
24 | import 'rxjs/add/observable/throw'; | ||
25 | |||
26 | import 'bootstrap-loader'; | ||
27 | |||
28 | import 'angular-pipes/src/math/bytes.pipe'; | ||
29 | import 'ng2-file-upload'; | ||
30 | import 'video.js'; | ||
31 | import 'ng2-meta'; | ||
32 | import 'ng2-bootstrap/pagination'; | ||
33 | import 'ng2-bootstrap/dropdown'; | ||
34 | import 'ng2-bootstrap/progressbar'; | ||
35 | import 'ng2-bootstrap/modal'; | ||