Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Add-on download links

edited August 2006 in Vanilla 1.0 Help
Am I the only one who uses wget to download Vanilla add-ons? I'd love to see a redirect and/or mod_rewrite beeing used instead of content-disposition for extension downloads. wget (at least my version) ignores content-disposition. I just wanted to explain how I do it.
  1. Find an extension I want and copy the link from my browser
  2. Replace the action Download with DoDownload, so we get the real file (otherwise, I guess each downloaded extension results in 2 real download stats?)
  3. Download with wget --server-response to figure out the filename
  4. Rename the downloaded index.php?PostBackAction=DoDownload&AddOnID=000 file to xxx found in 3
I've done this for more than 30 times now so I've gotten used to it. It's alright to call me outdated. :)

Comments

  • MarkMark Vanilla Staff
    That's really wierd.

    Here is the function I use to get and deliver the file with PHP. If you know of a better way, please share:

    function SaveAsDialogue($FolderPath, $FileName, $DeleteFile = '0') { $DeleteFile = ForceBool($DeleteFile, 0); if ($FolderPath != '') { if (substr($FolderPath,strlen($FolderPath)-1) != '/') $FolderPath = $FolderPath.'/'; } $FolderPath = $FolderPath.$FileName; header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream'); header('Content-Type: application/download'); header('Content-Disposition: attachment; filename='.$FileName); header('Content-Transfer-Encoding: binary'); readfile($FolderPath); if ($DeleteFile) unlink($FolderPath); die(); }
  • The sad thing is that the only way to get it to work (as I know of) is to redirect the user to an url that looks something like /addons/DoDownload/xxx/$FileName. I guess one could redirect the user to it with header('Location: ..). Another solution would be to directly use /addons/DoDownload/xxx/latest.extension.

    And later take care of it with mod_rewrite. I like the first best since then I would get the real filename downloaded. The latter would mean that I'd get latest.extension as the filename. But it's always nice with easy URIs. So maybe one could do a mix.
  • MarkMark Vanilla Staff
    Hmmmm. The only reason I'm opposed to having the extensions available in a web-accessable directory is that people could link to them directly and I'd lose download tracking. Know what I mean?
This discussion has been closed.