mirror of
https://github.com/Casvt/MIND.git
synced 2026-04-03 03:00:22 -04:00
Added backend for resetting setting values
This commit is contained in:
@@ -530,6 +530,7 @@ def api_admin_settings(inputs: Dict[str, Any]):
|
||||
|
||||
hosting_changes = any(
|
||||
inputs[s] is not None
|
||||
and inputs[s] != getattr(settings.sv, s)
|
||||
for s in ('host', 'port', 'url_prefix')
|
||||
)
|
||||
|
||||
@@ -547,6 +548,24 @@ def api_admin_settings(inputs: Dict[str, Any]):
|
||||
|
||||
return return_api({})
|
||||
|
||||
elif request.method == 'DELETE':
|
||||
hosting_changes = any(
|
||||
s in inputs["setting_keys"]
|
||||
and settings.get_default_value(s) != getattr(settings.sv, s)
|
||||
for s in ('host', 'port', 'url_prefix')
|
||||
)
|
||||
|
||||
if hosting_changes:
|
||||
settings.backup_hosting_settings()
|
||||
|
||||
for setting in inputs["setting_keys"]:
|
||||
settings.reset(setting)
|
||||
|
||||
if hosting_changes:
|
||||
Server().restart(StartType.RESTART_HOSTING_CHANGES)
|
||||
|
||||
return return_api({})
|
||||
|
||||
|
||||
@admin_api.route('/logs', LogfileData)
|
||||
@endpoint_wrapper
|
||||
|
||||
Reference in New Issue
Block a user