diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index b042e00b..32e0705d 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -201,7 +201,8 @@ class HttpCli(object): if "multipart/form-data" in ctype: return self.handle_post_multipart() - if "text/plain" in ctype: + if "text/plain" in ctype or "application/xml" in ctype: + # TODO this will be intredasting return self.handle_post_json() if "application/octet-stream" in ctype: diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 725b6ec1..97c4202f 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -82,8 +82,8 @@ var mp = (function () { 'tracks': tracks, 'cover_url': '' }; - var re_audio = new RegExp(/\.(opus|ogg|m4a|aac|mp3|wav|flac)$/, 'i'); - var re_cover = new RegExp(/^(cover|folder|cd|front|back)\.(jpe?g|png|gif)$/, 'i'); + var re_audio = new RegExp('\.(opus|ogg|m4a|aac|mp3|wav|flac)$', 'i'); + var re_cover = new RegExp('^(cover|folder|cd|front|back)\.(jpe?g|png|gif)$', 'i'); var trs = document.getElementById('files').getElementsByTagName('tbody')[0].getElementsByTagName('tr'); for (var a = 0, aa = trs.length; a < aa; a++) { @@ -579,13 +579,9 @@ function unblocked() { // show ui to manually start playback of a linked song function autoplay_blocked(tid) { - show_modal(` -
- `); + show_modal( + '' + + ''); var go = o('blk_go'); var na = o('blk_na'); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index f540051b..6178c79f 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -58,6 +58,23 @@ function o(id) { (function () { + // chrome requires https to use crypto.subtle, + // usually it's undefined but some chromes throw on invoke + try { + crypto.subtle.digest( + 'SHA-512', new Uint8Array(1) + ).then( + function(x) {up2k_init(true)}, + function(x) {up2k_init(false)} + ); + } + catch (ex) { + up2k_init(false); + } +})(); + + +function up2k_init(have_crypto) { // show modal message function showmodal(msg) { o('u2notbtn').innerHTML = msg; @@ -74,10 +91,11 @@ function o(id) { o('u2notbtn').innerHTML = ''; } - // might need sha512 polyfill when non-https (thx webkit (again)) - var have_crypto = window.crypto && crypto.subtle && crypto.subtle.digest; var shame = 'your browser disables sha512 unless you use https' - //have_crypto = false; + var is_https = (window.location + '').indexOf('https:') === 0; + if (is_https) + // chrome<37 firefox<34 edge<12 ie<11 opera<24 safari<10.1 + shame = 'your browser is impressively ancient' // upload ui hidden by default, clicking the header shows it o('u2tgl').onclick = function (e) { @@ -89,7 +107,10 @@ function o(id) { showmodal('