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