integrated CoC pull from bookstack

This commit is contained in:
2025-12-12 00:39:19 -05:00
parent c74b5b280b
commit 333bf20d86
3 changed files with 77 additions and 18 deletions

View File

@@ -10,6 +10,24 @@ import { assignUserToStatus } from '../services/statusService';
import { Request, response, Response } from 'express';
import { getUserRoles } from '../services/rolesService';
//get CoC
router.get('/coc', async (req: Request, res: Response) => {
const output = await fetch(`${process.env.DOC_HOST}/api/pages/714`, {
headers: {
Authorization: `Token ${process.env.DOC_TOKEN_ID}:${process.env.DOC_TOKEN_SECRET}`,
}
})
if (output.ok) {
const out = await output.json();
res.status(200).json(out.html);
} else {
console.error("Failed to fetch LOA policy from bookstack");
res.sendStatus(500);
}
})
// POST /application
router.post('/', async (req, res) => {
try {
@@ -283,20 +301,5 @@ router.post('/restart', async (req: Request, res: Response) => {
}
})
// router.get('/coc', async (req: Request, res: Response) => {
// const output = await fetch(`${process.env.DOC_HOST}/api/pages/`, {
// headers: {
// Authorization: `Token ${process.env.DOC_TOKEN_ID}:${process.env.DOC_TOKEN_SECRET}`,
// }
// })
// if (output.ok) {
// const out = await output.json();
// res.status(200).json(out.html);
// } else {
// console.error("Failed to fetch LOA policy from bookstack");
// res.sendStatus(500);
// }
// })
module.exports = router;