Merge branch 'master' of https://github.com/Stefan080106/printer_service
This commit is contained in:
32
src/index.js
32
src/index.js
@@ -1,10 +1,18 @@
|
||||
import pdfLib from "pdf-to-printer";
|
||||
import { jsPDF } from "jspdf";
|
||||
import fs from "fs";
|
||||
<<<<<<< HEAD
|
||||
import puppeteer from "puppeteer";
|
||||
import express from "express";
|
||||
import Joi from "joi";
|
||||
import TelegramBot from "node-telegram-bot-api";
|
||||
=======
|
||||
import puppeteer from 'puppeteer';
|
||||
import express from 'express';
|
||||
import Joi from 'joi';
|
||||
import TelegramBot from 'node-telegram-bot-api';
|
||||
import https from 'https';
|
||||
>>>>>>> f7a7fa7d73eb3cc7af05ff42d4a8f9eefeae2aec
|
||||
|
||||
const Logo = fs.readFileSync("./assets/Logo_fwaur.png", { encoding: "latin1" });
|
||||
const config = JSON.parse(fs.readFileSync("./config.json", "utf8"));
|
||||
@@ -23,6 +31,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];
|
||||
@@ -179,6 +198,15 @@ app.post("/depesche", async (req, res) => {
|
||||
return res.send("ok");
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`PDF Printing Service listening on port ${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}`);
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
=======
|
||||
});
|
||||
>>>>>>> f7a7fa7d73eb3cc7af05ff42d4a8f9eefeae2aec
|
||||
|
||||
Reference in New Issue
Block a user