Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/ns-api/files/ns.threatshield
Original file line number Diff line number Diff line change
Expand Up @@ -1032,15 +1032,22 @@ def set_geoblocking_configuration(e_uci, payload):

# handle the country feed enable/disable
feeds = list(e_uci.get('banip', 'global', 'ban_feed', list=True, default=[]))

ban_blockinput = list(e_uci.get('banip', 'global', 'ban_blockinput', list=True, default=[]))

if payload['enabled']:
# add 'country' feed if not present
if 'country' not in feeds:
feeds.append('country')
if 'country' not in ban_blockinput:
ban_blockinput.append('country')
e_uci.set('banip', 'global', 'ban_blockinput', ban_blockinput)
else:
# remove 'country' feed if present
if 'country' in feeds:
feeds.remove('country')
if 'country' in ban_blockinput:
ban_blockinput.remove('country')
e_uci.set('banip', 'global', 'ban_blockinput', ban_blockinput)

# convert country codes to lowercase
countries = [c.lower() for c in payload['countries']]
Expand Down
Loading