diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java index a6251675..b5e08a8b 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java @@ -150,7 +150,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener, private String mVersion; - private final String mUrl; + private String mUrl; private final String mApiKey; @@ -200,6 +200,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener, mOnConfigChangedListener = configListener; } + public void setWebGuiUrl(String newUrl) { + mUrl = newUrl; + } + /** * Number of previous calls to {@link #tryIsAvailable()}. */ diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index 6f5db56f..205c4d4d 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -227,8 +227,10 @@ public class SyncthingService extends Service implements if (mConfig != null) { mCurrentState = State.STARTING; - if (mApi != null) + if (mApi != null) { registerOnWebGuiAvailableListener(mApi); + mApi.setWebGuiUrl(mConfig.getWebGuiUrl()); + } if (mEventProcessor != null) registerOnWebGuiAvailableListener(mEventProcessor); new PollWebGuiAvailableTaskImpl(getFilesDir() + "/" + HTTPS_CERT_FILE)