fix is with transport

This commit is contained in:
Dobromir Popov
2024-02-23 20:16:15 +02:00
parent d51f6bfbba
commit e7d127f1ed
3 changed files with 11 additions and 4 deletions

4
.env
View File

@ -5,6 +5,10 @@ NEXT_PUBLIC_HOST=localhost
NEXT_PUBLIC_PORT=3003 NEXT_PUBLIC_PORT=3003
NEXTAUTH_URL=https://localhost:3003 NEXTAUTH_URL=https://localhost:3003
# NEXTAUTH_URL_INTERNAL=http://127.0.0.1:3003 # NEXTAUTH_URL_INTERNAL=http://127.0.0.1:3003
SSL_ENABLED=true
SSL_KEY=./certificates/localhost-key.pem
SSL_CERT=./certificates/localhost.pem
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32 # Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58 NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58

View File

@ -217,7 +217,8 @@ export default function AvailabilityForm({ publisherId, existingItem, inline, on
publisherId: availability.publisherId, publisherId: availability.publisherId,
startTime: startTime, startTime: startTime,
endTime: endTime, endTime: endTime,
// isWithTransportIn: slots[0].isWithTransport, isWithTransportIn: group[0].isFirst && timeSlots[0].isWithTransport,
isWithTransportOut: group[group.length - 1].isLast && timeSlots[timeSlots.length - 1].isWithTransport,
// Add other necessary fields, like isWithTransport if applicable // Add other necessary fields, like isWithTransport if applicable
}; };
}); });

View File

@ -6,6 +6,7 @@ const fs = require("fs");
const dotenv = require("dotenv"); const dotenv = require("dotenv");
const data = require("./src/helpers/data"); const data = require("./src/helpers/data");
const sharp = require('sharp'); const sharp = require('sharp');
const https = require('https');
//const getPort = require("get-port"); //const getPort = require("get-port");
if (process.env.NODE_ENV === 'test') { if (process.env.NODE_ENV === 'test') {
@ -55,16 +56,17 @@ const prisma = common.getPrismaClient();
app app
.prepare() .prepare()
.then(() => { .then(() => {
const server = express();
//check if ssl is enabled //check if ssl is enabled
if (process.env.SSL_ENABLED === "true") { if (process.env.SSL_ENABLED === "true") {
const options = { const options = {
key: fs.readFileSync(process.env.SSL_KEY), key: fs.readFileSync(process.env.SSL_KEY),
cert: fs.readFileSync(process.env.SSL_CERT), cert: fs.readFileSync(process.env.SSL_CERT),
}; };
https.createServer(options, server).listen(443); https.createServer(options, server).listen(PORT);
} }
const server = express();
// Add the middleware to set 'x-forwarded-host' header // Add the middleware to set 'x-forwarded-host' header
server.use((req, res, next) => { server.use((req, res, next) => {
req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers.host; req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers.host;
@ -542,7 +544,7 @@ app
}); });
}) })
.catch((ex) => { .catch((ex) => {
console.warn("Error starting server on ${NEXT_PUBLIC_HOST}:${PORT}") console.warn(`Error starting server on ${HOST}:${PORT}`)
console.error(ex.stack); console.error(ex.stack);
process.exit(1); process.exit(1);
}); });