Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Commit

Permalink
sped up check call
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusmatticus committed Nov 24, 2020
1 parent c4587c5 commit 9c21997
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Binary file modified MullvadVPN.alfredworkflow
Binary file not shown.
18 changes: 11 additions & 7 deletions src/mullvad.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def get_connection():
return execute(['mullvad', 'status']).splitlines()


def check_connection():
wf.add_item('check',
subtitle='Check security of connection',
arg='open https://mullvad.net/en/check/',
valid=True,
icon='icons/mullvad_yellow.png')

def set_kill_switch():
for status in get_kill_switch():
if status == 'Network traffic will be blocked when the VPN is disconnected':
Expand Down Expand Up @@ -318,21 +325,18 @@ def main(wf):
set_kill_switch()
protocol_status()
set_lan()
check_connection()
for action in mullvad_actions.ACTIONS:
if action['name'] in ['relay', 'Check']:
if action['name'] in ['relay']:
wf.add_item(action['name'], action['description'],
uid=action['name'],
autocomplete=action['autocomplete'],
arg=action['arg'],
valid=action['valid'],
icon=action['icon'])

if query and query.startswith('Check'):
wf.add_item('Check',
subtitle='Check security of connection',
arg='open https://mullvad.net/en/check/',
valid=True,
icon='icons/mullvad_yellow.png')
if query and query.startswith('check'):
check_connection()

elif query and any(query.startswith(x) for x in ['kill-switch', 'block-when-disconnected']):
set_kill_switch()
Expand Down
4 changes: 2 additions & 2 deletions src/mullvad_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
'valid': False
},
{
'name': 'Check',
'name': 'check',
'description': 'Check security of connection',
'autocomplete': 'Check ',
'autocomplete': 'check ',
'arg': '',
'icon': 'icons/mullvad_yellow.png',
'valid': False
Expand Down
2 changes: 1 addition & 1 deletion src/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8
0.9

0 comments on commit 9c21997

Please sign in to comment.