webtorrent updates, minor changes
This commit is contained in:
parent
e5e8d389f7
commit
2a1568e205
6 changed files with 32 additions and 23 deletions
|
@ -6,18 +6,16 @@
|
|||
<body>
|
||||
{{partial "header" .}}
|
||||
<main>
|
||||
<article>
|
||||
{{if .Content}}
|
||||
<section>
|
||||
{{if .Content}}
|
||||
{{.Content}}
|
||||
</section>
|
||||
{{end}}
|
||||
{{ if .Pages }}
|
||||
{{range .Pages}}
|
||||
{{partial "item" .}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
{{partial "footer" .}}
|
||||
</body>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<meta property="og:image" content="{{.Site.BaseURL}}media/{{.Params.image}}">
|
||||
<meta property="twitter:image" content="{{.Site.BaseURL}}media/{{.Params.image}}">
|
||||
{{else}}
|
||||
<meta property="og:image" content="{{.Site.BaseURL}}logo.png">
|
||||
<meta property="twitter:image" content="{{.Site.BaseURL}}logo.png">
|
||||
<meta property="og:image" content="{{.Site.BaseURL}}logo.webp">
|
||||
<meta property="twitter:image" content="{{.Site.BaseURL}}logo.webp">
|
||||
{{end}}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{{if .Params.image}}
|
||||
<img src="{{.Site.BaseURL}}{{.Params.image}}">
|
||||
{{else}}
|
||||
<img src="{{.Site.BaseURL}}/res/default.png">
|
||||
<img src="{{.Site.BaseURL}}{{.Site.Params.default_img}}">
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
|
@ -16,18 +16,23 @@
|
|||
<div id="wtmedia">
|
||||
</div>
|
||||
<div>
|
||||
Peers:<span id="Peers"></span>
|
||||
<span id="torrent-info">Waiting for peers.</span>
|
||||
<span id="torrent-peers"></span>
|
||||
<span id="torrent-progress"></span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function updateData(torrent) {
|
||||
document.getElementById('Peers').text=torrent.numPeers;
|
||||
if (torrent.numPeers > 0) {
|
||||
document.getElementById('torrent-info').innerHTML="This video is being served with webtorrent";
|
||||
document.getElementById('torrent-peers').innerHTML="Peers:"+torrent.numPeers;
|
||||
}
|
||||
}
|
||||
const client = new WebTorrent();
|
||||
const magnetURI = {{.Get "magnet"}};
|
||||
client.add(magnetURI, function (torrent) {
|
||||
const magnetURI = "{{.Get "magnet"}}";
|
||||
torrent = client.add(magnetURI, function (torrent) {
|
||||
// Got torrent metadata!
|
||||
torrent.addWebSeed({{.Get "source"}});
|
||||
torrent.addWebSeed("{{.Get "source"}}");
|
||||
console.log("Torrent Peers: "+torrent.numPeers);
|
||||
console.log('Client is downloading:', torrent.infoHash);
|
||||
torrent.files.forEach(function (file) {
|
||||
|
@ -35,6 +40,7 @@
|
|||
// more. Specify a container element (CSS selector or reference to DOM node).
|
||||
file.appendTo('#wtmedia');
|
||||
})
|
||||
window.setInterval
|
||||
|
||||
});
|
||||
window.setInterval(updateData,250,torrent);
|
||||
</script>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## A hugo Theme
|
||||
|
||||
![](https://gabe.rocks/themes/valor//media/freedom.png)
|
||||
![](https://gabe.rocks/themes/valor//media/freedom.webp)
|
||||
|
||||
### Check out the demo & documentation [here](https://gabe.rocks/themes/freedom/)
|
||||
|
||||
|
|
|
@ -93,21 +93,23 @@ main{
|
|||
justify-content: flex-start;
|
||||
}
|
||||
.listing *{
|
||||
margin:0;
|
||||
margin:5px;
|
||||
}
|
||||
.listing-text{
|
||||
width:80%;
|
||||
max-width:40rem;
|
||||
padding:1rem;
|
||||
font-size:1.25rem;
|
||||
}
|
||||
.listing img,
|
||||
.listing video{
|
||||
width:25rem;
|
||||
max-width:25vw;
|
||||
max-height: 25vh;
|
||||
}
|
||||
.listing h2, .listing p{
|
||||
margin:0;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,12 +210,12 @@ h2{
|
|||
article {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
padding: 1.5rem;
|
||||
padding: 0.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-family:Verdana, Geneva, Tahoma, sans-serif;
|
||||
max-width:80rem;
|
||||
max-width:60rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,7 @@ video{
|
|||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
padding:1.5%;
|
||||
justify-content: center;
|
||||
justify-content: left;
|
||||
text-decoration: none;
|
||||
text-align: left;
|
||||
width:80%;
|
||||
|
@ -306,7 +308,7 @@ video{
|
|||
margin:1rem;
|
||||
}
|
||||
.link-preview>img{
|
||||
max-width: 20%;
|
||||
max-width: 20rem;
|
||||
}
|
||||
.link-preview>div>p{
|
||||
text-decoration: none !important;
|
||||
|
@ -436,6 +438,7 @@ video{
|
|||
main{
|
||||
flex-direction: column-reverse;
|
||||
align-items: center;
|
||||
width:100vw;
|
||||
|
||||
}
|
||||
.recent,.featured{
|
||||
|
@ -448,6 +451,8 @@ video{
|
|||
width:unset;
|
||||
max-width: 100%;
|
||||
height:25vh;
|
||||
padding-left:2vw;
|
||||
padding-right:2vw;
|
||||
}
|
||||
.recent img,
|
||||
.featured img,
|
||||
|
|
Loading…
Reference in a new issue