Settings
This commit is contained in:
@@ -182,7 +182,12 @@
|
||||
<input type="checkbox" id="ID_SettingsAutoStart"><br><br>
|
||||
<h2>Use Bundled siad</h2>
|
||||
<input type="checkbox" id="ID_SettingsLaunchServer"><br><br>
|
||||
<button id="ID_SiaSettingsDefaults" type="button">Defaults</button>
|
||||
<h2>API Port</h2>
|
||||
<input type="number" id="ID_SettingsApiPort"><br><br>
|
||||
<h2>Host Port</h2>
|
||||
<input type="number" id="ID_SettingsHostPort"><br><br>
|
||||
<h2>RPC Port</h2>
|
||||
<input type="number" id="ID_SettingsRPCPort"><br><br>
|
||||
<button id="ID_SiaSettingsOK" type="button">Save</button>
|
||||
<button id="ID_SiaSettingsCancel" type="button">Cancel</button>
|
||||
</div>
|
||||
|
@@ -12,6 +12,10 @@
|
||||
document.getElementById(id)["checked"] = value;
|
||||
}
|
||||
|
||||
function getChecked(id) {
|
||||
return document.getElementById(id)["checked"];
|
||||
}
|
||||
|
||||
function getValue(id) {
|
||||
return document.getElementById(id).value;
|
||||
}
|
||||
@@ -153,6 +157,21 @@
|
||||
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
|
||||
setChecked('ID_SettingsLaunchServer', launch);
|
||||
}
|
||||
},
|
||||
setApiPort: (port) => {
|
||||
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
|
||||
setValue('ID_SettingsApiPort', port);
|
||||
}
|
||||
},
|
||||
setHostPort: (port) => {
|
||||
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
|
||||
setValue('ID_SettingsHostPort', port);
|
||||
}
|
||||
},
|
||||
setRpcPort: (port) => {
|
||||
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
|
||||
setValue('ID_SettingsRPCPort', port);
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
@@ -233,6 +252,10 @@
|
||||
window.appActions.calculateEstimatedStorage(funds, cb)
|
||||
}
|
||||
|
||||
function _setSiaSettings(settings, cb) {
|
||||
window.appActions.setSiaSettings(settings, cb);
|
||||
}
|
||||
|
||||
return {
|
||||
createWallet: _createWallet,
|
||||
mountDrive: _mountDrive,
|
||||
@@ -242,7 +265,8 @@
|
||||
unmountDrive: _unmountDrive,
|
||||
shutdown: _shutdown,
|
||||
setRenterSettings: _setRenterSettings,
|
||||
calculateEstimatedStorage: _calculateEstimatedStorage
|
||||
calculateEstimatedStorage: _calculateEstimatedStorage,
|
||||
setSiaSettings: _setSiaSettings
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -298,8 +322,30 @@
|
||||
const cancelButton = document.getElementById('ID_SiaSettingsCancel');
|
||||
cancelButton.onclick = () => {
|
||||
cancelButton.onclick = null;
|
||||
saveButton.onclick = null;
|
||||
beginMainApplication();
|
||||
};
|
||||
|
||||
const saveButton = document.getElementById('ID_SiaSettingsOK');
|
||||
saveButton.onclick = () => {
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
AppActions.setSiaSettings({
|
||||
'UnlockOnExit': getChecked('ID_SettingsLockWalletOnExit'),
|
||||
'AutoStartOnLogon': getChecked('ID_SettingsAutoStart'),
|
||||
'UseBundledSiad': getChecked('ID_SettingsLaunchServer'),
|
||||
'ApiPort': getValue('ID_SettingsApiPort'),
|
||||
'HostPort': getValue('ID_SettingsHostPort'),
|
||||
'RpcPort': getValue('ID_SettingsRPCPort')
|
||||
}, (success, reason) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
} else {
|
||||
displayErrorPopup('Settings Failed', reason);
|
||||
handleSiaEditSettings();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function beginMainApplication() {
|
||||
|
Reference in New Issue
Block a user