ActivityPub-federated video streaming platform using P2P directly in your web browser
Update to Angular RC 1
Chocobozzz230809efa1e7
diff --git a/client/.gitignore b/client/.gitignoreindex 4bb21ebabb..24129f7c58 100644--- a/client/.gitignore+++ b/client/.gitignore@@ -1,5 +1,7 @@typings+!typings/typings.d.tsangular/**/*.jsangular/**/*.mapangular/**/*.cssstylesheets/index.css+bundlesdiff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.tsindex 83a4f33107..359d7128ee 100644--- a/client/angular/app/app.component.ts+++ b/client/angular/app/app.component.ts@@ -1,6 +1,6 @@-import { Component } from 'angular2/core';-import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router';-import { HTTP_PROVIDERS } from 'angular2/http';+import { Component } from '@angular/core';+import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';+import { HTTP_PROVIDERS } from '@angular/http';import { VideosAddComponent } from '../videos/components/add/videos-add.component';import { VideosListComponent } from '../videos/components/list/videos-list.component';diff --git a/client/angular/friends/services/friends.service.ts b/client/angular/friends/services/friends.service.tsindex 4eb1fc67b1..cb34323e44 100644--- a/client/angular/friends/services/friends.service.ts+++ b/client/angular/friends/services/friends.service.ts@@ -1,5 +1,5 @@-import { Injectable } from 'angular2/core';-import { Http, Response } from 'angular2/http';+import { Injectable } from '@angular/core';+import { Http, Response } from '@angular/http';import { Observable } from 'rxjs/Rx';@Injectable()diff --git a/client/angular/bootstrap.ts b/client/angular/main.tssimilarity index 54%rename from client/angular/bootstrap.tsrename to client/angular/main.tsindex d0f524f4a0..e35f7dbdf2 100644--- a/client/angular/bootstrap.ts+++ b/client/angular/main.ts@@ -1,4 +1,4 @@-import { bootstrap } from 'angular2/platform/browser';+import { bootstrap } from '@angular/platform-browser-dynamic';import { AppComponent } from './app/app.component';bootstrap(AppComponent);diff --git a/client/angular/users/components/login/login.component.ts b/client/angular/users/components/login/login.component.tsindex cecf5d2fd7..d339353ef6 100644--- a/client/angular/users/components/login/login.component.ts+++ b/client/angular/users/components/login/login.component.ts@@ -1,5 +1,5 @@-import { Component } from 'angular2/core';-import { Router } from 'angular2/router';+import { Component } from '@angular/core';+import { Router } from '@angular/router-deprecated';import { AuthService } from '../../services/auth.service';import { AuthStatus } from '../../models/authStatus';diff --git a/client/angular/users/services/auth.service.ts b/client/angular/users/services/auth.service.tsindex fc5048d8af..099563d43b 100644--- a/client/angular/users/services/auth.service.ts+++ b/client/angular/users/services/auth.service.ts@@ -1,5 +1,5 @@-import { Injectable } from 'angular2/core';-import { Http, Response, Headers, URLSearchParams, RequestOptions } from 'angular2/http';+import { Injectable } from '@angular/core';+import { Http, Response, Headers, URLSearchParams, RequestOptions } from '@angular/http';import { Observable, Subject } from 'rxjs/Rx';import { AuthStatus } from '../models/authStatus';diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.tsindex bc7b4057c4..f801cecbb1 100644--- a/client/angular/videos/components/add/videos-add.component.ts+++ b/client/angular/videos/components/add/videos-add.component.ts@@ -1,5 +1,5 @@-import { Component, ElementRef, OnInit } from 'angular2/core';-import { Router } from 'angular2/router';+import { Component, ElementRef, OnInit } from '@angular/core';+import { Router } from '@angular/router-deprecated';import { AuthService } from '../../../users/services/auth.service';import { User } from '../../../users/models/user';diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.tsindex b081522c7e..6ff0b2afb4 100644--- a/client/angular/videos/components/list/videos-list.component.ts+++ b/client/angular/videos/components/list/videos-list.component.ts@@ -1,5 +1,5 @@-import { Component, OnInit } from 'angular2/core';-import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router';+import { Component, OnInit } from '@angular/core';+import { ROUTER_DIRECTIVES, RouteParams } from '@angular/router-deprecated';import { AuthService } from '../../../users/services/auth.service';import { User } from '../../../users/models/user';diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.tsindex b996ad882a..6ac2787ed8 100644--- a/client/angular/videos/components/watch/videos-watch.component.ts+++ b/client/angular/videos/components/watch/videos-watch.component.ts@@ -1,6 +1,6 @@-import { Component, OnInit, ElementRef } from 'angular2/core';-import { RouteParams, CanDeactivate, ComponentInstruction } from 'angular2/router';-import { BytesPipe } from 'angular-pipes/math';+import { Component, OnInit, ElementRef } from '@angular/core';+import { RouteParams, CanDeactivate, ComponentInstruction } from '@angular/router-deprecated';+import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';// TODO import it with systemjsdeclare var WebTorrent: any;diff --git a/client/angular/videos/services/videos.service.ts b/client/angular/videos/services/videos.service.tsindex 74b6a1ddc4..d085483396 100644--- a/client/angular/videos/services/videos.service.ts+++ b/client/angular/videos/services/videos.service.ts@@ -1,5 +1,5 @@-import { Injectable } from 'angular2/core';-import { Http, Response } from 'angular2/http';+import { Injectable } from '@angular/core';+import { Http, Response } from '@angular/http';import { Observable } from 'rxjs/Rx';import { Video } from '../models/video';diff --git a/client/index.html b/client/index.htmlindex 49a448c2c3..c9bc7adb2f 100644--- a/client/index.html+++ b/client/index.html@@ -1,47 +1,34 @@<html><head>+ <base href="/">+<title>PeerTube</title>++ <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">+<link rel="stylesheet" href="/app/stylesheets/index.css"><!-- 1. Load libraries --><!-- IE required polyfills, in this exact order --><script src="/app/node_modules/es6-shim/es6-shim.min.js"></script>- <script src="/app/node_modules/systemjs/dist/system-polyfills.js"></script>- <script src="/app/node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>-- <script src="/app/node_modules/angular2/bundles/angular2-polyfills.js"></script>+ <script src="/app/node_modules/zone.js/dist/zone.js"></script>+ <script src="/app/node_modules/reflect-metadata/Reflect.js"></script><script src="/app/node_modules/systemjs/dist/system.src.js"></script>- <script src="/app/node_modules/rxjs/bundles/Rx.js"></script>- <script src="/app/node_modules/angular2/bundles/angular2.dev.js"></script>- <script src="/app/node_modules/angular2/bundles/router.dev.js"></script>- <script src="/app/node_modules/angular2/bundles/http.dev.js"></script>+<script src="/app/node_modules/jquery/dist/jquery.js"></script><script src="/app/node_modules/jquery.ui.widget/jquery.ui.widget.js"></script><script src="/app/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script>+<script src="/app/node_modules/webtorrent/webtorrent.min.js"></script>+ <!-- <script src="/app/angular/angular-rxjs.bundle.js"></script> --><!-- 2. Configure SystemJS -->+ <script src="/app/systemjs.config.js"></script><script>- System.config({- packages: {- '/app': {- components: {- format: 'register',- defaultExtension: 'js'- }- }- },- map: {- 'angular-pipes/math': '/app/node_modules/angular-pipes/math.js'- }- });- System.import('/app/angular/bootstrap')- .then(null, console.error.bind(console));+ System.import('app').catch(function(err){ console.error(err); });</script>-- <base href="/"></head><!-- 3. Display the application -->diff --git a/client/package.json b/client/package.jsonindex db93ac6811..5a103ceb77 100644--- a/client/package.json+++ b/client/package.json@@ -17,28 +17,42 @@"tsc:w": "tsc -w","typings": "typings","postinstall": "typings install",- "test": "tslint -c ./tslint.json angular/**/*.ts angular/**/**/*.ts angular/**/**/**/*.ts"+ "test": "standard && tslint -c ./tslint.json angular/**/*.ts angular/**/**/*.ts angular/**/**/**/*.ts"},- "license": "ISC",+ "license": "GPLv3","dependencies": {- "angular-pipes": "^1.5.0",- "angular2": "2.0.0-beta.17",+ "angular-pipes": "^2.0.0",+ "@angular/common": "2.0.0-rc.1",+ "@angular/compiler": "2.0.0-rc.1",+ "@angular/core": "2.0.0-rc.1",+ "@angular/http": "2.0.0-rc.1",+ "@angular/platform-browser-dynamic": "2.0.0-rc.1",+ "@angular/platform-browser": "2.0.0-rc.1",+ "@angular/router-deprecated": "2.0.0-rc.1","blueimp-file-upload": "^9.12.1","bootstrap-sass": "^3.3.6","es6-promise": "^3.0.2","es6-shim": "^0.35.0","jquery": "^2.2.3","jquery.ui.widget": "^1.10.3",- "reflect-metadata": "0.1.2",+ "reflect-metadata": "0.1.3","rxjs": "5.0.0-beta.6",- "systemjs": "0.19.26",+ "systemjs": "0.19.27","webtorrent": "^0.89.0","zone.js": "0.6.12"},"devDependencies": {"codelyzer": "0.0.18",+ "standard": "^7.0.1",+ "systemjs-builder": "^0.15.16","tslint": "^3.7.4","typescript": "^1.8.10","typings": "^0.8.1"+ },+ "standard": {+ "ignore": [+ "angular/",+ "bundles/"+ ]}}diff --git a/client/systemjs.bundle.js b/client/systemjs.bundle.jsnew file mode 100644index 0000000000..2fd45156ad--- /dev/null+++ b/client/systemjs.bundle.js@@ -0,0 +1,15 @@+var SystemBuilder = require('systemjs-builder')+var builder = new SystemBuilder('node_modules', 'systemjs.config.js')++var toBundle = [+ 'rxjs/Rx',+ '@angular/common',+ '@angular/compiler',+ '@angular/core',+ '@angular/http',+ '@angular/platform-browser',+ '@angular/platform-browser-dynamic',+ '@angular/router-deprecated'+]++builder.bundle(toBundle.join(' + '), 'bundles/angular-rxjs.bundle.js')diff --git a/client/systemjs.config.js b/client/systemjs.config.jsnew file mode 100644index 0000000000..6b284ec63c--- /dev/null+++ b/client/systemjs.config.js@@ -0,0 +1,47 @@+;(function (global) {+ var map = {+ 'app': 'app/angular',+ 'angular-pipes': 'app/node_modules/angular-pipes',+ 'angular-rxjs.bundle': 'app/bundles/angular-rxjs.bundle.js'+ }++ var packages = {+ 'app': { main: 'main.js', defaultExtension: 'js' },+ 'rxjs': { defaultExtension: 'js' }+ }+ var packageNames = [+ '@angular/common',+ '@angular/compiler',+ '@angular/core',+ '@angular/http',+ '@angular/platform-browser',+ '@angular/platform-browser-dynamic',+ '@angular/router-deprecated',+ 'angular-pipes'+ ]++ packageNames.forEach(function (pkgName) {+ packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }+ })++ var config = {+ map: map,+ packages: packages,+ bundles: {+ 'angular-rxjs.bundle': [+ 'rxjs',+ '@angular/common/index.js',+ '@angular/compiler/index.js',+ '@angular/core/index.js',+ '@angular/http/index.js',+ '@angular/platform-browser/index.js',+ '@angular/platform-browser-dynamic/index.js',+ '@angular/router-deprecated/index.js'+ ]+ }+ }++ // filterSystemConfig - index.html's chance to modify config before we register it.+ if (global.filterSystemConfig) global.filterSystemConfig(config)+ System.config(config)+})(this)diff --git a/client/tsconfig.json b/client/tsconfig.jsonindex ca58ddb899..3e4648cf79 100644--- a/client/tsconfig.json+++ b/client/tsconfig.json@@ -1,7 +1,7 @@{"compilerOptions": {"target": "es5",- "module": "system",+ "module": "commonjs","moduleResolution": "node","sourceMap": true,"emitDecoratorMetadata": true,diff --git a/client/typings.json b/client/typings.jsonindex c06bb4d720..b5324f4199 100644--- a/client/typings.json+++ b/client/typings.json@@ -1,6 +1,7 @@{"ambientDependencies": {- "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",- "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd"+ "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",+ "jasmine": "registry:dt/jasmine#2.2.0+20160412134438",+ "node": "registry:dt/node#4.0.0+20160509154515"}}diff --git a/client/typings/typings.d.ts b/client/typings/typings.d.tsnew file mode 100644index 0000000000..579c9a586c--- /dev/null+++ b/client/typings/typings.d.ts@@ -0,0 +1,13 @@+/**+ * Declares the 'commonjs' format module object that identifies the "module id" for the current module.+ * Set a component's `moduleId` metadata property to `module.id` for module-relative urls+ * when the generated module format is 'commonjs'.+ */+declare var module: {id: string};++/**+ * Declares the 'system' format string that identifies the "module id" for the current module.+ * Set a component's `moduleId` metadata property to `__moduleName` for module-relative urls+ * when the generated module format is 'system'.+ */+declare var __moduleName: string;diff --git a/scripts/build/client/tsc.sh b/scripts/build/client/tsc.shindex ec06b643a9..cca1643d4b 100755--- a/scripts/build/client/tsc.sh+++ b/scripts/build/client/tsc.sh@@ -1,5 +1,5 @@#!/usr/bin/env shcd client || exit -1-+node systemjs.bundle.jsnpm run tscdiff --git a/scripts/clean/client/tsc.sh b/scripts/clean/client/tsc.shindex 775157a546..3ea6e78d5b 100755--- a/scripts/clean/client/tsc.sh+++ b/scripts/clean/client/tsc.sh@@ -2,3 +2,4 @@cd client || exit -1find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;+rm -rf ./bundlesdiff --git a/scripts/danger/clean/modules.sh b/scripts/danger/clean/modules.shindex 1aa6c732b9..d357e1b77f 100755--- a/scripts/danger/clean/modules.sh+++ b/scripts/danger/clean/modules.sh@@ -3,5 +3,5 @@read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -rif [[ "$REPLY" =~ ^[Yy]$ ]]; then- rm -rf node_modules client/node_modules client/typings+ rm -rf node_modules client/node_modules client/typings/{browser,main}*fi