Browse Source

added additional_links config

master
mortie 7 years ago
parent
commit
81390e4673
6 changed files with 49 additions and 4 deletions
  1. 11
    2
      README.md
  2. 2
    1
      conf.json.example
  3. 4
    0
      server.js
  4. 1
    0
      web/index.html
  5. 18
    0
      web/script.js
  6. 13
    1
      web/style.css

+ 11
- 2
README.md View File

@@ -75,6 +75,15 @@ install it through pip (installing pip if necessary)
`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/ )
}

+ 2
- 1
conf.json.example View File

@@ -1,4 +1,5 @@
{
"tmpdir": "tmp",
"subtitles": "en"
"subtitles": "en",
"additional_links": []
}

+ 4
- 0
server.js View File

@@ -62,3 +62,7 @@ app.post("/play/file", (req, res) => {
});
});
});

app.get("/additional-links", (req, res) => {
res.json(conf.additional_links);
});

+ 1
- 0
web/index.html View File

@@ -28,5 +28,6 @@
</div>

<script src="/webstuff.js"></script>
<script src="/script.js"></script>
</body>
</html>

+ 18
- 0
web/script.js View File

@@ -0,0 +1,18 @@
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);
});
});

+ 13
- 1
web/style.css View File

@@ -21,12 +21,24 @@
#parts .part input {
width: calc(100% - 80px);
}
#parts .part input[type=url],
#parts .part input[type=text] {
padding-left: 6px;
}

#parts .part button {
width: 75px;
float: right;
}

#parts .part button.link {
width: 100%;
height: 42px;
float: none;
}

#parts .part input,
#parts .part button {
height: 28px;
height: 34px;
line-height: 0px;
}

Loading…
Cancel
Save