Skip to content

Build your personal knowledge base with Trilium Notes

fixed setup page issues which caused wrong choice to be used in the wizard

azivnere2dfe1b6de46
diff --git a/src/public/javascripts/setup.js b/src/public/javascripts/setup.js
index 09d102b728..3239d8a13d 100644
--- a/src/public/javascripts/setup.js
+++ b/src/public/javascripts/setup.js
@@ -25,26 +25,20 @@ function SetupModel() {
this.instanceType = utils.isElectron() ? "desktop" : "server";
- this.setupTypeSelected = this.getSetupType = () =>
- this.setupNewDocument()
- || this.setupSyncFromDesktop()
- || this.setupSyncFromServer();
+ this.setupTypeSelected = () => !!this.setupType();
this.selectSetupType = () => {
- this.step(this.getSetupType());
- this.setupType(this.getSetupType());
+ this.step(this.setupType());
};
this.back = () => {
this.step("setup-type");
- this.setupNewDocument(false);
- this.setupSyncFromServer(false);
- this.setupSyncFromDesktop(false);
+ this.setupType("");
};
this.finish = async () => {
- if (this.setupNewDocument()) {
+ if (this.setupType() === 'new-document') {
const username = this.username();
const password1 = this.password1();
const password2 = this.password2();
@@ -72,7 +66,7 @@ function SetupModel() {
window.location.replace("/");
});
}
- else if (this.setupSyncFromServer()) {
+ else if (this.setupType() === 'sync-from-server') {
const syncServerHost = this.syncServerHost();
const syncProxy = this.syncProxy();
const username = this.username();
diff --git a/src/views/setup.ejs b/src/views/setup.ejs
index af35f04177..b64c869fb2 100644
--- a/src/views/setup.ejs
+++ b/src/views/setup.ejs
@@ -13,15 +13,15 @@
<div id="setup-type" data-bind="visible: step() == 'setup-type'" style="margin-top: 20px;">
<div class="radio" style="margin-bottom: 15px;">
- <label><input type="radio" name="setup-type" value="new-document" data-bind="checked: setupNewDocument">
+ <label><input type="radio" name="setup-type" value="new-document" data-bind="checked: setupType">
I'm a new user and I want to create new Trilium document for my notes</label>
</div>
<div class="radio" data-bind="if: instanceType == 'server'" style="margin-bottom: 15px;">
- <label><input type="radio" name="setup-type" value="sync-from-desktop" data-bind="checked: setupSyncFromDesktop">
+ <label><input type="radio" name="setup-type" value="sync-from-desktop" data-bind="checked: setupType">
I have desktop instance already and I want to setup sync with it</label>
</div>
<div class="radio" data-bind="if: instanceType == 'desktop'" style="margin-bottom: 15px;">
- <label><input type="radio" name="setup-type" value="sync-from-server" data-bind="checked: setupSyncFromServer">
+ <label><input type="radio" name="setup-type" value="sync-from-server" data-bind="checked: setupType">
I have server instance up and I want to setup sync with it</label>
</div>