This repository has been archived by the owner on Jul 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
100 lines (75 loc) · 1.75 KB
/
app.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const express = require("express");
//SETTINGS
const port = 3000;
const links =
[
{
name: "Digitales Register",
icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Flat_tick_icon.svg/1200px-Flat_tick_icon.svg.png",
url: "https://tfobz.digitalesregister.it"
},
{
name: "Moodle",
icon: "",
url: "https://moodle.tfobz.net"
},
{
name: "Schulbar",
icon: "",
url: "https://www.schulbar.it"
},
{
name: "Mail",
icon: "",
url: "https://mail.tfobz.net/login.php",
useIFrame: true
},
{
name: "Schulwebseit",
icon: "",
url: "http://tfobz.it",
useIFrame: true
},
{
name: "Dokumente für den Schulbetrieb",
icon: "",
url: "https://dokumente.tfobz.net",
useIFrame: true
},
{
name: "Räume",
icon: "",
url: "https://mrbs.tfobz.net",
useIFrame: true
},
{
name: "Test",
icon: "",
url: "http://localhost:10000",
useIFrame: true
}
]
const app = express();
app.set('view engine', 'ejs');
app.use(express.static("public"));
app.use(setDefaultValues);
app.get('/', (req, res) => {
res.render('index');
});
app.get("/offline", (req, res) => {
res.render('offline');
});
app.get('/:id/site', (req, res) => {
let siteID = req.params.id;
let selected = links[siteID];
selected['id'] = siteID;
res.render('site', {selected: selected});
});
app.listen(port, () => {
console.log(`Express listening at port ${port}`);
});
function setDefaultValues(req, res, next) {
res.locals.url = "http://" + req.get("host");
res.locals.links = links;
next();
}