feat(ssl)

This commit is contained in:
Stefan080106
2023-04-18 00:25:06 +02:00
parent 113d7c5dc1
commit f7a7fa7d73
11 changed files with 197 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import puppeteer from 'puppeteer';
import express from 'express';
import Joi from 'joi';
import TelegramBot from 'node-telegram-bot-api';
import https from 'https';
const Logo = fs.readFileSync("./assets/Logo_fwaur.png", { encoding: "latin1" });
const config = JSON.parse(fs.readFileSync("./config.json", "utf8"));
@@ -23,6 +24,17 @@ const printerName = config.printer_device_id;
const PORT = config.port || 2000;
const cacheFolder = "./cache/"
// Certificate
const privateKey = fs.readFileSync('./assets/ssl/localhost/localhost.decrypted.key');
const certificate = fs.readFileSync('./assets/ssl/localhost/localhost.crt');
const credentials = {
key: privateKey,
cert: certificate
};
let bot = null;
const messageIDs = [1034133487]
@@ -200,6 +212,11 @@ app.post('/depesche', async (req, res) => {
return res.send('ok');
});
app.listen(PORT, () => {
app.get("/health", (req, res) => {
res.send("ok");
});
const httpsServer = https.createServer(credentials, app);
httpsServer.listen(PORT, () => {
console.log(`PDF Printing Service listening on port ${PORT}`);
})
});