mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
First typescript iteration
This commit is contained in:
parent
d5f345ed4c
commit
65fcc3119c
113 changed files with 1961 additions and 1784 deletions
|
@ -1,42 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
const express = require('express')
|
||||
const waterfall = require('async/waterfall')
|
||||
|
||||
const db = require('../../../initializers/database')
|
||||
const middlewares = require('../../../middlewares')
|
||||
const checkSignature = middlewares.secure.checkSignature
|
||||
const signatureValidator = middlewares.validators.remote.signature
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
// Post because this is a secured request
|
||||
router.post('/remove',
|
||||
signatureValidator.signature,
|
||||
checkSignature,
|
||||
removePods
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = router
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function removePods (req, res, next) {
|
||||
const host = req.body.signature.host
|
||||
|
||||
waterfall([
|
||||
function loadPod (callback) {
|
||||
db.Pod.loadByHost(host, callback)
|
||||
},
|
||||
|
||||
function deletePod (pod, callback) {
|
||||
pod.destroy().asCallback(callback)
|
||||
}
|
||||
], function (err) {
|
||||
if (err) return next(err)
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue