Fixed acl status handling & ffmpeg path in corewizard
This commit is contained in:
parent
3d5eb18530
commit
3a6d577924
2 changed files with 24 additions and 6 deletions
|
|
@ -79,7 +79,7 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin,
|
|||
@octoprint.plugin.BlueprintPlugin.route("/acl", methods=["POST"])
|
||||
def acl_wizard_api(self):
|
||||
from flask import request
|
||||
from octoprint.server.api import valid_boolean_trues
|
||||
from octoprint.server.api import valid_boolean_trues, NO_CONTENT
|
||||
|
||||
if "ac" in request.values and request.values["ac"] in valid_boolean_trues and \
|
||||
"user" in request.values.keys() and "pass1" in request.values.keys() and \
|
||||
|
|
@ -95,6 +95,7 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin,
|
|||
octoprint.server.principals.identity_loaders.appendleft(octoprint.users.dummy_identity_loader)
|
||||
|
||||
self._settings.save()
|
||||
return NO_CONTENT
|
||||
|
||||
#~~ Webcam subwizard
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
$(function() {
|
||||
function CoreWizardAclViewModel() {
|
||||
function CoreWizardAclViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.loginStateViewModel = parameters[0];
|
||||
|
||||
self.username = ko.observable(undefined);
|
||||
self.password = ko.observable(undefined);
|
||||
self.confirmedPassword = ko.observable(undefined);
|
||||
|
|
@ -52,14 +54,23 @@ $(function() {
|
|||
|
||||
self._sendData = function(data, callback) {
|
||||
$.ajax({
|
||||
url: API_BASEURL + "plugin/corewizard/acl",
|
||||
url: BASEURL + "plugin/corewizard/acl",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function() {
|
||||
self.setup(true);
|
||||
self.decision(data.ac);
|
||||
if (callback) callback();
|
||||
if (data.ac) {
|
||||
// we now log the user in
|
||||
var user = data.user;
|
||||
var pass = data.pass1;
|
||||
self.loginStateViewModel.login(user, pass, true, function() {
|
||||
if (callback) callback();
|
||||
});
|
||||
} else {
|
||||
if (callback) callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -91,15 +102,21 @@ $(function() {
|
|||
self.settingsViewModel.enqueueForSaving({
|
||||
webcam: {
|
||||
streamUrl: self.settingsViewModel.webcam_streamUrl(),
|
||||
snapshotUrl: self.settingsViewModel.webcam_snapshotUrl()
|
||||
snapshotUrl: self.settingsViewModel.webcam_snapshotUrl(),
|
||||
ffmpegPath: self.settingsViewModel.webcam_ffmpegPath()
|
||||
}
|
||||
});
|
||||
|
||||
if (self.settingsViewModel.webcam_streamUrl()
|
||||
|| (self.settingsViewModel.webcam_snapshotUrl() && self.settingsViewModel.webcam_ffmpegPath())) {
|
||||
return "reload";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
CoreWizardAclViewModel,
|
||||
[],
|
||||
["loginStateViewModel"],
|
||||
"#wizard_plugin_corewizard_acl"
|
||||
], [
|
||||
CoreWizardWebcamViewModel,
|
||||
|
|
|
|||
Loading…
Reference in a new issue