merge
This commit is contained in:
parent
0030ad4216
commit
046cfaeff0
81
app.js
81
app.js
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
const express = require("express");
|
||||
const session = require("express-session");
|
||||
const bcrypt = require("bcrypt");
|
||||
|
@ -9,32 +8,24 @@ const path = require("path");
|
|||
const moment = require("moment");
|
||||
require("dotenv").config();
|
||||
const log = require("node-file-logger");
|
||||
=======
|
||||
const express = require('express');
|
||||
const session = require('express-session');
|
||||
const bcrypt = require('bcrypt');
|
||||
const crypto = require('crypto');
|
||||
const nodemailer = require('nodemailer');
|
||||
const { Pool } = require('pg');
|
||||
const path = require('path');
|
||||
const moment = require('moment');
|
||||
require('dotenv').config();
|
||||
const log = require('node-file-logger');
|
||||
const QRCode = require('qrcode');
|
||||
>>>>>>> 233dce1040dfa6dc0ac991a0ef473e58d5aa6cc1
|
||||
const QRCode = require("qrcode");
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT;
|
||||
|
||||
const TeleBot = require('telebot');
|
||||
const TeleBot = require("telebot");
|
||||
const bot = new TeleBot(process.env.TELEBOT);
|
||||
telebotChatID=process.env.TELECHAT;
|
||||
telebotChatID = process.env.TELECHAT;
|
||||
|
||||
bot.on('text', (msg) => {
|
||||
if (msg.from.id==telebotChatID) {
|
||||
bot.on("text", (msg) => {
|
||||
if (msg.from.id == telebotChatID) {
|
||||
msg.reply.text(msg.text);
|
||||
} else {
|
||||
msg.reply.text("Entschuldige, " + msg.from.username + "\nIch darf nicht mit fremden reden.");
|
||||
msg.reply.text(
|
||||
"Entschuldige, " +
|
||||
msg.from.username +
|
||||
"\nIch darf nicht mit fremden reden."
|
||||
);
|
||||
log.Info("Telebot-nachricht: " + msg.from.username + " - " + msg.text);
|
||||
}
|
||||
});
|
||||
|
@ -462,53 +453,63 @@ app.get("/register", (req, res) => {
|
|||
res.render("register", { session: req.session }); // Stelle sicher, dass es eine register.ejs gibt
|
||||
});
|
||||
|
||||
app.get('/contact', (req, res) => {
|
||||
res.render('contact', { session: req.session });
|
||||
app.get("/contact", (req, res) => {
|
||||
res.render("contact", { session: req.session });
|
||||
});
|
||||
|
||||
app.get('/car', (req, res) => {
|
||||
res.render('car', { session: req.session });
|
||||
app.get("/car", (req, res) => {
|
||||
res.render("car", { session: req.session });
|
||||
});
|
||||
|
||||
app.post('/car', (req, res) => {
|
||||
app.post("/car", (req, res) => {
|
||||
const { kennzeichen, message, contact } = req.body;
|
||||
let formattedLicensePlate = kennzeichen.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
|
||||
let formattedLicensePlate = kennzeichen
|
||||
.replace(/[^a-zA-Z0-9]/g, "")
|
||||
.toUpperCase();
|
||||
|
||||
if (formattedLicensePlate=='DUKL445') {
|
||||
if (contact!=""){
|
||||
if (formattedLicensePlate == "DUKL445") {
|
||||
if (contact != "") {
|
||||
bot.sendMessage(telebotChatID, contact);
|
||||
}
|
||||
bot.sendMessage(telebotChatID, message);
|
||||
console.log(message + contact);
|
||||
req.session.message = ['Success', 'Nachricht versendet.', 'none']
|
||||
req.session.message = ["Success", "Nachricht versendet.", "none"];
|
||||
} else {
|
||||
log.Info("Kontakt: " + contact + " - Nachricht: " + message + " - Kennzeichen: " + kennzeichen);
|
||||
log.Info(
|
||||
"Kontakt: " +
|
||||
contact +
|
||||
" - Nachricht: " +
|
||||
message +
|
||||
" - Kennzeichen: " +
|
||||
kennzeichen
|
||||
);
|
||||
}
|
||||
res.render('carsend', { session: req.session });
|
||||
res.render("carsend", { session: req.session });
|
||||
});
|
||||
|
||||
app.get('/qr', requireAuth, (req, res)=>{
|
||||
res.render('qrcode', { session: req.session});
|
||||
app.get("/qr", requireAuth, (req, res) => {
|
||||
res.render("qrcode", { session: req.session });
|
||||
});
|
||||
|
||||
app.post('/qr', requireAuth, (req, res)=>{
|
||||
const {text, invert} = req.body;
|
||||
app.post("/qr", requireAuth, (req, res) => {
|
||||
const { text, invert } = req.body;
|
||||
|
||||
const options = {
|
||||
color: {
|
||||
dark: invert ? '#FFFFFF' : '#000000', // Farbe der QR-Code-Muster
|
||||
light: invert ? '#000000' : '#FFFFFF' // Farbe des Hintergrunds
|
||||
}
|
||||
dark: invert ? "#FFFFFF" : "#000000", // Farbe der QR-Code-Muster
|
||||
light: invert ? "#000000" : "#FFFFFF", // Farbe des Hintergrunds
|
||||
},
|
||||
};
|
||||
|
||||
QRCode.toDataURL(text, options, (err, url) => {
|
||||
if (err) {
|
||||
return res.send('Fehler beim Generieren des QR-Codes');
|
||||
return res.send("Fehler beim Generieren des QR-Codes");
|
||||
}
|
||||
|
||||
res.render('qrcodeshow', {
|
||||
res.render("qrcodeshow", {
|
||||
session: req.session,
|
||||
qrCodeUrl: url });
|
||||
qrCodeUrl: url,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"node-file-logger": "^0.9.5",
|
||||
"nodemailer": "^6.9.13",
|
||||
"pg": "^8.11.5",
|
||||
"qrcode": "^1.5.3",
|
||||
"qrcode": "^1.5.4",
|
||||
"telebot": "^1.4.1"
|
||||
}
|
||||
},
|
||||
|
@ -555,12 +555,6 @@
|
|||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"node_modules/encode-utf8": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz",
|
||||
"integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
|
@ -1687,13 +1681,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/qrcode": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz",
|
||||
"integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==",
|
||||
"license": "MIT",
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
||||
"dependencies": {
|
||||
"dijkstrajs": "^1.0.1",
|
||||
"encode-utf8": "^1.0.3",
|
||||
"pngjs": "^5.0.0",
|
||||
"yargs": "^15.3.1"
|
||||
},
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"node-file-logger": "^0.9.5",
|
||||
"nodemailer": "^6.9.13",
|
||||
"pg": "^8.11.5",
|
||||
"qrcode": "^1.5.3",
|
||||
"qrcode": "^1.5.4",
|
||||
"telebot": "^1.4.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue