mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-03 21:17:33 +08:00
cleanup (admin): disabling constants edit from the console
This commit is contained in:
@ -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);
|
let obj = Object.assign({}, o);
|
||||||
Object.keys(obj).map((key) => {
|
Object.keys(obj).map((key) => {
|
||||||
let t = obj[key];
|
let t = obj[key];
|
||||||
@ -9,7 +10,7 @@ export const FormObjToJSON = function(o, fn){
|
|||||||
obj[key] = obj[key].value;
|
obj[key] = obj[key].value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
obj[key] = FormObjToJSON(obj[key], fn);
|
obj[key] = FormObjToJSON(obj[key], fn, i+1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj
|
return obj
|
||||||
|
|||||||
@ -113,21 +113,21 @@ export class SetupPage extends React.Component {
|
|||||||
"severe": true,
|
"severe": true,
|
||||||
"message": "This can lead to data leaks. Please use a SSL certificate or expose your instance via a filestash domain"
|
"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",
|
"name_failure": "Application is running as root",
|
||||||
"pass": objectGet(config, ["private", "user", "value"]) !== "root",
|
"pass": objectGet(config, ["constant", "user", "value"]) !== "root",
|
||||||
"severe": true,
|
"severe": true,
|
||||||
"message": "This is dangerous, you should use another user with less privileges"
|
"message": "This is dangerous, you should use another user with less privileges"
|
||||||
}, {
|
}, {
|
||||||
"name_success": "Emacs is installed",
|
"name_success": "Emacs is installed",
|
||||||
"name_failure": "Emacs is not installed",
|
"name_failure": "Emacs is not installed",
|
||||||
"pass": objectGet(config, ["private", "emacs", "value"]),
|
"pass": objectGet(config, ["constant", "emacs", "value"]),
|
||||||
"severe": false,
|
"severe": false,
|
||||||
"message": "If you want to use all the org-mode features of Filestash, you need to install emacs"
|
"message": "If you want to use all the org-mode features of Filestash, you need to install emacs"
|
||||||
}, {
|
}, {
|
||||||
"name_success": "Pdftotext is installed",
|
"name_success": "Pdftotext is installed",
|
||||||
"name_failure": "Pdftotext is not installed",
|
"name_failure": "Pdftotext is not installed",
|
||||||
"pass": objectGet(config, ["private", "pdftotext", "value"]),
|
"pass": objectGet(config, ["constant", "pdftotext", "value"]),
|
||||||
"severe": false,
|
"severe": false,
|
||||||
"message": "You won't be able to search through PDF documents without it"
|
"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) => {
|
waitForDomain().then((url) => {
|
||||||
// TODO
|
|
||||||
console.log("DONE: ", url, this.state);
|
|
||||||
this.setState({redirect_uri: url});
|
this.setState({redirect_uri: url});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
window.location.hash = "#2";
|
window.location.hash = "#2";
|
||||||
|
|||||||
@ -498,7 +498,7 @@ func (this Configuration) Interface() interface{} {
|
|||||||
func (this Configuration) MarshalJSON() ([]byte, error) {
|
func (this Configuration) MarshalJSON() ([]byte, error) {
|
||||||
form := this.form
|
form := this.form
|
||||||
form = append(form, Form{
|
form = append(form, Form{
|
||||||
Title: "private",
|
Title: "constant",
|
||||||
Elmnts: []FormElement{
|
Elmnts: []FormElement{
|
||||||
FormElement{Name: "user", Type: "boolean", ReadOnly: true, Value: func() string{
|
FormElement{Name: "user", Type: "boolean", ReadOnly: true, Value: func() string{
|
||||||
if u, err := user.Current(); err == nil {
|
if u, err := user.Current(); err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user