feat(ssl)
This commit is contained in:
21
src/index.js
21
src/index.js
@@ -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}`);
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user