Permalink
Browse files

cactusvpn, ibvpn and treeview-scrolled

  • Loading branch information...
pulpofred
pulpofred committed Mar 10, 2016
1 parent b394a82 commit 0943c29b85a33dc862bbe9099b9f58a692077ad4
@@ -106,7 +106,7 @@ proc build-deb-rpm {arch} {
proc build-total {archs {x86_64 ix86}} {
proc build-total {{archs {x86_64 ix86}}} {
foreach arch $archs {
build-fruho linux $arch
build-fruhod linux $arch
@@ -245,6 +245,7 @@ proc push-update {os arch tohost} {
set ::FRUHO_VERSION 0.0.16
prepare-lib sklib 0.0.0
#build-total
build-total x86_64
#package require i18n
#i18n code2msg ./fruho/main.tcl {es pl} ./fruho/messages.txt
@@ -126,10 +126,3 @@ proc ::airvpn::ImportClicked {tab} {
}
lappend ::model::Supported_providers {150 airvpn}
if 0 {
dict set model::Supported_providers airvpn {
order 150
name $::airvpn::name
dispname $::airvpn::dispname
}
}
@@ -0,0 +1,128 @@
namespace eval ::cactusvpn {
namespace export *
namespace ensemble create
variable name cactusvpn
variable dispname CactusVPN
variable host bootstrap
variable port 10443
variable path_config /vpapi/cactusvpn/config
variable path_plans /vpapi/cactusvpn/plans
# input entries - resettable/modifiable variables
variable newprofilename ""
variable username ""
variable password ""
}
proc ::cactusvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "$dispname username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text "e.g. euahqiou"
ttk::label $pconf.passwordlabel -text "$dispname password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
hypertext $pconf.link "Create free or premium account on <https://fruho.com/redirect?urlid=cactusvpn&cn=$::model::Cn><cactusvpn.com>"
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
proc ::cactusvpn::add-to-treeview-plist {plist} {
variable name
variable dispname
$plist insert {} end -id $name -image [img load 16/logo_$name] -values [list $dispname]
}
# this is csp coroutine
proc ::cactusvpn::ImportClicked {tab} {
try {
variable name
variable dispname
variable host
variable port
variable path_config
variable path_plans
variable username
variable password
variable newprofilename
set profileid [name2id $newprofilename]
set pconf $tab.$name
importline-update $pconf "Importing configuration from $dispname" disabled spin
set result [vpapi-config-direct $newprofilename $host $port $path_config?[this-pcv] $username $password]
if {$result != 200} {
importline-update $pconf [http2importline $result] normal empty
return
}
puts stderr "VPAPI-CONFIG-DIRECT completed"
set result [vpapi-plans-direct $newprofilename $host $port $path_plans?[this-pcv] $username $password]
if {$result != 200} {
importline-update $pconf [http2importline $result] normal empty
return
}
# save in the model to be able later refresh the plans via vpapi
dict set ::model::Profiles $profileid vpapi_username $username
dict set ::model::Profiles $profileid vpapi_password $password
dict set ::model::Profiles $profileid vpapi_host $host
dict set ::model::Profiles $profileid vpapi_port $port
dict set ::model::Profiles $profileid vpapi_path_plans $path_plans
dict set ::model::Profiles $profileid provider $name
puts stderr "VPAPI-PLANS-DIRECT completed"
importline-update $pconf "" normal empty
set ::${name}::username ""
set ::${name}::password ""
# when repainting tabset select the newly created tab
set ::model::selected_profile $profileid
tabset-profiles .c.tabsetenvelope
} on error {e1 e2} {
puts stderr [log $e1 $e2]
}
}
lappend ::model::Supported_providers {090 cactusvpn}
@@ -117,11 +117,3 @@ proc ::cyberghost::ImportClicked {tab name} {
lappend ::model::Supported_providers {200 cyberghost}
if 0 {
dict set model::Supported_providers cyberghost {
order 200
name $::cyberghost::name
dispname $::cyberghost::dispname
}
}
@@ -336,11 +336,3 @@ proc ::from_file::create-slist {endpoints} {
lappend ::model::Supported_providers {900 from_file}
if 0 {
dict set model::Supported_providers from_file {
order 900
name $::from_file::name
dispname $::from_file::dispname
}
}
@@ -134,11 +134,3 @@ proc ::hideipvpn::ImportClicked {tab} {
}
lappend ::model::Supported_providers {050 hideipvpn}
if 0 {
dict set model::Supported_providers hideipvpn {
order 50
name $::hideipvpn::name
dispname $::hideipvpn::dispname
}
}
@@ -0,0 +1,128 @@
namespace eval ::ibvpn {
namespace export *
namespace ensemble create
variable name ibvpn
variable dispname ibVPN
variable host bootstrap
variable port 10443
variable path_config /vpapi/ibvpn/config
variable path_plans /vpapi/ibvpn/plans
# input entries - resettable/modifiable variables
variable newprofilename ""
variable username ""
variable password ""
}
proc ::ibvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "$dispname username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text "e.g. euahqiou"
ttk::label $pconf.passwordlabel -text "$dispname password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
hypertext $pconf.link "Create free or premium account on <https://fruho.com/redirect?urlid=ibvpn&cn=$::model::Cn><ibvpn.com>"
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
proc ::ibvpn::add-to-treeview-plist {plist} {
variable name
variable dispname
$plist insert {} end -id $name -image [img load 16/logo_$name] -values [list $dispname]
}
# this is csp coroutine
proc ::ibvpn::ImportClicked {tab} {
try {
variable name
variable dispname
variable host
variable port
variable path_config
variable path_plans
variable username
variable password
variable newprofilename
set profileid [name2id $newprofilename]
set pconf $tab.$name
importline-update $pconf "Importing configuration from $dispname" disabled spin
set result [vpapi-config-direct $newprofilename $host $port $path_config?[this-pcv] $username $password]
if {$result != 200} {
importline-update $pconf [http2importline $result] normal empty
return
}
puts stderr "VPAPI-CONFIG-DIRECT completed"
set result [vpapi-plans-direct $newprofilename $host $port $path_plans?[this-pcv] $username $password]
if {$result != 200} {
importline-update $pconf [http2importline $result] normal empty
return
}
# save in the model to be able later refresh the plans via vpapi
dict set ::model::Profiles $profileid vpapi_username $username
dict set ::model::Profiles $profileid vpapi_password $password
dict set ::model::Profiles $profileid vpapi_host $host
dict set ::model::Profiles $profileid vpapi_port $port
dict set ::model::Profiles $profileid vpapi_path_plans $path_plans
dict set ::model::Profiles $profileid provider $name
puts stderr "VPAPI-PLANS-DIRECT completed"
importline-update $pconf "" normal empty
set ::${name}::username ""
set ::${name}::password ""
# when repainting tabset select the newly created tab
set ::model::selected_profile $profileid
tabset-profiles .c.tabsetenvelope
} on error {e1 e2} {
puts stderr [log $e1 $e2]
}
}
lappend ::model::Supported_providers {120 ibvpn}
@@ -118,12 +118,3 @@ proc ::mullvad::ImportClicked {tab} {
lappend ::model::Supported_providers {030 mullvad}
if 0 {
dict set model::Supported_providers mullvad {
order 30
name $::mullvad::name
dispname $::mullvad::dispname
}
}
@@ -125,12 +125,3 @@ proc ::securitykiss::ImportClicked {tab} {
}
lappend ::model::Supported_providers {010 securitykiss}
if 0 {
dict set model::Supported_providers securitykiss {
order 10
name $::securitykiss::name
dispname $::securitykiss::dispname
}
}
@@ -125,11 +125,3 @@ proc ::vpnbook::ImportClicked {tab} {
}
lappend ::model::Supported_providers {020 vpnbook}
if 0 {
dict set model::Supported_providers vpnbook {
order 20
name $::vpnbook::name
dispname $::vpnbook::dispname
}
}
@@ -128,12 +128,3 @@ proc ::vyprvpn::ImportClicked {tab} {
lappend ::model::Supported_providers {110 vyprvpn}
if 0 {
dict set model::Supported_providers vyprvpn {
order 110
name $::vyprvpn::name
dispname $::vyprvpn::dispname
}
}
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 0943c29

Please sign in to comment.