Skip to content

Commit

Permalink
Merge pull request #1376 from sdr-enthusiasts/hex
Browse files Browse the repository at this point in the history
Hex
  • Loading branch information
fredclausen authored Feb 12, 2025
2 parents 03fd8bb + 640d5f3 commit 2ec23dd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion acarshub-typescript/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 14 additions & 4 deletions acarshub-typescript/src/helpers/html_functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "<br>" : ""}`
? this.replace_text(
message.matched_icao,
this.ensure_hex_is_uppercase_and_six_chars(
message.icao.toString()
)
) + `${!footer ? "<br>" : ""}`
: `${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" &&
Expand All @@ -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 ? "<br>" : ""}`
: "";
Expand Down Expand Up @@ -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");
},
};
10 changes: 8 additions & 2 deletions acarshub-typescript/src/helpers/html_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
: "/?")
)
: "";
Expand All @@ -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
)
: "/?")
)
: "";
Expand Down
2 changes: 1 addition & 1 deletion version-nextgen
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.8.0
v3.8.1

0 comments on commit 2ec23dd

Please sign in to comment.