From 32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Mar 2021 16:54:52 +0100 Subject: Add new plugin/peertube version notifs --- .../instances-index/mock-instances-index.ts | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 shared/extra-utils/instances-index/mock-instances-index.ts (limited to 'shared/extra-utils/instances-index') diff --git a/shared/extra-utils/instances-index/mock-instances-index.ts b/shared/extra-utils/instances-index/mock-instances-index.ts deleted file mode 100644 index 2604eda03..000000000 --- a/shared/extra-utils/instances-index/mock-instances-index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as express from 'express' - -export class MockInstancesIndex { - private readonly indexInstances: { host: string, createdAt: string }[] = [] - - initialize () { - return new Promise(res => { - const app = express() - - app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => { - if (process.env.DEBUG) console.log('Receiving request on mocked server %s.', req.url) - - return next() - }) - - app.get('/api/v1/instances/hosts', (req: express.Request, res: express.Response) => { - const since = req.query.since - - const filtered = this.indexInstances.filter(i => { - if (!since) return true - - return i.createdAt > since - }) - - return res.json({ - total: filtered.length, - data: filtered - }) - }) - - app.listen(42101, () => res()) - }) - } - - addInstance (host: string) { - this.indexInstances.push({ host, createdAt: new Date().toISOString() }) - } -} -- cgit v1.2.3