Browse Source

Fixed cache so github's camo server doesn't cache it

pull/102/head
jrtechs 4 years ago
parent
commit
22a510b1ef
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      routes/api/index.js

+ 9
- 2
routes/api/index.js View File

@ -31,12 +31,19 @@ function getURL(sqlData)
return "https://jrtechs.net/" + sqlData.category + "/" + sqlData.url; return "https://jrtechs.net/" + sqlData.category + "/" + sqlData.url;
} }
routes.get('/recentSVG.svg', (request, result) =>
/**
* Returns an svg containing the recent blog posts
*
* Used on github profile readme:
* https://github.com/jrtechs
*/
routes.get('/recentSVG', (request, result) =>
{ {
sql.getRecentPosts(4).then((sqlData)=> sql.getRecentPosts(4).then((sqlData)=>
{ {
result.writeHead(200, {'Content-Type': 'image/svg+xml', result.writeHead(200, {'Content-Type': 'image/svg+xml',
'Cache-Control': 'public, max-age=2678400',
'Cache-Control': 'no-cache',
'Vary': 'Accept-Encoding'}); 'Vary': 'Accept-Encoding'});
var res = ` var res = `
<svg width="400" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <svg width="400" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

Loading…
Cancel
Save