Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tools/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const path = require("path");
const bodyParser = require("body-parser");
const fs = require("fs");
const cors = require("cors");
const https = require('https');

const fsPromise = require("../utils/fsPromise");
const { getNetworkIp } = require("../utils/ip");
Expand Down Expand Up @@ -48,12 +49,16 @@ app.post("/firmware", async (req, res) => {
}
});

const key = fs.readFileSync('key.pem');
const cert = fs.readFileSync('cert.pem');
const server = https.createServer({key: key, cert: cert }, app);

const startServer = (portReq, ipReq) => {
port = portReq === undefined ? 8000 : portReq;
serverIp = ipReq === undefined ? "0.0.0.0" : ipReq;

app
.listen(port, serverIp, () => {
server.listen(port, serverIp, () => {
console.log(`Server running on ip ${serverIp} and port ${port}`);

let ipToShow = serverIp;
Expand Down