Skip to content

Commit 3b0fa35

Browse files
authored
Fix - WebUI unreachable via IPv6 (#1871) (#1873)
* Fixes - WebUI unreachable via IPv6 (#1871) * Rollover version * Align install_pr script working with default Qt6 builds & show authentication failures (#1871)
1 parent 68a630a commit 3b0fa35

File tree

4 files changed

+75
-31
lines changed

4 files changed

+75
-31
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.1.1-beta.1

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased](https://github.com/hyperion-project/hyperion.ng/compare/2.1.0...HEAD)
88

9+
### ⚠️ Breaking Changes
10+
11+
---
12+
13+
### ✨ Added
14+
15+
---
16+
17+
### 🔧 Changed
18+
19+
- **Fixes:**
20+
- WebUI unreachable via IPv6 (#1871)
21+
- Align install_pr script working with default Qt6 builds & show authentication failures (#1871)
22+
23+
---
24+
25+
### 🗑️ Removed
26+
927
## [2.1.0](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.1.0) - 2025-06-12
1028

1129
### ⚠️ Breaking Changes

bin/scripts/install_pr.sh

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ hasPython2=$?
1515
DISTRIBUTION="debian"
1616
CODENAME="bullseye"
1717
ARCHITECTURE=""
18-
WITH_QT5=false
1918

2019
BASE_PATH='.'
2120

@@ -35,21 +34,57 @@ else
3534
exit 1
3635
fi
3736

38-
function request_call() {
37+
request_call() {
38+
local url="$1"
39+
local response body status_code
40+
3941
if [ $hasWget -eq 0 ]; then
40-
echo $(wget --quiet --header="Authorization: token ${PR_TOKEN}" -O - $1)
42+
# Use a temp file to store headers
43+
local headers_file=$(mktemp)
44+
body=$(wget --quiet --server-response --header="Authorization: token ${PR_TOKEN}" -O - "$url" 2> "$headers_file")
45+
status_code=$(awk '/^ HTTP/{code=$2} END{print code}' "$headers_file")
46+
rm -f "$headers_file"
47+
4148
elif [ $hasCurl -eq 0 ]; then
42-
echo $(curl -skH "Authorization: token ${PR_TOKEN}" $1)
49+
# Append status code at the end of the response
50+
response=$(curl -sk -w "\n%{http_code}" -H "Authorization: token ${PR_TOKEN}" "$url")
51+
body=$(echo "$response" | sed '$d') # All but last line
52+
status_code=$(echo "$response" | tail -n1) # Last line = status code
53+
else
54+
echo "---> Neither wget nor curl is available." >&2
55+
exit 1
4356
fi
57+
58+
# Handle common HTTP errors
59+
case "$status_code" in
60+
401)
61+
echo "---> Error: 401 Unauthorized. Check your token." >&2
62+
exit 1
63+
;;
64+
403)
65+
echo "---> Error: 403 Forbidden. You might be rate-limited or lack permissions." >&2
66+
exit 1
67+
;;
68+
404)
69+
echo "---> Error: 404 Not Found. URL is incorrect or resource doesn't exist." >&2
70+
exit 1
71+
;;
72+
5*)
73+
echo "---> Error: Server error ($status_code). Try again later." >&2
74+
exit 1
75+
;;
76+
esac
77+
78+
# Success: print response body
79+
echo "$body"
4480
}
4581

46-
while getopts ":a:c:r:t:5" opt; do
82+
while getopts ":a:c:r:t:" opt; do
4783
case "$opt" in
4884
a) ARCHITECTURE=$OPTARG ;;
4985
c) CONFIGDIR=$OPTARG ;;
5086
r) run_id=$OPTARG ;;
5187
t) PR_TOKEN=$OPTARG ;;
52-
5) WITH_QT5=true ;;
5388
esac
5489
done
5590
shift $((OPTIND - 1))
@@ -103,19 +138,7 @@ if [ $? -ne 0 ]; then
103138
exit 1
104139
else
105140
PACKAGE="${ARCHITECTURE}"
106-
107-
# armv6 has no Qt6 support yet
108-
if [[ "${PACKAGE}" == "armv6" ]]; then
109-
WITH_QT5=true
110-
fi
111-
112-
QTVERSION="5"
113-
if [ ${WITH_QT5} == false ]; then
114-
QTVERSION="6"
115-
PACKAGE="${PACKAGE}_qt6"
116-
fi
117-
118-
echo "---> Download package for identified runtime architecture: $ARCHITECTURE and Qt$QTVERSION"
141+
echo "---> Download package for identified runtime architecture: $ARCHITECTURE"
119142
fi
120143

121144
# Determine if PR number exists

libsrc/utils/NetOrigin.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,34 @@ bool NetOrigin::isLocalAddress(const QHostAddress& ipAddress, const QHostAddress
5858
return true;
5959
}
6060

61-
//Convert to IPv4 to check, if an IPv6 address is an IPv4 mapped address
62-
QHostAddress ipv4Address(address.toIPv4Address());
63-
if (ipv4Address != QHostAddress::AnyIPv4) // ipv4Address is not "0.0.0.0"
61+
// Convert IPv4-mapped IPv6 to pure IPv4
62+
QHostAddress const ipv4Address(address.toIPv4Address());
63+
if (ipv4Address != QHostAddress::AnyIPv4)
6464
{
6565
address = ipv4Address;
6666
}
6767

68-
QList<QNetworkInterface> allInterfaces = QNetworkInterface::allInterfaces();
69-
for (const QNetworkInterface &networkInterface : allInterfaces) {
70-
QList<QNetworkAddressEntry> addressEntries = networkInterface.addressEntries();
71-
for (const QNetworkAddressEntry &localNetworkAddressEntry : addressEntries) {
72-
QHostAddress localIP = localNetworkAddressEntry.ip();
68+
QList<QNetworkInterface> const allInterfaces = QNetworkInterface::allInterfaces();
69+
for (const QNetworkInterface &networkInterface : allInterfaces)
70+
{
71+
QList<QNetworkAddressEntry> const addressEntries = networkInterface.addressEntries();
72+
for (const QNetworkAddressEntry &localNetworkAddressEntry : addressEntries)
73+
{
74+
QHostAddress const localIP = localNetworkAddressEntry.ip();
7375

74-
if(localIP.protocol() != QAbstractSocket::NetworkLayerProtocol::IPv4Protocol)
76+
// Skip protocol mismatch
77+
if (localIP.protocol() != address.protocol())
7578
{
7679
continue;
7780
}
7881

79-
bool isInSubnet = address.isInSubnet(localIP, localNetworkAddressEntry.prefixLength());
80-
if (isInSubnet)
82+
if (address.isInSubnet(localIP, localNetworkAddressEntry.prefixLength()))
8183
{
8284
return true;
8385
}
8486
}
8587
}
88+
8689
return false;
8790
}
8891

0 commit comments

Comments
 (0)