commit
cece85f9e7
5 changed files with 28 additions and 20 deletions
|
@ -36,7 +36,7 @@ module.exports = (app) => {
|
|||
const mimetypes = headers['accept'].split(',');
|
||||
if (mimetypes.includes('text/html')) {
|
||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
res.status(200).render('showLite', { fileInfo });
|
||||
res.status(200).render('showLite', { layout: 'show', fileInfo });
|
||||
} else {
|
||||
postToStats('serve', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
serveFile(fileInfo, res);
|
||||
|
@ -67,7 +67,7 @@ module.exports = (app) => {
|
|||
const mimetypes = headers['accept'].split(',');
|
||||
if (mimetypes.includes('text/html')) {
|
||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
res.status(200).render('showLite', { fileInfo });
|
||||
res.status(200).render('showLite', { layout: 'show', fileInfo });
|
||||
} else {
|
||||
postToStats('serve', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
serveFile(fileInfo, res);
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = (app) => {
|
|||
}
|
||||
// serve the file or the show route
|
||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
res.status(200).render('show', { fileInfo });
|
||||
res.status(200).render('show', { layout: 'show', fileInfo });
|
||||
})
|
||||
.catch(error => {
|
||||
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
||||
|
@ -97,7 +97,7 @@ module.exports = (app) => {
|
|||
}
|
||||
// serve the show route
|
||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||
res.status(200).render('show', { fileInfo });
|
||||
res.status(200).render('show', { layout: 'show', fileInfo });
|
||||
})
|
||||
.catch(error => {
|
||||
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
||||
|
|
16
speech.js
16
speech.js
|
@ -72,22 +72,6 @@ const hbs = expressHandlebars.create({
|
|||
return options.inverse(this);
|
||||
}
|
||||
},
|
||||
grouped_each (every, context, options) {
|
||||
let out = '';
|
||||
let subcontext = [];
|
||||
let i;
|
||||
if (context && context.length > 0) {
|
||||
for (i = 0; i < context.length; i++) {
|
||||
if (i > 0 && i % every === 0) {
|
||||
out += options.fn(subcontext);
|
||||
subcontext = [];
|
||||
}
|
||||
subcontext.push(context[i]);
|
||||
}
|
||||
out += options.fn(subcontext);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
},
|
||||
});
|
||||
app.engine('handlebars', hbs.engine);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<title>Spee.ch</title>
|
||||
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
|
||||
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||
{{ twitterCard }}
|
||||
</head>
|
||||
<body>
|
||||
{{{ body }}}
|
||||
|
|
23
views/layouts/show.handlebars
Normal file
23
views/layouts/show.handlebars
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Spee.ch</title>
|
||||
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
|
||||
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||
<!-- twitter card -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@spee.ch">
|
||||
<meta name="twitter:creator" content="@spee.ch">
|
||||
<meta name="twitter:title" content="{{fileInfo.name}}">
|
||||
<meta name="twitter:description" content="An image hosted via Spee.ch">
|
||||
<meta name="twitter:image" content="https://spee.ch/api/streamFile/{{fileInfo.fileName}}">
|
||||
</head>
|
||||
<body>
|
||||
{{{ body }}}
|
||||
<!-- google analytics -->
|
||||
{{ googleAnalytics }}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue