Commit 0a9f5ad7 authored by Thibaut Broggi's avatar Thibaut Broggi

Update tweet content

       It now contains the localized image signature as text
parent d220c33e
Pipeline #1491 passed with stage
in 1 minute and 9 seconds
......@@ -83,6 +83,15 @@ function buildUrl(req) {
+ querystring.stringify(req.args);
}
function tweetMessage(req) {
let _ = req.i18n._;
return (req.args.signature ? _('Faites comme ') + req.args.signature + ', s' : 'S')
+ _('outenez ')
+ 'La Quadrature du Net ! '
+ encodeURIComponent(buildUrl(req)) ;
}
app.get('/generate.png', function (req, res) {
let _ = req.i18n._;
......@@ -90,7 +99,7 @@ app.get('/generate.png', function (req, res) {
return res.redirect('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(buildUrl(req)));
}
else if (req.query.target === 'twitter') {
return res.redirect('https://twitter.com/intent/tweet?text=Soutenez La Quadrature du Net ! ' + encodeURIComponent(buildUrl(req)));
return res.redirect('https://twitter.com/intent/tweet?text=' + tweetMessage(req));
}
else if (req.query.target === 'download') {
res.set("Content-Disposition", "attachment;filename=lqdn_slogan.png");
......@@ -121,7 +130,7 @@ app.get('/generate.png', function (req, res) {
// Add footer
ctx.fillStyle = 'white';
ctx.fillRect(0, height * 0.84, width, height * 0.16);
ctx.fillRect(0, height * 0.85 - 1, width, height * 0.15 + 1);
ctx.fill();
ctx.font = '12pt FiraSans';
ctx.fillStyle = '#497ed5';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment