218 auto downloads rFCmp files now

Discussion in 'General Discussion' started by Noel Hibbard, May 21, 2013.

  1. BrokkelPiloot

    BrokkelPiloot Registered

    Joined:
    May 19, 2012
    Messages:
    188
    Likes Received:
    1
    HTTPS and license agreement checkmark :( Too bad.
     
  2. Christian Rosén

    Christian Rosén Registered

    Joined:
    Feb 7, 2012
    Messages:
    137
    Likes Received:
    1
    LOL
     
  3. BrokkelPiloot

    BrokkelPiloot Registered

    Joined:
    May 19, 2012
    Messages:
    188
    Likes Received:
    1
    Maybe there will be support for torrent files in the future :p?
     
  4. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Here is a revised getmod.php that supports Skydrive. You can suply my function with a short or long Skydrive share link and it will parse the HTML to find the raw download link. But I just realized I forgot to string replace the HTTPS with HTTP but it still worked. Hahaha.. Maybe rF2's client supports HTTPS after all. I am so lost now. The good news is this PHP file will work with Skydrive which isn't a bad way to host for now.

    Code:
    <?php
    	if (isset($_GET['sig']))
    	{
    		switch($_GET['sig'])
    		{
    			// Put the SubmitID for your rfcmp file here
    			case "839bf08a397e2b96b928524c57829d2a221e21b68338b19b1c7c44ed682e7e44":
    				// Put the short or long Skydrive URL here
    				header('Location: '.skydrive_direct('http://sdrv.ms/10icgK3'),TRUE,302);
    				break;
    			default:
    				echo "Unknown SIG";
    		}
    	}
    	else
    	{
    		echo "Missing SIG";	
    	}
    	
    	function skydrive_direct($skydrivelink)
    	{
    		$file = file_get_contents($skydrivelink);
    		$pos = strpos($file,'content="2;url=');
    		$pos += strlen('content="2;url=');
    		$buffer = "";
    		while(substr($file,$pos,1) != '"') {
    			$buffer .= substr($file,$pos,1);
    			$pos++;
    		}
    		$file = file_get_contents(html_entity_decode($buffer));
    		
    		$pos = strpos($file,'{"download":"');
    		$pos += strlen('{"download":"');
    		$buffer = "";
    		while(substr($file,$pos,1) != '"') {
    			$buffer .= substr($file,$pos,1);
    			$pos++;
    		}
    		return str_replace('\\', '', html_entity_decode($buffer));
    	}
    ?>
    
    I just added some comments. The code is rather simple though. Just throw this PHP file on any server you have access to that supports PHP and then add the URL to your rfcmp file. For example, put this in your rfcmp http://www.testserver.com/getmod.php

    rF2 automatically adds the submit id to the URL.
     
    Last edited by a moderator: May 21, 2013
  5. Banger

    Banger Registered

    Joined:
    Oct 26, 2011
    Messages:
    271
    Likes Received:
    0
    how about filedropper.com (5gb max file), no adverts,no countdown timers.
     
  6. Jonathon LeFaive

    Jonathon LeFaive Registered

    Joined:
    Jan 11, 2012
    Messages:
    70
    Likes Received:
    0
    HTTPS is currently unsupported for component downloads, but will be in the future.

    There is a maximum of one redirect per download request. For the sake of preventing infinite loops, there will always be a limit, but that limit will likely increase to something more flexible in later builds.
     
  7. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Well in my tests HTTPS is working. The URL in my rfcmp is HTTP but that URL redirects to a Skydrive URL which uses HTTPS. I made sure all the rfcmps were uninstalled and deleted from the Packages directory and did a fresh test. It grabbed the vmod, listed the missing stuff, it then downloaded the missing stuff and then joined.

    I think Dropbox fails because of the redirect limit that is set. It looks like Dropbox is redirecting twice plus the first redirect that I did with my getmod.php.
     
  8. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    I just looked at Filedropper. It will not work because it requires users intervention. The link takes you to a page where you then have to click download, then you have to type in a captcha. rF2 needs raw download links.
     
  9. dodswm

    dodswm Registered

    Joined:
    Feb 18, 2012
    Messages:
    25
    Likes Received:
    1
    Mega has an API that you can use to generate download links of public files (this could be integrated with getmod.php i'm sure), but they use HTTPS.

    There are very few free file hosts that require no interaction to download though, plus a lot will redirect users to a verification page (usually a CAPTCHA of some sort) if a file is being downloaded a lot, or being hotlinked.
     
  10. Jeremy Miller

    Jeremy Miller Former ISI Senior Programmer

    Joined:
    Oct 5, 2010
    Messages:
    276
    Likes Received:
    3
    Personally, I am kinda shocked HTTPS works at all. We are not going to support, in the near term, anything beyond standard HTTP/S. If a particular hosting sites is doing something funky well that is not really our fault. I personally would like to FTP but we do not really have to much demand for that right now.
     
  11. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Yeah, Skydrive may do this too if they get too many hits. So far in testing I have probably downloaded my 5MB skin rfcmp about 100 times and it hasn't stopped working.

    I have a simple proof of concept up and running now. The sigs and urls are stored in a database.

    If anyone wants to test with their own rfcmp, just add this URL when you package the rfcmp and then give me the submitid and the download URL for the rfcmp and I will add it to the database. Next up I will build a real simple front and so people can add their own redirects. Also need a way to password protect sigs so that only the author can come back later to make changes to that sig later on.

    http://rfcmpredir.site90.net/getmod.php
     
  12. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    I agree, building work arounds for all the crazy junk people do with their hosting sites could be a full time job. What it built in right now works fine.... other than maybe allowing a few more redirects.
     
  13. Jonathon LeFaive

    Jonathon LeFaive Registered

    Joined:
    Jan 11, 2012
    Messages:
    70
    Likes Received:
    0
    The "scheme name" part of the url (HTTP/HTTPS) is being ignored until SSL support is added. It's common for web servers that listen on port 443 (https) to also serve the same resources on port 80 (http). You can verify this by including the port number in the component URL. Using "https://SkyDrive.com:443/path-to-your/getmod.php" should fail with the current build.
     
  14. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Ah.. that explains it. Skydrive does listen to HTTP also which is why I picked it. Thanks for the explanation.
     
  15. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    My only request now would be a progress bar for the rFcmp files. :)
     
  16. canastos

    canastos Registered

    Joined:
    Dec 23, 2011
    Messages:
    483
    Likes Received:
    2
    Awesome investigation, Noel!!

    You are really mastering rFactor2 :)
    Now if would be fine if creator's content would be packed as components, so admins could use this new feature

    byyyyyyyye
     
  17. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    Very ugly but gets the job done.

    To add a mod use this link:
    http://rfcmpredir.site90.net/addmod.php

    The description isn't really used anywhere right now, so it really doesn't matter what you put there. I have been using the rfcmp name. Example Sebring_Virtua_LM v1.90.

    To lookup an existing mod to make changes to the description or URL, use this link:
    http://rfcmpredir.site90.net/lookupmod.php

    I am storing the passwords as MD5 hashes in the database so they should be secure, but if you don't trust it, don't use any password you would use for anything important. Also, don't forget the password or else you will not be able to change the URL later.

    And of course the URL you want to use in your rfcmp is:
    http://rfcmpredir.site90.net/getmod.php

    Have fun.
     
  18. Aleksi Elomaa

    Aleksi Elomaa Registered

    Joined:
    Oct 5, 2010
    Messages:
    62
    Likes Received:
    2
    GJ Noel, now just gotta hope that modders start to use this feature, will help a ton with joining races etc.
     
  19. 88mphTim

    88mphTim racesimcentral.net

    Joined:
    Sep 23, 2010
    Messages:
    10,840
    Likes Received:
    314
    A dropbox link is a login and forwarding link, I believe, not a direct download. That's how they can block you when they decide you've used too much bandwidth, but the link itself still works for the uploader when logged in.
     
  20. Noel Hibbard

    Noel Hibbard Registered

    Joined:
    Oct 5, 2010
    Messages:
    2,744
    Likes Received:
    40
    You don't have to be logged into DB for the direct links to work or even have an account for that matter.
     

Share This Page