diff --git a/config.go b/config.go
index 7c8437d..83cdb30 100644
--- a/config.go
+++ b/config.go
@@ -109,6 +109,8 @@ func SaveConfig() error {
configLock.Lock()
defer configLock.Unlock()
+ logger.Tracef("Saving config to %s", configPath)
+
file, err := os.Create(configPath)
if err != nil {
return fmt.Errorf("failed to create config file: %w", err)
diff --git a/jsonrpc.go b/jsonrpc.go
index b4dadd3..d8ffdac 100644
--- a/jsonrpc.go
+++ b/jsonrpc.go
@@ -405,8 +405,8 @@ func rpcGetTLSState() TLSState {
return getTLSState()
}
-func rpcSetTLSState(tlsState TLSState) error {
- err := setTLSState(tlsState)
+func rpcSetTLSState(state TLSState) error {
+ err := setTLSState(state)
if err != nil {
return fmt.Errorf("failed to set TLS state: %w", err)
}
diff --git a/main.go b/main.go
index d8934a8..feb1d3b 100644
--- a/main.go
+++ b/main.go
@@ -70,10 +70,12 @@ func Main() {
//go RunFuseServer()
go RunWebServer()
+ go RunWebSecureServer()
+ // Web secure server is started only if TLS mode is enabled
if config.TLSMode != "" {
- initCertStore()
- go RunWebSecureServer()
+ startWebSecureServer()
}
+
// As websocket client already checks if the cloud token is set, we can start it here.
go RunWebsocketClient()
diff --git a/ui/src/routes/devices.$id.settings.access._index.tsx b/ui/src/routes/devices.$id.settings.access._index.tsx
index 6d3a26d..389071e 100644
--- a/ui/src/routes/devices.$id.settings.access._index.tsx
+++ b/ui/src/routes/devices.$id.settings.access._index.tsx
@@ -161,7 +161,12 @@ export default function SettingsAccessIndexRoute() {
};
const handleTlsUpdate = useCallback(() => {
- send("setTLSState", { state: { mode: tlsMode, certificate: tlsCert, privateKey: tlsKey } as TLSState }, resp => {
+ const state = { mode: tlsMode } as TLSState;
+ if (tlsMode !== "disabled") {
+ state.certificate = tlsCert;
+ state.privateKey = tlsKey;
+ }
+ send("setTLSState", { state }, resp => {
if ("error" in resp) {
notifications.error(`Failed to update TLS settings: ${resp.error.data || "Unknown error"}`);
return;
@@ -171,17 +176,6 @@ export default function SettingsAccessIndexRoute() {
});
}, [send, tlsMode, tlsCert, tlsKey]);
- const handleReboot = useCallback(() => {
- send("reboot", { force: false }, resp => {
- if ("error" in resp) {
- notifications.error(`Failed to reboot: ${resp.error.data || "Unknown error"}`);
- return;
- }
-
- notifications.success("Device will restart shortly, it might take a few seconds to boot up again.");
- });
- }, [send]);
-
// Fetch device ID and cloud state on component mount
useEffect(() => {
getCloudState();
@@ -211,8 +205,8 @@ export default function SettingsAccessIndexRoute() {
- changing this setting might restart the device
+ Select the TLS mode for your device experimental
+ The feature might not work as expected, please report any issues if you encounter any.
>}
>
- If TLS wasn't enabled before, you'll need to reboot the device to apply the changes.
-