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