mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-24 12:05:21 -04:00
fix(network): fix excessive network prompting on failures, add VPN
connection statuses
This commit is contained in:
@@ -25,6 +25,7 @@ Singleton {
|
||||
signal importComplete(string uuid, string name)
|
||||
signal configLoaded(var config)
|
||||
signal configUpdated
|
||||
signal credentialsSet(string uuid)
|
||||
signal vpnDeleted(string uuid)
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -149,6 +150,28 @@ Singleton {
|
||||
});
|
||||
}
|
||||
|
||||
function setCredentials(uuid, username, password, save = true) {
|
||||
if (!available)
|
||||
return;
|
||||
const params = {
|
||||
uuid: uuid,
|
||||
save: save
|
||||
};
|
||||
if (username)
|
||||
params.username = username;
|
||||
if (password)
|
||||
params.password = password;
|
||||
|
||||
DMSService.sendRequest("network.vpn.setCredentials", params, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to save VPN credentials"), response.error);
|
||||
return;
|
||||
}
|
||||
ToastService.showInfo(I18n.tr("VPN credentials saved"));
|
||||
credentialsSet(uuid);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteVpn(uuidOrName) {
|
||||
if (!available)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user