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
NEXTAUTH_URL=https://localhost: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
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58

View File

@ -217,7 +217,8 @@ export default function AvailabilityForm({ publisherId, existingItem, inline, on
publisherId: availability.publisherId,
startTime: startTime,
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
};
});

View File

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