From ec4326381c4ce145d0e5e6b0ea0036feb5fc440b Mon Sep 17 00:00:00 2001 From: Thaddee Tyl Date: Sun, 5 Jan 2014 11:53:19 +0100 Subject: [PATCH] URL format change, to prepare for future possibilities. --- server.js | 2 +- web/index.html | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server.js b/server.js index 22454de..ccd86f1 100644 --- a/server.js +++ b/server.js @@ -19,7 +19,7 @@ function escapeFormat(t) { function sixHex(s) { return /^[0-9a-fA-F]{6}$/.test(s); } -camp.route(/^\/(([^-]|--)+)-(([^-]|--)+)-(([^-]|--)+).(svg|png|gif|jpg|pdf)$/, +camp.route(/^\/:(([^-]|--)+)-(([^-]|--)+)-(([^-]|--)+).(svg|png|gif|jpg|pdf)$/, function(data, match, end, ask) { var subject = escapeFormat(match[1]); var status = escapeFormat(match[3]); diff --git a/web/index.html b/web/index.html index 48a7568..ce9810c 100644 --- a/web/index.html +++ b/web/index.html @@ -29,8 +29,8 @@ h2 { font-variant: small-caps; }

GitHub Badges

- - + +

Ever wanted to have your own GitHub badges?
@@ -41,7 +41,7 @@ Maybe you simply love SVG.
Maybe you fancy a format that uses less than half the bandwidth.

- +

As for me, I wanted a format that people can reuse and hack on.
@@ -49,26 +49,26 @@ I wanted a service for everyone.
I made the GitHub Badge Service.

- +

Here's how it works.
-http://gh-badges.herokuapp.com/<SUBJECT>-<STATUS>-<COLOR>.svg
+http://gh-badges.herokuapp.com/:<SUBJECT>-<STATUS>-<COLOR>.svg
Use two dashes -- to have one dash as text.
Use two underscores __ to have one underscore as text.
Use an underscore _ if you want a space. Or, you know, use a space.

Colors:

- - - - - - - - - + + + + + + + + +

Like This?

@@ -119,7 +119,7 @@ function escapeField(s) { return s.replace(/-/g, '--').replace(/_/g, '__'); } function makeImage() { - var url = '/'; + var url = '/:'; url += escapeField(imageMaker.subject.value); url += '-' + escapeField(imageMaker.status.value); url += '-' + escapeField(imageMaker.color.value);