Example #1
0
                if not isAlternative(vpn_provider):
                    all_connections = getAddonList(addon.getSetting("vpn_provider_validated"), "*.ovpn")
                    location_connections = getFilteredProfileList(all_connections, addon.getSetting("vpn_protocol"), None)
                    location_connections.sort()
                else:
                    location_connections = getAlternativeLocations(vpn_provider, False)
                    connections = getAlternativeFriendlyLocations(vpn_provider, False)
            else:
                # Build a list of all validated connections
                location_connections = getValidatedList(addon, "")
            # Build the friendly list, displaying any active connection in blue
            if isAlternative(vpn_provider) and addon.getSetting("table_display_type") == "All connections":
                connections = getAlternativeFriendlyProfileList(connections, getVPNProfileFriendly(), "ff00ff00")
            else:
                connections = getFriendlyProfileList(location_connections, getVPNProfile(), "ff00ff00")
            if getVPNState() == "started":
                title = "Connected - " + getVPNProfileFriendly()
                connections.insert(0, disconnect_text)
            else:
                title = "Disconnected"
                connections.insert(0, disconnected_text)
            
            connections.append(cancel_text)

            i = xbmcgui.Dialog().select(title, connections)
            if connections[i] == disconnect_text or connections[i] == disconnected_text:
                setAPICommand("Disconnect")
            elif not connections[i] == cancel_text:
                if getVPNProfile() == location_connections[i-1] and (allowReconnection(vpn_provider) or addon.getSetting("allow_cycle_reconnect") == "true"):
                    setAPICommand("Reconnect")
                else:
Example #2
0
# Get the current behavioural settings
                connect_at_boot = addon.getSetting("vpn_connect_at_boot")
                reconnect_on_drop = addon.getSetting("vpn_reconnect")
                reconnect_filtering = addon.getSetting(
                    "vpn_reconnect_filtering")
                display_location_info = addon.getSetting(
                    "display_location_on_connect")
                #if addon.getSetting("vpn_command_use_sudo") == "true": useSudo(True)
                #else: useSudo(False)

                # Refresh filter lists
                debugTrace("Update filter lists from settings")
                refreshAddonFilterLists()

                # If the VPN is not deliberately disconnected, then connect it
                if vpn_setup and not getVPNState() == "off":
                    if getVPNState() == "started":
                        debugTrace("VPN is started on " + getVPNProfile() +
                                   " requesting " + getVPNRequestedProfile())
                        # We're connected, but to the wrong VPN
                        if not getVPNRequestedProfile() == "":
                            if getVPNProfile() != getVPNRequestedProfile():
                                reconnect_vpn = True
                    else:
                        debugTrace("VPN not started, state is " +
                                   getVPNState())
                        # If we've just booted, then we won't have set the vpn_state property on the window
                        # so it'll come back empty.  Use this to determine if we should connect on boot
                        if getVPNState() == "":
                            # Just booted/started service.  If we're not connected at boot, then we're
                            # deliberately disconnected until the user uses one of the connect options
Example #3
0
                    vpn_provider = addon.getSetting("vpn_provider_validated")
                    # If it's been set up, just check the VPN credentials file exists
                    # It can get deleted sometimes, like when reinstalling the addon
                    if usesPassAuth(getVPNLocation(vpn_provider)) and not xbmcvfs.exists(getCredentialsPath(addon)):
                        writeCredentials(addon)
                
                # Force a reboot timer check
                reboot_timer = 3600
                seconds_to_reboot_check = 0

				# Refresh filter lists
                debugTrace("Update filter lists from settings")
                refreshAddonFilterLists()

				# If the VPN is not deliberately disconnected, then connect it
                if vpn_setup and not getVPNState() == "off":
                    if getVPNState() == "started":
                        debugTrace("VPN is started on " + getVPNProfile() + " requesting " + getVPNRequestedProfile())
						# We're connected, but to the wrong VPN
                        if not getVPNRequestedProfile() == "":
                            if getVPNProfile() != getVPNRequestedProfile() :
                                reconnect_vpn = True
                    else:
                        debugTrace("VPN not started, state is " + getVPNState())
						# If we've just booted, then we won't have set the vpn_state property on the window
						# so it'll come back empty.  Use this to determine if we should connect on boot
                        if getVPNState() == "":
							# Just booted/started service.  If we're not connected at boot, then we're
							# deliberately disconnected until the user uses one of the connect options
                            if addon.getSetting("vpn_connect_at_boot") == "true":
                                debugTrace("Connecting to primary VPN at boot time")