mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 17:55:21 +03:00
change to query parameter from header
This commit is contained in:
parent
69e1148ac6
commit
176c355720
@ -710,7 +710,7 @@ def config_raw():
|
|||||||
|
|
||||||
@bp.route("/config/save", methods=["POST"])
|
@bp.route("/config/save", methods=["POST"])
|
||||||
def config_save():
|
def config_save():
|
||||||
save_option = request.headers.get("Save-Option")
|
save_option = request.args.get("save_option")
|
||||||
|
|
||||||
new_config = request.get_data().decode()
|
new_config = request.get_data().decode()
|
||||||
|
|
||||||
|
|||||||
@ -17,37 +17,14 @@ export default function Config() {
|
|||||||
const [success, setSuccess] = useState();
|
const [success, setSuccess] = useState();
|
||||||
const [error, setError] = useState();
|
const [error, setError] = useState();
|
||||||
|
|
||||||
const onHandleSaveConfig = async (e) => {
|
const onHandleSaveConfig = async (e, save_option) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post('config/save', window.editor.getValue(), {
|
.post('config/save?save_option='+save_option, window.editor.getValue(), {
|
||||||
headers: { 'Content-Type': 'text/plain', 'Save-Option': 'restart' },
|
headers: { 'Content-Type': 'text/plain' },
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSuccess(response.data);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
if (error.response) {
|
|
||||||
setError(error.response.data.message);
|
|
||||||
} else {
|
|
||||||
setError(error.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onHandleSaveConfigOnly = async (e) => {
|
|
||||||
if (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
axios
|
|
||||||
.post('config/save', window.editor.getValue(), {
|
|
||||||
headers: { 'Content-Type': 'text/plain', 'Save-Option': 'saveonly' },
|
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
@ -120,10 +97,10 @@ export default function Config() {
|
|||||||
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
|
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
|
||||||
Copy Config
|
Copy Config
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e)}>
|
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "restart")}>
|
||||||
Save & Restart
|
Save & Restart
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfigOnly(e)}>
|
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "saveonly")}>
|
||||||
Save Only
|
Save Only
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user