diff --git a/dist/src/mongoose/mongoose.c b/dist/src/mongoose/mongoose.c index 4fedd3a..3f68fb5 100644 --- a/dist/src/mongoose/mongoose.c +++ b/dist/src/mongoose/mongoose.c @@ -6014,7 +6014,6 @@ static const struct { size_t ext_len; const char *mime_type; } mg_static_builtin_mime_types[] = { - MIME_ENTRY("html", "text/html"), MIME_ENTRY("html", "text/html"), MIME_ENTRY("htm", "text/html"), MIME_ENTRY("shtm", "text/html"), @@ -6062,6 +6061,9 @@ static const struct { MIME_ENTRY("asf", "video/x-ms-asf"), MIME_ENTRY("avi", "video/x-msvideo"), MIME_ENTRY("bmp", "image/bmp"), + MIME_ENTRY("woff", "font/woff"), + MIME_ENTRY("woff2", "font/woff2"), + MIME_ENTRY("webmanifest", "application/manifest+json"), {NULL, 0, NULL}}; static struct mg_str mg_get_mime_type(const char *path, const char *dflt, diff --git a/htdocs/assets/MaterialIcons-Regular.ttf b/htdocs/assets/MaterialIcons-Regular.ttf deleted file mode 100644 index 7015564..0000000 Binary files a/htdocs/assets/MaterialIcons-Regular.ttf and /dev/null differ diff --git a/htdocs/css/mympd.css b/htdocs/css/mympd.css index 715c0ca..f2b5fec 100644 --- a/htdocs/css/mympd.css +++ b/htdocs/css/mympd.css @@ -112,9 +112,7 @@ small { font-family: 'Material Icons'; font-style: normal; font-weight: 400; - src: url(/assets/MaterialIcons-Regular.woff2) format('woff2'), - url(/assets/MaterialIcons-Regular.woff) format('woff'), - url(/assets/MaterialIcons-Regular.ttf) format('truetype'); + src: url(/assets/MaterialIcons-Regular.woff2) format('woff2'); } .material-icons { diff --git a/htdocs/index.html b/htdocs/index.html index 251ff1b..515fe60 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -10,10 +10,11 @@ + - - - + + +
diff --git a/htdocs/js/mympd.js b/htdocs/js/mympd.js index 64d2e42..55ad36b 100644 --- a/htdocs/js/mympd.js +++ b/htdocs/js/mympd.js @@ -395,6 +395,20 @@ function showAppInitAlert(text) { } function appInitStart() { + //register serviceworker + if ('serviceWorker' in navigator && document.URL.substring(0, 5) == 'https') { + window.addEventListener('load', function() { + navigator.serviceWorker.register('/sw.min.js', {scope: '/'}).then(function(registration) { + // Registration was successful + console.log('ServiceWorker registration successful with scope: ', registration.scope); + registration.update(); + }, function(err) { + // Registration failed + console.log('ServiceWorker registration failed: ', err); + }); + }); + } + appInited = false; document.getElementsByTagName('header')[0].classList.add('hide'); document.getElementsByTagName('main')[0].classList.add('hide'); @@ -851,18 +865,7 @@ function appInit() { }, false); - if ('serviceWorker' in navigator && document.URL.substring(0, 5) == 'https') { - window.addEventListener('load', function() { - navigator.serviceWorker.register('/sw.min.js', {scope: '/'}).then(function(registration) { - // Registration was successful - console.log('ServiceWorker registration successful with scope: ', registration.scope); - registration.update(); - }, function(err) { - // Registration failed - console.log('ServiceWorker registration failed: ', err); - }); - }); - } + window.addEventListener('beforeinstallprompt', function(event) { // Prevent Chrome 67 and earlier from automatically showing the prompt @@ -1646,9 +1649,9 @@ function setCounter(currentSongId, totalTime, elapsedTime) { domCache.progressBar.value = Math.floor(1000 * elapsedTime / totalTime); var counterText = elapsed_minutes + ":" + - (elapsed_seconds < 10 ? '0' : '') + elapsed_seconds + " / " + + (elapsed_seconds < 10 ? '0' : '') + elapsed_seconds + " / " + total_minutes + ":" + (total_seconds < 10 ? '0' : '') + total_seconds; - domCache.counter.innerText = counterText; + domCache.counter.innerHTML = counterText; //Set playing track in queue view if (lastState) { @@ -1671,7 +1674,7 @@ function setCounter(currentSongId, totalTime, elapsedTime) { if (tr) { var durationTd = tr.querySelector('[data-col=Duration]'); if (durationTd) - durationTd.innerText = counterText; + durationTd.innerHTML = counterText; var posTd = tr.querySelector('[data-col=Pos]'); if (posTd) { if (!posTd.classList.contains('material-icons')) { @@ -3163,8 +3166,10 @@ function notificationsSupported() { } function songChange(obj) { - if (obj.type == 'error' || obj.type == 'result') + if (obj.type != 'song_change') { + console.log(JSON.stringify(obj)); return; + } var curSong = obj.data.Title + obj.data.Artist + obj.data.Album + obj.data.uri + obj.data.currentSongId; if (lastSong == curSong) return; @@ -3172,6 +3177,7 @@ function songChange(obj) { var htmlNotification = ''; var pageTitle = 'myMPD: '; + domCache.currentCover.style.backgroundImage = 'url("' + obj.data.cover + '")'; if (typeof obj.data.Artist != 'undefined' && obj.data.Artist.length > 0 && obj.data.Artist != '-') { diff --git a/htdocs/robots.txt b/htdocs/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/htdocs/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/htdocs/sw.js b/htdocs/sw.js index 77e85b0..c6ff3d2 100644 --- a/htdocs/sw.js +++ b/htdocs/sw.js @@ -15,9 +15,7 @@ var urlsToCache = [ '/assets/coverimage-notavailable.png', '/assets/coverimage-loading.png', '/assets/favicon.ico', - '/assets/MaterialIcons-Regular.ttf', - '/assets/MaterialIcons-Regular.woff', - '/assets/MaterialIcons-Regular.woff2' + '/assets/MaterialIcons-Regular.woff' ]; self.addEventListener('install', function(event) {