i2psnark: Limit max size of embedded video

This commit is contained in:
zzz
2020-11-02 11:33:34 +00:00
parent c8605009ba
commit 751af5bcd8
5 changed files with 44 additions and 4 deletions

View File

@ -3439,14 +3439,14 @@ public class I2PSnarkServlet extends BasicServlet {
if (isAudio) if (isAudio)
buf.append("<audio"); buf.append("<audio");
else else
buf.append("<video"); buf.append("<div class=\"video-wrapper\"><video class=\"video\"");
// strip trailing slash // strip trailing slash
String path = base.substring(0, base.length() - 1); String path = base.substring(0, base.length() - 1);
buf.append(" controls><source src=\"").append(path).append("\" type=\"").append(mime).append("\">"); buf.append(" controls><source src=\"").append(path).append("\" type=\"").append(mime).append("\">");
if (isAudio) if (isAudio)
buf.append("</audio>"); buf.append("</audio>");
else else
buf.append("</video>"); buf.append("</video></div>");
} }
} }
if (er || ec) if (er || ec)
@ -3659,7 +3659,7 @@ public class I2PSnarkServlet extends BasicServlet {
if (isAudio) if (isAudio)
buf.append("<audio"); buf.append("<audio");
else else
buf.append("<video"); buf.append("<div class=\"video-wrapper\"><video class=\"video\"");
buf.append(" controls><source src=\"").append(ppath).append("\" type=\"").append(mime).append("\">"); buf.append(" controls><source src=\"").append(ppath).append("\" type=\"").append(mime).append("\">");
} }
buf.append("<a href=\"").append(ppath).append("\">"); buf.append("<a href=\"").append(ppath).append("\">");
@ -3673,7 +3673,7 @@ public class I2PSnarkServlet extends BasicServlet {
if (isAudio) if (isAudio)
buf.append("</audio>"); buf.append("</audio>");
else if (isVideo) else if (isVideo)
buf.append("</video>"); buf.append("</video></div>");
} else { } else {
buf.append(toImg(icon)); buf.append(toImg(icon));
} }

View File

@ -3108,6 +3108,16 @@ th.snarkTorrentStatus a img, .snarkTorrentETA a img, .snarkTrackerDetails a img,
float: left; float: left;
} }
.video-wrapper {
height: 100%;
width: 100%;
}
.video {
max-height: 95vh;
max-width: 80vw;
}
th a img { th a img {
max-height: 16px !important; max-height: 16px !important;
} }

View File

@ -2671,6 +2671,16 @@ a, a:link, th, td, button, input, select, textarea {
margin-right: 3px; margin-right: 3px;
} }
.video-wrapper {
height: 100%;
width: 100%;
}
.video {
max-height: 95vh;
max-width: 80vw;
}
.info_tracker { .info_tracker {
margin: 0 4px 0 2px; margin: 0 4px 0 2px;
padding: 1px 6px 1px 18px; padding: 1px 6px 1px 18px;

View File

@ -818,6 +818,16 @@ _:-ms-lang(x), .snarkTorrents tbody tr:hover, .snarkDirInfo tbody tr:hover {
margin-right: 3px; margin-right: 3px;
} }
.video-wrapper {
height: 100%;
width: 100%;
}
.video {
max-height: 95vh;
max-width: 80vw;
}
#infohash { #infohash {
-moz-user-select: all; -moz-user-select: all;
-webkit-user-select: all; -webkit-user-select: all;

View File

@ -3153,6 +3153,16 @@ th.snarkTorrentStatus a img, .snarkTorrentETA a img, .snarkTrackerDetails a img
padding-bottom: 8px; padding-bottom: 8px;
} }
.video-wrapper {
height: 100%;
width: 100%;
}
.video {
max-height: 95vh;
max-width: 80vw;
}
.snarkFileStatus { .snarkFileStatus {
font-size: 0; font-size: 0;
text-align: center; text-align: center;