aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-11 15:25:36 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-11 15:58:27 +0200
commit294f80f21e8a77d25f6fb5f0f26887fb4618ee2e (patch)
tree01e0016e7ae7edfc87e2ba9861436aedce89993b
parent1840c2f7c91f5f89602a3683d85b0a9df1454855 (diff)
downloadPeerTube-294f80f21e8a77d25f6fb5f0f26887fb4618ee2e.tar.gz
PeerTube-294f80f21e8a77d25f6fb5f0f26887fb4618ee2e.tar.zst
PeerTube-294f80f21e8a77d25f6fb5f0f26887fb4618ee2e.zip
Bundle webtorrent with webpack. Closes https://github.com/Chocobozzz/PeerTube/issues/50
-rw-r--r--client/config/webpack.common.js4
-rw-r--r--client/config/webpack.dev.js5
-rw-r--r--client/config/webpack.prod.js5
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts6
-rw-r--r--client/src/app/videos/video-watch/webtorrent.service.ts2
-rw-r--r--client/src/index.html3
6 files changed, 6 insertions, 19 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js
index 459985880..a81bca9d2 100644
--- a/client/config/webpack.common.js
+++ b/client/config/webpack.common.js
@@ -261,10 +261,6 @@ module.exports = function (options) {
261 to: 'assets' 261 to: 'assets'
262 }, 262 },
263 { 263 {
264 from: 'node_modules/webtorrent/webtorrent.min.js',
265 to: 'assets/webtorrent'
266 },
267 {
268 from: 'src/standalone', 264 from: 'src/standalone',
269 to: 'standalone' 265 to: 'standalone'
270 } 266 }
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index d6ebed730..42d9ca37e 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -83,10 +83,6 @@ module.exports = function (env) {
83 libraryTarget: 'var' 83 libraryTarget: 'var'
84 }, 84 },
85 85
86 externals: {
87 webtorrent: 'WebTorrent'
88 },
89
90 module: { 86 module: {
91 87
92 // Too slow, life is short 88 // Too slow, life is short
@@ -246,6 +242,7 @@ module.exports = function (env) {
246 node: { 242 node: {
247 global: true, 243 global: true,
248 crypto: 'empty', 244 crypto: 'empty',
245 fs: 'empty',
249 process: true, 246 process: true,
250 module: false, 247 module: false,
251 clearImmediate: false, 248 clearImmediate: false,
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js
index 3f063c7c6..c27a4f4b0 100644
--- a/client/config/webpack.prod.js
+++ b/client/config/webpack.prod.js
@@ -81,10 +81,6 @@ module.exports = function (env) {
81 publicPath: '/client/' 81 publicPath: '/client/'
82 }, 82 },
83 83
84 externals: {
85 webtorrent: 'WebTorrent'
86 },
87
88 /** 84 /**
89 * Add additional plugins to the compiler. 85 * Add additional plugins to the compiler.
90 * 86 *
@@ -272,6 +268,7 @@ module.exports = function (env) {
272 node: { 268 node: {
273 global: true, 269 global: true,
274 crypto: 'empty', 270 crypto: 'empty',
271 fs: 'empty',
275 process: false, 272 process: false,
276 module: false, 273 module: false,
277 clearImmediate: false, 274 clearImmediate: false,
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 32c847785..bcfebf2fd 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -21,15 +21,15 @@ import { WebTorrentService } from './webtorrent.service';
21}) 21})
22 22
23export class VideoWatchComponent implements OnInit, OnDestroy { 23export class VideoWatchComponent implements OnInit, OnDestroy {
24 private static LOADTIME_TOO_LONG: number = 20000; 24 private static LOADTIME_TOO_LONG = 20000;
25 25
26 @ViewChild('videoMagnetModal') videoMagnetModal: VideoMagnetComponent; 26 @ViewChild('videoMagnetModal') videoMagnetModal: VideoMagnetComponent;
27 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent; 27 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent;
28 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent; 28 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent;
29 29
30 downloadSpeed: number; 30 downloadSpeed: number;
31 error: boolean = false; 31 error = false;
32 loading: boolean = false; 32 loading = false;
33 numPeers: number; 33 numPeers: number;
34 player: videojs.Player; 34 player: videojs.Player;
35 playerElement: Element; 35 playerElement: Element;
diff --git a/client/src/app/videos/video-watch/webtorrent.service.ts b/client/src/app/videos/video-watch/webtorrent.service.ts
index 630a5c469..8936e7992 100644
--- a/client/src/app/videos/video-watch/webtorrent.service.ts
+++ b/client/src/app/videos/video-watch/webtorrent.service.ts
@@ -1,7 +1,7 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Subject } from 'rxjs/Subject'; 2import { Subject } from 'rxjs/Subject';
3 3
4declare const WebTorrent; 4import * as WebTorrent from 'webtorrent';
5 5
6@Injectable() 6@Injectable()
7export class WebTorrentService { 7export class WebTorrentService {
diff --git a/client/src/index.html b/client/src/index.html
index ea88bb15b..4346775b1 100644
--- a/client/src/index.html
+++ b/client/src/index.html
@@ -11,9 +11,6 @@
11 <!-- opengraph tags --> 11 <!-- opengraph tags -->
12 <!-- Do not remove it! --> 12 <!-- Do not remove it! -->
13 13
14 <!-- TODO: bundle it with webpack when https://github.com/webpack/webpack/pull/1931 will be merged -->
15 <!-- <script src="/client/assets/webtorrent/webtorrent.min.js"></script> -->
16
17 <link rel="icon" type="image/png" href="/client/assets/favicon.png" /> 14 <link rel="icon" type="image/png" href="/client/assets/favicon.png" />
18 15
19 <!-- base url --> 16 <!-- base url -->