mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +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
|
omr-vps-admin (0.12+20240819) unstable; urgency=medium
|
||||||
|
|
||||||
* Add LAN IPs info in status return
|
* Add LAN IPs info in status return
|
||||||
|
|
13
omr-admin.py
13
omr-admin.py
|
@ -25,6 +25,7 @@ import shutil
|
||||||
import psutil
|
import psutil
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
import copy
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
|
@ -300,11 +301,15 @@ def set_global_param(key, value):
|
||||||
def modif_config_user(user, changes):
|
def modif_config_user(user, changes):
|
||||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f:
|
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f:
|
||||||
content = json.load(f)
|
content = json.load(f)
|
||||||
|
content_initial = copy.deepcopy(content)
|
||||||
content['users'][0][user].update(changes)
|
content['users'][0][user].update(changes)
|
||||||
LOG.debug("backup_config() in modif_config_user")
|
if content_initial != content:
|
||||||
backup_config()
|
LOG.debug("backup_config() in modif_config_user")
|
||||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json', 'w') as f:
|
backup_config()
|
||||||
json.dump(content, f, indent=4)
|
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=''):
|
def add_ss_user(port, key, userid=0, ip=''):
|
||||||
with open('/etc/shadowsocks-libev/manager.json') as f:
|
with open('/etc/shadowsocks-libev/manager.json') as f:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue