UniUploader:Advanced
Important note: When you edit this page, you agree to release your contribution into the public domain. |
Contents |
Common Practices
UU is designed to provide basic functionality with minimal settings. The best way to set this up as an administrator is to "preconfigure" UU and then distribute it to Guild Members. This way your users don't have to worry about any of the settings in UU. They can just run the exe and they are ready for action.
There is a drawback to this , which is if you change your profiler interface file (primary URL) location, or preparse/compression/addon updater/etc. settings then you have to redistribute.
Such things as "start with windows" and "auto-launch WoW" you must be careful with because it could anger your users if they don't desire so much automation.
They are good ways to make sure your users have everything running properly and the way you want it to. You could turn on "auto-launch WoW" and instruct your users to just run UU and it will launch WoW, so they can essentially replace any links to the WoW executable, and just use UU to start WoW.
This is a great way to ensure that everyone is up to date.
You can customize UU with your own images.
There are currently 2 images that show in UU, which are logo1.gif and logo2.gif. logo1.gif is displayed in the Settings tab on the right, and logo2.gif is on the about tab. You don't need to have the images there if you want the distrib to be smaller.
If you do wish to equip UU with either or both of the images, here are the requirements:
- the images must be named correctly
- the images must be in the same directory as UU
- the images must be GIF compliant
- the images can have wierd dimensions, but not recommended, logo1.gif 216x144, logo2.gif 320x176
If you have support for GZip compression in your interface file, by all means turn that on.
Using compression is good, it will trim a file such as 5 megabytes down to ~20K, which is phenominal when your talking about uploading all the time.
If you have support for addon updates and/or Website==>WoW communication support in your website, set those up. See Section 4: Addon Updater and Section 5: Website ==> WoW for details about these systems.
Now that you have all that out of the way, all you have to do is set up the Primary Interface URL, which is your website file that recieves the uploads. The setting is in the Settings Tab on the top.
Rezip the ini file, the images (if you opted to include them), and the executable. Upload your package and distribute it to your users.
Basic Setup
The only setting that must be set for UU to perform its basic upload is the Primary URL setting which can be found on the Settings tab. This is the interface file on your website that recieves the SV file uploads. Once this is set, UU will automatically upload on file changes (unless you turned that off). You can set "Additional URL's" in the Options tab.
The additional URL's are basically more websites to upload to. You can set up to 4 additional URL's. the second field in these settings allows you to upload the files with different names for the files.
Note that any data recieved by the additional url's will not show in the server response window, and if you are using compression, SV will be compressed before uploading to any of the additional url's.
If the directory that you are uploading to requires basic HTTP authentication set by a .htaccess file, then fill in the settings for HTTP Credentials, found in the Options tab. If you have some other sort of authentication system then you will need to fill in the "additional variables" fields. Replace "arg1" with "username" (this is the name of the variable), and "value1" with the actual username. Use the same method for the password. You can use the "additional variables" for other things such as keeping track of which distrib the user is using.
Compression
To use compression, your interface file(s) must support it. here is a portion of example PHP code as a function:
function GetUploadedLocalFilename() { global $filefield, $_FILES; //filefield is the name of the file array uploaded if (isset($_FILES[$filefield])) { if (substr_count($_FILES[$filefield]['name'],".gz") > 0) { $filename = $_FILES[$filefield]['tmp_name']; $tempHandle = gzopen($filename, "r"); //uncompress $contents = fread($tempHandle,5000000); //read up to 5 megs (no way to see total uncompressed length :( ) fclose($tempHandle); $tmpfname = tempnam("","luatemp"); //create temp file for uncompressed data $handle = fopen($tmpfname, "w"); fwrite($handle, $contents); //write the uncompressed temp file fclose($handle); return $tmpfname; //return the filename (with full path) } else { return $_FILES[$filefield]['tmp_name']; } } else { return ""; } }
Addon Updater
This system is a little tricky, because the updater interface must be set up in a way that it can respond to all of UU's operations. Here is how it works: UU sends a request to the interface, OPERATION = GETADDONLIST , the interface file must respond with ONLY the xml file which is formatted as follows (example):
<addons> <addon name="CharacterProfiler" version="0.97" toc="11000" required="1" > <file name="CharacterProfiler.lua" md5sum="d64d775f5015b16390034ef72688b632" /> <file name="CharacterProfiler.toc" md5sum="255417db5329ad7a88e8fd1cbd997149" /> <file name="CharacterProfiler.xml" md5sum="287a42a55384dad5f10cbf8f92b36bd4" /> </addon> <addon name="guildextract" version="0.0.0" toc="11000" required="0"> <file name="Guildextract.xml" md5sum="0ceddad51783ed35bf4d53f353729f3b" /> <file name="guildextract.lua" md5sum="95b1a7fcd0926c3c439cdb0215dea45b" /> <file name="guildextract.toc" md5sum="b96c0c500e1cce8f898dd283bdbe1588" /> </addon> </addons>
UU then checks to see if the user has the addons installed, and if so, checks the md5sum of the files on the user's hard drive matches that from the xml data. If any of the files from a particular addon are outdated (md5's dont match), that addon's download URL is then requested like this:
- UU sends a request to the interface with 2 variables set, variable 1: OPERATION = GETADDON , variable 2: ADDON = "AddonName" where AddonName is the name of the folder that should be in the InterfaceAddOns folder, and is the same name used in the xml file.
- The interface file returns something like eg. http://somewhere.com/updater/AbcWoWMod.zip
The zip file must have the following directory structure: Interface/AddOns/AbcWoWMod/ with the parent folders included with the zip. UU then downloads the URL location (the zip file) , unzips it, and moves it to the correct wow addons directory.
The interface file must keep a current database with each md5sum of the addon's files, the names of the addons, and the location of the zip download. If the database and the zip files don't match you will have many problems, there is a possibility of UU trying to update the affected addon's every time, or returning an error.
The interface file can be integrated with the main interface by using something like a PHP case() function for the _REQUEST['OPERATION']. The Section 5: Website ==> WoW system also sends a similar request to the interface.
Website ==> WoW
This system provides a way for data from a website to be inserted into the SV file for use in WoW Mod's, essentially making it possible to run Full-Duplex (WoW (==) Website) WoW Addons.
You can find the settings for this sytem in the Advanced tab in the middle. UU first reads the data from the URL, then appends the data to the bottom of the specified SV file exactly as recieved from the URL. After the data from the website has been appended into the SV file, WoW Addon's can use the data. When logging out of WoW, if 1 or more addons have RegisterForSave set for the data, then it will remain in the SV file. There should never be more than 1 copy of the same variable in the SV file if the upload button is'nt pressed manually. If there are more than 1 of the same variable/data in the SV file, the addons will use the last (latest) copy of the variable/data. UniUploader will retrieve and append the data every time the upload button is pressed and (if option is set) when changes in the SV file are detected.
Upload Data Info
When UU uploads files, a few extra post variables are passed:
- the size of the uncompressed files are sent as integers, (# of bytes), only if gzip is turned on. For every checked SV, there will be a POST variable sent like this:
- usize_ + name of checked SV = # of bytes
- so if it were uploading a SV called myAddon.lua: usize_myAddon=123456
- usize_ + name of checked SV = # of bytes
- The local time of the computer running UU in both regular and UTC.
- The UU User Agent is passed via the HTTP Header, which also contains the UU Version.
Variable Snapshot
_REQUEST["usize_CharacterProfiler"] 712529 _REQUEST["clientTime"] 2007-08-09T19:06:09Z _REQUEST["clientTimeUTC"] 2007-08-09T23:06:09Z _POST["usize_CharacterProfiler"] 712529 _POST["clientTime"] 2007-08-09T19:06:09Z _POST["clientTimeUTC"] 2007-08-09T23:06:09Z _SERVER["HTTP_USER_AGENT"] UniUploader 2.0 (UU 2.6.7; English) _SERVER["CONTENT_TYPE"] multipart/form-data; boundary=698585d85ac04b7da6e40e52dc73542b _FILES["CharacterProfiler"] Array ( [name] => CharacterProfiler.lua [type] => application/octet-stream [tmp_name] => C:\DOCUME~1\Matt\LOCALS~1\Temp\php\upload\php56.tmp [error] => 0 [size] => 712529 )
Raw Data
This is a reassembled UniUploader TCP data stream with the binary data cut out:
POST /info.php HTTP/1.1 User-Agent: UniUploader 2.0 (UU 2.6.7; English) Content-Type: multipart/form-data; boundary=e62f89ca2c714e0dac26d9c465641710 Accept: application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Content-Length: 110174 Connection: Keep-Alive Host: foolyfrag.com --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="usize_FuBar" 1101 --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="FuBar"; filename="FuBar.lua.gz" Content-Type: application/octet-stream *BINARY DATA REMOVED FOR WIKI* --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="usize_PvPLog" 38319 --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="PvPLog"; filename="PvPLog.lua.gz" Content-Type: application/octet-stream *BINARY DATA REMOVED FOR WIKI* --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="usize_CharacterProfiler" 712529 --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="CharacterProfiler"; filename="CharacterProfiler.lua.gz" Content-Type: application/octet-stream *BINARY DATA REMOVED FOR WIKI* --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="clientTime" 2007-08-09T19:28:20Z --e62f89ca2c714e0dac26d9c465641710 Content-Disposition: form-data; name="clientTimeUTC" 2007-08-09T23:28:20Z --e62f89ca2c714e0dac26d9c465641710--