]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/controllers/activitypub/pods.ts
Follow works
[github/Chocobozzz/PeerTube.git] / server / controllers / activitypub / pods.ts
CommitLineData
0d0e8dd0
C
1// import * as express from 'express'
2//
3// import { database as db } from '../../../initializers/database'
4// import {
5// checkSignature,
6// signatureValidator,
7// setBodyHostPort,
8// remotePodsAddValidator,
9// asyncMiddleware
10// } from '../../../middlewares'
11// import { sendOwnedDataToPod } from '../../../lib'
12// import { getMyPublicCert, getFormattedObjects } from '../../../helpers'
13// import { CONFIG } from '../../../initializers'
14// import { PodInstance } from '../../../models'
15// import { PodSignature, Pod as FormattedPod } from '../../../../shared'
16//
17// const remotePodsRouter = express.Router()
18//
19// remotePodsRouter.post('/remove',
20// signatureValidator,
21// checkSignature,
22// asyncMiddleware(removePods)
23// )
24//
25// remotePodsRouter.post('/list',
26// asyncMiddleware(remotePodsList)
27// )
28//
29// remotePodsRouter.post('/add',
30// setBodyHostPort, // We need to modify the host before running the validator!
31// remotePodsAddValidator,
32// asyncMiddleware(addPods)
33// )
34//
35// // ---------------------------------------------------------------------------
36//
37// export {
38// remotePodsRouter
39// }
40//
41// // ---------------------------------------------------------------------------
42//
43// async function addPods (req: express.Request, res: express.Response, next: express.NextFunction) {
44// const information = req.body
45//
46// const pod = db.Pod.build(information)
47// const podCreated = await pod.save()
48//
49// await sendOwnedDataToPod(podCreated.id)
50//
51// const cert = await getMyPublicCert()
52// return res.json({ cert, email: CONFIG.ADMIN.EMAIL })
53// }
54//
55// async function remotePodsList (req: express.Request, res: express.Response, next: express.NextFunction) {
56// const pods = await db.Pod.list()
57//
58// return res.json(getFormattedObjects<FormattedPod, PodInstance>(pods, pods.length))
59// }
60//
61// async function removePods (req: express.Request, res: express.Response, next: express.NextFunction) {
62// const signature: PodSignature = req.body.signature
63// const host = signature.host
64//
65// const pod = await db.Pod.loadByHost(host)
66// await pod.destroy()
67//
68// return res.type('json').status(204).end()
69// }