Permalink
Browse files

vpnbook added and prompt for custom-auth-user

  • Loading branch information...
hypatia2 committed Nov 2, 2015
1 parent 417e5c9 commit 16aaa27ae7ac0783900da87e47a83eb6eceb284d
Showing with 366 additions and 13 deletions.
  1. +2 −2 build.tcl
  2. +139 −0 fruho/add_cyberghost.tcl
  3. +139 −0 fruho/add_vpnbook.tcl
  4. BIN fruho/images/16/logo_vpnbook.png
  5. +84 −9 fruho/main.tcl
  6. +1 −1 fruhod/main.tcl
  7. +1 −1 sklib/https.tcl
@@ -229,8 +229,8 @@ prepare-lib sklib 0.0.0
build-fruho linux [this-arch]
build-fruhod linux [this-arch]
build-deb-rpm [this-arch]
#build-fruhod linux [this-arch]
#build-deb-rpm [this-arch]
#release hypatia2
@@ -0,0 +1,139 @@
namespace eval ::cyberghost {
namespace export *
namespace ensemble create
variable name cyberghost
variable dispname CyberGhost
variable host bootstrap
variable port 10443
variable path_config /vpapi/cyberghost/config
variable path_plans /vpapi/cyberghost/plans
# input entries - resettable/modifiable variables
variable newprofilename ""
variable username 4478671_8Tp4DJYrvg
variable password 85hSeYF8hb
}
proc ::cyberghost::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 "Username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey
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
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
return $pconf
}
proc ::cyberghost::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 ::cyberghost::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
img place 24/spin $pconf.importline.img
$pconf.importline.msg configure -text "Importing configuration from $dispname"
$pconf.importline.button configure -state disabled
set result [vpapi-config-direct $newprofilename $host $port $path_config?[this-pcv] $username $password]
if {$result != 200} {
set msg [http2importline $result]
img place 24/empty $pconf.importline.img
$pconf.importline.button configure -state normal
$pconf.importline.msg configure -text $msg
return
}
puts stderr "VPAPI-CONFIG-DIRECT completed"
set result [vpapi-plans-direct $newprofilename $host $port $path_plans?[this-pcv] $username $password]
if {$result != 200} {
set msg [http2importline $result]
img place 24/empty $pconf.importline.img
$pconf.importline.button configure -state normal
$pconf.importline.msg configure -text $msg
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
puts stderr "VPAPI-PLANS-DIRECT completed"
img place 24/empty $pconf.importline.img
$pconf.importline.msg configure -text ""
$pconf.importline.button configure -state normal
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]
}
}
dict set model::Supported_providers cyberghost {
name $::cyberghost::name
dispname $::cyberghost::dispname
}
@@ -0,0 +1,139 @@
namespace eval ::vpnbook {
namespace export *
namespace ensemble create
variable name vpnbook
variable dispname VpnBook
variable host bootstrap
variable port 10443
variable path_config /vpapi/vpnbook/config
variable path_plans /vpapi/vpnbook/plans
# input entries - resettable/modifiable variables
variable newprofilename ""
variable username vpnbook
variable password ChakU3ub
}
proc ::vpnbook::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 "Username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey
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
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
return $pconf
}
proc ::vpnbook::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 ::vpnbook::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
img place 24/spin $pconf.importline.img
$pconf.importline.msg configure -text "Importing configuration from $dispname"
$pconf.importline.button configure -state disabled
set result [vpapi-config-direct $newprofilename $host $port $path_config?[this-pcv] $username $password]
if {$result != 200} {
set msg [http2importline $result]
img place 24/empty $pconf.importline.img
$pconf.importline.button configure -state normal
$pconf.importline.msg configure -text $msg
return
}
puts stderr "VPAPI-CONFIG-DIRECT completed"
set result [vpapi-plans-direct $newprofilename $host $port $path_plans?[this-pcv] $username $password]
if {$result != 200} {
set msg [http2importline $result]
img place 24/empty $pconf.importline.img
$pconf.importline.button configure -state normal
$pconf.importline.msg configure -text $msg
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
puts stderr "VPAPI-PLANS-DIRECT completed"
img place 24/empty $pconf.importline.img
$pconf.importline.msg configure -text ""
$pconf.importline.button configure -state normal
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]
}
}
dict set model::Supported_providers vpnbook {
name $::vpnbook::name
dispname $::vpnbook::dispname
}
Binary file not shown.
Oops, something went wrong.

0 comments on commit 16aaa27

Please sign in to comment.