Updated the changelog and the file.ts
parent
6a85e91f53
commit
07f1461821
|
@ -2,7 +2,9 @@
|
||||||
* **03.03.20**
|
* **03.03.20**
|
||||||
- Using webpack instead of our own loaded (a lot of restructuring)
|
- Using webpack instead of our own loaded (a lot of restructuring)
|
||||||
- Fixed that the microphone slider hasn't worked for touch devices
|
- Fixed that the microphone slider hasn't worked for touch devices
|
||||||
|
- Fixed a bug which caused that audio data hasn't been transmitted
|
||||||
|
- Added the ability to start a https web server
|
||||||
|
|
||||||
* **28.03.20**
|
* **28.03.20**
|
||||||
- Fixed a bug within the permission editor which kicks you from the server
|
- Fixed a bug within the permission editor which kicks you from the server
|
||||||
|
|
||||||
|
|
22
file.ts
22
file.ts
|
@ -9,6 +9,7 @@ import * as mt from "mime-types";
|
||||||
import * as os from "os";
|
import * as os from "os";
|
||||||
import {PathLike} from "fs";
|
import {PathLike} from "fs";
|
||||||
import {ChildProcess} from "child_process";
|
import {ChildProcess} from "child_process";
|
||||||
|
import * as https from "https";
|
||||||
|
|
||||||
/* All project files */
|
/* All project files */
|
||||||
type ProjectResourceType = "html" | "js" | "css" | "wasm" | "wav" | "json" | "img" | "i18n" | "pem";
|
type ProjectResourceType = "html" | "js" | "css" | "wasm" | "wav" | "json" | "img" | "i18n" | "pem";
|
||||||
|
@ -495,6 +496,8 @@ namespace server {
|
||||||
let server: http.Server;
|
let server: http.Server;
|
||||||
let php: string;
|
let php: string;
|
||||||
let options: Options;
|
let options: Options;
|
||||||
|
|
||||||
|
const use_https = true;
|
||||||
export async function launch(_files: ProjectResource[], options_: Options) {
|
export async function launch(_files: ProjectResource[], options_: Options) {
|
||||||
options = options_;
|
options = options_;
|
||||||
files = _files;
|
files = _files;
|
||||||
|
@ -513,7 +516,24 @@ namespace server {
|
||||||
console.error("failed to validate php interpreter: %o", error);
|
console.error("failed to validate php interpreter: %o", error);
|
||||||
throw "invalid php interpreter";
|
throw "invalid php interpreter";
|
||||||
}
|
}
|
||||||
server = http.createServer(handle_request);
|
|
||||||
|
if(process.env["ssl_enabled"] || use_https) {
|
||||||
|
//openssl req -nodes -new -x509 -keyout files_key.pem -out files_cert.pem
|
||||||
|
const key_file = process.env["ssl_key"] || path.join(__dirname, "files_key.pem");
|
||||||
|
const cert_file = process.env["ssl_cert"] || path.join(__dirname, "files_cert.pem");
|
||||||
|
if(!await fs.pathExists(key_file))
|
||||||
|
throw "Missing ssl key file";
|
||||||
|
|
||||||
|
if(!await fs.pathExists(cert_file))
|
||||||
|
throw "Missing ssl cert file";
|
||||||
|
|
||||||
|
server = https.createServer({
|
||||||
|
key: await fs.readFile(key_file),
|
||||||
|
cert: await fs.readFile(cert_file),
|
||||||
|
}, handle_request);
|
||||||
|
} else {
|
||||||
|
server = http.createServer(handle_request);
|
||||||
|
}
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
server.on('error', reject);
|
server.on('error', reject);
|
||||||
server.listen(options.port, () => {
|
server.listen(options.port, () => {
|
||||||
|
|
Loading…
Reference in New Issue