|
|
@@ -5,14 +5,17 @@ const config = require('../../config/app');
|
|
|
const { PDFDocument, rgb, StandardFonts } = require('pdf-lib');
|
|
|
|
|
|
|
|
|
-router.get('/pdf/:id', function (req, res, next) {
|
|
|
+router.get('/pdf/:type/:id', function (req, res, next) {
|
|
|
(async function () {
|
|
|
+ let type = req.params.type;
|
|
|
+ if (type != 'page' || type != 'work') throw new Error(`Not Support URL`);
|
|
|
+
|
|
|
let id = req.params.id;
|
|
|
utils.validators.validateId(id);
|
|
|
|
|
|
let host = config.cdnHost ?? config.resHost;
|
|
|
|
|
|
- let url = `${host}/thumbs/coloring-page/page/1200/${id}.jpeg`;
|
|
|
+ let url = `${host}/thumbs/coloring-page/${type}/1200/${id}.jpeg`;
|
|
|
|
|
|
try {
|
|
|
const response = await fetch(url);
|