diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-18 09:14:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 09:14:51 +0200 |
commit | 1f6125be8b6306ba34b5ad9df985df462ef9759c (patch) | |
tree | 9894ab5a6b239f7797303c24f21e79019b942238 /shared | |
parent | 9df52d660feb722404be00a50f3c8a612bec1c15 (diff) | |
download | PeerTube-1f6125be8b6306ba34b5ad9df985df462ef9759c.tar.gz PeerTube-1f6125be8b6306ba34b5ad9df985df462ef9759c.tar.zst PeerTube-1f6125be8b6306ba34b5ad9df985df462ef9759c.zip |
Optimize torrent URL update
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/miscs/checks.ts | 7 | ||||
-rw-r--r-- | shared/extra-utils/server/servers-command.ts | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/shared/extra-utils/miscs/checks.ts b/shared/extra-utils/miscs/checks.ts index aa2c8e8fa..b1be214b1 100644 --- a/shared/extra-utils/miscs/checks.ts +++ b/shared/extra-utils/miscs/checks.ts | |||
@@ -20,6 +20,12 @@ function expectStartWith (str: string, start: string) { | |||
20 | expect(str.startsWith(start), `${str} does not start with ${start}`).to.be.true | 20 | expect(str.startsWith(start), `${str} does not start with ${start}`).to.be.true |
21 | } | 21 | } |
22 | 22 | ||
23 | async function expectLogDoesNotContain (server: PeerTubeServer, str: string) { | ||
24 | const content = await server.servers.getLogContent() | ||
25 | |||
26 | expect(content.toString()).to.not.contain(str) | ||
27 | } | ||
28 | |||
23 | async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { | 29 | async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { |
24 | const res = await makeGetRequest({ | 30 | const res = await makeGetRequest({ |
25 | url, | 31 | url, |
@@ -46,6 +52,7 @@ async function testFileExistsOrNot (server: PeerTubeServer, directory: string, f | |||
46 | export { | 52 | export { |
47 | dateIsValid, | 53 | dateIsValid, |
48 | testImage, | 54 | testImage, |
55 | expectLogDoesNotContain, | ||
49 | testFileExistsOrNot, | 56 | testFileExistsOrNot, |
50 | expectStartWith | 57 | expectStartWith |
51 | } | 58 | } |
diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts index 40a11e8d7..776d2123c 100644 --- a/shared/extra-utils/server/servers-command.ts +++ b/shared/extra-utils/server/servers-command.ts | |||
@@ -55,7 +55,7 @@ export class ServersCommand extends AbstractCommand { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | async waitUntilLog (str: string, count = 1, strictCount = true) { | 57 | async waitUntilLog (str: string, count = 1, strictCount = true) { |
58 | const logfile = this.server.servers.buildDirectory('logs/peertube.log') | 58 | const logfile = this.buildDirectory('logs/peertube.log') |
59 | 59 | ||
60 | while (true) { | 60 | while (true) { |
61 | const buf = await readFile(logfile) | 61 | const buf = await readFile(logfile) |
@@ -80,6 +80,10 @@ export class ServersCommand extends AbstractCommand { | |||
80 | return this.buildDirectory(join('streaming-playlists', 'hls', videoUUID, basename(fileUrl))) | 80 | return this.buildDirectory(join('streaming-playlists', 'hls', videoUUID, basename(fileUrl))) |
81 | } | 81 | } |
82 | 82 | ||
83 | getLogContent () { | ||
84 | return readFile(this.buildDirectory('logs/peertube.log')) | ||
85 | } | ||
86 | |||
83 | async getServerFileSize (subPath: string) { | 87 | async getServerFileSize (subPath: string) { |
84 | const path = this.server.servers.buildDirectory(subPath) | 88 | const path = this.server.servers.buildDirectory(subPath) |
85 | 89 | ||