Exemplo n.º 1
0
            # Disconnect so that live files are not being modified
            if isVPNConnected(): resetVPNConnections(addon)

            # Select the provider
            provider_list = []
            for provider in providers:
                if usesUserKeys(provider):
                    provider_list.append(getVPNDisplay(provider))
            provider_list.sort()
            index = xbmcgui.Dialog().select("Select VPN provider",
                                            provider_list)
            provider_display = provider_list[index]
            provider = getVPNLocation(provider_display)
            # Get the key/cert pairs for that provider and offer up for deletion
            user_keys = getUserKeys(provider)
            user_certs = getUserCerts(provider)
            if len(user_keys) > 0 or len(user_certs) > 0:
                still_deleting = True
                while still_deleting:
                    if len(user_keys) > 0 or len(user_certs) > 0:

                        # Build a list of things to display.  We should always have pairs, but if
                        # something didn't copy or the user has messed with the dir this will cope
                        all_user = []
                        single_pair = "user  [I](Same key and certificate used for all connections)[/I]"
                        for key in user_keys:
                            list_item = os.path.basename(key)
                            list_item = list_item.replace(".key", "")
                            if list_item == "user": list_item = single_pair
                            all_user.append(list_item)
Exemplo n.º 2
0
    if addon.getSetting("1_vpn_validated") == "" or xbmcgui.Dialog().yesno(addon_name, "Deleting key and certificate files will reset all VPN connections.  Connections must be re-validated before use.\nContinue?"):

        # Reset the connection before we do anything else
        if isVPNConnected(): resetVPNConnections(addon)
    
        # Select the provider
        provider_list = []
        for provider in providers:
            if usesUserKeys(provider):
                provider_list.append(getVPNDisplay(provider))
        provider_list.sort()
        index = xbmcgui.Dialog().select("Select VPN provider", provider_list)
        provider_display = provider_list[index]
        provider = getVPNLocation(provider_display)
        # Get the key/cert pairs for that provider and offer up for deletion
        user_keys = getUserKeys(provider)
        user_certs = getUserCerts(provider)
        if len(user_keys) > 0 or len(user_certs) > 0:
            still_deleting = True
            while still_deleting:
                if len(user_keys) > 0 or len(user_certs) > 0:
                
                    # Build a list of things to display.  We should always have pairs, but if
                    # something didn't copy or the user has messed with the dir this will cope
                    all_user = []
                    single_pair = "user  [I](Same key and certificate used for all connections)[/I]"
                    for key in user_keys:
                        list_item = os.path.basename(key)
                        list_item = list_item.replace(".key", "")
                        if list_item == "user": list_item = single_pair
                        all_user.append(list_item)