diff --git a/WebApp/client/public/onebyone/chatmessage.js b/WebApp/client/public/onebyone/chatmessage.js index 48f6d2d..71c58e2 100644 --- a/WebApp/client/public/onebyone/chatmessage.js +++ b/WebApp/client/public/onebyone/chatmessage.js @@ -73,7 +73,6 @@ export function handleChatMessage(data) { addMessage(data); const isImage = data.content && data.content.startsWith('data:image/'); - const messageType = isImage ? 'file' : 'text'; // 显示通知 if (!data.isSelf) { diff --git a/WebApp/package.json b/WebApp/package.json index 8904246..2f90044 100644 --- a/WebApp/package.json +++ b/WebApp/package.json @@ -6,8 +6,8 @@ "build": "tsc -p tsconfig.build.json", "test": "jest --colors test/*.ts", "newman": "newman run test/renderstreaming.postman_collection.json", - "start": "node ./build/index.js", - "dev": "ts-node ./src/index.ts", + "start": "node ./build/index.js -s -p 8080 -m private -k ./server.key -c ./server.cert", + "dev": "ts-node ./src/index.ts -s -p 8080", "lint": "eslint src/**/*.ts test/**/*.ts", "pack": "pkg ." }, diff --git a/WebApp/src/index.ts b/WebApp/src/index.ts index 0bd49e7..7e4b4cb 100644 --- a/WebApp/src/index.ts +++ b/WebApp/src/index.ts @@ -13,28 +13,30 @@ export class RenderStreaming { public static run(argv: string[]): RenderStreaming { const program = new Command(); const readOptions = (): Options => { - if (Array.isArray(argv)) { - program - .usage('[options] ') - .option('-p, --port ', 'Port to start the server on.', process.env.PORT || `80`) - .option('-s, --secure', 'Enable HTTPS (you need server.key and server.cert).', process.env.SECURE || false) - .option('-k, --keyfile ', 'https key file.', process.env.KEYFILE || 'server.key') - .option('-c, --certfile ', 'https cert file.', process.env.CERTFILE || 'server.cert') - .option('-t, --type ', 'Type of signaling protocol, Choose websocket or http.', process.env.TYPE || 'websocket') - .option('-m, --mode ', 'Choose Communication mode public or private.', process.env.MODE || 'public') - .option('-l, --logging ', 'Choose http logging type combined, dev, short, tiny or none.', process.env.LOGGING || 'dev') - .parse(argv); - const option = program.opts(); - return { - port: option.port, - secure: option.secure == undefined ? false : option.secure, - keyfile: option.keyfile, - certfile: option.certfile, - type: option.type == undefined ? 'websocket' : option.type, - mode: option.mode, - logging: option.logging, - }; - } + // 确保argv是数组 + const args = Array.isArray(argv) ? argv : process.argv; + + program + .usage('[options] ') + .option('-p, --port ', 'Port to start the server on.', process.env.PORT || `80`) + .option('-s, --secure', 'Enable HTTPS (you need server.key and server.cert).', process.env.SECURE || true) + .option('-k, --keyfile ', 'https key file.', process.env.KEYFILE || 'server.key') + .option('-c, --certfile ', 'https cert file.', process.env.CERTFILE || 'server.cert') + .option('-t, --type ', 'Type of signaling protocol, Choose websocket or http.', process.env.TYPE || 'websocket') + .option('-m, --mode ', 'Choose Communication mode public or private.', process.env.MODE || 'public') + .option('-l, --logging ', 'Choose http logging type combined, dev, short, tiny or none.', process.env.LOGGING || 'dev') + .parse(args); + + const option = program.opts(); + return { + port: option.port, + secure: option.secure == undefined ? false : option.secure, + keyfile: option.keyfile, + certfile: option.certfile, + type: option.type == undefined ? 'websocket' : option.type, + mode: option.mode, + logging: option.logging, + }; }; const options = readOptions(); return new RenderStreaming(options);