mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-02-12 10:31:52 +00:00
Check if there is really changes before writing config file
This commit is contained in:
parent
ccbb69e41c
commit
f98c362de5
2 changed files with 16 additions and 4 deletions
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -1,3 +1,10 @@
|
|||
omr-vps-admin (0.12+20240827) unstable; urgency=medium
|
||||
|
||||
* Add support for "none" encryption with Shadowsocks-go
|
||||
* Check if there is really a modification before modifying config file
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Tue, 27 Aug 2024 15:14:37 +0200
|
||||
|
||||
omr-vps-admin (0.12+20240819) unstable; urgency=medium
|
||||
|
||||
* Add LAN IPs info in status return
|
||||
|
|
13
omr-admin.py
13
omr-admin.py
|
@ -25,6 +25,7 @@ import shutil
|
|||
import psutil
|
||||
import time
|
||||
import uuid
|
||||
import copy
|
||||
from pprint import pprint
|
||||
from datetime import datetime, timedelta
|
||||
from tempfile import mkstemp
|
||||
|
@ -300,11 +301,15 @@ def set_global_param(key, value):
|
|||
def modif_config_user(user, changes):
|
||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f:
|
||||
content = json.load(f)
|
||||
content_initial = copy.deepcopy(content)
|
||||
content['users'][0][user].update(changes)
|
||||
LOG.debug("backup_config() in modif_config_user")
|
||||
backup_config()
|
||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json', 'w') as f:
|
||||
json.dump(content, f, indent=4)
|
||||
if content_initial != content:
|
||||
LOG.debug("backup_config() in modif_config_user")
|
||||
backup_config()
|
||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json', 'w') as f:
|
||||
json.dump(content, f, indent=4)
|
||||
else:
|
||||
LOG.debug("No real changes in modif_config_user")
|
||||
|
||||
def add_ss_user(port, key, userid=0, ip=''):
|
||||
with open('/etc/shadowsocks-libev/manager.json') as f:
|
||||
|
|
Loading…
Reference in a new issue