Skip to content

Commit 4b38cc9

Browse files
author
Zomboided
committed
Systemd refresh
1 parent 9b13056 commit 4b38cc9

File tree

11 files changed

+53
-24
lines changed

11 files changed

+53
-24
lines changed

addon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
import xbmcplugin
2424
import xbmcgui
2525
import os
26-
from libs.common import connectionValidated, getIPInfo, isVPNConnected, getVPNProfile, getVPNProfileFriendly
26+
from libs.common import connectionValidated, getIPInfo, isVPNConnected, getVPNProfileFriendly
2727
from libs.common import getFriendlyProfileList, connectVPN, disconnectVPN, setVPNState, requestVPNCycle, getFilteredProfileList
2828
from libs.common import isVPNMonitorRunning, setVPNMonitorState, getVPNMonitorState, wizard
2929
from libs.common import getIconPath, getSystemData, getVPNServer
3030
from libs.platform import getPlatform, platforms, getPlatformString, fakeConnection
3131
from libs.vpnproviders import getAddonList, isAlternative, getAlternativeLocations, getAlternativeFriendlyLocations, getAlternativeLocation
3232
from libs.vpnproviders import allowReconnection
3333
from libs.utility import debugTrace, errorTrace, infoTrace, newPrint, getID, getName
34-
from libs.access import getVPNURL
34+
from libs.access import getVPNURL, getVPNProfile
3535
from libs.sysbox import popupSysBox
3636

3737

addon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<addon id="service.vpn.manager"
33
name="VPN Manager for OpenVPN"
4-
version="6.2.2"
4+
version="6.2.3"
55
provider-name="Zomboided">
66
<requires>
77
<import addon="xbmc.python" version="2.7.0"/>

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v6.2.3
2+
- Refresh systemd for Nord default connection
3+
14
v6.2.2
25
- Logging bug fix
36

libs/access.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ def setVPNURL(address):
4040
# Store the server name or URL being used
4141
xbmcgui.Window(10000).setProperty("VPN_Manager_Connected_Server_URL", address)
4242

43+
4344
def getVPNURL():
4445
# Return the server name or URL being used
4546
return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Server_URL")
4647

48+
49+
def getVPNProfile():
50+
# Return full profile path name
51+
return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Name")
52+
4753

4854
# Manage the authentication tokens
4955
def resetTokens():

libs/alternativeNord.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import urllib2
2727
import time
2828
from libs.utility import ifHTTPTrace, ifJSONTrace, debugTrace, infoTrace, errorTrace, ifDebug, newPrint, getID, now
29-
from libs.platform import getAddonPath
30-
from libs.access import setVPNRequestedServer, getVPNRequestedServer, resetTokens, setTokens, getTokens, setVPNURL, getVPNURL
29+
from libs.platform import getAddonPath, getSystemdPath, copySystemdFiles, fakeSystemd
30+
from libs.access import setVPNRequestedServer, getVPNRequestedServer, resetTokens, setTokens, getTokens, setVPNURL, getVPNURL, getVPNProfile
3131

3232
NORD_LOCATIONS = "COUNTRIES.txt"
3333

@@ -508,4 +508,13 @@ def resetNordVPN(vpn_provider):
508508
# Elsewhere the ovpn and location downloads will be deleted
509509
resetTokens()
510510
return True
511+
512+
513+
def postConnectNordVPN(vpn_provider):
514+
# Post connect, might need to update the systemd config
515+
addon = xbmcaddon.Addon(getID())
516+
if ((addon.getSetting("1_vpn_validated") == getVPNProfile()) and (addon.getSetting("vpn_connect_before_boot") == "true")):
517+
if xbmcvfs.exists(getSystemdPath("openvpn.config")) or fakeSystemd():
518+
copySystemdFiles()
519+
return
511520

libs/alternativeShellfire.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,7 @@ def sendAPI(command, command_text, api_data, check_response):
657657
return rc, api_data
658658

659659

660+
def postConnectShellfire(vpn_provider):
661+
# Post connect, nothing special to do for Shellfire
662+
return
663+

libs/common.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
from vpnproviders import usesPassAuth, cleanPassFiles, isUserDefined, getKeyPass, getKeyPassName, usesKeyPass, writeKeyPass, refreshVPNFiles
3939
from vpnproviders import setVPNProviderUpdate, setVPNProviderUpdateTime, getVPNDisplay, isAlternative, allowViewSelection, updateVPNFile
4040
from vpnproviders import getAlternativePreFetch, getAlternativeFriendlyLocations, getAlternativeFriendlyServers, getAlternativeLocation, getAlternativeServer
41-
from vpnproviders import authenticateAlternative, getAlternativeUserPass, getAlternativeProfiles, allowReconnection
41+
from vpnproviders import authenticateAlternative, getAlternativeUserPass, getAlternativeProfiles, allowReconnection, postConnectAlternative
4242
from ipinfo import getIPInfoFrom, getIPSources, getNextSource, getAutoSource, isAutoSelect, getErrorValue, getIndex
4343
from logbox import popupOpenVPNLog
44-
from access import setVPNURL, getVPNURL
44+
from access import setVPNURL, getVPNURL, getVPNProfile
4545
from userdefined import importWizard
4646

4747

@@ -434,11 +434,6 @@ def setVPNProfile(profile_name):
434434
return
435435

436436

437-
def getVPNProfile():
438-
# Return full profile path name
439-
return xbmcgui.Window(10000).getProperty("VPN_Manager_Connected_Profile_Name")
440-
441-
442437
def setVPNProfileFriendly(profile_name):
443438
# Store shortened profile name
444439
xbmcgui.Window(10000).setProperty("VPN_Manager_Connected_Profile_Friendly_Name", profile_name)
@@ -2040,6 +2035,8 @@ def connectVPN(connection_order, vpn_profile):
20402035
setVPNLastConnectedProfileFriendly("")
20412036
setConnectionErrorCount(0)
20422037
setConnectTime(addon)
2038+
if isAlternative(vpn_provider):
2039+
postConnectAlternative(vpn_provider)
20432040
# Indicate to the service that it should update its settings
20442041
updateService("connectVPN")
20452042
elif progress.iscanceled() or cancel_attempt:

libs/generation.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ def generateAll():
4040
#generateBlackbox
4141
#generateBTGuard()
4242
#generateBulletVPN()
43-
generateCelo()
43+
#generateCelo()
4444
#generateCyberGhost()
45-
#generateExpressVPN()
45+
generateExpressVPN()
4646
#generateHideMe()
4747
#generateHMA()
4848
#generateHideIPVPN()
4949
#generateibVPN()
50-
#generateIPVanish()
50+
generateIPVanish()
5151
#generateIVPN()
5252
#generateLimeVPN()
5353
#generateLiquidVPN()
@@ -62,7 +62,7 @@ def generateAll():
6262
#generateSecureVPN()
6363
#generateSmartDNSProxy()
6464
#generatetigerVPN()
65-
#generateTorGuard()
65+
generateTorGuard()
6666
#generateTotalVPN()
6767
#generateVanishedVPN()
6868
#generateVPNac()
@@ -72,7 +72,7 @@ def generateAll():
7272
#generateVPNUnlimited()
7373
#generateVyprVPN()
7474
#generateWiTopia()
75-
#generateWindscribe()
75+
generateWindscribe()
7676
return
7777

7878

@@ -219,7 +219,7 @@ def generateCyberGhost():
219219
# Data is stored as a bunch of ovpn files
220220
# File name has location but needs mapping. File has the server
221221
profiles = getProfileList("CyberGhost")
222-
location_file = getLocations("CyberGhost", "Premium and Premium Plus Account")
222+
location_file = getLocations("CyberGhost", "")
223223
for profile in profiles:
224224
geo = profile[profile.rfind("\\")+1:profile.index(".ovpn")]
225225
geo = resolveCountry(geo[0:2]) + geo[2:]
@@ -1223,6 +1223,9 @@ def generateWindscribe():
12231223
line = line.strip(" \t\n\r")
12241224
server = line
12251225
geo = line.replace(".windscribe.com", "")
1226+
if geo.startswith("wf-"):
1227+
geo = geo.replace("wf-", "")
1228+
geo = geo + "-Windflix"
12261229
if "-" in geo:
12271230
geo, rest = geo.split("-")
12281231
rest = " " + string.capwords(rest)

libs/vpnproviders.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
from utility import ifHTTPTrace, debugTrace, errorTrace, infoTrace, newPrint, getID, getShort
3030
from platform import getAddonPath, getUserDataPath, fakeConnection, getSeparator, getPlatform, platforms, useSudo, generateVPNs
3131
from alternativeNord import getNordVPNPreFetch, getNordVPNLocations, getNordVPNFriendlyLocations, getNordVPNLocation, getNordVPNLocationName
32-
from alternativeNord import getNordVPNUserPass, getNordVPNServers, getNordVPNFriendlyServers, getNordVPNServer, regenerateNordVPN
32+
from alternativeNord import getNordVPNUserPass, getNordVPNServers, getNordVPNFriendlyServers, getNordVPNServer, regenerateNordVPN, postConnectNordVPN
3333
from alternativeNord import resetNordVPN, authenticateNordVPN, getNordVPNProfiles, getNordVPNMessages, checkForNordVPNUpdates, refreshFromNordVPN
3434
from alternativeShellfire import getShellfirePreFetch, getShellfireLocations, getShellfireFriendlyLocations, getShellfireLocation
3535
from alternativeShellfire import getShellfireLocationName, getShellfireUserPass, getShellfireServers, getShellfireFriendlyServers
3636
from alternativeShellfire import getShellfireServer, regenerateShellfire, resetShellfire, authenticateShellfire, getShellfireProfiles
37-
from alternativeShellfire import getShellfireMessages, checkForShellfireUpdates, refreshFromShellfire
37+
from alternativeShellfire import getShellfireMessages, checkForShellfireUpdates, refreshFromShellfire, postConnectShellfire
3838

3939

4040
# **** ADD MORE VPN PROVIDERS HERE ****
@@ -538,6 +538,10 @@ def checkForAlternativeUpdates(vpn_provider):
538538
def refreshFromAlternative(vpn_provider):
539539
return globals()["refreshFrom" + vpn_provider](vpn_provider)
540540

541+
542+
def postConnectAlternative(vpn_provider):
543+
return globals()["postConnect" + vpn_provider](vpn_provider)
544+
541545

542546
def getLocationFiles(vpn_provider):
543547
# Return the locations files, add any user version to the end of the list

service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import urllib2
3030
import re
3131
import string
32-
from libs.common import updateServiceRequested, ackUpdate, getVPNProfile, setVPNProfile, getVPNProfileFriendly, setVPNProfileFriendly, getReconnectTime
32+
from libs.common import updateServiceRequested, ackUpdate, setVPNProfile, getVPNProfileFriendly, setVPNProfileFriendly, getReconnectTime
3333
from libs.common import getVPNRequestedProfile, setVPNRequestedProfile, getVPNRequestedProfileFriendly, setVPNRequestedProfileFriendly, getIPInfo
3434
from libs.common import setVPNState, getVPNState, stopRequested, ackStop, startRequested, ackStart, updateService, stopVPNConnection, startVPNConnection
3535
from libs.common import getVPNLastConnectedProfile, setVPNLastConnectedProfile, getVPNLastConnectedProfileFriendly, setVPNLastConnectedProfileFriendly
@@ -43,8 +43,8 @@
4343
from libs.utility import debugTrace, errorTrace, infoTrace, ifDebug, newPrint, setID, setName, setShort, setVery, running, setRunning, now, isCustom
4444
from libs.vpnproviders import removeGeneratedFiles, cleanPassFiles, fixOVPNFiles, getVPNLocation, usesPassAuth, clearKeysAndCerts, checkForVPNUpdates
4545
from libs.vpnproviders import populateSupportingFromGit, isAlternative, regenerateAlternative, getAlternativeLocation, updateVPNFile, checkUserDefined
46-
from libs.vpnproviders import getUserDataPath, getAlternativeMessages
47-
from libs.access import getVPNURL, setVPNURL
46+
from libs.vpnproviders import getUserDataPath, getAlternativeMessages, postConnectAlternative
47+
from libs.access import getVPNURL, setVPNURL, getVPNProfile
4848
from libs.vpnapi import VPNAPI
4949

5050
# Set the addon name for use in the dialogs
@@ -974,6 +974,8 @@ def onPlayBackStarted(self, *arg):
974974
addon.setSetting("alternative_message_time", str(now()))
975975
addon.setSetting("alternative_message_token", new_id)
976976
addon = xbmcaddon.Addon()
977+
if isAlternative(vpn_provider):
978+
postConnectAlternative(vpn_provider)
977979
if addon.getSetting("display_location_on_connect") == "true":
978980
_, ip, country, isp = getIPInfo(addon)
979981
xbmcgui.Dialog().notification(notification_title, "Connected to "+ getVPNProfileFriendly() + " via Service Provider " + isp + " in " + country + ". IP is " + ip + ".", getAddonPath(True, icon), 20000, False)

0 commit comments

Comments
 (0)