mirror of https://github.com/Chocobozzz/PeerTube
Client: split in angular modules
parent
2c8d4697db
commit
693b1aba46
|
@ -34,7 +34,7 @@
|
||||||
"@types/uglify-js": "^2.0.27",
|
"@types/uglify-js": "^2.0.27",
|
||||||
"@types/videojs": "0.0.30",
|
"@types/videojs": "0.0.30",
|
||||||
"@types/webpack": "^1.12.29",
|
"@types/webpack": "^1.12.29",
|
||||||
"angular-pipes": "^4.0.0",
|
"angular-pipes": "^5.0.0",
|
||||||
"angular2-template-loader": "^0.6.0",
|
"angular2-template-loader": "^0.6.0",
|
||||||
"assets-webpack-plugin": "^3.4.0",
|
"assets-webpack-plugin": "^3.4.0",
|
||||||
"awesome-typescript-loader": "^2.2.1",
|
"awesome-typescript-loader": "^2.2.1",
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"ng2-bootstrap": "1.1.16",
|
"ng2-bootstrap": "1.1.16",
|
||||||
"ng2-file-upload": "^1.1.0",
|
"ng2-file-upload": "^1.1.0",
|
||||||
"ng2-meta": "github:chocobozzz/ng2-meta",
|
"ng2-meta": "^2.0.0",
|
||||||
"node-sass": "^3.10.0",
|
"node-sass": "^3.10.0",
|
||||||
"normalize.css": "^5.0.0",
|
"normalize.css": "^5.0.0",
|
||||||
"raw-loader": "^0.5.1",
|
"raw-loader": "^0.5.1",
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
import { AccountComponent } from './account.component';
|
||||||
|
|
||||||
|
const accountRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'account',
|
||||||
|
component: AccountComponent,
|
||||||
|
data: {
|
||||||
|
meta: {
|
||||||
|
titleSuffix: ' - My account'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ RouterModule.forChild(accountRoutes) ],
|
||||||
|
exports: [ RouterModule ]
|
||||||
|
})
|
||||||
|
export class AccountRoutingModule {}
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { AccountRoutingModule } from './account-routing.module';
|
||||||
|
import { AccountComponent } from './account.component';
|
||||||
|
import { AccountService } from './account.service';
|
||||||
|
import { SharedModule } from '../shared';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
AccountRoutingModule,
|
||||||
|
SharedModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
AccountComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
AccountComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
providers: [
|
||||||
|
AccountService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AccountModule { }
|
|
@ -1,13 +0,0 @@
|
||||||
import { AccountComponent } from './account.component';
|
|
||||||
|
|
||||||
export const AccountRoutes = [
|
|
||||||
{
|
|
||||||
path: 'account',
|
|
||||||
component: AccountComponent,
|
|
||||||
data: {
|
|
||||||
meta: {
|
|
||||||
titleSuffix: ' - My account'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { AuthHttp, AuthService, RestExtractor } from '../shared';
|
import { AuthService } from '../core';
|
||||||
|
import { AuthHttp, RestExtractor } from '../shared';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AccountService {
|
export class AccountService {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
export * from './account-routing.module';
|
||||||
export * from './account.component';
|
export * from './account.component';
|
||||||
export * from './account.routes';
|
export * from './account.module';
|
||||||
export * from './account.service';
|
export * from './account.service';
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Routes } from '@angular/router';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { AdminComponent } from './admin.component';
|
import { AdminComponent } from './admin.component';
|
||||||
import { FriendsRoutes } from './friends';
|
import { FriendsRoutes } from './friends';
|
||||||
import { RequestsRoutes } from './requests';
|
import { RequestsRoutes } from './requests';
|
||||||
import { UsersRoutes } from './users';
|
import { UsersRoutes } from './users';
|
||||||
|
|
||||||
export const AdminRoutes: Routes = [
|
const adminRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: 'admin',
|
path: 'admin',
|
||||||
component: AdminComponent,
|
component: AdminComponent,
|
||||||
|
@ -21,3 +22,9 @@ export const AdminRoutes: Routes = [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ RouterModule.forChild(adminRoutes) ],
|
||||||
|
exports: [ RouterModule ]
|
||||||
|
})
|
||||||
|
export class AdminRoutingModule {}
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { AdminComponent } from './admin.component';
|
||||||
|
import { AdminRoutingModule } from './admin-routing.module';
|
||||||
|
import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends';
|
||||||
|
import { RequestsComponent, RequestStatsComponent, RequestService } from './requests';
|
||||||
|
import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users';
|
||||||
|
import { MenuAdminComponent } from './menu-admin.component';
|
||||||
|
import { SharedModule } from '../shared';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
AdminRoutingModule,
|
||||||
|
SharedModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
AdminComponent,
|
||||||
|
|
||||||
|
FriendsComponent,
|
||||||
|
FriendAddComponent,
|
||||||
|
FriendListComponent,
|
||||||
|
|
||||||
|
RequestsComponent,
|
||||||
|
RequestStatsComponent,
|
||||||
|
|
||||||
|
UsersComponent,
|
||||||
|
UserAddComponent,
|
||||||
|
UserListComponent,
|
||||||
|
|
||||||
|
MenuAdminComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
AdminComponent,
|
||||||
|
MenuAdminComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
providers: [
|
||||||
|
FriendService,
|
||||||
|
RequestService,
|
||||||
|
UserService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AdminModule { }
|
|
@ -1,6 +1,7 @@
|
||||||
export * from './friends';
|
export * from './friends';
|
||||||
export * from './requests';
|
export * from './requests';
|
||||||
export * from './users';
|
export * from './users';
|
||||||
|
export * from './admin-routing.module';
|
||||||
|
export * from './admin.module';
|
||||||
export * from './admin.component';
|
export * from './admin.component';
|
||||||
export * from './admin.routes';
|
|
||||||
export * from './menu-admin.component';
|
export * from './menu-admin.component';
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: '/videos/list',
|
||||||
|
pathMatch: 'full'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ RouterModule.forRoot(routes) ],
|
||||||
|
exports: [ RouterModule ]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule {}
|
||||||
|
|
|
@ -1,62 +1,22 @@
|
||||||
import { ApplicationRef, NgModule } from '@angular/core';
|
import { ApplicationRef, NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
||||||
import { HttpModule, RequestOptions, XHRBackend } from '@angular/http';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
|
import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
|
||||||
|
|
||||||
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
import { MetaModule, MetaConfig } from 'ng2-meta';
|
||||||
|
|
||||||
import { DropdownModule } from 'ng2-bootstrap/components/dropdown';
|
|
||||||
import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
|
|
||||||
import { PaginationModule } from 'ng2-bootstrap/components/pagination';
|
|
||||||
import { ModalModule } from 'ng2-bootstrap/components/modal';
|
|
||||||
|
|
||||||
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
|
|
||||||
|
|
||||||
import { MetaConfig, MetaModule } from 'ng2-meta';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Platform and Environment providers/directives/pipes
|
|
||||||
*/
|
|
||||||
import { ENV_PROVIDERS } from './environment';
|
import { ENV_PROVIDERS } from './environment';
|
||||||
import { routes } from './app.routes';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
// App is our top level component
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AppState } from './app.service';
|
import { AppState } from './app.service';
|
||||||
|
|
||||||
import {
|
import { AccountModule } from './account';
|
||||||
AdminComponent,
|
import { AdminModule } from './admin';
|
||||||
FriendsComponent,
|
import { CoreModule } from './core';
|
||||||
FriendAddComponent,
|
import { LoginModule } from './login';
|
||||||
FriendListComponent,
|
import { SharedModule } from './shared';
|
||||||
FriendService,
|
import { VideosModule } from './videos';
|
||||||
MenuAdminComponent,
|
|
||||||
RequestsComponent,
|
|
||||||
RequestStatsComponent,
|
|
||||||
RequestService,
|
|
||||||
UsersComponent,
|
|
||||||
UserAddComponent,
|
|
||||||
UserListComponent,
|
|
||||||
UserService
|
|
||||||
} from './admin';
|
|
||||||
import { AccountComponent, AccountService } from './account';
|
|
||||||
import { LoginComponent } from './login';
|
|
||||||
import { MenuComponent } from './menu.component';
|
import { MenuComponent } from './menu.component';
|
||||||
import { AuthService, AuthHttp, RestExtractor, RestService, SearchComponent, SearchService } from './shared';
|
|
||||||
import {
|
|
||||||
LoaderComponent,
|
|
||||||
VideosComponent,
|
|
||||||
VideoAddComponent,
|
|
||||||
VideoListComponent,
|
|
||||||
VideoMiniatureComponent,
|
|
||||||
VideoSortComponent,
|
|
||||||
VideoWatchComponent,
|
|
||||||
VideoShareComponent,
|
|
||||||
VideoMagnetComponent,
|
|
||||||
VideoService,
|
|
||||||
WebTorrentService
|
|
||||||
} from './videos';
|
|
||||||
|
|
||||||
const metaConfig: MetaConfig = {
|
const metaConfig: MetaConfig = {
|
||||||
//Append a title suffix such as a site name to all titles
|
//Append a title suffix such as a site name to all titles
|
||||||
|
@ -69,75 +29,31 @@ const metaConfig: MetaConfig = {
|
||||||
|
|
||||||
// Application wide providers
|
// Application wide providers
|
||||||
const APP_PROVIDERS = [
|
const APP_PROVIDERS = [
|
||||||
AppState,
|
AppState
|
||||||
|
|
||||||
{
|
|
||||||
provide: AuthHttp,
|
|
||||||
useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
|
|
||||||
return new AuthHttp(backend, defaultOptions, authService);
|
|
||||||
},
|
|
||||||
deps: [ XHRBackend, RequestOptions, AuthService ]
|
|
||||||
},
|
|
||||||
|
|
||||||
AuthService,
|
|
||||||
RestExtractor,
|
|
||||||
RestService,
|
|
||||||
|
|
||||||
VideoService,
|
|
||||||
SearchService,
|
|
||||||
FriendService,
|
|
||||||
RequestService,
|
|
||||||
UserService,
|
|
||||||
AccountService,
|
|
||||||
WebTorrentService
|
|
||||||
];
|
];
|
||||||
/**
|
|
||||||
* `AppModule` is the main entry point into Angular2's bootstraping process
|
|
||||||
*/
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
bootstrap: [ AppComponent ],
|
bootstrap: [ AppComponent ],
|
||||||
declarations: [
|
declarations: [
|
||||||
AccountComponent,
|
|
||||||
AdminComponent,
|
|
||||||
AppComponent,
|
AppComponent,
|
||||||
BytesPipe,
|
MenuComponent
|
||||||
FriendAddComponent,
|
|
||||||
FriendListComponent,
|
|
||||||
FriendsComponent,
|
|
||||||
LoaderComponent,
|
|
||||||
LoginComponent,
|
|
||||||
MenuAdminComponent,
|
|
||||||
MenuComponent,
|
|
||||||
RequestsComponent,
|
|
||||||
RequestStatsComponent,
|
|
||||||
SearchComponent,
|
|
||||||
UserAddComponent,
|
|
||||||
UserListComponent,
|
|
||||||
UsersComponent,
|
|
||||||
VideoAddComponent,
|
|
||||||
VideoListComponent,
|
|
||||||
VideoMiniatureComponent,
|
|
||||||
VideosComponent,
|
|
||||||
VideoSortComponent,
|
|
||||||
VideoWatchComponent,
|
|
||||||
VideoShareComponent,
|
|
||||||
VideoMagnetComponent
|
|
||||||
],
|
],
|
||||||
imports: [ // import Angular's modules
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
HttpModule,
|
|
||||||
RouterModule.forRoot(routes),
|
|
||||||
|
|
||||||
DropdownModule,
|
CoreModule,
|
||||||
ProgressbarModule,
|
SharedModule,
|
||||||
PaginationModule,
|
|
||||||
ModalModule,
|
|
||||||
|
|
||||||
FileUploadModule,
|
AppRoutingModule,
|
||||||
|
|
||||||
MetaModule.forRoot(metaConfig)
|
MetaModule.forRoot(metaConfig),
|
||||||
|
|
||||||
|
AccountModule,
|
||||||
|
AdminModule,
|
||||||
|
CoreModule,
|
||||||
|
LoginModule,
|
||||||
|
SharedModule,
|
||||||
|
VideosModule
|
||||||
],
|
],
|
||||||
providers: [ // expose our Services and Providers into Angular's dependency injection
|
providers: [ // expose our Services and Providers into Angular's dependency injection
|
||||||
ENV_PROVIDERS,
|
ENV_PROVIDERS,
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { Routes } from '@angular/router';
|
|
||||||
|
|
||||||
import { AccountRoutes } from './account';
|
|
||||||
import { LoginRoutes } from './login';
|
|
||||||
import { AdminRoutes } from './admin';
|
|
||||||
import { VideosRoutes } from './videos';
|
|
||||||
|
|
||||||
export const routes: Routes = [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
redirectTo: '/videos/list',
|
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
|
||||||
...AdminRoutes,
|
|
||||||
...AccountRoutes,
|
|
||||||
...LoginRoutes,
|
|
||||||
...VideosRoutes
|
|
||||||
];
|
|
|
@ -4,9 +4,10 @@ import { Router } from '@angular/router';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
|
|
||||||
import { AuthStatus } from './auth-status.model';
|
// Do not use the barrel (dependency loop)
|
||||||
import { AuthUser } from './auth-user.model';
|
import { AuthStatus } from '../../shared/auth/auth-status.model';
|
||||||
import { RestExtractor } from '../rest';
|
import { AuthUser } from '../../shared/auth/auth-user.model';
|
||||||
|
import { RestExtractor } from '../../shared/rest';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './auth.service'
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { HttpModule } from '@angular/http';
|
||||||
|
|
||||||
|
import { AuthService } from './auth';
|
||||||
|
import { throwIfAlreadyLoaded } from './module-import-guard';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
HttpModule
|
||||||
|
],
|
||||||
|
declarations: [ ],
|
||||||
|
exports: [ ],
|
||||||
|
providers: [ AuthService ]
|
||||||
|
})
|
||||||
|
export class CoreModule {
|
||||||
|
constructor( @Optional() @SkipSelf() parentModule: CoreModule) {
|
||||||
|
throwIfAlreadyLoaded(parentModule, 'CoreModule');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from './auth';
|
||||||
|
export * from './core.module'
|
|
@ -0,0 +1,5 @@
|
||||||
|
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) {
|
||||||
|
if (parentModule) {
|
||||||
|
throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +1,3 @@
|
||||||
|
export * from './login-routing.module';
|
||||||
export * from './login.component';
|
export * from './login.component';
|
||||||
export * from './login.routes';
|
export * from './login.module';
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
import { LoginComponent } from './login.component';
|
||||||
|
|
||||||
|
const loginRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'login',
|
||||||
|
component: LoginComponent,
|
||||||
|
data: {
|
||||||
|
meta: {
|
||||||
|
titleSuffix: ' - Login'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ RouterModule.forChild(loginRoutes) ],
|
||||||
|
exports: [ RouterModule ]
|
||||||
|
})
|
||||||
|
export class LoginRoutingModule {}
|
|
@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { AuthService, FormReactive } from '../shared';
|
import { AuthService } from '../core';
|
||||||
|
import { FormReactive } from '../shared';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-login',
|
selector: 'my-login',
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { LoginRoutingModule } from './login-routing.module';
|
||||||
|
import { LoginComponent } from './login.component';
|
||||||
|
import { SharedModule } from '../shared';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
LoginRoutingModule,
|
||||||
|
SharedModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
LoginComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
LoginComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
providers: [
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoginModule { }
|
|
@ -1,13 +0,0 @@
|
||||||
import { LoginComponent } from './login.component';
|
|
||||||
|
|
||||||
export const LoginRoutes = [
|
|
||||||
{
|
|
||||||
path: 'login',
|
|
||||||
component: LoginComponent,
|
|
||||||
data: {
|
|
||||||
meta: {
|
|
||||||
titleSuffix: ' - Login'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { AuthService, AuthStatus } from './shared';
|
import { AuthService } from './core';
|
||||||
|
import { AuthStatus } from './shared';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-menu',
|
selector: 'my-menu',
|
||||||
|
|
|
@ -7,11 +7,12 @@ import {
|
||||||
RequestMethod,
|
RequestMethod,
|
||||||
RequestOptions,
|
RequestOptions,
|
||||||
RequestOptionsArgs,
|
RequestOptionsArgs,
|
||||||
Response
|
Response,
|
||||||
|
XHRBackend
|
||||||
} from '@angular/http';
|
} from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from '../../core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthHttp extends Http {
|
export class AuthHttp extends Http {
|
||||||
|
@ -78,3 +79,13 @@ export class AuthHttp extends Http {
|
||||||
headers.set('Authorization', this.authService.getRequestHeaderValue());
|
headers.set('Authorization', this.authService.getRequestHeaderValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const AUTH_HTTP_PROVIDERS = [
|
||||||
|
{
|
||||||
|
provide: AuthHttp,
|
||||||
|
useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
|
||||||
|
return new AuthHttp(backend, defaultOptions, authService);
|
||||||
|
},
|
||||||
|
deps: [ XHRBackend, RequestOptions, AuthService ]
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
export * from './auth-http.service';
|
export * from './auth-http.service';
|
||||||
export * from './auth-status.model';
|
export * from './auth-status.model';
|
||||||
export * from './auth.service';
|
|
||||||
export * from './auth-user.model';
|
export * from './auth-user.model';
|
||||||
|
|
|
@ -3,3 +3,4 @@ export * from './forms';
|
||||||
export * from './rest';
|
export * from './rest';
|
||||||
export * from './search';
|
export * from './search';
|
||||||
export * from './users';
|
export * from './users';
|
||||||
|
export * from './shared.module';
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { HttpModule } from '@angular/http';
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
||||||
|
import { DropdownModule } from 'ng2-bootstrap/components/dropdown';
|
||||||
|
import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
|
||||||
|
import { PaginationModule } from 'ng2-bootstrap/components/pagination';
|
||||||
|
import { ModalModule } from 'ng2-bootstrap/components/modal';
|
||||||
|
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
|
||||||
|
|
||||||
|
import { AUTH_HTTP_PROVIDERS } from './auth';
|
||||||
|
import { RestExtractor, RestService } from './rest';
|
||||||
|
import { SearchComponent, SearchService } from './search';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpModule,
|
||||||
|
RouterModule,
|
||||||
|
|
||||||
|
DropdownModule,
|
||||||
|
FileUploadModule,
|
||||||
|
ModalModule,
|
||||||
|
PaginationModule,
|
||||||
|
ProgressbarModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
BytesPipe,
|
||||||
|
SearchComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpModule,
|
||||||
|
RouterModule,
|
||||||
|
|
||||||
|
DropdownModule,
|
||||||
|
FileUploadModule,
|
||||||
|
ModalModule,
|
||||||
|
PaginationModule,
|
||||||
|
ProgressbarModule,
|
||||||
|
BytesPipe,
|
||||||
|
|
||||||
|
SearchComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
providers: [
|
||||||
|
AUTH_HTTP_PROVIDERS,
|
||||||
|
RestExtractor,
|
||||||
|
RestService,
|
||||||
|
SearchService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SharedModule { }
|
|
@ -2,5 +2,6 @@ export * from './shared';
|
||||||
export * from './video-add';
|
export * from './video-add';
|
||||||
export * from './video-list';
|
export * from './video-list';
|
||||||
export * from './video-watch';
|
export * from './video-watch';
|
||||||
|
export * from './videos-routing.module';
|
||||||
export * from './videos.component';
|
export * from './videos.component';
|
||||||
export * from './videos.routes';
|
export * from './videos.module';
|
||||||
|
|
|
@ -4,7 +4,8 @@ import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import { Search } from '../../shared';
|
import { Search } from '../../shared';
|
||||||
import { SortField } from './sort-field.type';
|
import { SortField } from './sort-field.type';
|
||||||
import { AuthHttp, AuthService, RestExtractor, RestPagination, RestService, ResultList } from '../../shared';
|
import { AuthService } from '../../core';
|
||||||
|
import { AuthHttp, RestExtractor, RestPagination, RestService, ResultList } from '../../shared';
|
||||||
import { Video } from './video.model';
|
import { Video } from './video.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -4,7 +4,8 @@ import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
|
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
|
||||||
|
|
||||||
import { AuthService, FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared';
|
import { AuthService } from '../../core';
|
||||||
|
import { FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-videos-add',
|
selector: 'my-videos-add',
|
||||||
|
|
|
@ -7,7 +7,8 @@ import {
|
||||||
Video,
|
Video,
|
||||||
VideoService
|
VideoService
|
||||||
} from '../shared';
|
} from '../shared';
|
||||||
import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared';
|
import { AuthService } from '../../core';
|
||||||
|
import { AuthUser, RestPagination, Search, SearchField } from '../../shared';
|
||||||
import { SearchService } from '../../shared';
|
import { SearchService } from '../../shared';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Routes } from '@angular/router';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { VideoAddComponent } from './video-add';
|
import { VideoAddComponent } from './video-add';
|
||||||
import { VideoListComponent } from './video-list';
|
import { VideoListComponent } from './video-list';
|
||||||
import { VideosComponent } from './videos.component';
|
import { VideosComponent } from './videos.component';
|
||||||
import { VideoWatchComponent } from './video-watch';
|
import { VideoWatchComponent } from './video-watch';
|
||||||
|
|
||||||
export const VideosRoutes: Routes = [
|
const videosRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: 'videos',
|
path: 'videos',
|
||||||
component: VideosComponent,
|
component: VideosComponent,
|
||||||
|
@ -35,3 +36,9 @@ export const VideosRoutes: Routes = [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ RouterModule.forChild(videosRoutes) ],
|
||||||
|
exports: [ RouterModule ]
|
||||||
|
})
|
||||||
|
export class VideosRoutingModule {}
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { VideosRoutingModule } from './videos-routing.module';
|
||||||
|
import { VideosComponent } from './videos.component';
|
||||||
|
import { VideoAddComponent } from './video-add';
|
||||||
|
import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list';
|
||||||
|
import { VideoWatchComponent, VideoMagnetComponent, VideoShareComponent, WebTorrentService } from './video-watch';
|
||||||
|
import { LoaderComponent, VideoService } from './shared';
|
||||||
|
import { SharedModule } from '../shared';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
VideosRoutingModule,
|
||||||
|
SharedModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
VideosComponent,
|
||||||
|
|
||||||
|
VideoAddComponent,
|
||||||
|
|
||||||
|
VideoListComponent,
|
||||||
|
VideoMiniatureComponent,
|
||||||
|
VideoSortComponent,
|
||||||
|
|
||||||
|
VideoWatchComponent,
|
||||||
|
VideoMagnetComponent,
|
||||||
|
VideoShareComponent,
|
||||||
|
|
||||||
|
LoaderComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
VideosComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
providers: [
|
||||||
|
VideoService,
|
||||||
|
WebTorrentService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class VideosModule { }
|
Loading…
Reference in New Issue