Dynamic domain on index page code samples

This commit is contained in:
Jake 2014-10-19 20:47:16 -05:00
parent 3762a3f8bc
commit 02e23bcff8
2 changed files with 7 additions and 6 deletions

View File

@ -3,7 +3,7 @@ var router = express.Router();
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'Crafatar' });
res.render('index', { title: 'Crafatar', domain: req.protocol + "://" + req.headers.host });
});

View File

@ -9,27 +9,28 @@ block content
p Welcome to Crafatar, an API for Minecraft's faces!
h2 API
hr
= protocol
p
| Replace
mark.green uuid
| with a Mojang UUID to get the related head.
.well
| <img src="https://skins.jake0oo0.me/avatars/
| <img src="#{domain}/avatars/
mark.green uuid
| ">
p(style="margin-top: 10px;") Example: UUID: '2d5aa9cdaeb049189930461fc9b91cc5', Username: Jake0oo0
.well <img src="https://skins.jake0oo0.me/avatars/2d5aa9cdaeb049189930461fc9b91cc5">
.well <img src="#{domain}/avatars/2d5aa9cdaeb049189930461fc9b91cc5">
p(style="margin-top: 10px;") There is also an option to include a size, default is 180x180px. The size may not be larger than 512px.
.well
| <img src="https://skins.jake0oo0.me/avatars/
| <img src="#{domain}/avatars/
mark.green uuid
| /
mark.green size
| ">
p(style="margin-top: 10px;") Example: UUID: 'ae795aa86327408e92ab25c8a59f3ba1', Size: 250px, Username: redstone_sheep
.well <img src="https://skins.jake0oo0.me/avatars/ae795aa86327408e92ab25c8a59f3ba1/250">
.well <img src="#{domain}/avatars/ae795aa86327408e92ab25c8a59f3ba1/250">
p(style="margin-top: 10px;") By default, a 404 text is returned when the avatar was not found. You can change that to the avatar of steve or alex:
.well <img src="https://skins.jake0oo0.me/avatars/ae795aa86327408e92ab25c8a59f3ba1/250?default=alex">
.well <img src="#{domain}/avatars/ae795aa86327408e92ab25c8a59f3ba1/250?default=alex">
.col-md-2
img(src="/avatars/2d5aa9cdaeb049189930461fc9b91cc5?default=steve", title="Jake0oo0")
img(src="/avatars/ae795aa86327408e92ab25c8a59f3ba1?default=steve", title="redstone_sheep")