├── .gitignore ├── LICENSE ├── README.md ├── install-vmdStore.sh ├── install.txt ├── vmdStore-Installer-Script.zip ├── vmdStore-installer-tkconsole.tcl └── vmdStore ├── gui ├── installing.tcl ├── loading.tcl └── topGui.tcl ├── lib ├── browser.tcl ├── install.tcl ├── readExternalPackage.tcl ├── search.tcl ├── tar.tcl ├── theme │ ├── images │ │ ├── button-a-green.gif │ │ ├── button-a.gif │ │ ├── button-d-green.gif │ │ ├── button-d.gif │ │ ├── button-n-green.gif │ │ ├── button-n.gif │ │ ├── button-uninstall-a.gif │ │ ├── button-uninstall-d.gif │ │ ├── button-uninstall-n.gif │ │ ├── button-update-a.gif │ │ ├── button-update-d.gif │ │ ├── button-update-n.gif │ │ ├── entry-n.gif │ │ ├── spinner.gif │ │ └── vmdStore-Logo.gif │ └── theme.tcl ├── tls │ ├── linux │ │ ├── i686 │ │ │ ├── libtls1.6.7.1.so │ │ │ ├── teapot.txt │ │ │ └── tls.tcl │ │ └── x86_64 │ │ │ ├── libtls1.6.7.1.so │ │ │ ├── teapot.txt │ │ │ └── tls.tcl │ ├── macOS │ │ ├── libtls1.6.7.1.dylib │ │ ├── teapot.txt │ │ └── tls.tcl │ └── windows │ │ ├── 1.7.16 │ │ ├── pkgIndex.tcl │ │ ├── tls.htm │ │ ├── tls.tcl │ │ └── tls1716t.dll │ │ ├── teapot.txt │ │ ├── tls.tcl │ │ └── tls1671.dll ├── wget │ └── wget.exe └── zip │ └── unzip.exe ├── pkgIndex.tcl ├── vmdStore.rc └── vmdStore.tcl /.gitignore: -------------------------------------------------------------------------------- 1 | vmdStore/plugins 2 | vmdStore/vmdStore-Content 3 | vmdStore/vmdStore.rc.bak 4 | vmdStore/temp 5 | vmdStore/vmdStore.rc 6 | temp 7 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 BioSIM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vmdStore 2 | vmdStore provides a user-friendly interface to free install VMD plugins. vmdStore also helps you keeping the plugins always updated. 3 | 4 | ![Logo](https://i.imgur.com/fH1A93b.gif) 5 | 6 | ![vmdStore](https://i.imgur.com/pt2Yydd.jpg) 7 | 8 | ## Minimum Requirements 9 | Operating System: macOS, Linux, or Windows 10 | 11 | Visual Molecular Dynamics (VMD) 1.9.3 or later 12 | 13 | wget (Linux and macOS) 14 | 15 | ## Installation 16 | 17 | The GUI installers for VMD Store were deprecated. Please, follow one of the following methods to install VMD Store. 18 | 19 | **1. You can install VMD Store through the Tk Console on VMD:** 20 | 21 | This installation process can be used on every machine running VMD 1.9.3 or later. 22 | 23 | a. Download and unpack the VMD Store: 24 | 25 | [![Download vmdStore](https://a.fsdn.com/con/app/sf-download-button)](https://sourceforge.net/projects/vmdstore/files/latest/download) 26 | [![Download vmdStore](https://img.shields.io/sourceforge/dt/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 27 | [![Download vmdStore](https://img.shields.io/sourceforge/dd/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 28 | [![Download vmdStore](https://img.shields.io/sourceforge/dw/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 29 | [![Download vmdStore](https://img.shields.io/sourceforge/dm/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 30 | 31 | b. Launch VMD (1.9.3 or later) and open the Tk Console (Extensions > Tk Console); 32 | 33 | c. Navigate to the downloaded directory on Tk Console. Example: 34 | 35 | [Linux/macOS]: 36 | 37 | cd /home/users/myname/Downloads/BioSIM-Research-Group-vmdStore-19131bc/ 38 | 39 | 40 | [Windows]: 41 | 42 | cd C:/Users/myname/Downloads/BioSIM-Research-Group-vmdStore-19131bc/ 43 | 44 | d. Run the following command on Tk Console: 45 | 46 | ``` 47 | play vmdStore-installer-tkconsole.tcl 48 | ``` 49 | 50 | e. Follow the instructions; 51 | 52 | f. Done! 53 | Re-launch VMD and open VMD Store at Extensions > VMD Store > VMD Store. 54 | 55 | Video Tutorial (https://youtu.be/r6Ci2AS2uv0) 56 | 57 | 58 | **2. or the bash script (macOS and Linux only):** 59 | 60 | a. Download and unpack the VMD Store: 61 | 62 | [![Download vmdStore](https://a.fsdn.com/con/app/sf-download-button)](https://sourceforge.net/projects/vmdstore/files/latest/download) 63 | [![Download vmdStore](https://img.shields.io/sourceforge/dt/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 64 | [![Download vmdStore](https://img.shields.io/sourceforge/dd/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 65 | [![Download vmdStore](https://img.shields.io/sourceforge/dw/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 66 | [![Download vmdStore](https://img.shields.io/sourceforge/dm/vmdstore.svg)](https://sourceforge.net/projects/vmdstore/files/latest/download) 67 | 68 | b. Navigate to the download directory: 69 | 70 | ``` 71 | cd /home/users/myname/Downloads/BioSIM-Research-Group-vmdStore-19131bc/ 72 | ``` 73 | 74 | c. Run the following command: 75 | ``` 76 | bash install-vmdStore.sh 77 | ``` 78 | 79 | d. Follow the instructions. 80 | 81 | 82 | **3. or manually according to the following tutorial.** 83 | 84 | 85 | ### Manual Installation 86 | 1. Download or clone the repository. 87 | 88 | 2. Copy the "vmdStore" directory, which is located inside the download package, to a Read&Write allowed directory on your system. 89 | 90 | 3. Edit the "vmdStore/vmdStore.rc" file to replace the "none" word by the path where the vmdStore directory is located. Example: "/home/users/name/vmdStore". (Attention: Enclose the path in quotation marks) 91 | 92 | 4. Add the following lines to your .vmdrc or vmd.rc file: 93 | 94 | Replace the "none" word by the path where the vmdStore.rc file is located. Example: "/home/users/name/vmdStore/vmdStore.rc" 95 | 96 | ``` 97 | ##### VMD Store ## START ##### 98 | play none 99 | ##### VMD Store ## END ##### 100 | ``` 101 | 102 | 5. Start VMD. It could be necessary to restart VMD on first launch after vmdStore installation. 103 | 104 | ## Bug Report/Suggestions 105 | If you want to report bugs or suggest features, please contact me: hfernandes@med.up.pt 106 | 107 | If you want to include your own VMD plugin on VMD Store, send an email to hfernandes@med.up.pt 108 | 109 | ## Available Plugins 110 | ### Alanine Scanning Mutagenesis 111 | - compASM (https://github.com/BioSIM-Research-Group/compASM) 112 | 113 | ### Education 114 | - vmdMagazine (https://github.com/BioSIM-Research-Group/vmdMagazine 115 | 116 | ### Molecular Mechanics 117 | - DelPhiForceVMD (https://github.com/delphi001/DelPhiForceVMD) 118 | - pathways (https://github.com/balabin/pathways) 119 | - energySplit (https://github.com/BioSIM-Research-Group/energySplit) 120 | 121 | ### QM/MM 122 | - molUP (https://github.com/BioSIM-Research-Group/molUP) 123 | 124 | ### Tools 125 | - toolBar (https://github.com/BioSIM-Research-Group/toolBar) 126 | - selectionManager (https://github.com/BioSIM-Research-Group/selectionManager) 127 | - chemPathTracker (https://github.com/BioSIM-Research-Group/chemPathTracker) 128 | - volArea (https://github.com/BioSIM-Research-Group/volArea) 129 | 130 | ### Molecular Docking 131 | - vsLab (https://github.com/BioSIM-Research-Group/vsLab) 132 | -------------------------------------------------------------------------------- /install-vmdStore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo '===============================================================' 4 | echo '========================== VMD Store ==========================' 5 | echo '===============================================================' 6 | 7 | echo '====== This script is going to install VMD Store for you. =====' 8 | echo '===============================================================' 9 | echo '===============================================================' 10 | echo ' Where do you want to install the VMD Store?' 11 | echo ' Please provide a full path:' 12 | 13 | read installPath 14 | 15 | if [ ! -d "$installPath" ]; then 16 | echo 'The path provided is not valid: "'$installPath'"' 17 | echo 'Abort!' 18 | exit 19 | fi 20 | 21 | echo 'The VMD Store installation path: "'$installPath'"' 22 | echo '===============================================================' 23 | echo 'Checking last version of VMD Store...' 24 | versionFile=$(curl -s https://github.com/BioSIM-Research-Group/vmdStore/releases/latest) 25 | version=$(awk -F 'tag/' '{print $2}' <<< $versionFile | awk -F '"' '{print $1}') 26 | echo 'VMD Store version '$version' was found online.' 27 | echo '===============================================================' 28 | echo 'Downloading...' 29 | wget -q "https://github.com/BioSIM-Research-Group/vmdStore/archive/$version.zip" -O "$installPath/vmdStore.zip" 30 | echo 'Download Complete!' 31 | echo '===============================================================' 32 | echo 'Installing...' 33 | unzip -q "$installPath/vmdStore.zip" -d "$installPath/tmp_vmdStore" 34 | cp -r "$installPath/tmp_vmdStore/vmdStore-$version/vmdStore" "$installPath" 35 | rm -rf "$installPath/tmp_vmdStore" "$installPath/vmdStore.zip" 36 | sed -i -- "s/XXversionXX/$version/g" "$installPath/vmdStore/vmdStore.rc" 37 | path="$installPath/vmdStore" 38 | sed -i -- "s|none|\"$path\"|g" "$installPath/vmdStore/vmdStore.rc" 39 | echo ' The following lines were added to the file '"$HOME/.vmdrc" 40 | echo " ##### VMD Store ## START #####" 41 | echo " play \"$path/vmdStore.rc\"" 42 | echo " ##### VMD Store ## END #####" 43 | echo " menu main on" 44 | 45 | echo "##### VMD Store ## START #####" >> "$HOME/.vmdrc" 46 | echo "play \"$path/vmdStore.rc\"" >> "$HOME/.vmdrc" 47 | echo "##### VMD Store ## END #####" >> "$HOME/.vmdrc" 48 | echo "menu main on" >> "$HOME/.vmdrc" 49 | echo 'Installation Complete!' 50 | echo '===============================================================' 51 | echo 'Enjoy the VMD Store under the "Extensions" > "VMD Store" > "VMD Store" menu of VMD.' 52 | echo '===============================================================' 53 | echo 'VMD Store | Developed by Henrique S. Fernandes and Nuno M.F.S.A. Cerqueira' 54 | echo 'Contact: hfernandes@med.up.pt' -------------------------------------------------------------------------------- /install.txt: -------------------------------------------------------------------------------- 1 | ####vmdStore#### START vmdStore 2 | ## Version XXversionXX 3 | variable vmdStorePath none 4 | lappend auto_path $::vmdStorePath 5 | vmd_install_extension vmdStore "vmdStore::start" "VMD Store/VMD Store" 6 | ####vmdStore#### END vmdStore -------------------------------------------------------------------------------- /vmdStore-Installer-Script.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore-Installer-Script.zip -------------------------------------------------------------------------------- /vmdStore-installer-tkconsole.tcl: -------------------------------------------------------------------------------- 1 | #### VMD Store Installer 2 | #### Installation via VMD Tk Console 3 | 4 | #### Requirements 5 | ## VMD 1.9.3 later 6 | 7 | #### How to install ? 8 | ## 1. Launch VMD; 9 | ## 2. Open the Tk Console (Extensions > Tk console); 10 | ## 3. Write the following command and press ENTER: 11 | ## cd 12 | ## Example: cd /home/users/myname/Downloads/vmdStore-Installer 13 | ## 4. Write the following command and press ENTER: 14 | ## play vmdStore-install.tcl 15 | ## 5. Follow the instruction; 16 | ## 6. Done! 17 | ## Re-launch VMD and open VMD Store at Extensions > VMD Store > VMD Store. 18 | 19 | #### How to uninstall? 20 | ## 1. Edit your .vmdrc or vmd.rc file and delete all the lines related to VMD Store (example below); 21 | ## ####vmdStore#### START vmdStore 22 | ## play "/some.path/vmdStore/vmdStore.rc" 23 | ## ####vmdStore#### END vmdStore 24 | ## 2. Delete the vmdStore directory. 25 | 26 | ############################################################################################################ 27 | ############################################################################################################ 28 | ############################################################################################################ 29 | ############################################################################################################ 30 | 31 | #### Installation code 32 | set vmdStoreVersion "1.1.13" ; #Current VMD Store version 33 | set installerLocation "." ; #Get path of the installer location 34 | 35 | if {[file exists "$installerLocation/vmdStore"] == 0} { 36 | puts "FAILED!\n\nYou are not running the installation script (vmdStore-install.tcl) on the installation directory (vmdStore-Installer).\n\nPlease, run \"cd \"\nExample:\ncd /home/users/myname/Downloads/vmdStore-Installer" 37 | 38 | } else { 39 | puts "VMD Store Installer\n\nWhere do you want to install the VMD Store?\nPlease provide a full path:\n" ; #Initial message asking for the installation path 40 | gets stdin installPath ; #Ask for user input - Installation Path 41 | puts "The VMD Store ($vmdStoreVersion) is going to be installed in \"$installPath/vmdStore\"" ; #Message telling that the path was correctly collected 42 | 43 | # Copy the vmdStore directory to the path provided by the user. 44 | file copy -force "$installerLocation/vmdStore" "$installPath" 45 | 46 | # Edit the vmdStore.rc file 47 | set vmdStoreRCfile [open "$installPath/vmdStore/vmdStore.rc" w] 48 | puts $vmdStoreRCfile "####vmdStore#### START vmdStore" 49 | puts $vmdStoreRCfile "## Version $vmdStoreVersion" 50 | puts $vmdStoreRCfile "variable vmdStorePath \"$installPath/vmdStore\"" 51 | puts $vmdStoreRCfile "lappend auto_path \$::vmdStorePath" 52 | puts $vmdStoreRCfile "vmd_install_extension vmdStore \"vmdStore::start\" \"VMD Store/VMD Store\"" 53 | puts $vmdStoreRCfile "####vmdStore#### END vmdStore\n## VMD Store Plugin Manager ##\n## Please, do not change this file unless you know what are you doing! ##" 54 | 55 | close $vmdStoreRCfile 56 | 57 | # Add the installation line to .vmdrc or vmd.rc file 58 | set home $::env(HOME) ; # set home directory 59 | puts $home 60 | if {[string first "Windows" $::tcl_platform(os)] != -1} { 61 | set vmdrcPath "$home/vmd.rc" 62 | } else { 63 | set vmdrcPath "$home/.vmdrc" 64 | } 65 | 66 | set file [open "$vmdrcPath" a+] 67 | puts $file "##### VMD Store ## START #####\nplay \"$installPath/vmdStore/vmdStore.rc\"\n##### VMD Store ## END #####\nmenu main on" 68 | close $file 69 | 70 | # if {[string first "Windows" $::tcl_platform(os)] != -1} { 71 | # set vmdrcPath "C:/Program Files (x86)/University of Illinois/VMD/vmd.rc" 72 | 73 | # set file [open "$vmdrcPath" a+] 74 | # puts $file "##### VMD Store ## START #####\nplay \"$installPath/vmdStore/vmdStore.rc\"\n##### VMD Store ## END #####\nmenu main on" 75 | # close $file 76 | # } 77 | 78 | # Final messages 79 | puts "Installation Complete!" 80 | puts "===============================================================" 81 | puts "Enjoy the VMD Store under the \n\"Extensions\" > \"VMD Store\" > \"VMD Store\"\n menu of VMD." 82 | puts "===============================================================" 83 | puts "\n\nPlease, re-launch the VMD!" 84 | } 85 | -------------------------------------------------------------------------------- /vmdStore/gui/installing.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreInstalling 1.0 2 | 3 | proc vmdStore::installGui {plugin} { 4 | #### Check if the window exists 5 | if {[winfo exists $::vmdStore::installing]} {wm deiconify $::vmdStore::installing ;return $::vmdStore::installing} 6 | toplevel $::vmdStore::installing 7 | 8 | #### Title of the windows 9 | wm title $vmdStore::installing "vmdStore v$vmdStore::version - Installing $plugin" ; 10 | 11 | #### Screen Size 12 | set sWidth [expr [winfo vrootwidth $::vmdStore::installing] -0] 13 | set sHeight [expr [winfo vrootheight $::vmdStore::installing] -100] 14 | 15 | #### Window Size and Position 16 | wm geometry $::vmdStore::installing 400x190+[expr $sWidth / 2 - 400 / 2]+[expr $sHeight / 2 - 300 / 2] 17 | $::vmdStore::installing configure -background {white} 18 | 19 | wm resizable $::vmdStore::installing 0 0 20 | 21 | ## Procedure when the window is closed 22 | #wm protocol $::vmdStore::installing WM_DELETE_WINDOW {vmdStore::quit} 23 | 24 | ## Apply Theme 25 | ttk::style theme use vmdStoreTheme 26 | 27 | #################################################################################################################### 28 | #################################################################################################################### 29 | #################################################################################################################### 30 | 31 | #### Pack background frame 32 | grid columnconfigure $vmdStore::installing 0 -weight 1 33 | grid rowconfigure $vmdStore::installing 0 -weight 1 34 | 35 | set f0 $vmdStore::installing.frame0 36 | grid [ttk::frame $f0] -in $vmdStore::installing -sticky news 37 | 38 | grid [ttk::label $f0.loading \ 39 | -text "Installing $plugin..." \ 40 | -style vmdStore.whiteFg.blueBg.TLabel \ 41 | -font {Helvetica -25} \ 42 | -anchor center \ 43 | ] -in $f0 -row 0 -column 0 -sticky news -ipadx 20 -ipady 20 44 | 45 | grid [ttk::progressbar $f0.progressbar \ 46 | -orient horizontal \ 47 | -length 250 \ 48 | -phase 1 \ 49 | -variable vmdStore::installingProgress \ 50 | -mode indeterminate \ 51 | ] -in $f0 -row 1 -column 0 -sticky news 52 | 53 | $f0.progressbar start 10 54 | 55 | grid [ttk::label $f0.wait \ 56 | -text "After the installation, you have to restart VMD to make the plugin available." \ 57 | -style vmdStore.whiteFg.blueBg.TLabel \ 58 | -font {Helvetica -10} \ 59 | -anchor center \ 60 | ] -in $f0 -row 2 -column 0 -sticky news -ipadx 20 -ipady 20 61 | 62 | grid columnconfigure $f0 0 -weight 1 63 | grid rowconfigure $f0 1 -weight 1 64 | } -------------------------------------------------------------------------------- /vmdStore/gui/loading.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreLoadingGui 0.1 2 | 3 | proc vmdStore::loadingGui {} { 4 | #### Check if the window exists 5 | if {[winfo exists $::vmdStore::loadingGui]} {wm deiconify $::vmdStore::loadingGui ;return $::vmdStore::loadingGui} 6 | toplevel $::vmdStore::loadingGui 7 | 8 | #### Title of the windows 9 | wm title $vmdStore::loadingGui "vmdStore v$vmdStore::version - Loading..." ; 10 | 11 | #### Screen Size 12 | set sWidth [expr [winfo vrootwidth $::vmdStore::loadingGui] -0] 13 | set sHeight [expr [winfo vrootheight $::vmdStore::loadingGui] -100] 14 | 15 | #### Window Size and Position 16 | wm geometry $::vmdStore::loadingGui 400x300+[expr $sWidth / 2 - 400 / 2]+[expr $sHeight / 2 - 300 / 2] 17 | $::vmdStore::loadingGui configure -background {white} 18 | 19 | wm resizable $::vmdStore::loadingGui 0 0 20 | 21 | ## Procedure when the window is closed 22 | #wm protocol $::vmdStore::loadingGui WM_DELETE_WINDOW {vmdStore::quit} 23 | 24 | ## Apply Theme 25 | ttk::style theme use vmdStoreTheme 26 | 27 | #################################################################################################################### 28 | #################################################################################################################### 29 | #################################################################################################################### 30 | 31 | #### Pack background frame 32 | grid columnconfigure $vmdStore::loadingGui 0 -weight 1 33 | grid rowconfigure $vmdStore::loadingGui 0 -weight 1 34 | 35 | set f0 $vmdStore::loadingGui.frame0 36 | grid [ttk::frame $f0] -in $vmdStore::loadingGui -sticky news 37 | 38 | grid [ttk::label $f0.loading \ 39 | -text "Loading..." \ 40 | -style vmdStore.whiteFg.blueBg.TLabel \ 41 | -font {Helvetica -25} \ 42 | -anchor center \ 43 | ] -in $f0 -row 0 -column 0 -sticky news -ipadx 20 -ipady 20 44 | 45 | set image [image create photo -file "$::vmdStorePath/lib/theme/images/spinner.gif"] 46 | 47 | grid [ttk::label $f0.loadingImage \ 48 | -image $image \ 49 | -style vmdStore.whiteFg.blueBg.TLabel \ 50 | -anchor center \ 51 | ] -in $f0 -row 1 -column 0 -sticky news 52 | 53 | grid [ttk::label $f0.wait \ 54 | -text "We are collecting new data from internet.\nPlease wait..." \ 55 | -style vmdStore.whiteFg.blueBg.TLabel \ 56 | -font {Helvetica -20} \ 57 | -anchor center \ 58 | ] -in $f0 -row 2 -column 0 -sticky news -ipadx 20 -ipady 20 59 | 60 | grid columnconfigure $f0 0 -weight 1 61 | grid rowconfigure $f0 1 -weight 1 62 | 63 | } 64 | -------------------------------------------------------------------------------- /vmdStore/gui/topGui.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreTopGui 0.1 2 | 3 | proc vmdStore::topGui {} { 4 | #### Check if the window exists 5 | if {[winfo exists $::vmdStore::topGui]} {wm deiconify $::vmdStore::topGui ;return $::vmdStore::topGui} 6 | toplevel $::vmdStore::topGui 7 | 8 | #### Title of the windows 9 | wm title $vmdStore::topGui "vmdStore v$vmdStore::version " ; 10 | 11 | #### Screen Size 12 | set sWidth [expr [winfo vrootwidth $::vmdStore::topGui] -0] 13 | set sHeight [expr [winfo vrootheight $::vmdStore::topGui] -100] 14 | 15 | #### Window Size and Position 16 | wm geometry $::vmdStore::topGui 1000x700+[expr $sWidth / 2 - 1000 / 2]+[expr $sHeight / 2 - 700 / 2] 17 | $::vmdStore::topGui configure -background {white} 18 | 19 | ## Procedure when the window is closed 20 | #wm protocol $::vmdStore::topGui WM_DELETE_WINDOW {vmdStore::quit} 21 | 22 | ## Apply Theme 23 | ttk::style theme use vmdStoreTheme 24 | 25 | 26 | #################################################################################################################### 27 | #################################################################################################################### 28 | #################################################################################################################### 29 | 30 | 31 | #### Pack background frame 32 | grid columnconfigure $vmdStore::topGui 0 -weight 1 33 | grid rowconfigure $vmdStore::topGui 1 -weight 1 34 | 35 | set f0 $vmdStore::topGui.frame0 36 | grid [ttk::frame $f0] -in $vmdStore::topGui -sticky news 37 | 38 | #### Header 39 | ## Left 40 | grid [ttk::label $f0.logo \ 41 | -image [image create photo -file "$::vmdStorePath/lib/theme/images/vmdStore-Logo.gif"] \ 42 | -style vmdStore.whiteFg.blueBg.TLabel \ 43 | -font {Helvetica -25} \ 44 | -anchor center \ 45 | ] -in $f0 -row 0 -column 0 -sticky news -ipadx 25 46 | 47 | ## Right 48 | grid [ttk::frame $f0.h1 \ 49 | -style vmdStore.gray.TFrame \ 50 | -height 100 \ 51 | ] -in $f0 -row 0 -column 1 -sticky news 52 | 53 | variable searchBar "Search..." 54 | grid [ttk::entry $f0.h1.searchBarEntry \ 55 | -textvariable vmdStore::searchBar \ 56 | -style vmdStore.searchBar.Entry \ 57 | ] -in $f0.h1 -row 0 -column 0 -sticky news -pady 25 -padx [list 10 0] 58 | bind $f0.h1.searchBarEntry {if {$vmdStore::searchBar == "Search..."} {set vmdStore::searchBar ""}} 59 | 60 | grid [ttk::button $f0.h1.searchButton \ 61 | -command {vmdStore::search $vmdStore::searchBar $vmdStore::topGui.frame1.left.f0.tree} \ 62 | -text "Search" \ 63 | -style vmdStore.blueBg.TButton \ 64 | ] -in $f0.h1 -row 0 -column 1 -sticky e -pady 25 -padx [list 1 10] 65 | 66 | bind $f0.h1.searchBarEntry {puts $vmdStore::searchBar; vmdStore::search "$vmdStore::searchBar" $vmdStore::topGui.frame1.left.f0.tree} 67 | 68 | #grid [ttk::button $f0.h1.settings \ 69 | -command {} \ 70 | -text "Settings" \ 71 | -style vmdStore.blueBg.TButton \ 72 | ] -in $f0.h1 -row 0 -column 2 -sticky e -pady 25 -padx 10 73 | 74 | grid columnconfigure $f0 1 -weight 1 75 | grid columnconfigure $f0.h1 0 -weight 1 76 | 77 | 78 | #### Main 79 | set f1 $vmdStore::topGui.frame1 80 | grid [ttk::panedwindow $f1 \ 81 | -orient horizontal \ 82 | ] -sticky news -pady [list 10 0] 83 | grid columnconfigure $f1 1 -weight 1 84 | 85 | $f1 add [ttk::frame $f1.left] -weight 0 86 | $f1 add [ttk::frame $f1.right] -weight 1 87 | 88 | 89 | grid [ttk::frame $f1.left.f0 \ 90 | ] -in $f1.left -row 0 -column 0 -sticky news -rowspan 4 91 | 92 | ## TreeView 93 | grid [ttk::treeview $f1.left.f0.tree \ 94 | -show tree \ 95 | -yscroll "$f1.left.f0.vsb set" \ 96 | ] -in $f1.left.f0 -row 0 -column 1 -sticky news 97 | grid [ttk::scrollbar $f1.left.f0.vsb \ 98 | -orient vertical \ 99 | -command "$f1.left.f0.tree yview" \ 100 | ] -in $f1.left.f0 -row 0 -column 0 -sticky ns 101 | 102 | #### TreeView 103 | $vmdStore::topGui.frame1.left.f0.tree tag configure selected -background #0099ff -foreground white 104 | 105 | bind $f1.left.f0.tree <> { 106 | set selection [$vmdStore::topGui.frame1.left.f0.tree selection] 107 | 108 | set category [$vmdStore::topGui.frame1.left.f0.tree parent $selection] 109 | set plugin [$vmdStore::topGui.frame1.left.f0.tree item $selection -text] 110 | set account [lindex [lsearch -inline -index 1 $vmdStore::allPluginsAvailable $plugin] 2] 111 | 112 | if {$category != ""} { 113 | set category [$vmdStore::topGui.frame1.left.f0.tree item $category -text] 114 | vmdStore::fillData $category $plugin $account 115 | } 116 | } 117 | 118 | ## Content 119 | # Title 120 | grid [ttk::frame $f1.right.f0 \ 121 | -style vmdStore.blue.TFrame \ 122 | -height 30 \ 123 | ] -in $f1.right -row 0 -column 0 -sticky new -padx [list 0 5] 124 | 125 | grid [ttk::label $f1.right.f0.pluginTitle \ 126 | -text "Welcome to VMD Store!" \ 127 | -font {Helvetica -20} \ 128 | -style vmdStore.whiteFg.blueBg.TLabel \ 129 | ] -in $f1.right.f0 -row 0 -column 0 -sticky news -padx 5 130 | 131 | grid [ttk::label $f1.right.f0.version \ 132 | -text $vmdStore::pluginVersion \ 133 | -font {Helvetica -14} \ 134 | -style vmdStore.whiteFg.blueBg.TLabel \ 135 | ] -in $f1.right.f0 -row 0 -column 1 -sticky news -padx 5 136 | 137 | grid columnconfigure $f1.right.f0 0 -weight 1 138 | 139 | # Description 140 | grid [ttk::frame $f1.right.f1 \ 141 | -style vmdStore.gray.TFrame \ 142 | ] -in $f1.right -row 1 -column 0 -sticky news -padx [list 0 5] -pady 5 143 | 144 | grid [text $f1.right.f1.description \ 145 | -yscrollcommand "$f1.right.f1.yscb0 set" \ 146 | -highlightcolor #0099ff \ 147 | -highlightthickness 0 \ 148 | -wrap word \ 149 | -font {TkDefaultFont} \ 150 | -state normal \ 151 | ] -in $f1.right.f1 -row 0 -column 0 -sticky news 152 | 153 | $vmdStore::topGui.frame1.right.f1.description insert end "vmdStore is the easiest way to manage and install third-part VMD extensions. vmdStore compile several VMD extensions and allows you to install them and push VMD to the next level." 154 | $vmdStore::topGui.frame1.right.f1.description configure -state disabled 155 | 156 | grid [ttk::scrollbar $f1.right.f1.yscb0 \ 157 | -orient vertical \ 158 | -command [list $f1.right.f1.description yview]\ 159 | ] -in $f1.right.f1 -row 0 -column 1 -sticky ns 160 | 161 | grid columnconfigure $f1.right.f1 0 -weight 1 162 | 163 | grid rowconfigure $f1.right 0 -weight 0 164 | grid rowconfigure $f1.right 1 -weight 1 165 | grid rowconfigure $f1.right.f1 0 -weight 1 166 | grid rowconfigure $f1.right 2 -weight 0 167 | grid rowconfigure $f1.right 3 -weight 0 168 | 169 | # Image Gallery 170 | grid [ttk::frame $f1.right.f2 \ 171 | -style vmdStore.blue.TFrame \ 172 | -height 200 \ 173 | ] -in $f1.right -row 2 -column 0 -sticky news -padx [list 0 5] 174 | 175 | grid [canvas $f1.right.f2.canvas \ 176 | -xscrollcommand "$f1.right.f2.xsb set" \ 177 | -bg #0099ff \ 178 | ] -in $f1.right.f2 -row 0 -column 0 -sticky news 179 | 180 | grid [ttk::scrollbar $f1.right.f2.xsb \ 181 | -orient horizontal \ 182 | -command [list $f1.right.f2.canvas xview]\ 183 | ] -in $f1.right.f2 -row 1 -column 0 -sticky ew 184 | 185 | grid columnconfigure $f1.right.f2 0 -weight 1 186 | 187 | # Citation 188 | grid [ttk::frame $f1.right.f4 \ 189 | -style vmdStore.gray.TFrame \ 190 | ] -in $f1.right -row 3 -column 0 -sticky news -pady [list 2 0] -padx [list 0 5] 191 | 192 | grid [text $f1.right.f4.citationText \ 193 | -highlightcolor #0099ff \ 194 | -highlightthickness 0 \ 195 | -bg #f2f2f2 \ 196 | -wrap word \ 197 | -font {TkDefaultFont} \ 198 | -state disabled \ 199 | -height 2 \ 200 | -yscrollcommand "$f1.right.f4.yscb0 set" \ 201 | ] -in $f1.right.f4 -row 0 -column 0 -sticky news -padx [list 5 0] 202 | 203 | grid columnconfigure $f1.right.f4 0 -weight 1 204 | 205 | grid [ttk::scrollbar $f1.right.f4.yscb0 \ 206 | -orient vertical \ 207 | -command [list $f1.right.f4.citationText yview]\ 208 | ] -in $f1.right.f4 -row 0 -column 1 -sticky ns 209 | 210 | # Footer buttons 211 | grid [ttk::frame $f1.right.f3 \ 212 | -style vmdStore.gray.TFrame \ 213 | ] -in $f1.right -row 4 -column 0 -sticky news -pady [list 2 0] -padx [list 0 5] 214 | 215 | grid [ttk::button $f1.right.f3.uninstall \ 216 | -text "Uninstall" \ 217 | -command {vmdStore::uninstallPlugin $vmdStore::installLink} \ 218 | -state disabled \ 219 | -style vmdStore.uninstall.TButton \ 220 | ] -in $f1.right.f3 -row 0 -column 0 -sticky w -pady 5 -padx 10 221 | 222 | grid [ttk::progressbar $f1.right.f3.progressBar \ 223 | -orient horizontal \ 224 | -phase 1 \ 225 | -mode indeterminate \ 226 | ] -in $f1.right.f3 -row 0 -column 1 -sticky news -pady 5 -padx 10 227 | 228 | grid [ttk::label $f1.right.f3.progressLabel \ 229 | -text "" 230 | ] -in $f1.right.f3 -row 0 -column 2 -sticky news -pady 5 -padx 10 231 | 232 | grid [ttk::button $f1.right.f3.citation \ 233 | -text "Citation" \ 234 | -command {vmdStore::browser $vmdStore::citationLink} \ 235 | -state disabled \ 236 | -style vmdStore.blueBg.TButton \ 237 | ] -in $f1.right.f3 -row 0 -column 3 -sticky e -pady 5 -padx 10 238 | 239 | grid [ttk::button $f1.right.f3.webPage \ 240 | -text "Web Page" \ 241 | -command {vmdStore::browser $vmdStore::webPageLink} \ 242 | -state disabled \ 243 | -style vmdStore.blueBg.TButton \ 244 | ] -in $f1.right.f3 -row 0 -column 5 -sticky e -pady 5 -padx 10 245 | 246 | grid [ttk::button $f1.right.f3.install \ 247 | -text "Install" \ 248 | -command {vmdStore::installPlugin $vmdStore::installLink} \ 249 | -state disabled \ 250 | -style vmdStore.greenBg.TButton \ 251 | ] -in $f1.right.f3 -row 0 -column 6 -sticky e -pady 5 -padx 10 252 | 253 | 254 | grid columnconfigure $f1.right.f1 0 -weight 1 255 | 256 | grid columnconfigure $f1 1 -weight 1 257 | grid columnconfigure $f1.left 0 -weight 1 258 | grid columnconfigure $f1.left.f0 1 -weight 1 259 | grid columnconfigure $f1.right 0 -weight 1 260 | grid columnconfigure $f1.right.f3 1 -weight 1 261 | grid columnconfigure $f1.right.f3 2 -weight 1 262 | grid rowconfigure $f0 0 -weight 0 263 | #grid rowconfigure $f1.right.f3 0 -weight 1 264 | grid rowconfigure $f1.left 0 -weight 1 265 | grid rowconfigure $f1.left.f0 0 -weight 1 266 | 267 | 268 | 269 | #### Footer 270 | set f2 $vmdStore::topGui.frame2 271 | grid [ttk::frame $f2 \ 272 | ] -sticky news -pady [list 10 0] 273 | grid columnconfigure $f2 1 -weight 1 274 | 275 | grid [ttk::label $f2.credits \ 276 | -text "Developed by Henrique S. Fernandes and Nuno M. F. S. A. Cerqueira - BioSIM" \ 277 | -font {Helvetica 10} \ 278 | ] -in $f2 -row 0 -column 1 -sticky e -pady [list 15 0] -padx [list 0 15] 279 | 280 | grid columnconfigure $f2 0 -weight 1 281 | 282 | 283 | 284 | #### Read package information 285 | vmdStore::readExternalPackage "$vmdStore::readmePath" 286 | 287 | } -------------------------------------------------------------------------------- /vmdStore/lib/browser.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreBrowser 1.0 2 | 3 | proc vmdStore::browser {url} { 4 | # open is the OS X equivalent to xdg-open on Linux, start is used on Windows 5 | set commands {xdg-open open start} 6 | foreach browser $commands { 7 | if {$browser eq "start"} { 8 | set command [list {*}[auto_execok start] {}] 9 | } else { 10 | set command [auto_execok $browser] 11 | } 12 | if {[string length $command]} { 13 | break 14 | } 15 | } 16 | 17 | if {[string length $command] == 0} { 18 | return -code error "couldn't find browser" 19 | } 20 | if {[catch {exec {*}$command $url &} error]} { 21 | return -code error "couldn't execute '$command': $error" 22 | } 23 | } -------------------------------------------------------------------------------- /vmdStore/lib/install.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreInstallPlugins 0.1 2 | 3 | proc vmdStore::installPlugin {plugin} { 4 | ## Disable the install button 5 | $vmdStore::topGui.frame1.right.f3.install configure -state disabled 6 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state disabled 7 | 8 | vmdStore::installGui $plugin 9 | 10 | #### Save a backup of vmdrc 11 | catch {file copy -force $::vmdStorePath/vmdStore.rc $::vmdStorePath/vmdStore.rc.bak} 12 | 13 | # Getting the local Version of the Plugin 14 | set localVersion [lindex [lindex $vmdStore::installedPlugins [lsearch -index 0 $vmdStore::installedPlugins "$plugin"]] 1] 15 | 16 | # Getting the online version of the Plugin 17 | set onlineVersion $vmdStore::pluginVersion 18 | 19 | 20 | ###### Installing the Plugin 21 | puts "The most recent version of $plugin is installing..." 22 | 23 | # Cleaning the temp directory 24 | catch {file delete -force "$::vmdStorePath/temp"} 25 | file mkdir "$::vmdStorePath/temp" 26 | 27 | # Restart TLS 28 | ::http::unregister https 29 | ::http::register https 443 ::tls::socket 30 | 31 | set account [lindex [lsearch -inline -index 1 $vmdStore::allPluginsAvailable $plugin] 2] 32 | 33 | set url "https://github.com/$account/$plugin/archive/$onlineVersion.zip" 34 | set token [::http::geturl $url -timeout 30000] 35 | set data [::http::data $token] 36 | regexp -all {href=\"(\S+)\"} $data --> url 37 | puts "Downloading the plugin from: $url \n Please wait..." 38 | catch {exec $vmdStore::wget -O "$::vmdStorePath/temp/plugin.zip" "$url"} out 39 | puts $out 40 | #variable successfullDownload 0 41 | #set outputFile [open "$::vmdStorePath/temp/plugin.zip" wb] 42 | #set token [::http::geturl $url -channel $outputFile -binary true -timeout 1800000 -progress vmdStoreDownlodProgress -method GET] 43 | #close $outputFile 44 | 45 | # while {$vmdStore::successfullDownload == 0} { 46 | # file delete -force "$::vmdStorePath/temp/plugin.zip" 47 | # set outputFile [open "$::vmdStorePath/temp/plugin.zip" wb] 48 | # set token [::http::geturl $url -channel $outputFile -binary true -timeout 1800000 -progress vmdStoreDownlodProgress -method GET] 49 | # close $outputFile 50 | # } 51 | 52 | # Extracting the plugin 53 | if {[string first "Windows" $::tcl_platform(os)] != -1} { 54 | exec "$::vmdStorePath/lib/zip/unzip.exe" -q -o "$::vmdStorePath/temp/plugin.zip" -d "$::vmdStorePath/temp" 55 | } else { 56 | exec unzip -q -o "$::vmdStorePath/temp/plugin.zip" -d "$::vmdStorePath/temp" 57 | } 58 | 59 | # Copy Files 60 | file delete -force "$::vmdStorePath/plugins/$plugin" 61 | file mkdir "$::vmdStorePath/plugins/$plugin" 62 | vmdStoreCopyFiles "$::vmdStorePath/temp/$plugin-$onlineVersion/$plugin" "$::vmdStorePath/plugins/$plugin" 63 | 64 | 65 | ##### Update VMDRC file 66 | set vmdrcFile [open "$::vmdStorePath/temp/$plugin-$onlineVersion/install.txt" r] 67 | set vmdrcFileContent [read $vmdrcFile] 68 | close $vmdrcFile 69 | set vmdrcPath "$::vmdStorePath/vmdStore.rc" 70 | 71 | foreach line [split $vmdrcFileContent "\n"] { 72 | if {[regexp "####vmdStore#### START" $line] == 1} { 73 | set initDelimiter $line 74 | } elseif {[regexp "####vmdStore#### END" $line] == 1} { 75 | set finalDelimiter $line 76 | } 77 | } 78 | 79 | set vmdrcLocal [open $vmdrcPath r] 80 | set vmdrcLocalContent [split [read $vmdrcLocal] "\n"] 81 | close $vmdrcLocal 82 | 83 | file delete -force $vmdrcPath 84 | set vmdrcLocal [open $vmdrcPath w] 85 | 86 | set printOrNot 1 87 | set printOrNotA 0 88 | set i 0 89 | 90 | foreach line $vmdrcLocalContent { 91 | if {[regexp $initDelimiter $line] == 1} { 92 | set printOrNot 0 93 | } elseif {[regexp $finalDelimiter $line] == 1} { 94 | set printOrNotA 1 95 | } 96 | 97 | if {$printOrNot == 1 && $line != ""} { 98 | puts $vmdrcLocal $line 99 | } 100 | 101 | if {$printOrNotA == 1} { 102 | set printOrNot 1 103 | } 104 | 105 | incr i 106 | } 107 | 108 | set i 0 109 | foreach line [split $vmdrcFileContent "\n"] { 110 | if {[regexp "askFile" $line] == 1} { 111 | set types { 112 | {{All Files} * } 113 | } 114 | tk_messageBox -title "VMD Store" -icon warning -message "$plugin require some configurations.\n\n[string range [lindex [split $vmdrcFileContent "\n"] [expr $i - 1]] 1 end]" 115 | set path [tk_getOpenFile -filetypes $types] 116 | regexp {(.*.) askFile} $line -> newLine 117 | puts $vmdrcLocal "$newLine \"$path\"" 118 | } elseif {[regexp "none" $line] == 1} { 119 | tk_messageBox -title "VMD Store" -icon warning -message "$plugin require some configurations.\n\n[string range [lindex [split $vmdrcFileContent "\n"] [expr $i - 1]] 1 end]" 120 | set path [tk_chooseDirectory] 121 | regexp {(.*.) none} $line -> newLine 122 | puts $vmdrcLocal "$newLine \"$path\"" 123 | } elseif {[regexp "XXversionXX" $line] == 1} { 124 | regexp {(.*.) XXversionXX} $line -> newLine 125 | puts $vmdrcLocal "$newLine $onlineVersion" 126 | } else { 127 | puts $vmdrcLocal $line 128 | } 129 | incr i 130 | } 131 | 132 | close $vmdrcLocal 133 | 134 | 135 | # Cleaning the temp directory 136 | catch {file delete -force "$::vmdStorePath/temp"} 137 | file mkdir "$::vmdStorePath/temp" 138 | 139 | 140 | destroy $::vmdStore::installing 141 | tk_messageBox -title "VMD Store" -icon info -message "$plugin was installed sucessfully!" -detail "Please, restart VMD to apply the new settings." 142 | 143 | ## Enabling the install button 144 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state normal 145 | $vmdStore::topGui.frame1.right.f3.install configure -state normal 146 | 147 | } 148 | 149 | 150 | proc vmdStore::uninstallPlugin {plugin} { 151 | $vmdStore::topGui.frame1.right.f3.install configure -text "Install" -style vmdStore.greenBg.TButton 152 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state disabled 153 | 154 | #### Save a backup of vmdrc 155 | catch {file copy -force $::vmdStorePath/vmdStore.rc $::vmdStorePath/vmdStore.rc.bak} 156 | 157 | set vmdrcPath "$::vmdStorePath/vmdStore.rc" 158 | 159 | set vmdrcLocal [open $vmdrcPath r] 160 | set vmdrcLocalContent [split [read $vmdrcLocal] "\n"] 161 | close $vmdrcLocal 162 | 163 | file delete -force "$::vmdStorePath/plugins/$plugin" 164 | 165 | file delete -force $vmdrcPath 166 | set vmdrcLocal [open $vmdrcPath w] 167 | 168 | set initDelimiter "####vmdStore#### START $plugin" 169 | set finalDelimiter "####vmdStore#### END $plugin" 170 | 171 | set printOrNot 1 172 | set printOrNotA 0 173 | foreach line $vmdrcLocalContent { 174 | if {[regexp $initDelimiter $line] == 1} { 175 | set printOrNot 0 176 | } elseif {[regexp $finalDelimiter $line] == 1} { 177 | set printOrNotA 1 178 | } 179 | 180 | if {$printOrNot == 1} { 181 | puts $vmdrcLocal $line 182 | } 183 | 184 | if {$printOrNotA == 1} { 185 | set printOrNot 1 186 | } 187 | } 188 | 189 | close $vmdrcLocal 190 | 191 | ## Delete the folder 192 | file delete -force $::vmdStorePath/plugins/$plugin 193 | 194 | tk_messageBox -title "VMD Store" -icon info -message "$plugin was uninstalled sucessfully!" -detail "$plugin will be completely removed after you quit VMD." 195 | 196 | } -------------------------------------------------------------------------------- /vmdStore/lib/readExternalPackage.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreReadExternalPackage 0.2 2 | 3 | proc vmdStore::readExternalPackage {path} { 4 | $vmdStore::topGui.frame1.left.f0.tree insert "" end -id 0 -text "Loading..." 5 | set data "" 6 | while {$data == ""} { 7 | set token [::http::geturl "$path" -timeout 5000] 8 | set data [split [::http::data $token] "\n"] 9 | } 10 | 11 | set ignore "yes" 12 | set fillList {} 13 | set categoryList {} 14 | variable allPluginsAvailable {} 15 | set category "" 16 | foreach line $data { 17 | if {$ignore == "no"} { 18 | if {[string first "###" $line] != -1} { 19 | set category [lrange $line 1 end] 20 | lappend categoryList $category 21 | } 22 | if {[string first "-" $line] != -1} { 23 | set plugin [lindex $line 1] 24 | set account [lindex [regexp -inline {\(https://github.com/(\S+)/.*} [lindex $line 2]] 1] 25 | set a [list $category $plugin] 26 | lappend fillList $a 27 | lappend vmdStore::allPluginsAvailable [list $category $plugin $account] 28 | } 29 | } 30 | if {$line == "## Available Plugins"} { 31 | set ignore "no" 32 | } 33 | } 34 | 35 | ## Remove Loading label 36 | $vmdStore::topGui.frame1.left.f0.tree delete 0 37 | 38 | set i 0 39 | ## Fill the tree with the categories 40 | foreach category $categoryList { 41 | $vmdStore::topGui.frame1.left.f0.tree insert "" end -id $i -text $category 42 | set plugins [lsearch -all -index 0 -inline $fillList $category] 43 | foreach plugin $plugins { 44 | $vmdStore::topGui.frame1.left.f0.tree insert $i end -text [lindex $plugin end] 45 | } 46 | incr i 47 | } 48 | 49 | 50 | ##### Get descriptions 51 | variable pluginDescriptions {} 52 | foreach plugin $fillList { 53 | set plugin [lindex $plugin end] 54 | set account [lindex [lsearch -inline -index 1 $vmdStore::allPluginsAvailable $plugin] 2] 55 | ## Get the README file 56 | set data "" 57 | while {$data == ""} { 58 | set token [::http::geturl "https://raw.githubusercontent.com/$account/$plugin/master/README.md" -timeout 10000] 59 | set data [::http::data $token] 60 | } 61 | set a [list "$plugin" "$data"] 62 | lappend vmdStore::pluginDescriptions $a 63 | } 64 | 65 | } 66 | 67 | 68 | proc vmdStore::fillData {category plugin account} { 69 | ## Disable Lateral Pannel while the information is collected from the server 70 | $vmdStore::topGui.frame1.left.f0.tree configure -selectmode none 71 | $vmdStore::topGui.frame1.right.f3.progressBar start 10 72 | $vmdStore::topGui.frame1.right.f3.progressLabel configure -text "Loading..." 73 | $vmdStore::topGui.frame0.h1.searchBarEntry configure -state disabled 74 | $vmdStore::topGui.frame0.h1.searchButton configure -state disabled 75 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state disabled 76 | $vmdStore::topGui.frame1.right.f3.install configure -state disabled 77 | $vmdStore::topGui.frame1.right.f3.citation configure -state disabled 78 | $vmdStore::topGui.frame1.right.f3.webPage configure -state disabled 79 | 80 | set description "" 81 | while {$description == ""} { 82 | set token [::http::geturl "https://raw.githubusercontent.com/$account/$plugin/master/README.md" -timeout 10000] 83 | set description [::http::data $token] 84 | } 85 | 86 | ## Title 87 | $vmdStore::topGui.frame1.right.f0.pluginTitle configure -text $plugin 88 | 89 | $vmdStore::topGui.frame1.right.f3.progressLabel configure -text "Loading text..." 90 | 91 | ## Description 92 | $vmdStore::topGui.frame1.right.f1.description configure -state normal 93 | $vmdStore::topGui.frame1.right.f1.description delete 1.0 end 94 | $vmdStore::topGui.frame1.right.f1.description insert end $description 95 | vmdStore::markDown $vmdStore::topGui.frame1.right.f1.description 96 | vmdStore::colorSearchPattern $vmdStore::topGui.frame1.right.f1.description $vmdStore::searchBar 97 | $vmdStore::topGui.frame1.right.f1.description configure -state disabled 98 | 99 | 100 | ## Footer Buttons 101 | set vmdStore::installLink "$plugin" 102 | set vmdStore::webPageLink "https://github.com/$account/$plugin" 103 | 104 | set vmdStore::citationText "" 105 | set vmdStore::citationLink "" 106 | set i 0 107 | set text [split $description "\n"] 108 | foreach line $text { 109 | if {[string first "Citation" $line] != -1} { 110 | set vmdStore::citationText "[lindex $text [expr $i + 1]]" 111 | } elseif {[string first "DOI" $line] != -1} { 112 | set vmdStore::citationLink "[lindex $text [expr $i + 1]]" 113 | } 114 | incr i 115 | } 116 | 117 | set vmdStore::pluginVersion "" 118 | while {$vmdStore::pluginVersion == ""} { 119 | set url "https://github.com/$account/$plugin/releases/latest" 120 | set token [::http::geturl $url -timeout 30000] 121 | set data [set ${token}(meta)] 122 | regexp -all {tag\/(\S+)\s} $data --> vmdStore::pluginVersion 123 | } 124 | 125 | $vmdStore::topGui.frame1.right.f4.citationText configure -state normal 126 | $vmdStore::topGui.frame1.right.f4.citationText delete 1.0 end 127 | $vmdStore::topGui.frame1.right.f4.citationText insert end $vmdStore::citationText 128 | $vmdStore::topGui.frame1.right.f4.citationText configure -state disabled 129 | 130 | $vmdStore::topGui.frame1.right.f0.version configure -text "Version: $vmdStore::pluginVersion" 131 | 132 | 133 | 134 | 135 | 136 | $vmdStore::topGui.frame1.right.f3.progressLabel configure -text "Loading images..." 137 | 138 | ## Get Images 139 | variable gallery {} 140 | foreach line [split $description "\n"] { 141 | if {[string first "!" $line] != -1} { 142 | regexp {\((\S+)\)} $line --> imagePath 143 | set image "" 144 | while {$image == ""} { 145 | set token [::http::geturl "https://raw.githubusercontent.com/$account/$plugin/master/$imagePath" -timeout 30000] 146 | set image [::http::data $token] 147 | } 148 | set image [image create photo -data $image] 149 | lappend vmdStore::gallery $image 150 | } 151 | } 152 | 153 | 154 | ## Clean Image Gallery 155 | $vmdStore::topGui.frame1.right.f2.canvas delete all 156 | 157 | set i 0 158 | set xPos 0 159 | foreach image $vmdStore::gallery { 160 | set imageHeight [image height $image] 161 | set scale [format %.0f [expr ($imageHeight / 190) + 1]] 162 | set newImage [image create photo] 163 | set imageWidth [image width $image] 164 | $newImage copy $image -subsample $scale $scale 165 | 166 | set xPos [expr $xPos + 10 + ($imageWidth / $scale / 2)] 167 | 168 | $vmdStore::topGui.frame1.right.f2.canvas create image $xPos 100 -image $newImage -tags [list image$i] 169 | $vmdStore::topGui.frame1.right.f2.canvas bind image$i "vmdStore::zoomImage $image $i" 170 | 171 | set xPos [expr $xPos + ($imageWidth / $scale / 2)] 172 | 173 | incr i 174 | } 175 | 176 | $vmdStore::topGui.frame1.right.f3.progressLabel configure -text "Done!" 177 | 178 | $vmdStore::topGui.frame1.right.f2.canvas configure -scrollregion [list 0 0 [expr $xPos + 10] 100] 179 | 180 | ### Check if the plugin is already installed 181 | set alreadyInstalled [lsearch -index 0 $::vmdStore::installedPlugins $plugin] 182 | if {$alreadyInstalled == -1} { 183 | $vmdStore::topGui.frame1.right.f3.install configure -text "Install" -style vmdStore.greenBg.TButton 184 | $vmdStore::topGui.frame1.right.f3.install configure -style vmdStore.greenBg.TButton 185 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state disabled 186 | } else { 187 | if {$vmdStore::pluginVersion == [lindex [lindex $::vmdStore::installedPlugins $alreadyInstalled] 1]} { 188 | $vmdStore::topGui.frame1.right.f3.install configure -text "Re-Install" 189 | $vmdStore::topGui.frame1.right.f3.install configure -style vmdStore.greenBg.TButton 190 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state normal 191 | } else { 192 | $vmdStore::topGui.frame1.right.f3.install configure -text "Update" 193 | $vmdStore::topGui.frame1.right.f3.install configure -style vmdStore.update.TButton 194 | $vmdStore::topGui.frame1.right.f3.uninstall configure -state normal 195 | } 196 | } 197 | 198 | 199 | if {$vmdStore::citationLink != ""} { 200 | $vmdStore::topGui.frame1.right.f3.citation configure -state normal 201 | } else { 202 | $vmdStore::topGui.frame1.right.f3.citation configure -state disabled 203 | } 204 | if {$vmdStore::webPageLink != ""} { 205 | $vmdStore::topGui.frame1.right.f3.webPage configure -state normal 206 | } else { 207 | $vmdStore::topGui.frame1.right.f3.webPage configure -state disabled 208 | } 209 | 210 | $vmdStore::topGui.frame1.right.f3.install configure -state normal -style vmdStore.greenBg.TButton 211 | 212 | 213 | ## Re-Enabled Lateral Pannel 214 | $vmdStore::topGui.frame1.left.f0.tree configure -selectmode browse 215 | $vmdStore::topGui.frame1.right.f3.progressBar stop 216 | $vmdStore::topGui.frame1.right.f3.progressLabel configure -text "" 217 | $vmdStore::topGui.frame0.h1.searchBarEntry configure -state normal 218 | $vmdStore::topGui.frame0.h1.searchButton configure -state normal 219 | 220 | } 221 | 222 | proc vmdStore::zoomImage {image imageIndex} { 223 | #### Check if the window exists 224 | if {[winfo exists $::vmdStore::topGui.imagePopUp]} {wm deiconify $::vmdStore::topGui.imagePopUp ;return $::vmdStore::topGui.imagePopUp} 225 | toplevel $::vmdStore::topGui.imagePopUp 226 | 227 | #### Title of the windows 228 | wm title $::vmdStore::topGui.imagePopUp "vmdStore - Image Gallery" ; 229 | 230 | 231 | #### Set the size of the Window 232 | set sWidth [expr [winfo vrootwidth $::vmdStore::topGui] - 200] 233 | set sHeight [expr [winfo vrootheight $::vmdStore::topGui] - 200] 234 | 235 | wm geometry $::vmdStore::topGui.imagePopUp ${sWidth}x${sHeight}+100+100 236 | $::vmdStore::topGui.imagePopUp configure -background {white} 237 | 238 | set newImage [vmdStore::resizeImage $image] 239 | 240 | grid [ttk::label $::vmdStore::topGui.imagePopUp.image \ 241 | -image $newImage \ 242 | -anchor center \ 243 | ] -in $::vmdStore::topGui.imagePopUp -row 0 -column 0 -sticky news -columnspan 3 244 | 245 | set number [llength $vmdStore::gallery] 246 | 247 | set imageList $vmdStore::gallery 248 | 249 | if {$imageIndex == 0} { 250 | set previous [lindex $imageList 0] 251 | set prevI 0 252 | } else { 253 | set previous [lindex $imageList [expr $imageIndex - 1]] 254 | set prevI [expr $imageIndex - 1] 255 | } 256 | 257 | 258 | if {$imageIndex >= [expr $number - 1]} { 259 | set next [lindex $imageList end] 260 | set nextI [expr [llength $imageList] - 1] 261 | } else { 262 | set next [lindex $imageList [expr $imageIndex + 1]] 263 | set nextI [expr $imageIndex + 1] 264 | } 265 | 266 | 267 | grid [ttk::button $::vmdStore::topGui.imagePopUp.previous \ 268 | -text "\< Previous" \ 269 | -command "destroy $::vmdStore::topGui.imagePopUp; vmdStore::zoomImage $previous $prevI" \ 270 | -style vmdStore.blueBg.TButton \ 271 | ] -in $::vmdStore::topGui.imagePopUp -row 1 -column 0 -sticky w -padx 20 -pady 10 272 | 273 | grid [ttk::button $::vmdStore::topGui.imagePopUp.next \ 274 | -text "Next \>" \ 275 | -command "destroy $::vmdStore::topGui.imagePopUp; vmdStore::zoomImage $next $nextI" \ 276 | -style vmdStore.blueBg.TButton \ 277 | ] -in $::vmdStore::topGui.imagePopUp -row 1 -column 2 -sticky e -padx 20 -pady 10 278 | 279 | grid columnconfigure $::vmdStore::topGui.imagePopUp 0 -weight 1 280 | grid columnconfigure $::vmdStore::topGui.imagePopUp 1 -weight 1 281 | grid rowconfigure $::vmdStore::topGui.imagePopUp 0 -weight 1 282 | 283 | if {$imageIndex >= [expr $number - 1]} { 284 | $::vmdStore::topGui.imagePopUp.next configure -state disabled 285 | } 286 | 287 | if {$imageIndex == 0} { 288 | $::vmdStore::topGui.imagePopUp.previous configure -state disabled 289 | } 290 | 291 | } 292 | 293 | proc vmdStore::markDown {pathName} { 294 | foreach tagList $vmdStore::markdown { 295 | set tag0 [lindex $tagList 0] 296 | set tag1 [lindex $tagList 1] 297 | set tagName [lindex $tagList 3] 298 | set tagLength0 [string length $tag0] 299 | set tagLength1 [string length $tag1] 300 | 301 | set tagPos0 [$pathName search -all -strictlimits "$tag0" 0.0 end] 302 | if {[llength $tagPos0] != 0} { 303 | for {set index 0} { $index < [llength $tagPos0] } { incr index } { 304 | set pos0 [$pathName search -strictlimits "$tag0" 0.0 end] 305 | set pos1 [$pathName search -strictlimits "$tag1" $pos0 end] 306 | $pathName tag add $tagName $pos0 $pos1 307 | $pathName tag configure $tagName -font [lindex $tagList 2] 308 | set end1 [split $pos0 "."] 309 | set end2 [split $pos1 "."] 310 | $pathName delete "$pos0" "[lindex $end1 0].[expr [lindex $end1 1] + $tagLength0]" "$pos1" "[lindex $end2 0].[expr [lindex $end2 1] + $tagLength1]" 311 | } 312 | } 313 | 314 | } 315 | 316 | ## Delete Images from the Description Text 317 | set tagPos [$pathName search -all -strictlimits "!" 0.0 end] 318 | for {set index 0} { $index < [llength $tagPos] } { incr index } { 319 | set pos0 [$pathName search -strictlimits "!" 0.0 end] 320 | set pos1 [$pathName search -strictlimits "\n" $pos0 end] 321 | set end1 [split $pos1 "."] 322 | $pathName delete "$pos0" "[lindex $end1 0].[expr [lindex $end1 1] + 3]" 323 | } 324 | 325 | ## Links 326 | set tagPos [$pathName search -all -strictlimits "\[" 0.0 end] 327 | for {set index 0} { $index < [llength $tagPos] } { incr index } { 328 | set pos0 [$pathName search -strictlimits "\[" 0.0 end] 329 | set pos1 [$pathName search -strictlimits "\)" $pos0 end] 330 | set pos3 [split [$pathName search -strictlimits "\(" $pos0 end] "."] 331 | set link [$pathName get "[lindex $pos3 0].[expr [lindex $pos3 1] + 1]" $pos1] 332 | set end0 [split $pos0 "."] 333 | set end1 [split $pos1 "."] 334 | $pathName tag add "$link" "[lindex $end0 0].[expr [lindex $end0 1] + 1]" "[lindex $pos3 0].[expr [lindex $pos3 1] - 1]" 335 | $pathName tag configure "$link" -foreground #0066ff -underline true 336 | $pathName tag bind "$link" <1> "vmdStore::browser $link" 337 | $pathName delete "$pos0" "[lindex $end0 0].[expr [lindex $end0 1] + 1]" "[lindex $pos3 0].[expr [lindex $pos3 1] - 1]" "[lindex $end1 0].[expr [lindex $end1 1] + 1]" 338 | } 339 | } 340 | 341 | proc vmdStore::resizeImage {image} { 342 | set sWidth [expr [winfo vrootwidth $::vmdStore::topGui] - 200] 343 | set sHeight [expr [winfo vrootheight $::vmdStore::topGui] - 200] 344 | 345 | set imageHeight [image height $image] 346 | set imageWidth [image width $image] 347 | 348 | if {$imageHeight > $sHeight} { 349 | set scaleHeight [format %.0f [expr ($imageHeight / $sHeight) + 1]] 350 | } else { 351 | set scaleHeight 0 352 | } 353 | 354 | if {$imageWidth > $sWidth} { 355 | set scaleWidth [format %.0f [expr ($imageWidth / $sWidth) + 1]] 356 | } else { 357 | set scaleWidth 0 358 | } 359 | 360 | 361 | if {$scaleHeight == 0 && $scaleWidth == 0} { 362 | set newImage $image 363 | } elseif {$imageHeight >= $imageWidth} { 364 | set newImage [image create photo] 365 | $newImage copy $image -subsample $scaleHeight $scaleHeight 366 | } elseif {$imageHeight < $imageWidth} { 367 | set newImage [image create photo] 368 | $newImage copy $image -subsample $scaleWidth $scaleWidth 369 | } 370 | 371 | return $newImage 372 | 373 | } -------------------------------------------------------------------------------- /vmdStore/lib/search.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreSearch 0.1 2 | 3 | proc vmdStore::search {textSearch treeView} { 4 | if {$textSearch == ""} { 5 | set textSearch "Search..." 6 | set vmdStore::searchBar "Search..." 7 | } 8 | 9 | if {$textSearch != "Search..." } { 10 | set parents [$treeView children ""] 11 | foreach parent $parents { 12 | set category [$treeView item $parent -text] 13 | set plugins [$treeView children $parent] 14 | foreach plugin $plugins { 15 | #Open File 16 | set pluginA [$treeView item $plugin -text] 17 | set description [lindex [lsearch -index 0 -inline $vmdStore::pluginDescriptions "$pluginA"] 1] 18 | 19 | #Search 20 | $treeView item $parent -tag "" 21 | set searchResult [regexp -nocase $textSearch $description] 22 | if {$searchResult == 1} { 23 | $treeView item $parent -tag selected 24 | $treeView item $plugin -tag selected 25 | } else { 26 | $treeView item $plugin -tag "" 27 | } 28 | } 29 | } 30 | 31 | vmdStore::colorSearchPattern $vmdStore::topGui.frame1.right.f1.description $textSearch 32 | } else { 33 | $vmdStore::topGui.frame1.right.f1.description tag delete search 34 | set parents [$treeView children ""] 35 | foreach parent $parents { 36 | set category [$treeView item $parent -text] 37 | set plugins [$treeView children $parent] 38 | $treeView item $parent -tag "" 39 | foreach plugin $plugins { 40 | $treeView item $plugin -tag "" 41 | } 42 | } 43 | } 44 | 45 | } 46 | 47 | proc vmdStore::colorSearchPattern {pathName textSearch} { 48 | $pathName tag delete search 49 | $pathName tag configure search -foreground white -background #0099ff 50 | 51 | set tagLength [string length $textSearch] 52 | set tagPos [$pathName search -all -nocase -strictlimits "$textSearch" 0.0 end] 53 | 54 | if {[llength $tagPos] != 0} { 55 | foreach tag $tagPos { 56 | set end1 [split $tag "."] 57 | $pathName tag add search $tag "[lindex $end1 0].[expr [lindex $end1 1] + $tagLength]" 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /vmdStore/lib/tar.tcl: -------------------------------------------------------------------------------- 1 | # tar.tcl -- 2 | # 3 | # Creating, extracting, and listing posix tar archives 4 | # 5 | # Copyright (c) 2004 Aaron Faupell 6 | # 7 | # See the file "license.terms" for information on usage and redistribution 8 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. 9 | # 10 | # RCS: @(#) $Id: tar.tcl,v 1.17 2012/09/11 17:22:24 andreas_kupries Exp $ 11 | 12 | package provide tar 0.7.1 13 | 14 | namespace eval ::tar {} 15 | 16 | proc ::tar::parseOpts {acc opts} { 17 | array set flags $acc 18 | foreach {x y} $acc {upvar $x $x} 19 | 20 | set len [llength $opts] 21 | set i 0 22 | while {$i < $len} { 23 | set name [string trimleft [lindex $opts $i] -] 24 | if {![info exists flags($name)]} {return -code error "unknown option \"$name\""} 25 | if {$flags($name) == 1} { 26 | set $name [lindex $opts [expr {$i + 1}]] 27 | incr i $flags($name) 28 | } elseif {$flags($name) > 1} { 29 | set $name [lrange $opts [expr {$i + 1}] [expr {$i + $flags($name)}]] 30 | incr i $flags($name) 31 | } else { 32 | set $name 1 33 | } 34 | incr i 35 | } 36 | } 37 | 38 | proc ::tar::pad {size} { 39 | set pad [expr {512 - ($size % 512)}] 40 | if {$pad == 512} {return 0} 41 | return $pad 42 | } 43 | 44 | proc ::tar::seekorskip {ch off wh} { 45 | if {[tell $ch] < 0} { 46 | if {$wh!="current"} { 47 | error "WHENCE=$wh not supported on non-seekable channel $ch" 48 | } 49 | skip $ch $off 50 | return 51 | } 52 | seek $ch $off $wh 53 | return 54 | } 55 | 56 | proc ::tar::skip {ch len} { 57 | while {$len>0} { 58 | set buf $len 59 | if {$buf>65536} {set buf 65536} 60 | set n [read $ch $buf] 61 | if {$n<$buf} break 62 | incr len -$buf 63 | } 64 | return 65 | } 66 | 67 | proc ::tar::readHeader {data} { 68 | binary scan $data a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155 \ 69 | name mode uid gid size mtime cksum type \ 70 | linkname magic version uname gname devmajor devminor prefix 71 | 72 | foreach x {name type linkname} { 73 | set $x [string trim [set $x] "\x00"] 74 | } 75 | foreach x {uid gid size mtime cksum} { 76 | set $x [format %d 0[string trim [set $x] " \x00"]] 77 | } 78 | set mode [string trim $mode " \x00"] 79 | 80 | if {$magic == "ustar "} { 81 | # gnu tar 82 | # not fully supported 83 | foreach x {uname gname prefix} { 84 | set $x [string trim [set $x] "\x00"] 85 | } 86 | foreach x {devmajor devminor} { 87 | set $x [format %d 0[string trim [set $x] " \x00"]] 88 | } 89 | } elseif {$magic == "ustar\x00"} { 90 | # posix tar 91 | foreach x {uname gname prefix} { 92 | set $x [string trim [set $x] "\x00"] 93 | } 94 | foreach x {devmajor devminor} { 95 | set $x [format %d 0[string trim [set $x] " \x00"]] 96 | } 97 | } else { 98 | # old style tar 99 | foreach x {uname gname devmajor devminor prefix} { set $x {} } 100 | if {$type == ""} { 101 | if {[string match */ $name]} { 102 | set type 5 103 | } else { 104 | set type 0 105 | } 106 | } 107 | } 108 | 109 | return [list name $name mode $mode uid $uid gid $gid size $size mtime $mtime \ 110 | cksum $cksum type $type linkname $linkname magic $magic \ 111 | version $version uname $uname gname $gname devmajor $devmajor \ 112 | devminor $devminor prefix $prefix] 113 | } 114 | 115 | proc ::tar::contents {file args} { 116 | set chan 0 117 | parseOpts {chan 0} $args 118 | if {$chan} { 119 | set fh $file 120 | } else { 121 | set fh [::open $file] 122 | fconfigure $fh -encoding binary -translation lf -eofchar {} 123 | } 124 | set ret {} 125 | while {![eof $fh]} { 126 | array set header [readHeader [read $fh 512]] 127 | if {$header(name) == ""} break 128 | lappend ret $header(prefix)$header(name) 129 | seekorskip $fh [expr {$header(size) + [pad $header(size)]}] current 130 | } 131 | if {!$chan} { 132 | close $fh 133 | } 134 | return $ret 135 | } 136 | 137 | proc ::tar::stat {tar {file {}} args} { 138 | set chan 0 139 | parseOpts {chan 0} $args 140 | if {$chan} { 141 | set fh $tar 142 | } else { 143 | set fh [::open $tar] 144 | fconfigure $fh -encoding binary -translation lf -eofchar {} 145 | } 146 | set ret {} 147 | while {![eof $fh]} { 148 | array set header [readHeader [read $fh 512]] 149 | if {$header(name) == ""} break 150 | seekorskip $fh [expr {$header(size) + [pad $header(size)]}] current 151 | if {$file != "" && "$header(prefix)$header(name)" != $file} {continue} 152 | set header(type) [string map {0 file 5 directory 3 characterSpecial 4 blockSpecial 6 fifo 2 link} $header(type)] 153 | set header(mode) [string range $header(mode) 2 end] 154 | lappend ret $header(prefix)$header(name) [list mode $header(mode) uid $header(uid) gid $header(gid) \ 155 | size $header(size) mtime $header(mtime) type $header(type) linkname $header(linkname) \ 156 | uname $header(uname) gname $header(gname) devmajor $header(devmajor) devminor $header(devminor)] 157 | } 158 | if {!$chan} { 159 | close $fh 160 | } 161 | return $ret 162 | } 163 | 164 | proc ::tar::get {tar file args} { 165 | set chan 0 166 | parseOpts {chan 0} $args 167 | if {$chan} { 168 | set fh $tar 169 | } else { 170 | set fh [::open $tar] 171 | fconfigure $fh -encoding binary -translation lf -eofchar {} 172 | } 173 | while {![eof $fh]} { 174 | array set header [readHeader [read $fh 512]] 175 | if {$header(name) == ""} break 176 | set name [string trimleft $header(prefix)$header(name) /] 177 | if {$name == $file} { 178 | set file [read $fh $header(size)] 179 | if {!$chan} { 180 | close $fh 181 | } 182 | return $file 183 | } 184 | seekorskip $fh [expr {$header(size) + [pad $header(size)]}] current 185 | } 186 | if {!$chan} { 187 | close $fh 188 | } 189 | return {} 190 | } 191 | 192 | proc ::tar::untar {tar args} { 193 | set nooverwrite 0 194 | set data 0 195 | set nomtime 0 196 | set noperms 0 197 | set chan 0 198 | parseOpts {dir 1 file 1 glob 1 nooverwrite 0 nomtime 0 noperms 0 chan 0} $args 199 | if {![info exists dir]} {set dir [pwd]} 200 | set pattern * 201 | if {[info exists file]} { 202 | set pattern [string map {* \\* ? \\? \\ \\\\ \[ \\\[ \] \\\]} $file] 203 | } elseif {[info exists glob]} { 204 | set pattern $glob 205 | } 206 | 207 | set ret {} 208 | if {$chan} { 209 | set fh $tar 210 | } else { 211 | set fh [::open $tar] 212 | fconfigure $fh -encoding binary -translation lf -eofchar {} 213 | } 214 | while {![eof $fh]} { 215 | array set header [readHeader [read $fh 512]] 216 | if {$header(name) == ""} break 217 | set name [string trimleft $header(prefix)$header(name) /] 218 | if {![string match $pattern $name] || ($nooverwrite && [file exists $name])} { 219 | seekorskip $fh [expr {$header(size) + [pad $header(size)]}] current 220 | continue 221 | } 222 | 223 | set name [file join $dir $name] 224 | if {![file isdirectory [file dirname $name]]} { 225 | file mkdir [file dirname $name] 226 | lappend ret [file dirname $name] {} 227 | } 228 | if {[string match {[0346]} $header(type)]} { 229 | if {[catch {::open $name w+} new]} { 230 | # sometimes if we dont have write permission we can still delete 231 | catch {file delete -force $name} 232 | set new [::open $name w+] 233 | } 234 | fconfigure $new -encoding binary -translation lf -eofchar {} 235 | fcopy $fh $new -size $header(size) 236 | close $new 237 | lappend ret $name $header(size) 238 | } elseif {$header(type) == 5} { 239 | file mkdir $name 240 | lappend ret $name {} 241 | } elseif {[string match {[12]} $header(type)] && $::tcl_platform(platform) == "unix"} { 242 | catch {file delete $name} 243 | if {![catch {file link [string map {1 -hard 2 -symbolic} $header(type)] $name $header(linkname)}]} { 244 | lappend ret $name {} 245 | } 246 | } 247 | seekorskip $fh [pad $header(size)] current 248 | if {![file exists $name]} continue 249 | 250 | if {$::tcl_platform(platform) == "unix"} { 251 | if {!$noperms} { 252 | catch {file attributes $name -permissions 0[string range $header(mode) 2 end]} 253 | } 254 | catch {file attributes $name -owner $header(uid) -group $header(gid)} 255 | catch {file attributes $name -owner $header(uname) -group $header(gname)} 256 | } 257 | if {!$nomtime} { 258 | file mtime $name $header(mtime) 259 | } 260 | } 261 | if {!$chan} { 262 | close $fh 263 | } 264 | return $ret 265 | } 266 | 267 | ## 268 | # ::tar::statFile 269 | # 270 | # Returns stat info about a filesystem object, in the form of an info 271 | # dictionary like that returned by ::tar::readHeader. 272 | # 273 | # The mode, uid, gid, mtime, and type entries are always present. 274 | # The size and linkname entries are present if relevant for this type 275 | # of object. The uname and gname entries are present if the OS supports 276 | # them. No devmajor or devminor entry is present. 277 | ## 278 | 279 | proc ::tar::statFile {name followlinks} { 280 | if {$followlinks} { 281 | file stat $name stat 282 | } else { 283 | file lstat $name stat 284 | } 285 | 286 | set ret {} 287 | 288 | if {$::tcl_platform(platform) == "unix"} { 289 | lappend ret mode 1[file attributes $name -permissions] 290 | lappend ret uname [file attributes $name -owner] 291 | lappend ret gname [file attributes $name -group] 292 | if {$stat(type) == "link"} { 293 | lappend ret linkname [file link $name] 294 | } 295 | } else { 296 | lappend ret mode [lindex {100644 100755} [expr {$stat(type) == "directory"}]] 297 | } 298 | 299 | lappend ret uid $stat(uid) gid $stat(gid) mtime $stat(mtime) \ 300 | type $stat(type) 301 | 302 | if {$stat(type) == "file"} {lappend ret size $stat(size)} 303 | 304 | return $ret 305 | } 306 | 307 | ## 308 | # ::tar::formatHeader 309 | # 310 | # Opposite operation to ::tar::readHeader; takes a file name and info 311 | # dictionary as arguments, returns a corresponding (POSIX-tar) header. 312 | # 313 | # The following dictionary entries must be present: 314 | # mode 315 | # type 316 | # 317 | # The following dictionary entries are used if present, otherwise 318 | # the indicated default is used: 319 | # uid 0 320 | # gid 0 321 | # size 0 322 | # mtime [clock seconds] 323 | # linkname {} 324 | # uname {} 325 | # gname {} 326 | # 327 | # All other dictionary entries, including devmajor and devminor, are 328 | # presently ignored. 329 | ## 330 | 331 | proc ::tar::formatHeader {name info} { 332 | array set A { 333 | linkname "" 334 | uname "" 335 | gname "" 336 | size 0 337 | gid 0 338 | uid 0 339 | } 340 | set A(mtime) [clock seconds] 341 | array set A $info 342 | array set A {devmajor "" devminor ""} 343 | 344 | set type [string map {file 0 directory 5 characterSpecial 3 \ 345 | blockSpecial 4 fifo 6 link 2 socket A} $A(type)] 346 | 347 | set osize [format %o $A(size)] 348 | set ogid [format %o $A(gid)] 349 | set ouid [format %o $A(uid)] 350 | set omtime [format %o $A(mtime)] 351 | 352 | set name [string trimleft $name /] 353 | if {[string length $name] > 255} { 354 | return -code error "path name over 255 chars" 355 | } elseif {[string length $name] > 100} { 356 | set prefix [string range $name 0 end-100] 357 | set name [string range $name end-99 end] 358 | } else { 359 | set prefix "" 360 | } 361 | 362 | set header [binary format a100A8A8A8A12A12A8a1a100A6a2a32a32a8a8a155a12 \ 363 | $name $A(mode)\x00 $ouid\x00 $ogid\x00\ 364 | $osize\x00 $omtime\x00 {} $type \ 365 | $A(linkname) ustar\x00 00 $A(uname) $A(gname)\ 366 | $A(devmajor) $A(devminor) $prefix {}] 367 | 368 | binary scan $header c* tmp 369 | set cksum 0 370 | foreach x $tmp {incr cksum $x} 371 | 372 | return [string replace $header 148 155 [binary format A8 [format %o $cksum]\x00]] 373 | } 374 | 375 | 376 | proc ::tar::recurseDirs {files followlinks} { 377 | foreach x $files { 378 | if {[file isdirectory $x] && ([file type $x] != "link" || $followlinks)} { 379 | if {[set more [glob -dir $x -nocomplain *]] != ""} { 380 | eval lappend files [recurseDirs $more $followlinks] 381 | } else { 382 | lappend files $x 383 | } 384 | } 385 | } 386 | return $files 387 | } 388 | 389 | proc ::tar::writefile {in out followlinks name} { 390 | puts -nonewline $out [formatHeader $name [statFile $in $followlinks]] 391 | set size 0 392 | if {[file type $in] == "file" || ($followlinks && [file type $in] == "link")} { 393 | set in [::open $in] 394 | fconfigure $in -encoding binary -translation lf -eofchar {} 395 | set size [fcopy $in $out] 396 | close $in 397 | } 398 | puts -nonewline $out [string repeat \x00 [pad $size]] 399 | } 400 | 401 | proc ::tar::create {tar files args} { 402 | set dereference 0 403 | set chan 0 404 | parseOpts {dereference 0 chan 0} $args 405 | 406 | if {$chan} { 407 | set fh $tar 408 | } else { 409 | set fh [::open $tar w+] 410 | fconfigure $fh -encoding binary -translation lf -eofchar {} 411 | } 412 | foreach x [recurseDirs $files $dereference] { 413 | writefile $x $fh $dereference $x 414 | } 415 | puts -nonewline $fh [string repeat \x00 1024] 416 | 417 | if {!$chan} { 418 | close $fh 419 | } 420 | return $tar 421 | } 422 | 423 | proc ::tar::add {tar files args} { 424 | set dereference 0 425 | set prefix "" 426 | set quick 0 427 | parseOpts {dereference 0 prefix 1 quick 0} $args 428 | 429 | set fh [::open $tar r+] 430 | fconfigure $fh -encoding binary -translation lf -eofchar {} 431 | 432 | if {$quick} then { 433 | seek $fh -1024 end 434 | } else { 435 | set data [read $fh 512] 436 | while {[regexp {[^\0]} $data]} { 437 | array set header [readHeader $data] 438 | seek $fh [expr {$header(size) + [pad $header(size)]}] current 439 | set data [read $fh 512] 440 | } 441 | seek $fh -512 current 442 | } 443 | 444 | foreach x [recurseDirs $files $dereference] { 445 | writefile $x $fh $dereference $prefix$x 446 | } 447 | puts -nonewline $fh [string repeat \x00 1024] 448 | 449 | close $fh 450 | return $tar 451 | } 452 | 453 | proc ::tar::remove {tar files} { 454 | set n 0 455 | while {[file exists $tar$n.tmp]} {incr n} 456 | set tfh [::open $tar$n.tmp w] 457 | set fh [::open $tar r] 458 | 459 | fconfigure $fh -encoding binary -translation lf -eofchar {} 460 | fconfigure $tfh -encoding binary -translation lf -eofchar {} 461 | 462 | while {![eof $fh]} { 463 | array set header [readHeader [read $fh 512]] 464 | if {$header(name) == ""} { 465 | puts -nonewline $tfh [string repeat \x00 1024] 466 | break 467 | } 468 | set name $header(prefix)$header(name) 469 | set len [expr {$header(size) + [pad $header(size)]}] 470 | if {[lsearch $files $name] > -1} { 471 | seek $fh $len current 472 | } else { 473 | seek $fh -512 current 474 | fcopy $fh $tfh -size [expr {$len + 512}] 475 | } 476 | } 477 | 478 | close $fh 479 | close $tfh 480 | 481 | file rename -force $tar$n.tmp $tar 482 | } 483 | -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-a-green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-a-green.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-a.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-d-green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-d-green.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-d.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-d.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-n-green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-n-green.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-n.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-n.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-uninstall-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-uninstall-a.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-uninstall-d.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-uninstall-d.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-uninstall-n.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-uninstall-n.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-update-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-update-a.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-update-d.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-update-d.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/button-update-n.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/button-update-n.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/entry-n.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/entry-n.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/spinner.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/images/vmdStore-Logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/theme/images/vmdStore-Logo.gif -------------------------------------------------------------------------------- /vmdStore/lib/theme/theme.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStoreTheme 0.1 2 | 3 | proc vmdStore::loadImages {imgdir {patterns {*.gif}}} { 4 | foreach pattern $patterns { 5 | foreach file [glob -directory $imgdir $pattern] { 6 | set img [file tail [file rootname $file]] 7 | if {![info exists images($img)]} { 8 | set images($img) [image create photo -file $file] 9 | } 10 | } 11 | } 12 | return [array get images] 13 | } 14 | 15 | variable images 16 | 17 | array set vmdStore::images [vmdStore::loadImages [file join [file dirname [info script]] images] *.gif] 18 | 19 | ttk::style theme create vmdStoreTheme -parent clam -settings { 20 | 21 | #### Color 22 | set blue #0099ff 23 | set gray #f2f2f2 24 | 25 | ttk::style configure . \ 26 | -background white 27 | 28 | 29 | #### Frame 30 | ttk::style configure vmdStore.blue.TFrame \ 31 | -background $blue 32 | 33 | # 34 | ttk::style configure vmdStore.gray.TFrame \ 35 | -background $gray 36 | 37 | 38 | #### Label 39 | ttk::style configure vmdStore.whiteFg.blueBg.TLabel \ 40 | -background $blue \ 41 | -foreground white 42 | 43 | 44 | #### Entry 45 | ttk::style element create vmdStore.searchBar.Entry.field \ 46 | image [list $vmdStore::images(entry-n) \ 47 | pressed $vmdStore::images(entry-n) \ 48 | {selected active} $vmdStore::images(entry-n) \ 49 | selected $vmdStore::images(entry-n) \ 50 | active $vmdStore::images(entry-n) \ 51 | disabled $vmdStore::images(entry-n) \ 52 | ] \ 53 | -border [list 5 0 5 0] -sticky ew 54 | 55 | ttk::style configure vmdStore.searchBar.Entry \ 56 | -selectbackground $blue \ 57 | -selectforeground white \ 58 | 59 | ttk::style layout vmdStore.searchBar.Entry { 60 | Entry.vmdStore.searchBar.Entry.field -children { 61 | Entry.vmdStore.searchBar.Entry.textarea 62 | } 63 | } 64 | 65 | 66 | 67 | 68 | 69 | #### Button 70 | ttk::style element create vmdStore.blueBg.TButton.button \ 71 | image [list $vmdStore::images(button-n) \ 72 | pressed $vmdStore::images(button-a) \ 73 | {selected active} $vmdStore::images(button-a) \ 74 | selected $vmdStore::images(button-a) \ 75 | active $vmdStore::images(button-a) \ 76 | disabled $vmdStore::images(button-d) \ 77 | ] \ 78 | -border 4 -sticky ew -padding [list 10 0 10 0] 79 | 80 | ttk::style configure vmdStore.blueBg.TButton \ 81 | -anchor center \ 82 | -foreground white 83 | 84 | ttk::style layout vmdStore.blueBg.TButton { 85 | Button.vmdStore.blueBg.TButton.button -children { 86 | Button.vmdStore.blueBg.TButton.label 87 | } 88 | } 89 | 90 | # 91 | ttk::style element create vmdStore.greenBg.TButton.button \ 92 | image [list $vmdStore::images(button-n-green) \ 93 | pressed $vmdStore::images(button-a-green) \ 94 | {selected active} $vmdStore::images(button-a-green) \ 95 | selected $vmdStore::images(button-a-green) \ 96 | active $vmdStore::images(button-a-green) \ 97 | disabled $vmdStore::images(button-d-green) \ 98 | ] \ 99 | -border [list 24 4 4 4] -sticky ew -padding [list 26 0 10 0] 100 | 101 | ttk::style configure vmdStore.greenBg.TButton \ 102 | -anchor center \ 103 | -foreground white 104 | 105 | ttk::style layout vmdStore.greenBg.TButton { 106 | Button.vmdStore.greenBg.TButton.button -children { 107 | Button.vmdStore.greenBg.TButton.label 108 | } 109 | } 110 | 111 | # 112 | ttk::style element create vmdStore.uninstall.TButton.button \ 113 | image [list $vmdStore::images(button-uninstall-n) \ 114 | pressed $vmdStore::images(button-uninstall-a) \ 115 | {selected active} $vmdStore::images(button-uninstall-a) \ 116 | selected $vmdStore::images(button-uninstall-a) \ 117 | active $vmdStore::images(button-uninstall-a) \ 118 | disabled $vmdStore::images(button-uninstall-d) \ 119 | ] \ 120 | -border [list 24 4 4 4] -sticky ew -padding [list 24 0 10 0] 121 | 122 | ttk::style configure vmdStore.uninstall.TButton \ 123 | -anchor center \ 124 | -foreground white 125 | 126 | ttk::style layout vmdStore.uninstall.TButton { 127 | Button.vmdStore.uninstall.TButton.button -children { 128 | Button.vmdStore.uninstall.TButton.label 129 | } 130 | } 131 | 132 | # 133 | ttk::style element create vmdStore.update.TButton.button \ 134 | image [list $vmdStore::images(button-update-n) \ 135 | pressed $vmdStore::images(button-update-a) \ 136 | {selected active} $vmdStore::images(button-update-a) \ 137 | selected $vmdStore::images(button-update-a) \ 138 | active $vmdStore::images(button-update-a) \ 139 | disabled $vmdStore::images(button-update-d) \ 140 | ] \ 141 | -border [list 24 4 4 4] -sticky ew -padding [list 26 0 10 0] 142 | 143 | ttk::style configure vmdStore.update.TButton \ 144 | -anchor center \ 145 | -foreground white 146 | 147 | ttk::style layout vmdStore.update.TButton { 148 | Button.vmdStore.update.TButton.button -children { 149 | Button.vmdStore.update.TButton.label 150 | } 151 | } 152 | 153 | } -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/i686/libtls1.6.7.1.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/tls/linux/i686/libtls1.6.7.1.so -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/i686/teapot.txt: -------------------------------------------------------------------------------- 1 | Package tls 1.6.7.1 2 | Meta as::author {Dan Razell} {Matt Newman} {Jeff Hobbs} 3 | Meta as::build::date 2015-07-09 4 | Meta as::origin http://sourceforge.net/projects/tls 5 | Meta category Channels 6 | Meta description TLS provides a replacement socket command for 7 | Meta description setting up and using secure sockets. 8 | Meta license BSD 9 | Meta openssl {OpenSSL 1.0.2d 9 Jul 2015} 10 | Meta platform linux-glibc2.3-ix86 11 | Meta require {Tcl 8.4} 12 | Meta subject ssl tls security 13 | Meta summary SSL/TLS binding for Tcl 14 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/i686/tls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1997-2000 Matt Newman 3 | # 4 | # $Header: /cvsroot/tls/tls/tls.tcl,v 1.14 2015/07/07 17:16:03 andreas_kupries Exp $ 5 | # 6 | namespace eval tls { 7 | variable logcmd tclLog 8 | variable debug 0 9 | 10 | # Default flags passed to tls::import 11 | variable defaults {} 12 | 13 | # Maps UID to Server Socket 14 | variable srvmap 15 | variable srvuid 0 16 | 17 | # Over-ride this if you are using a different socket command 18 | variable socketCmd 19 | if {![info exists socketCmd]} { 20 | set socketCmd [info command ::socket] 21 | } 22 | } 23 | 24 | proc tls::initlib {dir dll} { 25 | # Package index cd's into the package directory for loading. 26 | # Irrelevant to unixoids, but for Windows this enables the OS to find 27 | # the dependent DLL's in the CWD, where they may be. 28 | set cwd [pwd] 29 | catch {cd $dir} 30 | if {[string equal $::tcl_platform(platform) "windows"] && 31 | ![string equal [lindex [file system $dir] 0] "native"]} { 32 | # If it is a wrapped executable running on windows, the openssl 33 | # dlls must be copied out of the virtual filesystem to the disk 34 | # where Windows will find them when resolving the dependency in 35 | # the tls dll. We choose to make them siblings of the executable. 36 | package require starkit 37 | set dst [file nativename [file dirname $starkit::topdir]] 38 | foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { 39 | catch {file delete -force $dst/$sdll} 40 | catch {file copy -force $dir/$sdll $dst/$sdll} 41 | } 42 | } 43 | set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] 44 | catch {cd $cwd} 45 | if {$res} { 46 | namespace eval [namespace parent] {namespace delete tls} 47 | return -code $res $err 48 | } 49 | rename tls::initlib {} 50 | } 51 | 52 | # 53 | # Backwards compatibility, also used to set the default 54 | # context options 55 | # 56 | proc tls::init {args} { 57 | variable defaults 58 | 59 | set defaults $args 60 | } 61 | # 62 | # Helper function - behaves exactly as the native socket command. 63 | # 64 | proc tls::socket {args} { 65 | variable socketCmd 66 | variable defaults 67 | set idx [lsearch $args -server] 68 | if {$idx != -1} { 69 | set server 1 70 | set callback [lindex $args [expr {$idx+1}]] 71 | set args [lreplace $args $idx [expr {$idx+1}]] 72 | 73 | set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" 74 | set options "-cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 75 | } else { 76 | set server 0 77 | 78 | set usage "wrong # args: should be \"tls::socket ?options? host port\"" 79 | set options "-async, -cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -myport, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 80 | } 81 | set argc [llength $args] 82 | set sopts {} 83 | set iopts [concat [list -server $server] $defaults] ;# Import options 84 | 85 | for {set idx 0} {$idx < $argc} {incr idx} { 86 | set arg [lindex $args $idx] 87 | switch -glob -- $server,$arg { 88 | 0,-async {lappend sopts $arg} 89 | 0,-myport - 90 | *,-type - 91 | *,-myaddr {lappend sopts $arg [lindex $args [incr idx]]} 92 | *,-cadir - 93 | *,-cafile - 94 | *,-certfile - 95 | *,-cipher - 96 | *,-command - 97 | *,-dhparams - 98 | *,-keyfile - 99 | *,-password - 100 | *,-request - 101 | *,-require - 102 | *,-servername - 103 | *,-ssl2 - 104 | *,-ssl3 - 105 | *,-tls1 - 106 | *,-tls1.1 - 107 | *,-tls1.2 {lappend iopts $arg [lindex $args [incr idx]]} 108 | -* {return -code error "bad option \"$arg\": must be one of $options"} 109 | default {break} 110 | } 111 | } 112 | if {$server} { 113 | if {($idx + 1) != $argc} { 114 | return -code error $usage 115 | } 116 | set uid [incr ::tls::srvuid] 117 | 118 | set port [lindex $args [expr {$argc-1}]] 119 | lappend sopts $port 120 | #set sopts [linsert $sopts 0 -server $callback] 121 | set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] 122 | #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] 123 | } else { 124 | if {($idx + 2) != $argc} { 125 | return -code error $usage 126 | } 127 | set host [lindex $args [expr {$argc-2}]] 128 | set port [lindex $args [expr {$argc-1}]] 129 | lappend sopts $host $port 130 | } 131 | # 132 | # Create TCP/IP socket 133 | # 134 | set chan [eval $socketCmd $sopts] 135 | if {!$server && [catch { 136 | # 137 | # Push SSL layer onto socket 138 | # 139 | eval [list tls::import] $chan $iopts 140 | } err]} { 141 | set info ${::errorInfo} 142 | catch {close $chan} 143 | return -code error -errorinfo $info $err 144 | } 145 | return $chan 146 | } 147 | 148 | # tls::_accept -- 149 | # 150 | # This is the actual accept that TLS sockets use, which then calls 151 | # the callback registered by tls::socket. 152 | # 153 | # Arguments: 154 | # iopts tls::import opts 155 | # callback server callback to invoke 156 | # chan socket channel to accept/deny 157 | # ipaddr calling IP address 158 | # port calling port 159 | # 160 | # Results: 161 | # Returns an error if the callback throws one. 162 | # 163 | proc tls::_accept { iopts callback chan ipaddr port } { 164 | log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] 165 | 166 | set chan [eval [list tls::import $chan] $iopts] 167 | 168 | lappend callback $chan $ipaddr $port 169 | if {[catch { 170 | uplevel #0 $callback 171 | } err]} { 172 | log 1 "tls::_accept error: ${::errorInfo}" 173 | close $chan 174 | error $err $::errorInfo $::errorCode 175 | } else { 176 | log 2 "tls::_accept - called \"$callback\" succeeded" 177 | } 178 | } 179 | # 180 | # Sample callback for hooking: - 181 | # 182 | # error 183 | # verify 184 | # info 185 | # 186 | proc tls::callback {option args} { 187 | variable debug 188 | 189 | #log 2 [concat $option $args] 190 | 191 | switch -- $option { 192 | "error" { 193 | foreach {chan msg} $args break 194 | 195 | log 0 "TLS/$chan: error: $msg" 196 | } 197 | "verify" { 198 | # poor man's lassign 199 | foreach {chan depth cert rc err} $args break 200 | 201 | array set c $cert 202 | 203 | if {$rc != "1"} { 204 | log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" 205 | } else { 206 | log 2 "TLS/$chan: verify/$depth: $c(subject)" 207 | } 208 | if {$debug > 0} { 209 | return 1; # FORCE OK 210 | } else { 211 | return $rc 212 | } 213 | } 214 | "info" { 215 | # poor man's lassign 216 | foreach {chan major minor state msg} $args break 217 | 218 | if {$msg != ""} { 219 | append state ": $msg" 220 | } 221 | # For tracing 222 | upvar #0 tls::$chan cb 223 | set cb($major) $minor 224 | 225 | log 2 "TLS/$chan: $major/$minor: $state" 226 | } 227 | default { 228 | return -code error "bad option \"$option\":\ 229 | must be one of error, info, or verify" 230 | } 231 | } 232 | } 233 | 234 | proc tls::xhandshake {chan} { 235 | upvar #0 tls::$chan cb 236 | 237 | if {[info exists cb(handshake)] && \ 238 | $cb(handshake) == "done"} { 239 | return 1 240 | } 241 | while {1} { 242 | vwait tls::${chan}(handshake) 243 | if {![info exists cb(handshake)]} { 244 | return 0 245 | } 246 | if {$cb(handshake) == "done"} { 247 | return 1 248 | } 249 | } 250 | } 251 | 252 | proc tls::password {} { 253 | log 0 "TLS/Password: did you forget to set your passwd!" 254 | # Return the worlds best kept secret password. 255 | return "secret" 256 | } 257 | 258 | proc tls::log {level msg} { 259 | variable debug 260 | variable logcmd 261 | 262 | if {$level > $debug || $logcmd == ""} { 263 | return 264 | } 265 | set cmd $logcmd 266 | lappend cmd $msg 267 | uplevel #0 $cmd 268 | } 269 | 270 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/x86_64/libtls1.6.7.1.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/tls/linux/x86_64/libtls1.6.7.1.so -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/x86_64/teapot.txt: -------------------------------------------------------------------------------- 1 | Package tls 1.6.7.1 2 | Meta as::author {Dan Razell} {Matt Newman} {Jeff Hobbs} 3 | Meta as::build::date 2015-07-09 4 | Meta as::origin http://sourceforge.net/projects/tls 5 | Meta category Channels 6 | Meta description TLS provides a replacement socket command for 7 | Meta description setting up and using secure sockets. 8 | Meta license BSD 9 | Meta openssl {OpenSSL 1.0.2d 9 Jul 2015} 10 | Meta platform linux-glibc2.3-x86_64 11 | Meta require {Tcl 8.4} 12 | Meta subject ssl tls security 13 | Meta summary SSL/TLS binding for Tcl 14 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/linux/x86_64/tls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1997-2000 Matt Newman 3 | # 4 | # $Header: /cvsroot/tls/tls/tls.tcl,v 1.14 2015/07/07 17:16:03 andreas_kupries Exp $ 5 | # 6 | namespace eval tls { 7 | variable logcmd tclLog 8 | variable debug 0 9 | 10 | # Default flags passed to tls::import 11 | variable defaults {} 12 | 13 | # Maps UID to Server Socket 14 | variable srvmap 15 | variable srvuid 0 16 | 17 | # Over-ride this if you are using a different socket command 18 | variable socketCmd 19 | if {![info exists socketCmd]} { 20 | set socketCmd [info command ::socket] 21 | } 22 | } 23 | 24 | proc tls::initlib {dir dll} { 25 | # Package index cd's into the package directory for loading. 26 | # Irrelevant to unixoids, but for Windows this enables the OS to find 27 | # the dependent DLL's in the CWD, where they may be. 28 | set cwd [pwd] 29 | catch {cd $dir} 30 | if {[string equal $::tcl_platform(platform) "windows"] && 31 | ![string equal [lindex [file system $dir] 0] "native"]} { 32 | # If it is a wrapped executable running on windows, the openssl 33 | # dlls must be copied out of the virtual filesystem to the disk 34 | # where Windows will find them when resolving the dependency in 35 | # the tls dll. We choose to make them siblings of the executable. 36 | package require starkit 37 | set dst [file nativename [file dirname $starkit::topdir]] 38 | foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { 39 | catch {file delete -force $dst/$sdll} 40 | catch {file copy -force $dir/$sdll $dst/$sdll} 41 | } 42 | } 43 | set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] 44 | catch {cd $cwd} 45 | if {$res} { 46 | namespace eval [namespace parent] {namespace delete tls} 47 | return -code $res $err 48 | } 49 | rename tls::initlib {} 50 | } 51 | 52 | # 53 | # Backwards compatibility, also used to set the default 54 | # context options 55 | # 56 | proc tls::init {args} { 57 | variable defaults 58 | 59 | set defaults $args 60 | } 61 | # 62 | # Helper function - behaves exactly as the native socket command. 63 | # 64 | proc tls::socket {args} { 65 | variable socketCmd 66 | variable defaults 67 | set idx [lsearch $args -server] 68 | if {$idx != -1} { 69 | set server 1 70 | set callback [lindex $args [expr {$idx+1}]] 71 | set args [lreplace $args $idx [expr {$idx+1}]] 72 | 73 | set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" 74 | set options "-cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 75 | } else { 76 | set server 0 77 | 78 | set usage "wrong # args: should be \"tls::socket ?options? host port\"" 79 | set options "-async, -cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -myport, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 80 | } 81 | set argc [llength $args] 82 | set sopts {} 83 | set iopts [concat [list -server $server] $defaults] ;# Import options 84 | 85 | for {set idx 0} {$idx < $argc} {incr idx} { 86 | set arg [lindex $args $idx] 87 | switch -glob -- $server,$arg { 88 | 0,-async {lappend sopts $arg} 89 | 0,-myport - 90 | *,-type - 91 | *,-myaddr {lappend sopts $arg [lindex $args [incr idx]]} 92 | *,-cadir - 93 | *,-cafile - 94 | *,-certfile - 95 | *,-cipher - 96 | *,-command - 97 | *,-dhparams - 98 | *,-keyfile - 99 | *,-password - 100 | *,-request - 101 | *,-require - 102 | *,-servername - 103 | *,-ssl2 - 104 | *,-ssl3 - 105 | *,-tls1 - 106 | *,-tls1.1 - 107 | *,-tls1.2 {lappend iopts $arg [lindex $args [incr idx]]} 108 | -* {return -code error "bad option \"$arg\": must be one of $options"} 109 | default {break} 110 | } 111 | } 112 | if {$server} { 113 | if {($idx + 1) != $argc} { 114 | return -code error $usage 115 | } 116 | set uid [incr ::tls::srvuid] 117 | 118 | set port [lindex $args [expr {$argc-1}]] 119 | lappend sopts $port 120 | #set sopts [linsert $sopts 0 -server $callback] 121 | set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] 122 | #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] 123 | } else { 124 | if {($idx + 2) != $argc} { 125 | return -code error $usage 126 | } 127 | set host [lindex $args [expr {$argc-2}]] 128 | set port [lindex $args [expr {$argc-1}]] 129 | lappend sopts $host $port 130 | } 131 | # 132 | # Create TCP/IP socket 133 | # 134 | set chan [eval $socketCmd $sopts] 135 | if {!$server && [catch { 136 | # 137 | # Push SSL layer onto socket 138 | # 139 | eval [list tls::import] $chan $iopts 140 | } err]} { 141 | set info ${::errorInfo} 142 | catch {close $chan} 143 | return -code error -errorinfo $info $err 144 | } 145 | return $chan 146 | } 147 | 148 | # tls::_accept -- 149 | # 150 | # This is the actual accept that TLS sockets use, which then calls 151 | # the callback registered by tls::socket. 152 | # 153 | # Arguments: 154 | # iopts tls::import opts 155 | # callback server callback to invoke 156 | # chan socket channel to accept/deny 157 | # ipaddr calling IP address 158 | # port calling port 159 | # 160 | # Results: 161 | # Returns an error if the callback throws one. 162 | # 163 | proc tls::_accept { iopts callback chan ipaddr port } { 164 | log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] 165 | 166 | set chan [eval [list tls::import $chan] $iopts] 167 | 168 | lappend callback $chan $ipaddr $port 169 | if {[catch { 170 | uplevel #0 $callback 171 | } err]} { 172 | log 1 "tls::_accept error: ${::errorInfo}" 173 | close $chan 174 | error $err $::errorInfo $::errorCode 175 | } else { 176 | log 2 "tls::_accept - called \"$callback\" succeeded" 177 | } 178 | } 179 | # 180 | # Sample callback for hooking: - 181 | # 182 | # error 183 | # verify 184 | # info 185 | # 186 | proc tls::callback {option args} { 187 | variable debug 188 | 189 | #log 2 [concat $option $args] 190 | 191 | switch -- $option { 192 | "error" { 193 | foreach {chan msg} $args break 194 | 195 | log 0 "TLS/$chan: error: $msg" 196 | } 197 | "verify" { 198 | # poor man's lassign 199 | foreach {chan depth cert rc err} $args break 200 | 201 | array set c $cert 202 | 203 | if {$rc != "1"} { 204 | log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" 205 | } else { 206 | log 2 "TLS/$chan: verify/$depth: $c(subject)" 207 | } 208 | if {$debug > 0} { 209 | return 1; # FORCE OK 210 | } else { 211 | return $rc 212 | } 213 | } 214 | "info" { 215 | # poor man's lassign 216 | foreach {chan major minor state msg} $args break 217 | 218 | if {$msg != ""} { 219 | append state ": $msg" 220 | } 221 | # For tracing 222 | upvar #0 tls::$chan cb 223 | set cb($major) $minor 224 | 225 | log 2 "TLS/$chan: $major/$minor: $state" 226 | } 227 | default { 228 | return -code error "bad option \"$option\":\ 229 | must be one of error, info, or verify" 230 | } 231 | } 232 | } 233 | 234 | proc tls::xhandshake {chan} { 235 | upvar #0 tls::$chan cb 236 | 237 | if {[info exists cb(handshake)] && \ 238 | $cb(handshake) == "done"} { 239 | return 1 240 | } 241 | while {1} { 242 | vwait tls::${chan}(handshake) 243 | if {![info exists cb(handshake)]} { 244 | return 0 245 | } 246 | if {$cb(handshake) == "done"} { 247 | return 1 248 | } 249 | } 250 | } 251 | 252 | proc tls::password {} { 253 | log 0 "TLS/Password: did you forget to set your passwd!" 254 | # Return the worlds best kept secret password. 255 | return "secret" 256 | } 257 | 258 | proc tls::log {level msg} { 259 | variable debug 260 | variable logcmd 261 | 262 | if {$level > $debug || $logcmd == ""} { 263 | return 264 | } 265 | set cmd $logcmd 266 | lappend cmd $msg 267 | uplevel #0 $cmd 268 | } 269 | 270 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/macOS/libtls1.6.7.1.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/tls/macOS/libtls1.6.7.1.dylib -------------------------------------------------------------------------------- /vmdStore/lib/tls/macOS/teapot.txt: -------------------------------------------------------------------------------- 1 | Package tls 1.6.7.1 2 | Meta as::author {Dan Razell} {Matt Newman} {Jeff Hobbs} 3 | Meta as::build::date 2015-07-09 4 | Meta as::origin http://sourceforge.net/projects/tls 5 | Meta category Channels 6 | Meta description TLS provides a replacement socket command for 7 | Meta description setting up and using secure sockets. 8 | Meta license BSD 9 | Meta openssl {OpenSSL 1.0.2d 9 Jul 2015} 10 | Meta platform macosx10.5-i386-x86_64 11 | Meta require {Tcl 8.4} 12 | Meta subject ssl tls security 13 | Meta summary SSL/TLS binding for Tcl 14 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/macOS/tls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1997-2000 Matt Newman 3 | # 4 | # $Header: /cvsroot/tls/tls/tls.tcl,v 1.14 2015/07/07 17:16:03 andreas_kupries Exp $ 5 | # 6 | namespace eval tls { 7 | variable logcmd tclLog 8 | variable debug 0 9 | 10 | # Default flags passed to tls::import 11 | variable defaults {} 12 | 13 | # Maps UID to Server Socket 14 | variable srvmap 15 | variable srvuid 0 16 | 17 | # Over-ride this if you are using a different socket command 18 | variable socketCmd 19 | if {![info exists socketCmd]} { 20 | set socketCmd [info command ::socket] 21 | } 22 | } 23 | 24 | proc tls::initlib {dir dll} { 25 | # Package index cd's into the package directory for loading. 26 | # Irrelevant to unixoids, but for Windows this enables the OS to find 27 | # the dependent DLL's in the CWD, where they may be. 28 | set cwd [pwd] 29 | catch {cd $dir} 30 | if {[string equal $::tcl_platform(platform) "windows"] && 31 | ![string equal [lindex [file system $dir] 0] "native"]} { 32 | # If it is a wrapped executable running on windows, the openssl 33 | # dlls must be copied out of the virtual filesystem to the disk 34 | # where Windows will find them when resolving the dependency in 35 | # the tls dll. We choose to make them siblings of the executable. 36 | package require starkit 37 | set dst [file nativename [file dirname $starkit::topdir]] 38 | foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { 39 | catch {file delete -force $dst/$sdll} 40 | catch {file copy -force $dir/$sdll $dst/$sdll} 41 | } 42 | } 43 | set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] 44 | catch {cd $cwd} 45 | if {$res} { 46 | namespace eval [namespace parent] {namespace delete tls} 47 | return -code $res $err 48 | } 49 | rename tls::initlib {} 50 | } 51 | 52 | # 53 | # Backwards compatibility, also used to set the default 54 | # context options 55 | # 56 | proc tls::init {args} { 57 | variable defaults 58 | 59 | set defaults $args 60 | } 61 | # 62 | # Helper function - behaves exactly as the native socket command. 63 | # 64 | proc tls::socket {args} { 65 | variable socketCmd 66 | variable defaults 67 | set idx [lsearch $args -server] 68 | if {$idx != -1} { 69 | set server 1 70 | set callback [lindex $args [expr {$idx+1}]] 71 | set args [lreplace $args $idx [expr {$idx+1}]] 72 | 73 | set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" 74 | set options "-cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 75 | } else { 76 | set server 0 77 | 78 | set usage "wrong # args: should be \"tls::socket ?options? host port\"" 79 | set options "-async, -cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -myport, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 80 | } 81 | set argc [llength $args] 82 | set sopts {} 83 | set iopts [concat [list -server $server] $defaults] ;# Import options 84 | 85 | for {set idx 0} {$idx < $argc} {incr idx} { 86 | set arg [lindex $args $idx] 87 | switch -glob -- $server,$arg { 88 | 0,-async {lappend sopts $arg} 89 | 0,-myport - 90 | *,-type - 91 | *,-myaddr {lappend sopts $arg [lindex $args [incr idx]]} 92 | *,-cadir - 93 | *,-cafile - 94 | *,-certfile - 95 | *,-cipher - 96 | *,-command - 97 | *,-dhparams - 98 | *,-keyfile - 99 | *,-password - 100 | *,-request - 101 | *,-require - 102 | *,-servername - 103 | *,-ssl2 - 104 | *,-ssl3 - 105 | *,-tls1 - 106 | *,-tls1.1 - 107 | *,-tls1.2 {lappend iopts $arg [lindex $args [incr idx]]} 108 | -* {return -code error "bad option \"$arg\": must be one of $options"} 109 | default {break} 110 | } 111 | } 112 | if {$server} { 113 | if {($idx + 1) != $argc} { 114 | return -code error $usage 115 | } 116 | set uid [incr ::tls::srvuid] 117 | 118 | set port [lindex $args [expr {$argc-1}]] 119 | lappend sopts $port 120 | #set sopts [linsert $sopts 0 -server $callback] 121 | set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] 122 | #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] 123 | } else { 124 | if {($idx + 2) != $argc} { 125 | return -code error $usage 126 | } 127 | set host [lindex $args [expr {$argc-2}]] 128 | set port [lindex $args [expr {$argc-1}]] 129 | lappend sopts $host $port 130 | } 131 | # 132 | # Create TCP/IP socket 133 | # 134 | set chan [eval $socketCmd $sopts] 135 | if {!$server && [catch { 136 | # 137 | # Push SSL layer onto socket 138 | # 139 | eval [list tls::import] $chan $iopts 140 | } err]} { 141 | set info ${::errorInfo} 142 | catch {close $chan} 143 | return -code error -errorinfo $info $err 144 | } 145 | return $chan 146 | } 147 | 148 | # tls::_accept -- 149 | # 150 | # This is the actual accept that TLS sockets use, which then calls 151 | # the callback registered by tls::socket. 152 | # 153 | # Arguments: 154 | # iopts tls::import opts 155 | # callback server callback to invoke 156 | # chan socket channel to accept/deny 157 | # ipaddr calling IP address 158 | # port calling port 159 | # 160 | # Results: 161 | # Returns an error if the callback throws one. 162 | # 163 | proc tls::_accept { iopts callback chan ipaddr port } { 164 | log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] 165 | 166 | set chan [eval [list tls::import $chan] $iopts] 167 | 168 | lappend callback $chan $ipaddr $port 169 | if {[catch { 170 | uplevel #0 $callback 171 | } err]} { 172 | log 1 "tls::_accept error: ${::errorInfo}" 173 | close $chan 174 | error $err $::errorInfo $::errorCode 175 | } else { 176 | log 2 "tls::_accept - called \"$callback\" succeeded" 177 | } 178 | } 179 | # 180 | # Sample callback for hooking: - 181 | # 182 | # error 183 | # verify 184 | # info 185 | # 186 | proc tls::callback {option args} { 187 | variable debug 188 | 189 | #log 2 [concat $option $args] 190 | 191 | switch -- $option { 192 | "error" { 193 | foreach {chan msg} $args break 194 | 195 | log 0 "TLS/$chan: error: $msg" 196 | } 197 | "verify" { 198 | # poor man's lassign 199 | foreach {chan depth cert rc err} $args break 200 | 201 | array set c $cert 202 | 203 | if {$rc != "1"} { 204 | log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" 205 | } else { 206 | log 2 "TLS/$chan: verify/$depth: $c(subject)" 207 | } 208 | if {$debug > 0} { 209 | return 1; # FORCE OK 210 | } else { 211 | return $rc 212 | } 213 | } 214 | "info" { 215 | # poor man's lassign 216 | foreach {chan major minor state msg} $args break 217 | 218 | if {$msg != ""} { 219 | append state ": $msg" 220 | } 221 | # For tracing 222 | upvar #0 tls::$chan cb 223 | set cb($major) $minor 224 | 225 | log 2 "TLS/$chan: $major/$minor: $state" 226 | } 227 | default { 228 | return -code error "bad option \"$option\":\ 229 | must be one of error, info, or verify" 230 | } 231 | } 232 | } 233 | 234 | proc tls::xhandshake {chan} { 235 | upvar #0 tls::$chan cb 236 | 237 | if {[info exists cb(handshake)] && \ 238 | $cb(handshake) == "done"} { 239 | return 1 240 | } 241 | while {1} { 242 | vwait tls::${chan}(handshake) 243 | if {![info exists cb(handshake)]} { 244 | return 0 245 | } 246 | if {$cb(handshake) == "done"} { 247 | return 1 248 | } 249 | } 250 | } 251 | 252 | proc tls::password {} { 253 | log 0 "TLS/Password: did you forget to set your passwd!" 254 | # Return the worlds best kept secret password. 255 | return "secret" 256 | } 257 | 258 | proc tls::log {level msg} { 259 | variable debug 260 | variable logcmd 261 | 262 | if {$level > $debug || $logcmd == ""} { 263 | return 264 | } 265 | set cmd $logcmd 266 | lappend cmd $msg 267 | uplevel #0 $cmd 268 | } 269 | 270 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/1.7.16/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | if {![package vsatisfies [package provide Tcl] 8.3]} {return} 2 | package ifneeded tls 1.7.16 "source \[file join [list $dir] tls.tcl\] ; tls::initlib [list $dir] tls1716t.dll" 3 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/1.7.16/tls.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | TLS (SSL) Tcl Commands 10 | 11 | 12 | 13 | 14 |
15 |
NAME
16 |
tls - binding to OpenSSL 17 | toolkit.
18 |
19 |
20 |
SYNOPSIS
21 |
22 |
package require Tcl ?8.4?
23 |
package require tls ?1.7.16?
24 |
 
25 |
tls::init ?options?
26 |
tls::socket ?options? host port
27 |
tls::socket ?-server command? 28 | ?options? port
29 |
tls::handshake channel
30 |
tls::status ?-local? channel
31 |
tls::import channel ?options?
32 |
tls::unimport channel
33 |
tls::ciphers protocol ?verbose?
34 |
tls::version
35 |
36 |
37 |
COMMANDS
38 |
CALLBACK OPTIONS
39 |
HTTPS EXAMPLE
40 |
SPECIAL CONSIDERATIONS
41 |
SEE ALSO
42 |
43 | 44 |
45 | 46 |

NAME

47 | 48 |

tls - binding to OpenSSL 49 | toolkit.

50 | 51 |

SYNOPSIS

52 | 53 |

package require Tcl 8.4
54 | package require tls 1.7.16
55 |
56 | tls::init ?options?
57 |
tls::socket ?options? host 58 | port
59 | tls::socket ?-server command? ?options? port
60 |
tls::status ?-local? channel
61 |
tls::handshake channel
62 |
63 | tls::import channel ?options?
64 | tls::unimport channel
65 | tls::ciphers 66 | protocol ?verbose?
67 | tls::version 68 |

69 | 70 |

DESCRIPTION

71 | 72 |

This extension provides a generic binding to OpenSSL, utilizing the 74 | Tcl_StackChannel 75 | API for Tcl 8.2 and higher. The sockets behave exactly the same 76 | as channels created using Tcl's built-in socket 77 | command with additional options for controlling the SSL session. 78 | To use TLS with an earlier version of Tcl than 8.4, please obtain 79 | TLS 1.3. 80 |

81 | 82 |

COMMANDS

83 | 84 |

Typically one would use the tls::socket command 85 | which provides compatibility with the native Tcl socket 86 | command. In such cases tls::import should not be 87 | used directly.

88 | 89 |
90 |
tls::init ?options?
91 |
This routine sets the default options used by tls::socket 92 | and is optional. If you call tls::import 93 | directly this routine has no effect. Any of the options 94 | that tls::socket accepts can be set 95 | using this command, though you should limit your options 96 | to only TLS related ones.
97 |
 
98 |
tls::socket ?options? 99 | host port
100 |
tls::socket ?-server command? ?options? port
101 |
This is a helper function that utilizes the underlying 102 | commands (tls::import). It behaves 103 | exactly the same as the native Tcl socket 104 | command except that the options can include any of the 105 | applicable tls:import 106 | options with one additional option: 107 |
108 |
109 |
-autoservername bool
110 |
Automatically send the -servername as the host argument 111 | (default: false)
112 |
113 |
114 |
 
115 |
tls::handshake channel
116 |
Forces handshake to take place, and returns 0 if 117 | handshake is still in progress (non-blocking), or 1 if 118 | the handshake was successful. If the handshake failed 119 | this routine will throw an error.
120 |
 
121 |
tls::status 122 | ?-local? channel
123 |
Returns the current security status of an SSL channel. The 124 | result is a list of key-value pairs describing the 125 | connected peer. If the result is an empty list then the 126 | SSL handshake has not yet completed. 127 | If -local is given, then the certificate information 128 | is the one used locally.
129 |
130 | 131 |
132 |
133 |
issuer dn
134 |
The distinguished name (DN) of the certificate 135 | issuer.
136 |
subject dn
137 |
The distinguished name (DN) of the certificate 138 | subject.
139 |
notBefore date
140 |
The begin date for the validity of the certificate.
141 |
notAfter date
142 |
The expiry date for the certificate.
143 |
serial n
144 |
The serial number of the certificate.
145 |
cipher cipher
146 |
The current cipher in use between the client and 147 | server channels.
148 |
sbits n
149 |
The number of bits used for the session key.
150 |
151 |
152 | 153 |
154 |
tls::import channel 155 | ?options?
156 |
SSL-enable a regular Tcl channel - it need not be a 157 | socket, but must provide bi-directional flow. Also 158 | setting session parameters for SSL handshake.
159 |
160 | 161 |
162 |
163 |
-cadir dir
164 |
Provide the directory containing the CA certificates.
165 |
-cafile filename
166 |
Provide the CA file.
167 |
-certfile filename
168 |
Provide the certificate to use.
169 |
-cipher string
170 |
Provide the cipher suites to use. Syntax is as per 171 | OpenSSL.
172 |
-command callback
173 |
If specified, this callback will be invoked at several points 174 | during the OpenSSL handshake. It can pass errors and tracing 175 | information, and it can allow Tcl scripts to perform 176 | their own validation of the certificate in place of the 177 | default validation provided by OpenSSL. 178 |
179 | See CALLBACK OPTIONS for 180 | further discussion.
181 |
-dhparams filename
182 |
Provide a Diffie-Hellman parameters file.
183 |
-keyfile filename
184 |
Provide the private key file. (default: 185 | value of -certfile)
186 |
-model channel
187 |
This will force this channel to share the same SSL_CTX 188 | structure as the specified channel, and 189 | therefore share callbacks etc.
190 |
-password callback
191 |
If supplied, this callback will be invoked when OpenSSL needs 192 | to obtain a password, typically to unlock the private key of 193 | a certificate. 194 | The callback should return a string which represents the 195 | password to be used. 196 |
197 | See CALLBACK OPTIONS for 198 | further discussion.
199 |
-request bool
200 |
Request a certificate from peer during SSL handshake. 201 | (default: true)
202 |
-require bool
203 |
Require a valid certificate from peer during SSL 204 | handshake. If this is set to true then -request 205 | must also be set to true. (default: false)
206 |
-server bool
207 |
Handshake as server if true, else handshake as 208 | client.(default: false)
209 |
-servername host
210 |
Only available if the OpenSSL library the package is linked 211 | against supports the TLS hostname extension for 'Server Name 212 | Indication' (SNI). Use to name the logical host we are talking 213 | to and expecting a certificate for
214 |
-ssl2 bool
215 |
Enable use of SSL v2. (default: false)
216 |
-ssl3 bool
217 |
Enable use of SSL v3. (default: false)
218 |
-tls1 bool
219 |
Enable use of TLS v1. (default: true)
220 |
-tls1.1 bool
221 |
Enable use of TLS v1.1 (default: true)
222 |
-tls1.2 bool
223 |
Enable use of TLS v1.2 (default: true)
224 |
225 |
226 | 227 |
228 |
tls::unimport channel
229 |
Provided for symmetry to tls::import, this 230 | unstacks the SSL-enabling of a regular Tcl channel. An error 231 | is thrown if TLS is not the top stacked channel type.
232 |
233 | 234 |
235 |
tls::ciphers 236 | protocol ?verbose?
237 |
Returns list of supported ciphers based on the protocol 238 | you supply, which must be one of ssl2, ssl3, or tls1. 239 | If verbose is specified as true then a verbose, 240 | semi-human readable list is returned providing additional 241 | information on the nature of the cipher support. In each 242 | case the result is a Tcl list.
243 |
244 | 245 |
246 |
tls::version
247 |
Returns the version string defined by OpenSSL.
248 |
249 | 250 |

CALLBACK OPTIONS

251 | 252 |

253 | As indicated above, individual channels can be given their own callbacks 254 | to handle intermediate processing by the OpenSSL library, using the 255 | -command and -password options passed to either of 256 | tls::socket or tls::import. 257 |

258 | 259 |
260 |
261 | 262 |
-command callback
263 |
264 | Invokes the specified callback script at 265 | several points during the OpenSSL handshake. 266 | Except as indicated below, values returned from the 267 | callback are ignored. 268 | Arguments appended to the script upon callback take one of the 269 | following forms: 270 | 271 |
272 |
273 | 274 |
275 | 276 | 289 | 290 |
291 | info channel major minor message 292 |
293 |
294 | This form of callback is invoked by the OpenSSL function 295 | SSL_CTX_set_info_callback(). 296 |
297 | The major and minor arguments are used to 298 | represent the state information bitmask. 299 |
300 |
Possible values for major are:
301 |
handshake, alert, connect, accept.
302 |
Possible values for minor are:
303 |
start, done, read, write, loop, exit.
304 |
305 | The message argument is a descriptive string which may 306 | be generated either by 307 | SSL_state_string_long() or by 308 | SSL_alert_desc_string_long(), 309 | depending on context. 310 |
311 | 312 |
313 | 314 |
315 | verify channel depth cert status error 316 |
317 |
318 | This form of callback is invoked by the OpenSSL function 319 | SSL_set_verify(). 320 |
321 | The depth argument is an integer representing the 322 | current depth on the certificate chain, with 323 | 0 as the subject certificate and higher values 324 | denoting progressively more indirect issuer certificates. 325 |
326 | The cert argument is a list of key-value pairs similar 327 | to those returned by 328 | tls::status. 329 |
330 | The status argument is an integer representing the 331 | current validity of the certificate. 332 | A value of 0 means the certificate is deemed invalid. 333 | A value of 1 means the certificate is deemed valid. 334 |
335 | The error argument supplies the message, if any, generated 336 | by 337 | X509_STORE_CTX_get_error(). 338 |
339 |
340 | The callback may override normal validation processing by explicitly 341 | returning one of the above status values. 342 |
343 | 344 |
345 |
346 | 347 |
348 | 349 |
-password callback
350 |
351 | Invokes the specified callback script when OpenSSL needs to 352 | obtain a password. The callback should return a string which 353 | represents the password to be used. 354 | No arguments are appended to the script upon callback. 355 |
356 |
357 |
358 | 359 |

360 | Reference implementations of these callbacks are provided in the 361 | distribution as tls::callback and 362 | tls::password respectively. Note that these are 363 | sample implementations only. In a more realistic deployment 364 | you would specify your own callback scripts on each TLS channel 365 | using the -command and -password options. 366 |

367 | 368 |

369 | The default behavior when the -command option is not specified is for 370 | TLS to process the associated library callbacks internally. 371 | The default behavior when the -password option is not specified is for 372 | TLS to process the associated library callbacks by attempting to call 373 | tls::password. 374 | The difference between these two behaviors is a consequence of maintaining 375 | compatibility with earlier implementations. 376 |

377 | 378 |

379 | The tls::debug variable provides some additional 380 | control over these reference callbacks. Its value is zero by default. 381 | Higher values produce more diagnostic output, and will also force the 382 | verify method in tls::callback to accept the 383 | certificate, even when it is invalid. 384 |

385 | 386 |

387 | 388 | The use of the reference callbacks tls::callback and 389 | tls::password is not recommended. They may be removed 390 | from future releases. 391 | 392 |

393 | 394 |

395 | 396 | The use of the variable tls::debug is not recommended. 397 | It may be removed from future releases. 398 | 399 |

400 | 401 |

HTTPS EXAMPLE

402 | 403 |

This example uses a sample server.pem provided with the TLS release, 404 | courtesy of the OpenSSL project.

405 | 406 |

407 | package require http
408 | package require tls
409 | 
410 | http::register https 443 [list ::tls::socket -autoservername true -require true -cadir /etc/ssl/certs]
411 | 
412 | set tok [http::geturl https://www.tcl.tk/]
413 | 
414 | 415 |

SPECIAL CONSIDERATIONS

416 | 417 |

The capabilities of this package can vary enormously based 418 | upon how your OpenSSL library was configured and built. At the 419 | most macro-level OpenSSL supports a "no patents" build, 420 | which disables RSA, IDEA, RC(2,4,5) and SSL2 - if your OpenSSL is 421 | configured this way then you will need to build TLS with the 422 | -DNO_PATENTS option - and the resultant module will function 423 | correctly and also support ADH certificate-less encryption, 424 | however you will be unable to utilize this to speak to normal Web 425 | Servers, which typically require RSA support. Please see http://www.openssl.org/ for 427 | more information on the whole issue of patents and US export 428 | restrictions.

429 | 430 |

SEE ALSO

431 | 432 |

socket, fileevent, OpenSSL

434 | 435 |
436 | 437 |
438 | Copyright © 1999 Matt Newman.
439 | Copyright © 2004 Starfish Systems.
440 | 
441 | 442 | 443 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/1.7.16/tls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1997-2000 Matt Newman 3 | # 4 | namespace eval tls { 5 | variable logcmd tclLog 6 | variable debug 0 7 | 8 | # Default flags passed to tls::import 9 | variable defaults {} 10 | 11 | # Maps UID to Server Socket 12 | variable srvmap 13 | variable srvuid 0 14 | 15 | # Over-ride this if you are using a different socket command 16 | variable socketCmd 17 | if {![info exists socketCmd]} { 18 | set socketCmd [info command ::socket] 19 | } 20 | 21 | # This is the possible arguments to tls::socket and tls::init 22 | # The format of this is a list of lists 23 | ## Each inner list contains the following elements 24 | ### Server (matched against "string match" for 0/1) 25 | ### Option name 26 | ### Variable to add the option to: 27 | #### sopts: [socket] option 28 | #### iopts: [tls::import] option 29 | ### How many arguments the following the option to consume 30 | variable socketOptionRules { 31 | {0 -async sopts 0} 32 | {* -myaddr sopts 1} 33 | {0 -myport sopts 1} 34 | {* -type sopts 1} 35 | {* -cadir iopts 1} 36 | {* -cafile iopts 1} 37 | {* -certfile iopts 1} 38 | {* -cipher iopts 1} 39 | {* -command iopts 1} 40 | {* -dhparams iopts 1} 41 | {* -keyfile iopts 1} 42 | {* -password iopts 1} 43 | {* -request iopts 1} 44 | {* -require iopts 1} 45 | {* -autoservername discardOpts 1} 46 | {* -servername iopts 1} 47 | {* -ssl2 iopts 1} 48 | {* -ssl3 iopts 1} 49 | {* -tls1 iopts 1} 50 | {* -tls1.1 iopts 1} 51 | {* -tls1.2 iopts 1} 52 | } 53 | 54 | # tls::socket and tls::init options as a humane readable string 55 | variable socketOptionsNoServer 56 | variable socketOptionsServer 57 | 58 | # Internal [switch] body to validate options 59 | variable socketOptionsSwitchBody 60 | } 61 | 62 | proc tls::_initsocketoptions {} { 63 | variable socketOptionRules 64 | variable socketOptionsNoServer 65 | variable socketOptionsServer 66 | variable socketOptionsSwitchBody 67 | 68 | # Do not re-run if we have already been initialized 69 | if {[info exists socketOptionsSwitchBody]} { 70 | return 71 | } 72 | 73 | # Create several structures from our list of options 74 | ## 1. options: a text representation of the valid options for the current 75 | ## server type 76 | ## 2. argSwitchBody: Switch body for processing arguments 77 | set options(0) [list] 78 | set options(1) [list] 79 | set argSwitchBody [list] 80 | foreach optionRule $socketOptionRules { 81 | set ruleServer [lindex $optionRule 0] 82 | set ruleOption [lindex $optionRule 1] 83 | set ruleVarToUpdate [lindex $optionRule 2] 84 | set ruleVarArgsToConsume [lindex $optionRule 3] 85 | 86 | foreach server [list 0 1] { 87 | if {![string match $ruleServer $server]} { 88 | continue 89 | } 90 | 91 | lappend options($server) $ruleOption 92 | } 93 | 94 | switch -- $ruleVarArgsToConsume { 95 | 0 { 96 | set argToExecute { 97 | lappend @VAR@ $arg 98 | set argsArray($arg) true 99 | } 100 | } 101 | 1 { 102 | set argToExecute { 103 | incr idx 104 | if {$idx >= [llength $args]} { 105 | return -code error "\"$arg\" option must be followed by value" 106 | } 107 | set argValue [lindex $args $idx] 108 | lappend @VAR@ $arg $argValue 109 | set argsArray($arg) $argValue 110 | } 111 | } 112 | default { 113 | return -code error "Internal argument construction error" 114 | } 115 | } 116 | 117 | lappend argSwitchBody $ruleServer,$ruleOption [string map [list @VAR@ $ruleVarToUpdate] $argToExecute] 118 | } 119 | 120 | # Add in the final options 121 | lappend argSwitchBody {*,-*} {return -code error "bad option \"$arg\": must be one of $options"} 122 | lappend argSwitchBody default break 123 | 124 | # Set the final variables 125 | set socketOptionsNoServer [join $options(0) {, }] 126 | set socketOptionsServer [join $options(1) {, }] 127 | set socketOptionsSwitchBody $argSwitchBody 128 | } 129 | 130 | proc tls::initlib {dir dll} { 131 | # Package index cd's into the package directory for loading. 132 | # Irrelevant to unixoids, but for Windows this enables the OS to find 133 | # the dependent DLL's in the CWD, where they may be. 134 | set cwd [pwd] 135 | catch {cd $dir} 136 | if {[string equal $::tcl_platform(platform) "windows"] && 137 | ![string equal [lindex [file system $dir] 0] "native"]} { 138 | # If it is a wrapped executable running on windows, the openssl 139 | # dlls must be copied out of the virtual filesystem to the disk 140 | # where Windows will find them when resolving the dependency in 141 | # the tls dll. We choose to make them siblings of the executable. 142 | package require starkit 143 | set dst [file nativename [file dirname $starkit::topdir]] 144 | foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { 145 | catch {file delete -force $dst/$sdll} 146 | catch {file copy -force $dir/$sdll $dst/$sdll} 147 | } 148 | } 149 | set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] 150 | catch {cd $cwd} 151 | if {$res} { 152 | namespace eval [namespace parent] {namespace delete tls} 153 | return -code $res $err 154 | } 155 | rename tls::initlib {} 156 | } 157 | 158 | 159 | # 160 | # Backwards compatibility, also used to set the default 161 | # context options 162 | # 163 | proc tls::init {args} { 164 | variable defaults 165 | variable socketOptionsNoServer 166 | variable socketOptionsServer 167 | variable socketOptionsSwitchBody 168 | 169 | tls::_initsocketoptions 170 | 171 | # Technically a third option should be used here: Options that are valid 172 | # only a both servers and non-servers 173 | set server -1 174 | set options $socketOptionsServer 175 | 176 | # Validate arguments passed 177 | set initialArgs $args 178 | set argc [llength $args] 179 | 180 | array set argsArray [list] 181 | for {set idx 0} {$idx < $argc} {incr idx} { 182 | set arg [lindex $args $idx] 183 | switch -glob -- $server,$arg $socketOptionsSwitchBody 184 | } 185 | 186 | set defaults $initialArgs 187 | } 188 | # 189 | # Helper function - behaves exactly as the native socket command. 190 | # 191 | proc tls::socket {args} { 192 | variable socketCmd 193 | variable defaults 194 | variable socketOptionsNoServer 195 | variable socketOptionsServer 196 | variable socketOptionsSwitchBody 197 | 198 | tls::_initsocketoptions 199 | 200 | set idx [lsearch $args -server] 201 | if {$idx != -1} { 202 | set server 1 203 | set callback [lindex $args [expr {$idx+1}]] 204 | set args [lreplace $args $idx [expr {$idx+1}]] 205 | 206 | set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" 207 | set options $socketOptionsServer 208 | } else { 209 | set server 0 210 | 211 | set usage "wrong # args: should be \"tls::socket ?options? host port\"" 212 | set options $socketOptionsNoServer 213 | } 214 | 215 | # Combine defaults with current options 216 | set args [concat $defaults $args] 217 | 218 | set argc [llength $args] 219 | set sopts {} 220 | set iopts [list -server $server] 221 | 222 | array set argsArray [list] 223 | for {set idx 0} {$idx < $argc} {incr idx} { 224 | set arg [lindex $args $idx] 225 | switch -glob -- $server,$arg $socketOptionsSwitchBody 226 | } 227 | 228 | if {$server} { 229 | if {($idx + 1) != $argc} { 230 | return -code error $usage 231 | } 232 | set uid [incr ::tls::srvuid] 233 | 234 | set port [lindex $args [expr {$argc-1}]] 235 | lappend sopts $port 236 | #set sopts [linsert $sopts 0 -server $callback] 237 | set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] 238 | #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] 239 | } else { 240 | if {($idx + 2) != $argc} { 241 | return -code error $usage 242 | } 243 | 244 | set host [lindex $args [expr {$argc-2}]] 245 | set port [lindex $args [expr {$argc-1}]] 246 | 247 | # If an "-autoservername" option is found, honor it 248 | if {[info exists argsArray(-autoservername)] && $argsArray(-autoservername)} { 249 | if {![info exists argsArray(-servername)]} { 250 | set argsArray(-servername) $host 251 | lappend iopts -servername $host 252 | } 253 | } 254 | 255 | lappend sopts $host $port 256 | } 257 | # 258 | # Create TCP/IP socket 259 | # 260 | set chan [eval $socketCmd $sopts] 261 | if {!$server && [catch { 262 | # 263 | # Push SSL layer onto socket 264 | # 265 | eval [list tls::import] $chan $iopts 266 | } err]} { 267 | set info ${::errorInfo} 268 | catch {close $chan} 269 | return -code error -errorinfo $info $err 270 | } 271 | return $chan 272 | } 273 | 274 | # tls::_accept -- 275 | # 276 | # This is the actual accept that TLS sockets use, which then calls 277 | # the callback registered by tls::socket. 278 | # 279 | # Arguments: 280 | # iopts tls::import opts 281 | # callback server callback to invoke 282 | # chan socket channel to accept/deny 283 | # ipaddr calling IP address 284 | # port calling port 285 | # 286 | # Results: 287 | # Returns an error if the callback throws one. 288 | # 289 | proc tls::_accept { iopts callback chan ipaddr port } { 290 | log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] 291 | 292 | set chan [eval [list tls::import $chan] $iopts] 293 | 294 | lappend callback $chan $ipaddr $port 295 | if {[catch { 296 | uplevel #0 $callback 297 | } err]} { 298 | log 1 "tls::_accept error: ${::errorInfo}" 299 | close $chan 300 | error $err $::errorInfo $::errorCode 301 | } else { 302 | log 2 "tls::_accept - called \"$callback\" succeeded" 303 | } 304 | } 305 | # 306 | # Sample callback for hooking: - 307 | # 308 | # error 309 | # verify 310 | # info 311 | # 312 | proc tls::callback {option args} { 313 | variable debug 314 | 315 | #log 2 [concat $option $args] 316 | 317 | switch -- $option { 318 | "error" { 319 | foreach {chan msg} $args break 320 | 321 | log 0 "TLS/$chan: error: $msg" 322 | } 323 | "verify" { 324 | # poor man's lassign 325 | foreach {chan depth cert rc err} $args break 326 | 327 | array set c $cert 328 | 329 | if {$rc != "1"} { 330 | log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" 331 | } else { 332 | log 2 "TLS/$chan: verify/$depth: $c(subject)" 333 | } 334 | if {$debug > 0} { 335 | return 1; # FORCE OK 336 | } else { 337 | return $rc 338 | } 339 | } 340 | "info" { 341 | # poor man's lassign 342 | foreach {chan major minor state msg} $args break 343 | 344 | if {$msg != ""} { 345 | append state ": $msg" 346 | } 347 | # For tracing 348 | upvar #0 tls::$chan cb 349 | set cb($major) $minor 350 | 351 | log 2 "TLS/$chan: $major/$minor: $state" 352 | } 353 | default { 354 | return -code error "bad option \"$option\":\ 355 | must be one of error, info, or verify" 356 | } 357 | } 358 | } 359 | 360 | proc tls::xhandshake {chan} { 361 | upvar #0 tls::$chan cb 362 | 363 | if {[info exists cb(handshake)] && \ 364 | $cb(handshake) == "done"} { 365 | return 1 366 | } 367 | while {1} { 368 | vwait tls::${chan}(handshake) 369 | if {![info exists cb(handshake)]} { 370 | return 0 371 | } 372 | if {$cb(handshake) == "done"} { 373 | return 1 374 | } 375 | } 376 | } 377 | 378 | proc tls::password {} { 379 | log 0 "TLS/Password: did you forget to set your passwd!" 380 | # Return the worlds best kept secret password. 381 | return "secret" 382 | } 383 | 384 | proc tls::log {level msg} { 385 | variable debug 386 | variable logcmd 387 | 388 | if {$level > $debug || $logcmd == ""} { 389 | return 390 | } 391 | set cmd $logcmd 392 | lappend cmd $msg 393 | uplevel #0 $cmd 394 | } 395 | 396 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/1.7.16/tls1716t.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/tls/windows/1.7.16/tls1716t.dll -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/teapot.txt: -------------------------------------------------------------------------------- 1 | Package tls 1.6.7.1 2 | Meta as::author {Dan Razell} {Matt Newman} {Jeff Hobbs} 3 | Meta as::build::date 2015-07-09 4 | Meta as::origin http://sourceforge.net/projects/tls 5 | Meta category Channels 6 | Meta description TLS provides a replacement socket command for 7 | Meta description setting up and using secure sockets. 8 | Meta license BSD 9 | Meta openssl {OpenSSL 1.0.2d 9 Jul 2015} 10 | Meta platform win32-ix86 11 | Meta require {Tcl 8.4} 12 | Meta subject ssl tls security 13 | Meta summary SSL/TLS binding for Tcl 14 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/tls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1997-2000 Matt Newman 3 | # 4 | # $Header: /cvsroot/tls/tls/tls.tcl,v 1.14 2015/07/07 17:16:03 andreas_kupries Exp $ 5 | # 6 | namespace eval tls { 7 | variable logcmd tclLog 8 | variable debug 0 9 | 10 | # Default flags passed to tls::import 11 | variable defaults {} 12 | 13 | # Maps UID to Server Socket 14 | variable srvmap 15 | variable srvuid 0 16 | 17 | # Over-ride this if you are using a different socket command 18 | variable socketCmd 19 | if {![info exists socketCmd]} { 20 | set socketCmd [info command ::socket] 21 | } 22 | } 23 | 24 | proc tls::initlib {dir dll} { 25 | # Package index cd's into the package directory for loading. 26 | # Irrelevant to unixoids, but for Windows this enables the OS to find 27 | # the dependent DLL's in the CWD, where they may be. 28 | set cwd [pwd] 29 | catch {cd $dir} 30 | if {[string equal $::tcl_platform(platform) "windows"] && 31 | ![string equal [lindex [file system $dir] 0] "native"]} { 32 | # If it is a wrapped executable running on windows, the openssl 33 | # dlls must be copied out of the virtual filesystem to the disk 34 | # where Windows will find them when resolving the dependency in 35 | # the tls dll. We choose to make them siblings of the executable. 36 | package require starkit 37 | set dst [file nativename [file dirname $starkit::topdir]] 38 | foreach sdll [glob -nocomplain -directory $dir -tails *eay32.dll] { 39 | catch {file delete -force $dst/$sdll} 40 | catch {file copy -force $dir/$sdll $dst/$sdll} 41 | } 42 | } 43 | set res [catch {uplevel #0 [list load [file join [pwd] $dll]]} err] 44 | catch {cd $cwd} 45 | if {$res} { 46 | namespace eval [namespace parent] {namespace delete tls} 47 | return -code $res $err 48 | } 49 | rename tls::initlib {} 50 | } 51 | 52 | # 53 | # Backwards compatibility, also used to set the default 54 | # context options 55 | # 56 | proc tls::init {args} { 57 | variable defaults 58 | 59 | set defaults $args 60 | } 61 | # 62 | # Helper function - behaves exactly as the native socket command. 63 | # 64 | proc tls::socket {args} { 65 | variable socketCmd 66 | variable defaults 67 | set idx [lsearch $args -server] 68 | if {$idx != -1} { 69 | set server 1 70 | set callback [lindex $args [expr {$idx+1}]] 71 | set args [lreplace $args $idx [expr {$idx+1}]] 72 | 73 | set usage "wrong # args: should be \"tls::socket -server command ?options? port\"" 74 | set options "-cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 75 | } else { 76 | set server 0 77 | 78 | set usage "wrong # args: should be \"tls::socket ?options? host port\"" 79 | set options "-async, -cadir, -cafile, -certfile, -cipher, -command, -dhparams, -keyfile, -myaddr, -myport, -password, -request, -require, -servername, -ssl2, -ssl3, -tls1, -tls1.1 or -tls1.2" 80 | } 81 | set argc [llength $args] 82 | set sopts {} 83 | set iopts [concat [list -server $server] $defaults] ;# Import options 84 | 85 | for {set idx 0} {$idx < $argc} {incr idx} { 86 | set arg [lindex $args $idx] 87 | switch -glob -- $server,$arg { 88 | 0,-async {lappend sopts $arg} 89 | 0,-myport - 90 | *,-type - 91 | *,-myaddr {lappend sopts $arg [lindex $args [incr idx]]} 92 | *,-cadir - 93 | *,-cafile - 94 | *,-certfile - 95 | *,-cipher - 96 | *,-command - 97 | *,-dhparams - 98 | *,-keyfile - 99 | *,-password - 100 | *,-request - 101 | *,-require - 102 | *,-servername - 103 | *,-ssl2 - 104 | *,-ssl3 - 105 | *,-tls1 - 106 | *,-tls1.1 - 107 | *,-tls1.2 {lappend iopts $arg [lindex $args [incr idx]]} 108 | -* {return -code error "bad option \"$arg\": must be one of $options"} 109 | default {break} 110 | } 111 | } 112 | if {$server} { 113 | if {($idx + 1) != $argc} { 114 | return -code error $usage 115 | } 116 | set uid [incr ::tls::srvuid] 117 | 118 | set port [lindex $args [expr {$argc-1}]] 119 | lappend sopts $port 120 | #set sopts [linsert $sopts 0 -server $callback] 121 | set sopts [linsert $sopts 0 -server [list tls::_accept $iopts $callback]] 122 | #set sopts [linsert $sopts 0 -server [list tls::_accept $uid $callback]] 123 | } else { 124 | if {($idx + 2) != $argc} { 125 | return -code error $usage 126 | } 127 | set host [lindex $args [expr {$argc-2}]] 128 | set port [lindex $args [expr {$argc-1}]] 129 | lappend sopts $host $port 130 | } 131 | # 132 | # Create TCP/IP socket 133 | # 134 | set chan [eval $socketCmd $sopts] 135 | if {!$server && [catch { 136 | # 137 | # Push SSL layer onto socket 138 | # 139 | eval [list tls::import] $chan $iopts 140 | } err]} { 141 | set info ${::errorInfo} 142 | catch {close $chan} 143 | return -code error -errorinfo $info $err 144 | } 145 | return $chan 146 | } 147 | 148 | # tls::_accept -- 149 | # 150 | # This is the actual accept that TLS sockets use, which then calls 151 | # the callback registered by tls::socket. 152 | # 153 | # Arguments: 154 | # iopts tls::import opts 155 | # callback server callback to invoke 156 | # chan socket channel to accept/deny 157 | # ipaddr calling IP address 158 | # port calling port 159 | # 160 | # Results: 161 | # Returns an error if the callback throws one. 162 | # 163 | proc tls::_accept { iopts callback chan ipaddr port } { 164 | log 2 [list tls::_accept $iopts $callback $chan $ipaddr $port] 165 | 166 | set chan [eval [list tls::import $chan] $iopts] 167 | 168 | lappend callback $chan $ipaddr $port 169 | if {[catch { 170 | uplevel #0 $callback 171 | } err]} { 172 | log 1 "tls::_accept error: ${::errorInfo}" 173 | close $chan 174 | error $err $::errorInfo $::errorCode 175 | } else { 176 | log 2 "tls::_accept - called \"$callback\" succeeded" 177 | } 178 | } 179 | # 180 | # Sample callback for hooking: - 181 | # 182 | # error 183 | # verify 184 | # info 185 | # 186 | proc tls::callback {option args} { 187 | variable debug 188 | 189 | #log 2 [concat $option $args] 190 | 191 | switch -- $option { 192 | "error" { 193 | foreach {chan msg} $args break 194 | 195 | log 0 "TLS/$chan: error: $msg" 196 | } 197 | "verify" { 198 | # poor man's lassign 199 | foreach {chan depth cert rc err} $args break 200 | 201 | array set c $cert 202 | 203 | if {$rc != "1"} { 204 | log 1 "TLS/$chan: verify/$depth: Bad Cert: $err (rc = $rc)" 205 | } else { 206 | log 2 "TLS/$chan: verify/$depth: $c(subject)" 207 | } 208 | if {$debug > 0} { 209 | return 1; # FORCE OK 210 | } else { 211 | return $rc 212 | } 213 | } 214 | "info" { 215 | # poor man's lassign 216 | foreach {chan major minor state msg} $args break 217 | 218 | if {$msg != ""} { 219 | append state ": $msg" 220 | } 221 | # For tracing 222 | upvar #0 tls::$chan cb 223 | set cb($major) $minor 224 | 225 | log 2 "TLS/$chan: $major/$minor: $state" 226 | } 227 | default { 228 | return -code error "bad option \"$option\":\ 229 | must be one of error, info, or verify" 230 | } 231 | } 232 | } 233 | 234 | proc tls::xhandshake {chan} { 235 | upvar #0 tls::$chan cb 236 | 237 | if {[info exists cb(handshake)] && \ 238 | $cb(handshake) == "done"} { 239 | return 1 240 | } 241 | while {1} { 242 | vwait tls::${chan}(handshake) 243 | if {![info exists cb(handshake)]} { 244 | return 0 245 | } 246 | if {$cb(handshake) == "done"} { 247 | return 1 248 | } 249 | } 250 | } 251 | 252 | proc tls::password {} { 253 | log 0 "TLS/Password: did you forget to set your passwd!" 254 | # Return the worlds best kept secret password. 255 | return "secret" 256 | } 257 | 258 | proc tls::log {level msg} { 259 | variable debug 260 | variable logcmd 261 | 262 | if {$level > $debug || $logcmd == ""} { 263 | return 264 | } 265 | set cmd $logcmd 266 | lappend cmd $msg 267 | uplevel #0 $cmd 268 | } 269 | 270 | -------------------------------------------------------------------------------- /vmdStore/lib/tls/windows/tls1671.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/tls/windows/tls1671.dll -------------------------------------------------------------------------------- /vmdStore/lib/wget/wget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/wget/wget.exe -------------------------------------------------------------------------------- /vmdStore/lib/zip/unzip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/059f9af95862754b1be4eb884008388d49fdff85/vmdStore/lib/zip/unzip.exe -------------------------------------------------------------------------------- /vmdStore/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | ## VMD Store ## 2 | ## Developed by Henrique S. Fernandes (hfernandes@med.up.pt) and Nuno M. F. S. A. Cerqueira (nscerque@fc.up.pt) 3 | 4 | package ifneeded vmdStore 0.3 [list source [file join $dir/vmdStore.tcl]] 5 | 6 | # Theme 7 | package ifneeded vmdStoreTheme 0.1 [list source [file join $dir/lib/theme/theme.tcl]] 8 | 9 | # GUI 10 | package ifneeded vmdStoreTopGui 0.1 [list source [file join $dir/gui/topGui.tcl]] 11 | package ifneeded vmdStoreLoadingGui 0.1 [list source [file join $dir/gui/loading.tcl]] 12 | package ifneeded vmdStoreInstalling 1.0 [list source [file join $dir/gui/installing.tcl]] 13 | 14 | # Lib 15 | package ifneeded vmdStoreReadExternalPackage 0.2 [list source [file join $dir/lib/readExternalPackage.tcl]] 16 | package ifneeded vmdStoreBrowser 1.0 [list source [file join $dir/lib/browser.tcl]] 17 | package ifneeded vmdStoreSearch 0.1 [list source [file join $dir/lib/search.tcl]] 18 | package ifneeded vmdStoreInstallPlugins 0.1 [list source [file join $dir/lib/install.tcl]] 19 | package ifneeded tar 0.7.1 [list source [file join $dir/lib/tar.tcl]] 20 | 21 | if {[lindex "$::tcl_platform(os)" 0] == "Windows"} { 22 | if {$::tcl_platform(pointerSize) == 8} { 23 | package ifneeded tls 1.7.16 \ 24 | "[list source [file join $dir/lib/tls/windows/1.7.16 tls.tcl]] ; \ 25 | [list tls::initlib $dir/lib/tls/windows/1.7.16 tls1716t.dll]" 26 | } else { 27 | package ifneeded tls 1.6.7.1 \ 28 | "[list source [file join $dir/lib/tls/windows tls.tcl]] ; \ 29 | [list tls::initlib $dir/lib/tls/windows tls1671.dll]" 30 | } 31 | } elseif {[lindex "$::tcl_platform(os)" 0] == "Darwin"} { 32 | package ifneeded tls 1.6.7.1 "[list source [file join $dir/lib/tls/macOS tls.tcl]] ; [list tls::initlib $dir/lib/tls/macOS libtls1.6.7.1.dylib]" 33 | } elseif {[lindex "$::tcl_platform(os)" 0] == "Linux"} { 34 | if {$::tcl_platform(machine) == "i686"} { 35 | package ifneeded tls 1.6.7.1 "[list source [file join $dir/lib/tls/linux/i868 tls.tcl]] ; [list tls::initlib $dir/lib/tls/linux/i868 libtls1.6.7.1.so]" 36 | } elseif {$::tcl_platform(machine) == "x86_64"} { 37 | package ifneeded tls 1.6.7.1 "[list source [file join $dir/lib/tls/linux/x86_64 tls.tcl]] ; [list tls::initlib $dir/lib/tls/linux/x86_64 libtls1.6.7.1.so]" 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /vmdStore/vmdStore.rc: -------------------------------------------------------------------------------- 1 | ####vmdStore#### START vmdStore 2 | ## Version XXversionXX 3 | variable vmdStorePath none 4 | lappend auto_path $::vmdStorePath 5 | vmd_install_extension vmdStore "vmdStore::start" "VMD Store/VMD Store" 6 | ####vmdStore#### END vmdStore 7 | ## VMD Store Plugin Manager ## 8 | ## Please, do not change this file unless you know what are you doing! ## 9 | -------------------------------------------------------------------------------- /vmdStore/vmdStore.tcl: -------------------------------------------------------------------------------- 1 | package provide vmdStore 0.3 2 | 3 | #### INIT ############################################################ 4 | namespace eval vmdStore:: { 5 | namespace export vmdStore 6 | 7 | #### Load Packages 8 | package require Tk 9 | package require http 10 | package forget tls 11 | 12 | if {[lindex "$::tcl_platform(os)" 0] == "Windows"} { 13 | if {$::tcl_platform(pointerSize) == 8} { 14 | package require -exact tls 1.7.16 15 | } else { 16 | package require -exact tls 1.6.7.1 17 | } 18 | } else { 19 | package require -exact tls 1.6.7.1 20 | } 21 | 22 | ## GUI 23 | package require vmdStoreTopGui 0.1 24 | package require vmdStoreLoadingGui 0.1 25 | package require vmdStoreInstalling 1.0 26 | 27 | ## Theme 28 | package require vmdStoreTheme 0.1 29 | 30 | ## Lib 31 | package require vmdStoreReadExternalPackage 0.2 32 | package require vmdStoreBrowser 1.0 33 | package require vmdStoreSearch 0.1 34 | package require vmdStoreInstallPlugins 0.1 35 | package require tar 0.7.1 36 | 37 | 38 | 39 | #### Program Variables 40 | ## General 41 | variable version "1.1.14" 42 | 43 | #GUI 44 | variable topGui ".vmdStore" 45 | variable loadingGui ".vmdStoreLoading" 46 | variable installing ".vmdStoreInstalling" 47 | variable askDir ".vmdStoreAskDir" 48 | 49 | #Read External Package 50 | variable readmePath "https://raw.githubusercontent.com/BioSIM-Research-Group/vmdStore/master/README.md" 51 | variable server "https://biosim.pt/software/" 52 | variable externalPackage "$::vmdStorePath/temp/repository" 53 | variable installLink "" 54 | variable webPageLink "" 55 | variable citationLink "" 56 | variable citationText "" 57 | variable pluginVersion "" 58 | variable installedPlugins {} 59 | variable installingProgress 5 60 | 61 | if {[string first "Windows" $::tcl_platform(os)] != -1} { 62 | variable wget "$vmdStorePath/lib/wget/wget.exe" 63 | } else { 64 | variable wget "wget" 65 | } 66 | 67 | #Markdown 68 | variable markdown [list \ 69 | [list "####" "\n" "Helvetica 10 bold" "h4"] \ 70 | [list "###" "\n" "Helvetica 14 bold" "h3"] \ 71 | [list "##" "\n" "Helvetica 18 bold" "h2"] \ 72 | [list "#" "\n" "Helvetica 22 bold" "h1"] \ 73 | [list "**_" "_**" "-weight bold -slant italic" "bolditalic"] \ 74 | [list "**" "**" "-weight bold" "bold"] \ 75 | [list "_" "_" "-slant italic" "italic"] \ 76 | ] 77 | 78 | } 79 | 80 | 81 | proc vmdStore::start {} { 82 | #### Open loading GUI 83 | vmdStore::loadingGui 84 | 85 | #### Enabling SSL protocol 86 | ::http::register https 443 ::tls::socket 87 | 88 | 89 | #### Save a backup of vmdrc 90 | catch {file copy -force $::vmdStorePath/vmdStore.rc $::vmdStorePath/vmdStore.rc.bak} 91 | 92 | #### Read VMDRC to check the version of all installed plugins 93 | set vmdrcPath "$::vmdStorePath/vmdStore.rc" 94 | set vmdrcLocal [open $vmdrcPath r] 95 | set vmdrcLocalContent [split [read $vmdrcLocal] "\n"] 96 | close $vmdrcLocal 97 | set i 0 98 | foreach line $vmdrcLocalContent { 99 | if {[regexp "####vmdStore#### START" $line] == 1} { 100 | regexp {####vmdStore####\sSTART\s(\S+)} $line -> plugin 101 | regexp {##\sVersion\s(\S+)} [lindex $vmdrcLocalContent [expr $i + 1]] -> version 102 | set installedPlugin [list $plugin $version] 103 | lappend vmdStore::installedPlugins $installedPlugin 104 | } 105 | incr i 106 | } 107 | 108 | 109 | #### Update vmdStore 110 | # Getting the local Version of vmdStore 111 | set localVersion [lindex [lindex $vmdStore::installedPlugins [lsearch -index 0 $vmdStore::installedPlugins "vmdStore"]] 1] 112 | 113 | # Getting the online Version of vmdStore 114 | set onlineVersion "" 115 | while {$onlineVersion == ""} { 116 | set url "https://github.com/BioSIM-Research-Group/vmdStore/releases/latest" 117 | set token [::http::geturl $url -timeout 30000] 118 | set data [set ${token}(meta)] 119 | regexp -all {tag\/(\S+)\s} $data --> onlineVersion 120 | } 121 | 122 | 123 | # Check if an update is needed 124 | if {$localVersion != $onlineVersion} { 125 | #Update vmdStore 126 | puts "A new version of vmdStore is available. It will be installed automatically." 127 | 128 | catch {file delete -force "$::vmdStorePath/temp"} 129 | file mkdir "$::vmdStorePath/temp" 130 | 131 | set url "https://github.com/BioSIM-Research-Group/vmdStore/archive/$onlineVersion.zip" 132 | set token [::http::geturl $url -timeout 30000] 133 | set data [::http::data $token] 134 | regexp -all {href=\"(\S+)\"} $data --> url 135 | puts "Downloading the update from: $url \n Please wait..." 136 | catch {exec $vmdStore::wget -O "$::vmdStorePath/temp/plugin.zip" "$url"} out 137 | puts $out 138 | #variable successfullDownload 0 139 | # set outputFile [open "$::vmdStorePath/temp/plugin.zip" w] 140 | # set token [::http::geturl $url -channel $outputFile -binary true -timeout 900000 -progress vmdStoreDownlodProgress -method GET] 141 | # close $outputFile 142 | 143 | # while {$vmdStore::successfullDownload == 0} { 144 | # file delete -force "$::vmdStorePath/temp/plugin.zip" 145 | # set outputFile [open "$::vmdStorePath/temp/plugin.zip" wb] 146 | # set token [::http::geturl $url -channel $outputFile -binary true -timeout 900000 -progress vmdStoreDownlodProgress -method GET] 147 | # close $outputFile 148 | # } 149 | 150 | if {[string first "Windows" $::tcl_platform(os)] != -1} { 151 | exec "$::vmdStorePath/lib/zip/unzip.exe" -q -o "$::vmdStorePath/temp/plugin.zip" -d "$::vmdStorePath/temp" 152 | } else { 153 | exec unzip -q -o "$::vmdStorePath/temp/plugin.zip" -d "$::vmdStorePath/temp" 154 | } 155 | 156 | # Copy Files 157 | vmdStoreCopyFiles "$::vmdStorePath/temp/vmdStore-$onlineVersion/vmdStore" "$::vmdStorePath" 158 | 159 | # Restore initial vmdStore.rc file 160 | catch {file copy -force $::vmdStorePath/vmdStore.rc.bak $::vmdStorePath/vmdStore.rc} 161 | 162 | #Update VMDRC file 163 | set vmdrcFile [open "$::vmdStorePath/temp/vmdStore-$onlineVersion/install.txt" r] 164 | set vmdrcFileContent [read $vmdrcFile] 165 | close $vmdrcFile 166 | set vmdrcPath "$::vmdStorePath/vmdStore.rc" 167 | 168 | foreach line [split $vmdrcFileContent "\n"] { 169 | if {[regexp "####vmdStore#### START" $line] == 1} { 170 | set initDelimiter $line 171 | } elseif {[regexp "####vmdStore#### END" $line] == 1} { 172 | set finalDelimiter $line 173 | } 174 | } 175 | 176 | set vmdrcLocal [open $vmdrcPath r] 177 | set vmdrcLocalContent [split [read $vmdrcLocal] "\n"] 178 | close $vmdrcLocal 179 | 180 | file delete -force $vmdrcPath 181 | set vmdrcLocal [open $vmdrcPath w] 182 | 183 | set printOrNot 1 184 | set printOrNotA 0 185 | set i 0 186 | foreach line [split $vmdrcFileContent "\n"] { 187 | if {[regexp "none" $line] == 1} { 188 | set path [subst $::vmdStorePath] 189 | regexp {(.*.) none} $line -> newLine 190 | puts $vmdrcLocal "$newLine \"$path\"" 191 | } elseif {[regexp "XXversionXX" $line] == 1} { 192 | regexp {(.*.) XXversionXX} $line -> newLine 193 | puts $vmdrcLocal "$newLine $onlineVersion" 194 | } else { 195 | puts $vmdrcLocal $line 196 | } 197 | } 198 | 199 | foreach line $vmdrcLocalContent { 200 | if {[regexp $initDelimiter $line] == 1} { 201 | set printOrNot 0 202 | } elseif {[regexp $finalDelimiter $line] == 1} { 203 | set printOrNotA 1 204 | } 205 | 206 | if {$printOrNot == 1 && $line != ""} { 207 | puts $vmdrcLocal $line 208 | } 209 | 210 | if {$printOrNotA == 1} { 211 | set printOrNot 1 212 | } 213 | 214 | incr i 215 | } 216 | 217 | 218 | close $vmdrcLocal 219 | 220 | destroy $::vmdStore::loadingGui 221 | tk_messageBox -title "VMD Store" -icon warning -message "The VMD Store was updated. Please, restart VMD to apply the new settings." 222 | 223 | } else { 224 | #Running the latest version 225 | #puts "You are running the latest version of vmdStore." 226 | 227 | destroy $::vmdStore::loadingGui 228 | 229 | if {[winfo exists $::vmdStore::topGui]} {wm deiconify $::vmdStore::topGui ;return $::vmdStore::topGui} 230 | #### Open the GUI 231 | vmdStore::topGui 232 | update 233 | return $::vmdStore::topGui 234 | } 235 | 236 | 237 | 238 | } 239 | 240 | proc vmdStoreDownlodProgress {token total current} { 241 | if {$total != 0} { 242 | set vmdStore::successfullDownload 1 243 | } 244 | set units "Bytes" 245 | if {$total > 1024} { 246 | set current [format %.2f [expr $current / 1024]] 247 | set total [format %.2f [expr $total / 1024]] 248 | set units "KB" 249 | } 250 | if {$total > 1024} { 251 | set current [format %.2f [expr $current / 1024]] 252 | set total [format %.2f [expr $total / 1024]] 253 | set units "MB" 254 | } 255 | if {$total > 1024} { 256 | set current [format %.2f [expr $current / 1024]] 257 | set total [format %.2f [expr $total / 1024]] 258 | set units "GB" 259 | } 260 | if {$total != 0} { 261 | puts "Downloading $current $units of $total $units" 262 | } 263 | } 264 | 265 | proc vmdStoreCopyFiles {origin destination} { 266 | set error none 267 | set list [glob -nocomplain -directory "$origin" *] 268 | foreach item $list { 269 | if {[file isdirectory $item] == 1} { 270 | set newDestination "$destination/[file tail $item]" 271 | if {[file exists "$newDestination"] != 1} { 272 | file mkdir "$newDestination" 273 | } 274 | vmdStoreCopyFiles "$item" "$newDestination" 275 | } else { 276 | catch {file copy -force "$item" "$destination"} debug 277 | #if {$debug != ""} { 278 | # tk_messageBox -title "VMD Store" -icon error -message "The file \"$item\" was not installed/updated. Please, try again or install/update it manually." 279 | # } 280 | } 281 | } 282 | } 283 | --------------------------------------------------------------------------------