| `conf.json.example` to `conf.json`). These are: | `conf.json.example` to `conf.json`). These are: | ||||
| { | { | ||||
| "tmpdir": String. The directory to store temporary files in. Default: "tmp" | |||||
| "subtitles": String (or false). The language code for the subtitles, or false for no subtitles. Default: "en" (english). | |||||
| "tmpdir": String. The directory to store temporary files in. | |||||
| Default: "tmp" | |||||
| "subtitles": String (or false). The language code for the subtitles, | |||||
| or false for no subtitles. Default: "en" (english). | |||||
| "additional_links": Array of objects which look like this: | |||||
| { "name": "some name", "url": "some URL" } | |||||
| Lets you add more parts to the index page. I use it to link to an | |||||
| instance of guacamole, a web based VNC client. | |||||
| ( https://guacamole.incubator.apache.org/ ) | |||||
| } | } |
| { | { | ||||
| "tmpdir": "tmp", | "tmpdir": "tmp", | ||||
| "subtitles": "en" | |||||
| "subtitles": "en", | |||||
| "additional_links": [] | |||||
| } | } |
| }); | }); | ||||
| }); | }); | ||||
| }); | }); | ||||
| app.get("/additional-links", (req, res) => { | |||||
| res.json(conf.additional_links); | |||||
| }); |
| </div> | </div> | ||||
| <script src="/webstuff.js"></script> | <script src="/webstuff.js"></script> | ||||
| <script src="/script.js"></script> | |||||
| </body> | </body> | ||||
| </html> | </html> |
| get("/additional-links", function(err, res) { | |||||
| if (err) | |||||
| return console.trace(err); | |||||
| JSON.parse(res).forEach(function(link) { | |||||
| var form = document.createElement("form"); | |||||
| form.className = "part"; | |||||
| form.method = "get"; | |||||
| form.action = link.url; | |||||
| var btn = document.createElement("button"); | |||||
| btn.className = "link"; | |||||
| btn.innerHTML = link.name; | |||||
| form.appendChild(btn); | |||||
| $$("#parts").appendChild(form); | |||||
| }); | |||||
| }); |
| #parts .part input { | #parts .part input { | ||||
| width: calc(100% - 80px); | width: calc(100% - 80px); | ||||
| } | } | ||||
| #parts .part input[type=url], | |||||
| #parts .part input[type=text] { | |||||
| padding-left: 6px; | |||||
| } | |||||
| #parts .part button { | #parts .part button { | ||||
| width: 75px; | width: 75px; | ||||
| float: right; | float: right; | ||||
| } | } | ||||
| #parts .part button.link { | |||||
| width: 100%; | |||||
| height: 42px; | |||||
| float: none; | |||||
| } | |||||
| #parts .part input, | #parts .part input, | ||||
| #parts .part button { | #parts .part button { | ||||
| height: 28px; | |||||
| height: 34px; | |||||
| line-height: 0px; | |||||
| } | } |