diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-11 10:56:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-11 10:58:09 +0200 |
commit | 5d79474cc66383ecbfcef6366f63a34c3af21cbf (patch) | |
tree | 6b2cd85c25294ca04c94cbbcc90353d25e9cee06 /client/src/app/+admin/system/debug | |
parent | 2b3f1919fda81c2781ceeb9071d426c184e1b21c (diff) | |
download | PeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.tar.gz PeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.tar.zst PeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.zip |
Add debug component to help admins to fix IP issues
Diffstat (limited to 'client/src/app/+admin/system/debug')
5 files changed, 83 insertions, 0 deletions
diff --git a/client/src/app/+admin/system/debug/debug.component.html b/client/src/app/+admin/system/debug/debug.component.html new file mode 100644 index 000000000..f35414b37 --- /dev/null +++ b/client/src/app/+admin/system/debug/debug.component.html | |||
@@ -0,0 +1,19 @@ | |||
1 | <div class="root"> | ||
2 | <h4>IP</h4> | ||
3 | |||
4 | <p>PeerTube thinks your public IP is <strong>{{ debug?.ip }}</strong>.</p> | ||
5 | |||
6 | <p>If this is not your correct public IP, please consider fixing it because:</p> | ||
7 | <ul> | ||
8 | <li>Views may not be counted correctly (reduced compared to what they should be)</li> | ||
9 | <li>Anti brute force system could be overzealous</li> | ||
10 | <li>P2P system could not work correctly</li> | ||
11 | </ul> | ||
12 | |||
13 | <p>To fix it:<p> | ||
14 | <ul> | ||
15 | <li>Check the <code>trust_proxy</code> configuration key</li> | ||
16 | <li>If you run PeerTube using Docker, check you run the <code>reverse-proxy</code> with <code>network_mode: "host"</code> | ||
17 | (see <a href="https://github.com/Chocobozzz/PeerTube/issues/1643#issuecomment-464789666">issue 1643</a>)</li> | ||
18 | </ul> | ||
19 | </div> | ||
diff --git a/client/src/app/+admin/system/debug/debug.component.scss b/client/src/app/+admin/system/debug/debug.component.scss new file mode 100644 index 000000000..90addd284 --- /dev/null +++ b/client/src/app/+admin/system/debug/debug.component.scss | |||
@@ -0,0 +1,6 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | .root { | ||
5 | font-size: 14px; | ||
6 | } | ||
diff --git a/client/src/app/+admin/system/debug/debug.component.ts b/client/src/app/+admin/system/debug/debug.component.ts new file mode 100644 index 000000000..8a77f79f7 --- /dev/null +++ b/client/src/app/+admin/system/debug/debug.component.ts | |||
@@ -0,0 +1,31 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Notifier } from '@app/core' | ||
3 | import { Debug } from '@shared/models/server' | ||
4 | import { DebugService } from '@app/+admin/system/debug/debug.service' | ||
5 | |||
6 | @Component({ | ||
7 | templateUrl: './debug.component.html', | ||
8 | styleUrls: [ './debug.component.scss' ] | ||
9 | }) | ||
10 | export class DebugComponent implements OnInit { | ||
11 | debug: Debug | ||
12 | |||
13 | constructor ( | ||
14 | private debugService: DebugService, | ||
15 | private notifier: Notifier | ||
16 | ) { | ||
17 | } | ||
18 | |||
19 | ngOnInit (): void { | ||
20 | this.load() | ||
21 | } | ||
22 | |||
23 | load () { | ||
24 | this.debugService.getDebug() | ||
25 | .subscribe( | ||
26 | debug => this.debug = debug, | ||
27 | |||
28 | err => this.notifier.error(err.message) | ||
29 | ) | ||
30 | } | ||
31 | } | ||
diff --git a/client/src/app/+admin/system/debug/debug.service.ts b/client/src/app/+admin/system/debug/debug.service.ts new file mode 100644 index 000000000..6c722d177 --- /dev/null +++ b/client/src/app/+admin/system/debug/debug.service.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import { catchError } from 'rxjs/operators' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { Observable } from 'rxjs' | ||
5 | import { environment } from '../../../../environments/environment' | ||
6 | import { RestExtractor, RestService } from '../../../shared' | ||
7 | import { Debug } from '@shared/models/server' | ||
8 | |||
9 | @Injectable() | ||
10 | export class DebugService { | ||
11 | private static BASE_DEBUG_URL = environment.apiUrl + '/api/v1/server/debug' | ||
12 | |||
13 | constructor ( | ||
14 | private authHttp: HttpClient, | ||
15 | private restService: RestService, | ||
16 | private restExtractor: RestExtractor | ||
17 | ) {} | ||
18 | |||
19 | getDebug (): Observable<Debug> { | ||
20 | return this.authHttp.get<Debug>(DebugService.BASE_DEBUG_URL) | ||
21 | .pipe( | ||
22 | catchError(err => this.restExtractor.handleError(err)) | ||
23 | ) | ||
24 | } | ||
25 | } | ||
diff --git a/client/src/app/+admin/system/debug/index.ts b/client/src/app/+admin/system/debug/index.ts new file mode 100644 index 000000000..7fc7a0721 --- /dev/null +++ b/client/src/app/+admin/system/debug/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './debug.component' | ||
2 | export * from './debug.service' | ||