]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/controllers/api/remote/pods.ts
Fix upgrade peertube script (bad semver comparison)
[github/Chocobozzz/PeerTube.git] / server / controllers / api / remote / pods.ts
CommitLineData
4d4e5cd4 1import * as express from 'express'
34831b48 2
e02643f3 3import { database as db } from '../../../initializers/database'
65fcc311 4import { checkSignature, signatureValidator } from '../../../middlewares'
34831b48 5
65fcc311 6const remotePodsRouter = express.Router()
34831b48
C
7
8// Post because this is a secured request
65fcc311
C
9remotePodsRouter.post('/remove',
10 signatureValidator,
34831b48
C
11 checkSignature,
12 removePods
13)
14
15// ---------------------------------------------------------------------------
16
65fcc311
C
17export {
18 remotePodsRouter
19}
34831b48
C
20
21// ---------------------------------------------------------------------------
22
69818c93 23function removePods (req: express.Request, res: express.Response, next: express.NextFunction) {
34831b48
C
24 const host = req.body.signature.host
25
6fcd19ba
C
26 db.Pod.loadByHost(host)
27 .then(pod => {
28 return pod.destroy()
29 })
30 .then(() => res.type('json').status(204).end())
31 .catch(err => next(err))
34831b48 32}