Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No dynamically redirecting URLs anymore for downloads #34

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

No dynamically redirecting URLs anymore for downloads #34

PragTob opened this issue May 24, 2013 · 10 comments

Comments

@PragTob
Copy link
Member

PragTob commented May 24, 2013

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
Copy link
Member

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

@jamesaanderson
Copy link
Contributor

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

@steveklabnik
Copy link
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
Copy link
Contributor

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
Copy link
Member

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

var app = Davis(function () {
this.get('/download/mac', function (req) {
window.location.replace(...)
})
})

app.start()

It would work for clients that evaluate javascript, I think. Has anyone used this technique before? (meta tag with refresh of 0)

http://www.w3.org/TR/WCAG20-TECHS/H76.html

Seems what we want, though I don't know if all clients would follow it.

@jamesaanderson
Copy link
Contributor

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

@PragTob
Copy link
Member Author

PragTob commented May 25, 2013

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
Copy link
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
Copy link
Contributor

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
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants