Skip to content

Commit

Permalink
fix: hide public ip, if not included in label list
Browse files Browse the repository at this point in the history
fixes #690
  • Loading branch information
MauriceNino committed Apr 29, 2023
1 parent c62ba63 commit ccf7d12
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/api/src/data/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export default {
result = {
speedDown: json.speedDown * (unit === 'bit' ? 8 : 1),
speedUp: json.speedUp * (unit === 'bit' ? 8 : 1),
publicIp: json.publicIp,
publicIp: CONFIG.network_label_list.includes('public_ip')
? json.publicIp
: undefined,
};
} else if (CONFIG.accept_ookla_eula && (await commandExists('speedtest'))) {
usedRunner = 'ookla';
Expand All @@ -133,7 +135,9 @@ export default {
result = {
speedDown: json.download.bandwidth * 8,
speedUp: json.upload.bandwidth * 8,
publicIp: json.interface.externalIp,
publicIp: CONFIG.network_label_list.includes('public_ip')
? json.interface.externalIp
: undefined,
};
} else if (await commandExists('speedtest-cli')) {
usedRunner = 'speedtest-cli';
Expand All @@ -143,7 +147,9 @@ export default {
result = {
speedDown: json.download,
speedUp: json.upload,
publicIp: json.client.ip,
publicIp: CONFIG.network_label_list.includes('public_ip')
? json.client.ip
: undefined,
};
} else {
throw new Error(removePad`
Expand Down

0 comments on commit ccf7d12

Please sign in to comment.