No dynamically redirecting URLs anymore for downloads #34

Open
PragTob opened this Issue May 24, 2013 · 10 comments

5 participants

@PragTob
Shoes member

Hi everyone,

since the move to github pages we don't have dynamically redirecting URLs anymore.

The question is: can we fix that somehow?

Shoes on!
Tobi

@steveklabnik
Shoes member

Jekyll doesn't have support for this, I don't think.

@jamesaanderson

What about using JS routing like in Backbone.js? Davis.js?

@steveklabnik
Shoes member

That doesn't help.

We need shoesrb.com/download/mac to redirect to s3. JS can't do that, that I know of.

@jamesaanderson

I haven't used Davis.js but by looking at their example wouldn't the following work?

var app = Davis(function () {
  this.get('/download/:os', function (req) {
    if (req.params['os'] == 'mac') {
      window.location.replace(...)
    }
    else {
      ...
    }
  })
})

app.start()
@wasnotrice
Shoes member
@jamesaanderson

See http://en.wikipedia.org/wiki/Meta_refresh#Usability. It does seem like the best option though.

@PragTob
Shoes member

if we do it/try it we would still have to make that it works without JavaScript. I'm a noscript user and I want the basic functionality of shoesrb.com to be available without JS :-)

@wasnotrice
Shoes member

Uses for these download URLs:

  • folks browsing the shoes site for a shoes download
  • other sites wanting to promote shoes, by linking to downloads
  • shoes itself, so that it can download and/or update itself

This last one has always been the trickiest one. In Shoes 3, there is an option to package a Shoes app without Shoes. It comes with a small stub that only knows how to download and install the latest version of Shoes. It does not know how to navigate links or javascript. Actually, if I remember correctly, the stub hits a particular URL, which returns a text/plain string. That string is the URL for the download. I don't know if Shoes 4 will have this same kind of stub installer, but it seems prudent to think about this use case. We want to have a stable URL that can (somehow) direct clients to the real current URL.

@JesseHerrick

Idea! GitHub has a releases API. So we could implement it several ways. None of which, unfortunately, will work outside of the browser.

The Meta Refresh/JavaScript Way

<!DOCTYPE html>
<html>
  <head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script>
    $.getJSON('https://api.github.com/repos/shoes/shoes/releases', function(data) {
      release = data[0].tarball_url;
      $('head').append('<META http-equiv="refresh" content="0;URL=' + release + '">');
    });
    </script>
    <title>Latest Shoes Release</title>
  </head>
  <body>

  </body>
</html>

This will have jQuery append a meta refresh/redirect to the head, which will in turn download the tarball.

The JavaScript Only Way Just pretend this is in the head of the same document.

$.getJSON('https://api.github.com/repos/shoes/shoes/releases', function(data) {
  release = data[0].tarball_url;
  window.location.href = release;
});

Let me know what you think.

@JesseHerrick

As for OS specific downloads, it really depends on how Shoes releases will released. But I'm sure I can make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment