-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
61 lines (54 loc) · 1.77 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const nunjucks = require('nunjucks');
const dotenv = require('dotenv');
dotenv.config();
module.exports = async function (req, res) {
if(process.env.REDIRECT!=undefined) {
res.redirect(process.env.REDIRECT);
return;
}
const query = req.query;
if (query.cookies) {
const cookies = JSON.parse(query.cookies);
for (cookieName in cookies) {
res.cookie(cookieName, cookies[cookieName], {});
}
}
nunjucks.configure(__dirname + '/site/templates', { autoescape: true });
const goal = 'show';
const publicId = process.env.PUBLIC_ID;
const primaryColor = '#6f879f';
const textColor = '#3f5f7f';
const backgroundColor = '#ffffff';
const host = process.env.HOST || "https://accounts.groups2.com";
const streamHost = "";
const theme = "light";
const moduleForum = process.env.MODULE_FORUM ||query.module_forum || "off";
const moduleGroups = process.env.MODULE_GROUPS ||query.module_groups ||"off";
const extraHead = "";
let page = query.page;
if (! page) {
return res.send('page parameter is missing');
}
page += '.njk';
res.send(
nunjucks.render(
page,
{
name: 'uxlovers',
goal,
brand: 'Sample Page',
about: 'Sample Page is a sample Grou.ps site.',
public_id: publicId,
primary_color: primaryColor,
text_color: textColor,
background_color: backgroundColor,
host,
theme,
stream_host: streamHost,
module_forum: moduleForum,
module_groups: moduleGroups,
engine: "groupsville"
}
)
);
};