mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge 78caf628ac
into 3ea0137bf5
This commit is contained in:
commit
c7fadb8243
3 changed files with 12 additions and 3 deletions
|
@ -861,10 +861,11 @@ firewall:
|
||||||
api: GET /firewall/upnp
|
api: GET /firewall/upnp
|
||||||
arguments:
|
arguments:
|
||||||
action:
|
action:
|
||||||
help: enable/disable
|
help: enable/disable/check
|
||||||
choices:
|
choices:
|
||||||
- enable
|
- enable
|
||||||
- disable
|
- disable
|
||||||
|
- check
|
||||||
- []
|
- []
|
||||||
nargs: "*"
|
nargs: "*"
|
||||||
|
|
||||||
|
|
10
firewall.py
10
firewall.py
|
@ -207,7 +207,7 @@ def firewall_upnp(action=None):
|
||||||
Add uPnP cron and enable uPnP in firewall.yml, or the opposite.
|
Add uPnP cron and enable uPnP in firewall.yml, or the opposite.
|
||||||
|
|
||||||
Keyword argument:
|
Keyword argument:
|
||||||
action -- enable/disable
|
action -- enable/disable/check
|
||||||
|
|
||||||
"""
|
"""
|
||||||
firewall = firewall_list(raw=True)
|
firewall = firewall_list(raw=True)
|
||||||
|
@ -244,12 +244,18 @@ def firewall_upnp(action=None):
|
||||||
|
|
||||||
msignals.display(m18n.n('upnp_disabled'), 'success')
|
msignals.display(m18n.n('upnp_disabled'), 'success')
|
||||||
|
|
||||||
|
if action == 'check':
|
||||||
|
if firewall['uPnP']['enabled'] == True:
|
||||||
|
msignals.display(m18n.n('upnp_active'), 'success')
|
||||||
|
else:
|
||||||
|
raise MoulinetteError(errno.EADV,
|
||||||
|
m18n.n('upnp_inactive'))
|
||||||
|
|
||||||
if action:
|
if action:
|
||||||
os.system("cp /etc/yunohost/firewall.yml /etc/yunohost/firewall.yml.old")
|
os.system("cp /etc/yunohost/firewall.yml /etc/yunohost/firewall.yml.old")
|
||||||
with open('/etc/yunohost/firewall.yml', 'w') as f:
|
with open('/etc/yunohost/firewall.yml', 'w') as f:
|
||||||
yaml.safe_dump(firewall, f, default_flow_style=False)
|
yaml.safe_dump(firewall, f, default_flow_style=False)
|
||||||
|
|
||||||
return { "enabled": firewall['uPnP']['enabled'] }
|
|
||||||
|
|
||||||
|
|
||||||
def firewall_stop():
|
def firewall_stop():
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
"upnp_port_open_failed" : "Unable to open uPnP ports",
|
"upnp_port_open_failed" : "Unable to open uPnP ports",
|
||||||
"upnp_enabled" : "uPnP successfully enabled",
|
"upnp_enabled" : "uPnP successfully enabled",
|
||||||
"upnp_disabled" : "uPnP successfully disabled",
|
"upnp_disabled" : "uPnP successfully disabled",
|
||||||
|
"upnp_active" : "uPnP is activate",
|
||||||
|
"upnp_inactive" : "uPnP is not activate",
|
||||||
"firewall_reloaded" : "Firewall successfully reloaded",
|
"firewall_reloaded" : "Firewall successfully reloaded",
|
||||||
|
|
||||||
"hook_choice_invalid" : "Invalid choice '%s'",
|
"hook_choice_invalid" : "Invalid choice '%s'",
|
||||||
|
|
Loading…
Add table
Reference in a new issue