cleanup (admin): disabling constants edit from the console

This commit is contained in:
Mickael Kerjean
2019-05-17 13:39:41 +10:00
parent 5b9dbf76a8
commit b1b142a620
3 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,5 @@
export const FormObjToJSON = function(o, fn){
export const FormObjToJSON = function(o, fn, i = 0){
if(i === 0) delete o["constants"];
let obj = Object.assign({}, o);
Object.keys(obj).map((key) => {
let t = obj[key];
@ -9,7 +10,7 @@ export const FormObjToJSON = function(o, fn){
obj[key] = obj[key].value;
}
} else {
obj[key] = FormObjToJSON(obj[key], fn);
obj[key] = FormObjToJSON(obj[key], fn, i+1);
}
});
return obj

View File

@ -113,21 +113,21 @@ export class SetupPage extends React.Component {
"severe": true,
"message": "This can lead to data leaks. Please use a SSL certificate or expose your instance via a filestash domain"
}, {
"name_success": "Application is running as " + config.private.user.value,
"name_success": "Application is running as '" + objectGet(config, ["constant", "user", "value"]) + "'",
"name_failure": "Application is running as root",
"pass": objectGet(config, ["private", "user", "value"]) !== "root",
"pass": objectGet(config, ["constant", "user", "value"]) !== "root",
"severe": true,
"message": "This is dangerous, you should use another user with less privileges"
}, {
"name_success": "Emacs is installed",
"name_failure": "Emacs is not installed",
"pass": objectGet(config, ["private", "emacs", "value"]),
"pass": objectGet(config, ["constant", "emacs", "value"]),
"severe": false,
"message": "If you want to use all the org-mode features of Filestash, you need to install emacs"
}, {
"name_success": "Pdftotext is installed",
"name_failure": "Pdftotext is not installed",
"pass": objectGet(config, ["private", "pdftotext", "value"]),
"pass": objectGet(config, ["constant", "pdftotext", "value"]),
"severe": false,
"message": "You won't be able to search through PDF documents without it"
}
@ -211,8 +211,6 @@ class MultiStepForm extends React.Component {
});
};
waitForDomain().then((url) => {
// TODO
console.log("DONE: ", url, this.state);
this.setState({redirect_uri: url});
}).catch((err) => {
window.location.hash = "#2";

View File

@ -498,7 +498,7 @@ func (this Configuration) Interface() interface{} {
func (this Configuration) MarshalJSON() ([]byte, error) {
form := this.form
form = append(form, Form{
Title: "private",
Title: "constant",
Elmnts: []FormElement{
FormElement{Name: "user", Type: "boolean", ReadOnly: true, Value: func() string{
if u, err := user.Current(); err == nil {