mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
network: support hidden SSIDs
This commit is contained in:
@@ -357,31 +357,51 @@ func (b *NetworkManagerBackend) updateWiFiNetworks() ([]WiFiNetwork, error) {
|
|||||||
|
|
||||||
savedSSIDs := make(map[string]bool)
|
savedSSIDs := make(map[string]bool)
|
||||||
autoconnectMap := make(map[string]bool)
|
autoconnectMap := make(map[string]bool)
|
||||||
|
hiddenSSIDs := make(map[string]bool)
|
||||||
for _, conn := range connections {
|
for _, conn := range connections {
|
||||||
connSettings, err := conn.GetSettings()
|
connSettings, err := conn.GetSettings()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if connMeta, ok := connSettings["connection"]; ok {
|
connMeta, ok := connSettings["connection"]
|
||||||
if connType, ok := connMeta["type"].(string); ok && connType == "802-11-wireless" {
|
if !ok {
|
||||||
if wifiSettings, ok := connSettings["802-11-wireless"]; ok {
|
continue
|
||||||
if ssidBytes, ok := wifiSettings["ssid"].([]byte); ok {
|
}
|
||||||
ssid := string(ssidBytes)
|
|
||||||
savedSSIDs[ssid] = true
|
connType, ok := connMeta["type"].(string)
|
||||||
autoconnect := true
|
if !ok || connType != "802-11-wireless" {
|
||||||
if ac, ok := connMeta["autoconnect"].(bool); ok {
|
continue
|
||||||
autoconnect = ac
|
}
|
||||||
}
|
|
||||||
autoconnectMap[ssid] = autoconnect
|
wifiSettings, ok := connSettings["802-11-wireless"]
|
||||||
}
|
if !ok {
|
||||||
}
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssidBytes, ok := wifiSettings["ssid"].([]byte)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ssid := string(ssidBytes)
|
||||||
|
savedSSIDs[ssid] = true
|
||||||
|
autoconnect := true
|
||||||
|
if ac, ok := connMeta["autoconnect"].(bool); ok {
|
||||||
|
autoconnect = ac
|
||||||
|
}
|
||||||
|
autoconnectMap[ssid] = autoconnect
|
||||||
|
|
||||||
|
if hidden, ok := wifiSettings["hidden"].(bool); ok && hidden {
|
||||||
|
hiddenSSIDs[ssid] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.stateMutex.RLock()
|
b.stateMutex.RLock()
|
||||||
currentSSID := b.state.WiFiSSID
|
currentSSID := b.state.WiFiSSID
|
||||||
|
wifiConnected := b.state.WiFiConnected
|
||||||
|
wifiSignal := b.state.WiFiSignal
|
||||||
|
wifiBSSID := b.state.WiFiBSSID
|
||||||
b.stateMutex.RUnlock()
|
b.stateMutex.RUnlock()
|
||||||
|
|
||||||
seenSSIDs := make(map[string]*WiFiNetwork)
|
seenSSIDs := make(map[string]*WiFiNetwork)
|
||||||
@@ -444,6 +464,7 @@ func (b *NetworkManagerBackend) updateWiFiNetworks() ([]WiFiNetwork, error) {
|
|||||||
Connected: ssid == currentSSID,
|
Connected: ssid == currentSSID,
|
||||||
Saved: savedSSIDs[ssid],
|
Saved: savedSSIDs[ssid],
|
||||||
Autoconnect: autoconnectMap[ssid],
|
Autoconnect: autoconnectMap[ssid],
|
||||||
|
Hidden: hiddenSSIDs[ssid],
|
||||||
Frequency: freq,
|
Frequency: freq,
|
||||||
Mode: modeStr,
|
Mode: modeStr,
|
||||||
Rate: maxBitrate / 1000,
|
Rate: maxBitrate / 1000,
|
||||||
@@ -454,6 +475,23 @@ func (b *NetworkManagerBackend) updateWiFiNetworks() ([]WiFiNetwork, error) {
|
|||||||
networks = append(networks, network)
|
networks = append(networks, network)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if wifiConnected && currentSSID != "" {
|
||||||
|
if _, exists := seenSSIDs[currentSSID]; !exists {
|
||||||
|
hiddenNetwork := WiFiNetwork{
|
||||||
|
SSID: currentSSID,
|
||||||
|
BSSID: wifiBSSID,
|
||||||
|
Signal: wifiSignal,
|
||||||
|
Secured: true,
|
||||||
|
Connected: true,
|
||||||
|
Saved: savedSSIDs[currentSSID],
|
||||||
|
Autoconnect: autoconnectMap[currentSSID],
|
||||||
|
Hidden: true,
|
||||||
|
Mode: "infrastructure",
|
||||||
|
}
|
||||||
|
networks = append(networks, hiddenNetwork)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sortWiFiNetworks(networks)
|
sortWiFiNetworks(networks)
|
||||||
|
|
||||||
b.stateMutex.Lock()
|
b.stateMutex.Lock()
|
||||||
@@ -515,40 +553,53 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
|||||||
nm := b.nmConn.(gonetworkmanager.NetworkManager)
|
nm := b.nmConn.(gonetworkmanager.NetworkManager)
|
||||||
dev := devInfo.device
|
dev := devInfo.device
|
||||||
w := devInfo.wireless
|
w := devInfo.wireless
|
||||||
apPaths, err := w.GetAccessPoints()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to get access points: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var targetAP gonetworkmanager.AccessPoint
|
var targetAP gonetworkmanager.AccessPoint
|
||||||
for _, ap := range apPaths {
|
var flags, wpaFlags, rsnFlags uint32
|
||||||
ssid, err := ap.GetPropertySSID()
|
|
||||||
if err != nil || ssid != req.SSID {
|
if !req.Hidden {
|
||||||
continue
|
apPaths, err := w.GetAccessPoints()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get access points: %w", err)
|
||||||
}
|
}
|
||||||
targetAP = ap
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if targetAP == nil {
|
for _, ap := range apPaths {
|
||||||
return fmt.Errorf("access point not found: %s", req.SSID)
|
ssid, err := ap.GetPropertySSID()
|
||||||
}
|
if err != nil || ssid != req.SSID {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
targetAP = ap
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
flags, _ := targetAP.GetPropertyFlags()
|
if targetAP == nil {
|
||||||
wpaFlags, _ := targetAP.GetPropertyWPAFlags()
|
return fmt.Errorf("access point not found: %s", req.SSID)
|
||||||
rsnFlags, _ := targetAP.GetPropertyRSNFlags()
|
}
|
||||||
|
|
||||||
|
flags, _ = targetAP.GetPropertyFlags()
|
||||||
|
wpaFlags, _ = targetAP.GetPropertyWPAFlags()
|
||||||
|
rsnFlags, _ = targetAP.GetPropertyRSNFlags()
|
||||||
|
}
|
||||||
|
|
||||||
const KeyMgmt8021x = uint32(512)
|
const KeyMgmt8021x = uint32(512)
|
||||||
const KeyMgmtPsk = uint32(256)
|
const KeyMgmtPsk = uint32(256)
|
||||||
const KeyMgmtSae = uint32(1024)
|
const KeyMgmtSae = uint32(1024)
|
||||||
|
|
||||||
isEnterprise := (wpaFlags&KeyMgmt8021x) != 0 || (rsnFlags&KeyMgmt8021x) != 0
|
var isEnterprise, isPsk, isSae, secured bool
|
||||||
isPsk := (wpaFlags&KeyMgmtPsk) != 0 || (rsnFlags&KeyMgmtPsk) != 0
|
|
||||||
isSae := (wpaFlags&KeyMgmtSae) != 0 || (rsnFlags&KeyMgmtSae) != 0
|
|
||||||
|
|
||||||
secured := flags != uint32(gonetworkmanager.Nm80211APFlagsNone) ||
|
switch {
|
||||||
wpaFlags != uint32(gonetworkmanager.Nm80211APSecNone) ||
|
case req.Hidden:
|
||||||
rsnFlags != uint32(gonetworkmanager.Nm80211APSecNone)
|
secured = req.Password != "" || req.Username != ""
|
||||||
|
isEnterprise = req.Username != ""
|
||||||
|
isPsk = req.Password != "" && !isEnterprise
|
||||||
|
default:
|
||||||
|
isEnterprise = (wpaFlags&KeyMgmt8021x) != 0 || (rsnFlags&KeyMgmt8021x) != 0
|
||||||
|
isPsk = (wpaFlags&KeyMgmtPsk) != 0 || (rsnFlags&KeyMgmtPsk) != 0
|
||||||
|
isSae = (wpaFlags&KeyMgmtSae) != 0 || (rsnFlags&KeyMgmtSae) != 0
|
||||||
|
secured = flags != uint32(gonetworkmanager.Nm80211APFlagsNone) ||
|
||||||
|
wpaFlags != uint32(gonetworkmanager.Nm80211APSecNone) ||
|
||||||
|
rsnFlags != uint32(gonetworkmanager.Nm80211APSecNone)
|
||||||
|
}
|
||||||
|
|
||||||
if isEnterprise {
|
if isEnterprise {
|
||||||
log.Infof("[createAndConnectWiFi] Enterprise network detected (802.1x) - SSID: %s, interactive: %v",
|
log.Infof("[createAndConnectWiFi] Enterprise network detected (802.1x) - SSID: %s, interactive: %v",
|
||||||
@@ -567,11 +618,15 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
|||||||
settings["ipv6"] = map[string]any{"method": "auto"}
|
settings["ipv6"] = map[string]any{"method": "auto"}
|
||||||
|
|
||||||
if secured {
|
if secured {
|
||||||
settings["802-11-wireless"] = map[string]any{
|
wifiSettings := map[string]any{
|
||||||
"ssid": []byte(req.SSID),
|
"ssid": []byte(req.SSID),
|
||||||
"mode": "infrastructure",
|
"mode": "infrastructure",
|
||||||
"security": "802-11-wireless-security",
|
"security": "802-11-wireless-security",
|
||||||
}
|
}
|
||||||
|
if req.Hidden {
|
||||||
|
wifiSettings["hidden"] = true
|
||||||
|
}
|
||||||
|
settings["802-11-wireless"] = wifiSettings
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case isEnterprise || req.Username != "":
|
case isEnterprise || req.Username != "":
|
||||||
@@ -658,10 +713,14 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
|||||||
return fmt.Errorf("secured network but not SAE/PSK/802.1X (rsn=0x%x wpa=0x%x)", rsnFlags, wpaFlags)
|
return fmt.Errorf("secured network but not SAE/PSK/802.1X (rsn=0x%x wpa=0x%x)", rsnFlags, wpaFlags)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settings["802-11-wireless"] = map[string]any{
|
wifiSettings := map[string]any{
|
||||||
"ssid": []byte(req.SSID),
|
"ssid": []byte(req.SSID),
|
||||||
"mode": "infrastructure",
|
"mode": "infrastructure",
|
||||||
}
|
}
|
||||||
|
if req.Hidden {
|
||||||
|
wifiSettings["hidden"] = true
|
||||||
|
}
|
||||||
|
settings["802-11-wireless"] = wifiSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Interactive {
|
if req.Interactive {
|
||||||
@@ -685,14 +744,23 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
|||||||
log.Infof("[createAndConnectWiFi] Enterprise connection added, activating (secret agent will be called)")
|
log.Infof("[createAndConnectWiFi] Enterprise connection added, activating (secret agent will be called)")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = nm.ActivateWirelessConnection(conn, dev, targetAP)
|
if req.Hidden {
|
||||||
|
_, err = nm.ActivateConnection(conn, dev, nil)
|
||||||
|
} else {
|
||||||
|
_, err = nm.ActivateWirelessConnection(conn, dev, targetAP)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to activate connection: %w", err)
|
return fmt.Errorf("failed to activate connection: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("[createAndConnectWiFi] Connection activation initiated, waiting for NetworkManager state changes...")
|
log.Infof("[createAndConnectWiFi] Connection activation initiated, waiting for NetworkManager state changes...")
|
||||||
} else {
|
} else {
|
||||||
_, err = nm.AddAndActivateWirelessConnection(settings, dev, targetAP)
|
var err error
|
||||||
|
if req.Hidden {
|
||||||
|
_, err = nm.AddAndActivateConnection(settings, dev)
|
||||||
|
} else {
|
||||||
|
_, err = nm.AddAndActivateWirelessConnection(settings, dev, targetAP)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to connect: %w", err)
|
return fmt.Errorf("failed to connect: %w", err)
|
||||||
}
|
}
|
||||||
@@ -813,6 +881,7 @@ func (b *NetworkManagerBackend) updateAllWiFiDevices() {
|
|||||||
|
|
||||||
savedSSIDs := make(map[string]bool)
|
savedSSIDs := make(map[string]bool)
|
||||||
autoconnectMap := make(map[string]bool)
|
autoconnectMap := make(map[string]bool)
|
||||||
|
hiddenSSIDs := make(map[string]bool)
|
||||||
for _, conn := range connections {
|
for _, conn := range connections {
|
||||||
connSettings, err := conn.GetSettings()
|
connSettings, err := conn.GetSettings()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -846,6 +915,10 @@ func (b *NetworkManagerBackend) updateAllWiFiDevices() {
|
|||||||
autoconnect = ac
|
autoconnect = ac
|
||||||
}
|
}
|
||||||
autoconnectMap[ssid] = autoconnect
|
autoconnectMap[ssid] = autoconnect
|
||||||
|
|
||||||
|
if hidden, ok := wifiSettings["hidden"].(bool); ok && hidden {
|
||||||
|
hiddenSSIDs[ssid] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var devices []WiFiDevice
|
var devices []WiFiDevice
|
||||||
@@ -939,6 +1012,7 @@ func (b *NetworkManagerBackend) updateAllWiFiDevices() {
|
|||||||
Connected: connected && apSSID == ssid,
|
Connected: connected && apSSID == ssid,
|
||||||
Saved: savedSSIDs[apSSID],
|
Saved: savedSSIDs[apSSID],
|
||||||
Autoconnect: autoconnectMap[apSSID],
|
Autoconnect: autoconnectMap[apSSID],
|
||||||
|
Hidden: hiddenSSIDs[apSSID],
|
||||||
Frequency: freq,
|
Frequency: freq,
|
||||||
Mode: modeStr,
|
Mode: modeStr,
|
||||||
Rate: maxBitrate / 1000,
|
Rate: maxBitrate / 1000,
|
||||||
@@ -949,6 +1023,25 @@ func (b *NetworkManagerBackend) updateAllWiFiDevices() {
|
|||||||
seenSSIDs[apSSID] = &network
|
seenSSIDs[apSSID] = &network
|
||||||
networks = append(networks, network)
|
networks = append(networks, network)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if connected && ssid != "" {
|
||||||
|
if _, exists := seenSSIDs[ssid]; !exists {
|
||||||
|
hiddenNetwork := WiFiNetwork{
|
||||||
|
SSID: ssid,
|
||||||
|
BSSID: bssid,
|
||||||
|
Signal: signal,
|
||||||
|
Secured: true,
|
||||||
|
Connected: true,
|
||||||
|
Saved: savedSSIDs[ssid],
|
||||||
|
Autoconnect: autoconnectMap[ssid],
|
||||||
|
Hidden: true,
|
||||||
|
Mode: "infrastructure",
|
||||||
|
Device: name,
|
||||||
|
}
|
||||||
|
networks = append(networks, hiddenNetwork)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sortWiFiNetworks(networks)
|
sortWiFiNetworks(networks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ type WiFiNetwork struct {
|
|||||||
Connected bool `json:"connected"`
|
Connected bool `json:"connected"`
|
||||||
Saved bool `json:"saved"`
|
Saved bool `json:"saved"`
|
||||||
Autoconnect bool `json:"autoconnect"`
|
Autoconnect bool `json:"autoconnect"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
Frequency uint32 `json:"frequency"`
|
Frequency uint32 `json:"frequency"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
Rate uint32 `json:"rate"`
|
Rate uint32 `json:"rate"`
|
||||||
@@ -127,6 +128,7 @@ type ConnectionRequest struct {
|
|||||||
AnonymousIdentity string `json:"anonymousIdentity,omitempty"`
|
AnonymousIdentity string `json:"anonymousIdentity,omitempty"`
|
||||||
DomainSuffixMatch string `json:"domainSuffixMatch,omitempty"`
|
DomainSuffixMatch string `json:"domainSuffixMatch,omitempty"`
|
||||||
Interactive bool `json:"interactive,omitempty"`
|
Interactive bool `json:"interactive,omitempty"`
|
||||||
|
Hidden bool `json:"hidden,omitempty"`
|
||||||
Device string `json:"device,omitempty"`
|
Device string `json:"device,omitempty"`
|
||||||
EAPMethod string `json:"eapMethod,omitempty"`
|
EAPMethod string `json:"eapMethod,omitempty"`
|
||||||
Phase2Auth string `json:"phase2Auth,omitempty"`
|
Phase2Auth string `json:"phase2Auth,omitempty"`
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ FloatingWindow {
|
|||||||
property string wifiPasswordInput: ""
|
property string wifiPasswordInput: ""
|
||||||
property string wifiUsernameInput: ""
|
property string wifiUsernameInput: ""
|
||||||
property bool requiresEnterprise: false
|
property bool requiresEnterprise: false
|
||||||
|
property bool isHiddenNetwork: false
|
||||||
|
|
||||||
property string wifiAnonymousIdentityInput: ""
|
property string wifiAnonymousIdentityInput: ""
|
||||||
property string wifiDomainInput: ""
|
property string wifiDomainInput: ""
|
||||||
@@ -44,6 +45,8 @@ FloatingWindow {
|
|||||||
property int calculatedHeight: {
|
property int calculatedHeight: {
|
||||||
let h = headerHeight + buttonRowHeight + Theme.spacingL * 2;
|
let h = headerHeight + buttonRowHeight + Theme.spacingL * 2;
|
||||||
h += fieldsInfo.length * inputFieldWithSpacing;
|
h += fieldsInfo.length * inputFieldWithSpacing;
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
h += inputFieldWithSpacing;
|
||||||
if (showUsernameField)
|
if (showUsernameField)
|
||||||
h += inputFieldWithSpacing;
|
h += inputFieldWithSpacing;
|
||||||
if (showPasswordField)
|
if (showPasswordField)
|
||||||
@@ -68,6 +71,10 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isHiddenNetwork) {
|
||||||
|
ssidInput.forceActiveFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (requiresEnterprise && !isVpnPrompt) {
|
if (requiresEnterprise && !isVpnPrompt) {
|
||||||
usernameInput.forceActiveFocus();
|
usernameInput.forceActiveFocus();
|
||||||
return;
|
return;
|
||||||
@@ -82,6 +89,7 @@ FloatingWindow {
|
|||||||
wifiAnonymousIdentityInput = "";
|
wifiAnonymousIdentityInput = "";
|
||||||
wifiDomainInput = "";
|
wifiDomainInput = "";
|
||||||
isPromptMode = false;
|
isPromptMode = false;
|
||||||
|
isHiddenNetwork = false;
|
||||||
promptToken = "";
|
promptToken = "";
|
||||||
promptReason = "";
|
promptReason = "";
|
||||||
promptFields = [];
|
promptFields = [];
|
||||||
@@ -100,6 +108,30 @@ FloatingWindow {
|
|||||||
Qt.callLater(focusFirstField);
|
Qt.callLater(focusFirstField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showHidden() {
|
||||||
|
wifiPasswordSSID = "";
|
||||||
|
wifiPasswordInput = "";
|
||||||
|
wifiUsernameInput = "";
|
||||||
|
wifiAnonymousIdentityInput = "";
|
||||||
|
wifiDomainInput = "";
|
||||||
|
isPromptMode = false;
|
||||||
|
isHiddenNetwork = true;
|
||||||
|
promptToken = "";
|
||||||
|
promptReason = "";
|
||||||
|
promptFields = [];
|
||||||
|
promptSetting = "";
|
||||||
|
isVpnPrompt = false;
|
||||||
|
connectionName = "";
|
||||||
|
vpnServiceType = "";
|
||||||
|
connectionType = "";
|
||||||
|
fieldsInfo = [];
|
||||||
|
secretValues = {};
|
||||||
|
requiresEnterprise = false;
|
||||||
|
|
||||||
|
visible = true;
|
||||||
|
Qt.callLater(focusFirstField);
|
||||||
|
}
|
||||||
|
|
||||||
function showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService, fInfo) {
|
function showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService, fInfo) {
|
||||||
isPromptMode = true;
|
isPromptMode = true;
|
||||||
promptToken = token;
|
promptToken = token;
|
||||||
@@ -184,8 +216,9 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
NetworkService.submitCredentials(promptToken, secrets, savePasswordCheckbox.checked);
|
NetworkService.submitCredentials(promptToken, secrets, savePasswordCheckbox.checked);
|
||||||
} else {
|
} else {
|
||||||
|
const ssid = isHiddenNetwork ? ssidInput.text : wifiPasswordSSID;
|
||||||
const username = requiresEnterprise ? usernameInput.text : "";
|
const username = requiresEnterprise ? usernameInput.text : "";
|
||||||
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username, wifiAnonymousIdentityInput, wifiDomainInput);
|
NetworkService.connectToWifi(ssid, passwordInput.text, username, wifiAnonymousIdentityInput, wifiDomainInput, isHiddenNetwork);
|
||||||
}
|
}
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
@@ -196,6 +229,8 @@ FloatingWindow {
|
|||||||
passwordInput.text = "";
|
passwordInput.text = "";
|
||||||
if (requiresEnterprise)
|
if (requiresEnterprise)
|
||||||
usernameInput.text = "";
|
usernameInput.text = "";
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
ssidInput.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearAndClose() {
|
function clearAndClose() {
|
||||||
@@ -215,6 +250,8 @@ FloatingWindow {
|
|||||||
return I18n.tr("Smartcard PIN");
|
return I18n.tr("Smartcard PIN");
|
||||||
if (isVpnPrompt)
|
if (isVpnPrompt)
|
||||||
return I18n.tr("VPN Password");
|
return I18n.tr("VPN Password");
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
return I18n.tr("Hidden Network");
|
||||||
return I18n.tr("Wi-Fi Password");
|
return I18n.tr("Wi-Fi Password");
|
||||||
}
|
}
|
||||||
minimumSize: Qt.size(420, calculatedHeight)
|
minimumSize: Qt.size(420, calculatedHeight)
|
||||||
@@ -236,6 +273,7 @@ FloatingWindow {
|
|||||||
usernameInput.text = "";
|
usernameInput.text = "";
|
||||||
anonInput.text = "";
|
anonInput.text = "";
|
||||||
domainMatchInput.text = "";
|
domainMatchInput.text = "";
|
||||||
|
ssidInput.text = "";
|
||||||
for (var i = 0; i < dynamicFieldsRepeater.count; i++) {
|
for (var i = 0; i < dynamicFieldsRepeater.count; i++) {
|
||||||
const item = dynamicFieldsRepeater.itemAt(i);
|
const item = dynamicFieldsRepeater.itemAt(i);
|
||||||
if (item?.children[0])
|
if (item?.children[0])
|
||||||
@@ -296,6 +334,8 @@ FloatingWindow {
|
|||||||
return I18n.tr("Smartcard Authentication");
|
return I18n.tr("Smartcard Authentication");
|
||||||
if (isVpnPrompt)
|
if (isVpnPrompt)
|
||||||
return I18n.tr("Connect to VPN");
|
return I18n.tr("Connect to VPN");
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
return I18n.tr("Connect to Hidden Network");
|
||||||
return I18n.tr("Connect to Wi-Fi");
|
return I18n.tr("Connect to Wi-Fi");
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
@@ -315,6 +355,8 @@ FloatingWindow {
|
|||||||
return I18n.tr("Enter credentials for ") + wifiPasswordSSID;
|
return I18n.tr("Enter credentials for ") + wifiPasswordSSID;
|
||||||
if (isVpnPrompt)
|
if (isVpnPrompt)
|
||||||
return I18n.tr("Enter password for ") + wifiPasswordSSID;
|
return I18n.tr("Enter password for ") + wifiPasswordSSID;
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
return I18n.tr("Enter network name and password");
|
||||||
const prefix = requiresEnterprise ? I18n.tr("Enter credentials for ") : I18n.tr("Enter password for ");
|
const prefix = requiresEnterprise ? I18n.tr("Enter credentials for ") : I18n.tr("Enter password for ");
|
||||||
return prefix + wifiPasswordSSID;
|
return prefix + wifiPasswordSSID;
|
||||||
}
|
}
|
||||||
@@ -357,6 +399,34 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: inputFieldHeight
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceHover
|
||||||
|
border.color: ssidInput.activeFocus ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: ssidInput.activeFocus ? 2 : 1
|
||||||
|
visible: isHiddenNetwork
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: ssidInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: ssidInput
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
textColor: Theme.surfaceText
|
||||||
|
placeholderText: I18n.tr("Network Name (SSID)")
|
||||||
|
backgroundColor: "transparent"
|
||||||
|
enabled: root.visible
|
||||||
|
keyNavigationTab: passwordInput
|
||||||
|
onAccepted: passwordInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: dynamicFieldsRepeater
|
id: dynamicFieldsRepeater
|
||||||
model: fieldsInfo
|
model: fieldsInfo
|
||||||
@@ -696,6 +766,8 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
if (isVpnPrompt)
|
if (isVpnPrompt)
|
||||||
return passwordInput.text.length > 0;
|
return passwordInput.text.length > 0;
|
||||||
|
if (isHiddenNetwork)
|
||||||
|
return ssidInput.text.length > 0;
|
||||||
return requiresEnterprise ? (usernameInput.text.length > 0 && passwordInput.text.length > 0) : passwordInput.text.length > 0;
|
return requiresEnterprise ? (usernameInput.text.length > 0 && passwordInput.text.length > 0) : passwordInput.text.length > 0;
|
||||||
}
|
}
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
|
|||||||
@@ -768,6 +768,13 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
iconName: "wifi_find"
|
||||||
|
buttonSize: 32
|
||||||
|
visible: NetworkService.backend === "networkmanager" && NetworkService.wifiEnabled && !NetworkService.wifiToggling
|
||||||
|
onClicked: PopoutService.showHiddenNetworkModal()
|
||||||
|
}
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
iconName: "refresh"
|
iconName: "refresh"
|
||||||
buttonSize: 32
|
buttonSize: 32
|
||||||
@@ -1102,6 +1109,14 @@ Item {
|
|||||||
visible: isPinned
|
visible: isPinned
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "visibility_off"
|
||||||
|
size: 14
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
visible: modelData.hidden || false
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -1127,6 +1142,20 @@ Item {
|
|||||||
visible: modelData.saved
|
visible: modelData.saved
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "•"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
visible: modelData.hidden || false
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Hidden")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
visible: modelData.hidden || false
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "•"
|
text: "•"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ Singleton {
|
|||||||
scanWifi();
|
scanWifi();
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "", hidden = false) {
|
||||||
if (!networkAvailable || isConnecting)
|
if (!networkAvailable || isConnecting)
|
||||||
return;
|
return;
|
||||||
pendingConnectionSSID = ssid;
|
pendingConnectionSSID = ssid;
|
||||||
@@ -427,6 +427,8 @@ Singleton {
|
|||||||
};
|
};
|
||||||
if (effectiveWifiDevice)
|
if (effectiveWifiDevice)
|
||||||
params.device = effectiveWifiDevice;
|
params.device = effectiveWifiDevice;
|
||||||
|
if (hidden)
|
||||||
|
params.hidden = true;
|
||||||
|
|
||||||
if (DMSService.apiVersion >= 7) {
|
if (DMSService.apiVersion >= 7) {
|
||||||
if (password || username) {
|
if (password || username) {
|
||||||
@@ -611,8 +613,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "", hidden = false) {
|
||||||
connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch);
|
connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch, hidden);
|
||||||
setNetworkPreference("wifi");
|
setNetworkPreference("wifi");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,8 +415,12 @@ Singleton {
|
|||||||
notificationModal?.close();
|
notificationModal?.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showWifiPasswordModal() {
|
function showWifiPasswordModal(ssid) {
|
||||||
wifiPasswordModal?.show();
|
wifiPasswordModal?.show(ssid);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showHiddenNetworkModal() {
|
||||||
|
wifiPasswordModal?.showHidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideWifiPasswordModal() {
|
function hideWifiPasswordModal() {
|
||||||
|
|||||||
Reference in New Issue
Block a user