Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
generateur-slogans
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LQDN Adminsys
generateur-slogans
Commits
67910cb4
Verified
Commit
67910cb4
authored
Oct 24, 2017
by
Thibaut Broggi
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make social network share work without javascript
parent
591290c2
Pipeline
#1447
passed with stage
in 37 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
235 additions
and
216 deletions
+235
-216
srv.js
srv.js
+16
-0
static/style.css
static/style.css
+4
-3
views/index.ejs
views/index.ejs
+215
-213
No files found.
srv.js
View file @
67910cb4
#!/usr/bin/env node
const
fs
=
require
(
'
fs
'
);
const
querystring
=
require
(
'
querystring
'
);
const
express
=
require
(
'
express
'
);
const
Canvas
=
require
(
'
canvas
'
);
const
Image
=
Canvas
.
Image
;
...
...
@@ -32,7 +33,22 @@ for (let i in fonts) {
}
Canvas
.
registerFont
(
'
./static/fonts/FiraSans-Bold.otf
'
,
{
family
:
'
FiraSans
'
,
weight
:
'
bold
'
});
function
buildUrl
(
req
)
{
delete
req
.
query
.
target
;
return
encodeURIComponent
(
req
.
protocol
+
'
://
'
+
req
.
headers
.
host
+
'
/
'
+
(
config
.
subdir
||
''
)
+
'
?
'
+
querystring
.
stringify
(
req
.
query
));
}
app
.
get
(
'
/generate.png
'
,
function
(
req
,
res
)
{
if
(
req
.
query
.
target
===
'
facebook
'
)
{
return
res
.
redirect
(
'
https://www.facebook.com/sharer/sharer.php?u=
'
+
buildUrl
(
req
));
}
else
if
(
req
.
query
.
target
===
'
twitter
'
)
{
return
res
.
redirect
(
'
https://twitter.com/intent/tweet?text=Soutenez La Quadrature du Net !
'
+
buildUrl
(
req
));
}
let
bgColor
=
req
.
query
[
'
bg-color
'
]
||
'
#f54358
'
;
let
fgColor
=
req
.
query
[
'
fg-color
'
]
||
'
#ffd201
'
;
let
fillText
=
req
.
query
.
text
?
req
.
query
.
text
.
trim
()
:
'
démocratie
'
;
...
...
static/style.css
View file @
67910cb4
...
...
@@ -6,10 +6,11 @@ html {
box-sizing
:
inherit
;
}
body
{
body
,
form
{
margin
:
auto
;
color
:
#497ed5
;
min-height
:
100vh
;
max-width
:
100%
;
font-family
:
'FiraSans'
;
background-color
:
#ebf3ff
;
}
...
...
@@ -213,7 +214,7 @@ div.navButtons {
margin-top
:
2em
;
}
body
{
body
,
form
{
display
:
flex
;
flex-direction
:
row
;
}
...
...
@@ -223,7 +224,7 @@ body {
display
:
none
;
}
body
{
body
,
form
{
flex-direction
:
column
;
}
...
...
views/index.ejs
View file @
67910cb4
This diff is collapsed.
Click to expand it.
Thibaut Broggi
@Erneraude
mentioned in issue
#9 (closed)
·
Oct 24, 2017
mentioned in issue
#9 (closed)
mentioned in issue #9
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment