add support for create key

This commit is contained in:
CodePoet80 committed 2021-05-26 19:09:35 -04:00
1 parent a990fca7bc
commit d61bee6ab3
4 files changed
+37 -3

No files matched your search

+17 -1
View File
@@ -59,7 +59,7 @@ PreferencesAssistant.prototype.setup = function() {
//Text fields
this.controller.setupWidget("txtCustomClientId",
this.attributes = {
hintText: $L("Your Share Service API Key"),
hintText: $L("Your Service API Key"),
multiline: false,
enterSubmits: false,
autoReplace: false,
@@ -70,6 +70,19 @@ PreferencesAssistant.prototype.setup = function() {
disabled: !appModel.AppSettingsCurrent["CustomClientId"]
}
);
this.controller.setupWidget("txtCustomCreateKey",
this.attributes = {
hintText: $L("Your Service Create Key"),
multiline: false,
enterSubmits: false,
autoReplace: false,
textCase: Mojo.Widget.steModeLowerCase
},
this.model = {
value: appModel.AppSettingsCurrent["CustomCreateKey"],
disabled: !appModel.AppSettingsCurrent["CustomCreateKey"]
}
);
this.controller.setupWidget("txtEndpointURL",
this.attributes = {
hintText: $L("http://your-server.com/"),
@@ -141,6 +154,9 @@ PreferencesAssistant.prototype.handleValueChange = function(event) {
var thisWidgetSetup = this.controller.getWidgetSetup("txtCustomClientId");
thisWidgetSetup.model.disabled = !event.value;
this.controller.modelChanged(thisWidgetSetup.model);
var thisWidgetSetup = this.controller.getWidgetSetup("txtCustomCreateKey");
thisWidgetSetup.model.disabled = !event.value;
this.controller.modelChanged(thisWidgetSetup.model);
if (event.value)
this.controller.get('txtCustomClientId').mojo.focus();
break;
+1
View File
@@ -30,6 +30,7 @@ var AppModel = function() {
ShortURL: "",
UseCustomClientId: false,
CustomClientId: "",
CustomCreateKey: "",
UseCustomDownloadPath: false,
CustomDownloadPath: null,
FirstRun: true
+13 -2
View File
@@ -336,7 +336,8 @@ ShareServiceModel.prototype.DoNewUserRequest = function(username, sharephrase, p
var request = {
"username":username,
"sharephrase":sharephrase,
"password":password
"password":password,
"createkey":this.getCurrentCreateKey()
}
xmlhttp.send(JSON.stringify(request));
xmlhttp.onreadystatechange = function() {
@@ -388,7 +389,17 @@ ShareServiceModel.prototype.getCurrentClientKey = function() {
retVal = this.CustomClientId;
Mojo.Log.info("Using custom shareboard client key: " + retVal);
}
Mojo.Log.info("Using shareboard client key: " + retVal);
//Mojo.Log.info("Using shareboard client key: " + retVal);
return retVal;
}
ShareServiceModel.prototype.getCurrentCreateKey = function() {
var retVal = atob(appKeys['shareBoardCreateKey']);
if (this.UseCustomEndpoint) {
retVal = this.CustomClientId;
Mojo.Log.info("Using custom shareboard create key: " + retVal);
}
//Mojo.Log.info("Using shareboard create key: " + retVal);
return retVal;
}
@@ -44,6 +44,12 @@
</div>
</div>
<div class="palm-row">
<div class="palm-row-wrapper" style="margin:14px 22px 4px 12px">
<div id="txtCustomCreateKey" name="txtCustomCreateKey" x-mojo-element="TextField" title="CustomCreateKey"></div>
</div>
</div>
<div class="palm-row">
<div class="palm-row-wrapper">
<div x-mojo-element="ToggleButton" id="toggleCustomEndPoint" title="UseCustomEndpoint"></div>