i2psnark HTML5 minor cleanups

This commit is contained in:
zzz
2019-12-02 15:01:23 +00:00
parent 2bb94bea80
commit 11d89e248e
2 changed files with 11 additions and 11 deletions

View File

@ -3349,16 +3349,16 @@ public class I2PSnarkServlet extends BasicServlet {
if (storage != null && storage.complete()) { if (storage != null && storage.complete()) {
String mime = getMimeType(r.getName()); String mime = getMimeType(r.getName());
boolean isAudio = mime != null && isAudio(mime); boolean isAudio = mime != null && isAudio(mime);
boolean isVideo = mime != null && isVideo(mime); boolean isVideo = !isAudio && mime != null && isVideo(mime);
if (isAudio || isVideo) { if (isAudio || isVideo) {
// HTML5 // HTML5
if (isAudio) if (isAudio)
buf.append("<audio controls>"); buf.append("<audio");
else else
buf.append("<video controls>"); buf.append("<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("<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
@ -3551,14 +3551,14 @@ public class I2PSnarkServlet extends BasicServlet {
buf.append("<td class=\"snarkFileIcon\">"); buf.append("<td class=\"snarkFileIcon\">");
if (complete) { if (complete) {
isAudio = isAudio(mime); isAudio = isAudio(mime);
isVideo = isVideo(mime); isVideo = !isAudio && isVideo(mime);
if (isAudio || isVideo) { if (isAudio || isVideo) {
// HTML5 // HTML5
if (isAudio) if (isAudio)
buf.append("<audio controls>"); buf.append("<audio");
else else
buf.append("<video controls>"); buf.append("<video");
buf.append("<source src=\"").append(path).append("\" type=\"").append(mime).append("\">"); buf.append(" controls><source src=\"").append(path).append("\" type=\"").append(mime).append("\">");
} }
buf.append("<a href=\"").append(path).append("\">"); buf.append("<a href=\"").append(path).append("\">");
if (mime.startsWith("image/")) { if (mime.startsWith("image/")) {
@ -3703,7 +3703,7 @@ public class I2PSnarkServlet extends BasicServlet {
continue; continue;
String name = fai.file.getName(); String name = fai.file.getName();
String mime = getMimeType(name); String mime = getMimeType(name);
if (mime != null && (mime.startsWith("audio/") || mime.equals("application/ogg"))) if (mime != null && isAudio(mime))
return true; return true;
} }
return false; return false;
@ -3810,7 +3810,7 @@ public class I2PSnarkServlet extends BasicServlet {
continue; continue;
String name = fai.file.getName(); String name = fai.file.getName();
String mime = getMimeType(name); String mime = getMimeType(name);
if (mime != null && (mime.startsWith("audio/") || mime.equals("application/ogg"))) { if (mime != null && isAudio(mime)) {
// TODO Extended M3U // TODO Extended M3U
buf.append(reqURL).append(encodePath(name)).append('\n'); buf.append(reqURL).append(encodePath(name)).append('\n');
} }

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 0; public final static long BUILD = 1;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";