update other share option
parent
d4598d76c0
commit
c2d927788a
|
|
@ -25,12 +25,13 @@ router.get("/:shareCode",function(req,res){
|
|||
case "e":
|
||||
return getEvent(req,res,param);
|
||||
case "o":
|
||||
return getOther(req, res)
|
||||
return getOther(req, res, param)
|
||||
}
|
||||
});
|
||||
|
||||
function getOther(req, res,) {
|
||||
console.log(req.headers);
|
||||
function getOther(req, res, param) {
|
||||
param = decodeURIComponent(param);
|
||||
var params = JSON.parse(param);
|
||||
var userAgent = req.headers['user-agent'];
|
||||
var userAgentOverride = req.headers['user-agent-override'];
|
||||
var referrer = req.headers['referer'] || "";
|
||||
|
|
@ -39,9 +40,9 @@ function getOther(req, res,) {
|
|||
userAgent === 'Facebot' ||
|
||||
userAgent.startsWith('Twitterbot') ||
|
||||
referrer.startsWith('http://opengraphcheck.com')) {
|
||||
getOtherMeta(req, res, req.query.title, req.query.description, req.query.imageUrl, req.query.imageWidth, req.query.imageHeight, req.query.url);
|
||||
getOtherMeta(req, res, params.title, params.description, params.imageUrl, params.imageWidth, params.imageHeight, params.url);
|
||||
} else {
|
||||
var url = req.query.url;
|
||||
var url = params.url || (req.protocol + "://" + req.hostname);
|
||||
res.redirect(url);
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +65,8 @@ function getSermon(req, res, id){
|
|||
}
|
||||
|
||||
function getOtherMeta(req, res, title, description, imageUrl, imageWidth, imageHeight, url) {
|
||||
imageWidth = imageWidth || 200;
|
||||
imageHeight = imageHeight || 200;
|
||||
var result = `<html>
|
||||
<head>
|
||||
<title>Old Fashion Baptist Church</title>
|
||||
|
|
@ -74,8 +77,8 @@ function getOtherMeta(req, res, title, description, imageUrl, imageWidth, imageH
|
|||
<meta property="og:title" content="` + title + `" />
|
||||
<meta property="og:description" content="` + description + `" />
|
||||
<meta property="og:image" content="` + imageUrl + `" />
|
||||
<meta property="og:image:width" content="`+ imageWidth || '200' +`" />
|
||||
<meta property="og:image:height" content="`+ imageHeight || '200' +`" />
|
||||
<meta property="og:image:width" content="`+ imageWidth +`" />
|
||||
<meta property="og:image:height" content="`+ imageHeight +`" />
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue