diff --git a/acarshub-typescript/package.json b/acarshub-typescript/package.json index f20fda54..f140115b 100644 --- a/acarshub-typescript/package.json +++ b/acarshub-typescript/package.json @@ -1,6 +1,6 @@ { "name": "acarshub-typescript", - "version": "3.8.0", + "version": "3.8.1", "description": "Web front end for the docker-acarshub project", "main": "index.js", "repository": "https://github.com/sdr-enthusiasts/docker-acarshub", diff --git a/acarshub-typescript/src/helpers/html_functions.ts b/acarshub-typescript/src/helpers/html_functions.ts index 4c84a94e..10168d5d 100644 --- a/acarshub-typescript/src/helpers/html_functions.ts +++ b/acarshub-typescript/src/helpers/html_functions.ts @@ -265,13 +265,17 @@ export let html_functions = { : ""; html_output += typeof message.matched_icao === "object" - ? this.replace_text(message.matched_icao, message.icao.toString()) + - `${!footer ? "
" : ""}` + ? this.replace_text( + message.matched_icao, + this.ensure_hex_is_uppercase_and_six_chars( + message.icao.toString() + ) + ) + `${!footer ? "
" : ""}` : `${message.icao}`; html_output += typeof message.icao_hex !== "undefined" && typeof message.matched_icao === "undefined" - ? `/${message.icao_hex}` + ? `/${this.ensure_hex_is_uppercase_and_six_chars(message.icao_hex)}` : ""; html_output += typeof message.icao_hex !== "undefined" && @@ -280,7 +284,9 @@ export let html_functions = { ? "/" + this.replace_text( message.matched_icao, - message.icao_hex.toString() + this.ensure_hex_is_uppercase_and_six_chars( + message.icao_hex.toString() + ) ) + `${!footer ? "
" : ""}` : ""; @@ -382,4 +388,8 @@ export let html_functions = { return html_output; }, + + ensure_hex_is_uppercase_and_six_chars: function (hex: string): string { + return hex.toUpperCase().padStart(6, "0"); + }, }; diff --git a/acarshub-typescript/src/helpers/html_generator.ts b/acarshub-typescript/src/helpers/html_generator.ts index ece688d7..60704b66 100644 --- a/acarshub-typescript/src/helpers/html_generator.ts +++ b/acarshub-typescript/src/helpers/html_generator.ts @@ -212,7 +212,10 @@ export function display_message_group( "To Address", message.toaddr + (typeof message.toaddr_hex !== "undefined" - ? "/" + message.toaddr_hex + ? "/" + + html_functions.ensure_hex_is_uppercase_and_six_chars( + message.toaddr_hex + ) : "/?") ) : ""; @@ -231,7 +234,10 @@ export function display_message_group( "From Address", message.fromaddr + (typeof message.fromaddr_hex !== "undefined" - ? "/" + message.fromaddr_hex + ? "/" + + html_functions.ensure_hex_is_uppercase_and_six_chars( + message.fromaddr_hex + ) : "/?") ) : ""; diff --git a/version-nextgen b/version-nextgen index 40c06ccb..32f8572e 100644 --- a/version-nextgen +++ b/version-nextgen @@ -1 +1 @@ -v3.8.0 +v3.8.1