diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-06 10:35:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:16 +0200 |
commit | c8fc9b47188b33cfc33184b1ee7e680a093244f1 (patch) | |
tree | 7deb3e57513c0b456decdd9008aa76540393d9fa /shared/extra-utils/mock-servers/joinpeertube-versions.ts | |
parent | a92ddacb38a4a17e117ca9ed41680a03580fb81d (diff) | |
download | PeerTube-c8fc9b47188b33cfc33184b1ee7e680a093244f1.tar.gz PeerTube-c8fc9b47188b33cfc33184b1ee7e680a093244f1.tar.zst PeerTube-c8fc9b47188b33cfc33184b1ee7e680a093244f1.zip |
Rename mock server files
Diffstat (limited to 'shared/extra-utils/mock-servers/joinpeertube-versions.ts')
-rw-r--r-- | shared/extra-utils/mock-servers/joinpeertube-versions.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/shared/extra-utils/mock-servers/joinpeertube-versions.ts b/shared/extra-utils/mock-servers/joinpeertube-versions.ts deleted file mode 100644 index 5ea432ecf..000000000 --- a/shared/extra-utils/mock-servers/joinpeertube-versions.ts +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | import * as express from 'express' | ||
2 | import { randomInt } from '@shared/core-utils' | ||
3 | |||
4 | export class MockJoinPeerTubeVersions { | ||
5 | private latestVersion: string | ||
6 | |||
7 | initialize () { | ||
8 | return new Promise<number>(res => { | ||
9 | const app = express() | ||
10 | |||
11 | app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
12 | if (process.env.DEBUG) console.log('Receiving request on mocked server %s.', req.url) | ||
13 | |||
14 | return next() | ||
15 | }) | ||
16 | |||
17 | app.get('/versions.json', (req: express.Request, res: express.Response) => { | ||
18 | return res.json({ | ||
19 | peertube: { | ||
20 | latestVersion: this.latestVersion | ||
21 | } | ||
22 | }) | ||
23 | }) | ||
24 | |||
25 | const port = 42201 + randomInt(1, 100) | ||
26 | app.listen(port, () => res(port)) | ||
27 | }) | ||
28 | } | ||
29 | |||
30 | setLatestVersion (latestVersion: string) { | ||
31 | this.latestVersion = latestVersion | ||
32 | } | ||
33 | } | ||