From e75bc5d3fe24979ca59c995a7decbcbf720a20a8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 31 May 2022 11:35:32 +0200 Subject: style(master): change server eol to LF --- master/server/src/server.ts | 4 +++- master/server/src/utility.ts | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'master/server/src') diff --git a/master/server/src/server.ts b/master/server/src/server.ts index 4368b78..5774a2b 100644 --- a/master/server/src/server.ts +++ b/master/server/src/server.ts @@ -161,10 +161,12 @@ async function main() { } }); - const address = nw_interface_info.address; + const local_address = nw_interface_info.address; const port = 80; + const address = is_prod ? local_address : "localhost"; + await app.listen(port, address); console.log(`Listening on address http://${address}:${port}`); diff --git a/master/server/src/utility.ts b/master/server/src/utility.ts index 6a02575..f0061f7 100644 --- a/master/server/src/utility.ts +++ b/master/server/src/utility.ts @@ -1,16 +1,16 @@ -export function filter_object< - ObjectType, - Key extends keyof ObjectType, - Value extends ObjectType[keyof ObjectType] ->( - obj: ObjectType, - filter_cb: (key: Key, value: Value) => boolean -) { - const entries = Object.entries(obj); - - const filtered = entries.filter(([ str_key, any_value ]) => { - return filter_cb(str_key as Key, any_value as Value); - }); - - return Object.fromEntries(filtered) as ObjectType; -} +export function filter_object< + ObjectType, + Key extends keyof ObjectType, + Value extends ObjectType[keyof ObjectType] +>( + obj: ObjectType, + filter_cb: (key: Key, value: Value) => boolean +) { + const entries = Object.entries(obj); + + const filtered = entries.filter(([ str_key, any_value ]) => { + return filter_cb(str_key as Key, any_value as Value); + }); + + return Object.fromEntries(filtered) as ObjectType; +} -- cgit v1.2.3-18-g5258