Skip to content

SSL Support #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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