Skip to content

Commit

Permalink
Test 5
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jul 8, 2024
1 parent 9477f26 commit 6f399c1
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions pages/settings/PageSettingsTailscale.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Page {
property VeQuickItem hostNameItem: VeQuickItem { uid: Global.systemSettings.serviceUid + "/Settings/Services/Tailscale/Hostname" }

property int connectState: stateItem.isValid ? stateItem.value : 0
property string errorMessage: errorMessageItem.isValid && errorMessageItem.value !== "" && isEnabled ? "\n\nERROR: " + errorMessageItem.value : ""
property string errorMessage: errorMessageItem.isValid && errorMessageItem.value !== "" && isEnabled ? "ERROR: " + errorMessageItem.value : ""
property string hostName: hostNameItem.isValid ? hostNameItem.value : ""
property string ipV4: ipV4Item.isValid ? ipV4Item.value : ""
property string ipV6: ipV6Item.isValid ? ipV6Item.value : ""
Expand All @@ -61,6 +61,12 @@ Page {
property bool isEnabledAndRunning: isEnabled && isRunning
property bool isConnected: connectState == 100 && isEnabledAndRunning


property string network: "Wired"
property string tech: "ethernet"

property alias service: service.service

VeQuickItem {
id: service

Expand All @@ -79,19 +85,15 @@ Page {
readonly property bool manual: method_ === "manual"
property bool secured
property bool favorite
property bool completed

// Only handle changed value after component completion because otherwise <network> may not be set correctly.
// onValueChanged: if (completed) parseJson()
Component.onCompleted: {
completed = true
parseJson()
if (root._wifi) {
setAgent("on")
}
}

function parseJson() {

if (!isValid || typeof value !== "string") {
return
}
Expand Down Expand Up @@ -127,8 +129,9 @@ Page {
secured = details["Secured"] === "yes"
favorite = details["Favorite"] === "yes"

subnet = calculateSubnetFromNetmask(ipAddress, netmask)
console.log("Subnet: " + subnet)
// make subnet available outside of this function
root.subnet = calculateSubnetFromNetmask(ipAddress, netmask)
console.log("Subnet: " + root.subnet)
}
}
}
Expand Down Expand Up @@ -200,9 +203,9 @@ Page {
//% ""
//text: qsTrId("settings_tailscale_")
// NOTE: maybe put this in a separate page to not distract unexpected users
text: "Tailscale is a VPN solution that is based on Wireguard, a fast, modern and secure VPN solution. Enabling Tailscale on a GX device offers remote access to the GX as well as other devices in the same network. A few examples:\n
- Remotely access all ports on the GX device (HTTP, SSH, Modbus TCP, etc.)\n
- Remotely access all ports on other devices in the same network (Web control panel, SSH, Modbus TCP, etc.)"
text: "Tailscale is a VPN solution that is based on Wireguard, a fast, modern and secure VPN solution. Enabling Tailscale on a GX device offers remote access to the GX as well as other devices in the same network. A few examples:\n"
+ "- Remotely access all ports on the GX device (HTTP, SSH, Modbus TCP, etc.)\n"
+ "- Remotely access all ports on other devices in the same network (Web control panel, SSH, Modbus TCP, etc.)"
allowed: VenusOS.User_AccessType_Installer
}

Expand Down Expand Up @@ -340,10 +343,10 @@ Page {
color: Theme.color_font_secondary
//% ""
// text: qsTrId("settings_tailscale_")
text: "Expose physical subnet routes to your entire Tailscale network. Separate multiple IP/subnets by comma.\n
Enter \"" + subnet + "\" to be able to access your local network via Tailscale.\n
\n
NOTE: If you haven't enabled \"autoApprovers\" in the Tailscale admin console, then you need to manually approve the route in the Tailscale admin console. See https://tailscale.com/kb/1019/subnets -> Enable subnet routes from the admin console"
text: "Expose physical subnet routes to your entire Tailscale network. Separate multiple IP/subnets by comma.\n"
+ "Enter \"" + service.subnet + "\" to be able to access your local network via Tailscale.\n"
+ "\n"
+ "NOTE: If you haven't enabled \"autoApprovers\" in the Tailscale admin console, then you need to manually approve the route in the Tailscale admin console. See https://tailscale.com/kb/1019/subnets -> Enable subnet routes from the admin console"
}

enabled: ! isEnabled
Expand Down

0 comments on commit 6f399c1

Please sign in to comment.