diff --git a/packages/desktop/resources/sample-config.yaml b/packages/desktop/resources/sample-config.yaml index 09e56617..67a8e06d 100644 --- a/packages/desktop/resources/sample-config.yaml +++ b/packages/desktop/resources/sample-config.yaml @@ -111,37 +111,37 @@ window/bar: # --------- Available variables --------- # network.defaultInterface -- the default network interface of the device # network.defaultInterface.name -- string - # network.defaultInterface.friendly_name -- string + # network.defaultInterface.friendlyName -- string # network.defaultInterface.description -- string - # network.defaultInterface.if_type -- Interface Type, Options: Unknown, Ethernet, TokenRing, Fddi, BasicIsdn, PrimaryIsdn, Ppp, Loopback, Ethernet3Megabit, Slip, Atm, GenericModem, FastEthernetT, Isdn, FastEthernetFx, Wireless80211, AsymmetricDsl, RateAdaptDsl, SymmetricDsl, VeryHighSpeedDsl, IPOverAtm, GigabitEthernet, Tunnel, MultiRateSymmetricDsl, HighPerformanceSerialBus, Wman, Wwanpp, Wwanpp2, Bridge + # network.defaultInterface.type -- Interface Type, Options: Unknown, Ethernet, TokenRing, Fddi, BasicIsdn, PrimaryIsdn, Ppp, Loopback, Ethernet3Megabit, Slip, Atm, GenericModem, FastEthernetT, Isdn, FastEthernetFx, Wireless80211, AsymmetricDsl, RateAdaptDsl, SymmetricDsl, VeryHighSpeedDsl, IPOverAtm, GigabitEthernet, Tunnel, MultiRateSymmetricDsl, HighPerformanceSerialBus, Wman, Wwanpp, Wwanpp2, Bridge # network.defaultInterface.ipv4[0] -- array of Ipv4Net objects: ipv4.addr, ipv4.netmask # network.defaultInterface.ipv6[0] -- array of Ipv6Net objects: ipv6.addr, ipv6.netmask - # network.defaultInterface.mac_addr -- MacAddr object - # network.defaultInterface.transmit_speed -- number - # network.defaultInterface.receive_speed -- number - # network.defaultInterface.dns_servers[0] -- array of IpAddr objects - # network.defaultInterface.default -- boolean, whether this is the default interface + # network.defaultInterface.macAddress -- MacAddr object + # network.defaultInterface.transmitSpeed -- number + # network.defaultInterface.receiveSpeed -- number + # network.defaultInterface.dnsServers[0] -- array of IpAddr objects + # network.defaultInterface.isDefault -- boolean, whether this is the default interface # network.defaultGateway -- the default gateway of the device - # network.defaultGateway.mac_addr -- MacAddr object + # network.defaultGateway.macAddress -- MacAddr object # network.defaultGateway.ipv4[0] -- array of Ipv4Addr objects # network.defaultGateway.ipv6[0] -- array of Ipv6Addr objects # network.defaultGateway.ssid -- Windows Only for now, string - # network.defaultGateway.signal_strength_percent -- Windows Only for now, number 0-100 representing % strength - # network.defaultGateway.connected -- Windows Only for now, boolean + # network.defaultGateway.signalStrengthPercent -- Windows Only for now, number 0-100 representing % strength + # network.defaultGateway.isConnected -- Windows Only for now, boolean # network.interfaces -- array of all network interfaces of the device # network.interfaces[0].name -- string - # network.interfaces[0].friendly_name -- string + # network.interfaces[0].friendlyName -- string # network.interfaces[0].description -- string - # network.interfaces[0].if_type -- Interface Type, Options: Unknown, Ethernet, TokenRing, Fddi, BasicIsdn, PrimaryIsdn, Ppp, Loopback, Ethernet3Megabit, Slip, Atm, GenericModem, FastEthernetT, Isdn, FastEthernetFx, Wireless80211, AsymmetricDsl, RateAdaptDsl, SymmetricDsl, VeryHighSpeedDsl, IPOverAtm, GigabitEthernet, Tunnel, MultiRateSymmetricDsl, HighPerformanceSerialBus, Wman, Wwanpp, Wwanpp2, Bridge + # network.interfaces[0].type -- Interface Type, Options: Unknown, Ethernet, TokenRing, Fddi, BasicIsdn, PrimaryIsdn, Ppp, Loopback, Ethernet3Megabit, Slip, Atm, GenericModem, FastEthernetT, Isdn, FastEthernetFx, Wireless80211, AsymmetricDsl, RateAdaptDsl, SymmetricDsl, VeryHighSpeedDsl, IPOverAtm, GigabitEthernet, Tunnel, MultiRateSymmetricDsl, HighPerformanceSerialBus, Wman, Wwanpp, Wwanpp2, Bridge # network.interfaces[0].ipv4[0] -- array of Ipv4Net objects: ipv4.addr, ipv4.netmask # network.interfaces[0].ipv6[0] -- array of Ipv6Net objects: ipv6.addr, ipv6.netmask - # network.interfaces[0].mac_addr -- MacAddr object - # network.interfaces[0].transmit_speed -- numebr - # network.interfaces[0].receive_speed -- number - # network.interfaces[0].dns_servers[0] -- array of IpAddr objects - # network.interfaces[0].default -- boolean, whether this is the default interface + # network.interfaces[0].macAddress -- MacAddr object + # network.interfaces[0].transmitSpeed -- numebr + # network.interfaces[0].receiveSpeed -- number + # network.interfaces[0].dnsServers[0] -- array of IpAddr objects + # network.interfaces[0].isDefault -- boolean, whether this is the default interface # --------- Signal strength explanation --------- # Signal strength is generally measured in dBm. @@ -154,15 +154,15 @@ window/bar: template: | - @if (network.defaultInterface.if_type === 'Ethernet') { - @if (network.defaultGateway.connected !== true) { } + @if (network.defaultInterface.type === 'Ethernet') { + @if (network.defaultGateway.isConnected !== true) { } @else { } } @else if (network.defaultGateway.connected !== true) { } - @else if (network.defaultGateway.signal_strength_percent >= 80) { } - @else if (network.defaultGateway.signal_strength_percent >= 65) { } - @else if (network.defaultGateway.signal_strength_percent >= 40) { } - @else if (network.defaultGateway.signal_strength_percent >= 25) { } + @else if (network.defaultGateway.signalStrengthPercent >= 80) { } + @else if (network.defaultGateway.signalStrengthPercent >= 65) { } + @else if (network.defaultGateway.signalStrengthPercent >= 40) { } + @else if (network.defaultGateway.signalStrengthPercent >= 25) { } @else { } template/memory: diff --git a/packages/desktop/src/providers/network/variables.rs b/packages/desktop/src/providers/network/variables.rs index 5d5751fa..4aceff97 100644 --- a/packages/desktop/src/providers/network/variables.rs +++ b/packages/desktop/src/providers/network/variables.rs @@ -13,11 +13,13 @@ pub struct NetworkVariables { } #[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] pub struct NetworkInterface { pub name: String, pub friendly_name: Option, pub description: Option, #[serde(serialize_with = "interfacetype_ser")] + #[serde(rename = "type")] pub interface_type: NdInterfaceType, #[serde(serialize_with = "ipv4_ser")] pub ipv4: Vec, @@ -32,6 +34,7 @@ pub struct NetworkInterface { } #[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] pub struct Gateway { #[serde(serialize_with = "macaddr_ser")] pub mac_address: NdMacAddr, @@ -43,6 +46,7 @@ pub struct Gateway { } #[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] pub enum InterfaceType { Unknown, Ethernet, @@ -122,6 +126,7 @@ fn interfacetype_ser( } #[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] pub struct Ipv4Net { pub address: Ipv4Addr, pub prefix_length: u8, @@ -157,6 +162,7 @@ fn ipv4_ser( } #[derive(Serialize, Debug, Clone)] +#[serde(rename_all = "camelCase")] struct Ipv6Net { pub address: Ipv6Addr, pub prefix_length: u8,