Compare commits

...

5 Commits

Author SHA1 Message Date
ed
bbb1e165d6 v0.10.22 2021-05-18 04:10:37 +02:00
ed
fed8d94885 handle unsupported codecs better 2021-05-18 03:44:30 +02:00
ed
58040cc0ed fix the treesize off-by-one (*finally*) 2021-05-18 03:21:53 +02:00
ed
03d692db66 add now-playing clipboard meme 2021-05-18 02:54:52 +02:00
ed
903f8e8453 logging 2021-05-17 18:45:15 +02:00
6 changed files with 87 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ turn your phone or raspi into a portable file server with resumable uploads/down
* server runs on anything with `py2.7` or `py3.3+` * server runs on anything with `py2.7` or `py3.3+`
* browse/upload with IE4 / netscape4.0 on win3.11 (heh) * browse/upload with IE4 / netscape4.0 on win3.11 (heh)
* *resumable* uploads need `firefox 34+` / `chrome 37+` / `safari 7+` * *resumable* uploads need `firefox 34+` / `chrome 41+` / `safari 7+` for full speed
* code standard: `black` * code standard: `black`
📷 screenshots: [browser](#the-browser) // [upload](#uploading) // [md-viewer](#markdown-viewer) // [search](#searching) // [fsearch](#file-search) // [zip-DL](#zip-downloads) // [ie4](#browser-support) 📷 screenshots: [browser](#the-browser) // [upload](#uploading) // [md-viewer](#markdown-viewer) // [search](#searching) // [fsearch](#file-search) // [zip-DL](#zip-downloads) // [ie4](#browser-support)

View File

@@ -1,8 +1,8 @@
# coding: utf-8 # coding: utf-8
VERSION = (0, 10, 21) VERSION = (0, 10, 22)
CODENAME = "zip it" CODENAME = "zip it"
BUILD_DT = (2021, 5, 16) BUILD_DT = (2021, 5, 18)
S_VERSION = ".".join(map(str, VERSION)) S_VERSION = ".".join(map(str, VERSION))
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)

View File

@@ -281,29 +281,48 @@ a, #files tbody div a:last-child {
padding: .2em 0 0 .07em; padding: .2em 0 0 .07em;
color: #fff; color: #fff;
} }
#wzip { #wzip, #wnp {
display: none; display: none;
margin-right: .3em; margin-right: .3em;
padding-right: .3em; padding-right: .3em;
border-right: .1em solid #555; border-right: .1em solid #555;
} }
#wnp a {
position: relative;
font-size: .47em;
margin: 0 .1em;
top: -.4em;
}
#wnp a+a {
margin-left: .33em;
}
#wtoggle, #wtoggle,
#wtoggle * { #wtoggle * {
line-height: 1em; line-height: 1em;
} }
#wtoggle.np {
width: 5.5em;
}
#wtoggle.sel { #wtoggle.sel {
width: 6.4em; width: 6.4em;
} }
#wtoggle.sel #wzip { #wtoggle.sel #wzip,
#wtoggle.np #wnp {
display: inline-block; display: inline-block;
} }
#wtoggle.sel #wzip a { #wtoggle.sel.np #wnp {
display: none;
}
#wzip a {
font-size: .4em; font-size: .4em;
padding: 0 .3em; padding: 0 .3em;
margin: -.3em .2em; margin: -.3em .2em;
position: relative; position: relative;
display: inline-block; display: inline-block;
} }
#wzip a+a {
margin-left: .8em;
}
#wtoggle.sel #wzip #selzip { #wtoggle.sel #wzip #selzip {
top: -.6em; top: -.6em;
padding: .4em .3em; padding: .4em .3em;
@@ -508,7 +527,6 @@ input[type="checkbox"]:checked+label {
left: 0; left: 0;
bottom: 0; bottom: 0;
top: 7em; top: 7em;
padding-top: .2em;
overflow-y: auto; overflow-y: auto;
-ms-scroll-chaining: none; -ms-scroll-chaining: none;
overscroll-behavior-y: none; overscroll-behavior-y: none;
@@ -556,6 +574,7 @@ input[type="checkbox"]:checked+label {
#detree { #detree {
padding: .3em .5em; padding: .3em .5em;
font-size: 1.5em; font-size: 1.5em;
line-height: 1.5em;
} }
#tree ul, #tree ul,
#tree li { #tree li {

View File

@@ -114,22 +114,7 @@
<div id="srv_info"><span>{{ srv_info }}</span></div> <div id="srv_info"><span>{{ srv_info }}</span></div>
{%- endif %} {%- endif %}
<div id="widget"> <div id="widget"></div>
<div id="wtoggle">
<span id="wzip">
<a href="#" id="selall">sel.<br />all</a>
<a href="#" id="selinv">sel.<br />inv.</a>
<a href="#" id="selzip">zip</a>
</span><a
href="#" id="wtico"></a>
</div>
<div id="widgeti">
<div id="pctl"><a href="#" id="bprev"></a><a href="#" id="bplay"></a><a href="#" id="bnext"></a></div>
<canvas id="pvol" width="288" height="38"></canvas>
<canvas id="barpos"></canvas>
<canvas id="barbuf"></canvas>
</div>
</div>
<script> <script>
var tag_order_cfg = {{ tag_order }}; var tag_order_cfg = {{ tag_order }};

View File

@@ -7,6 +7,28 @@ function dbg(msg) {
} }
// add widget buttons
ebi('widget').innerHTML = (
'<div id="wtoggle">' +
'<span id="wzip"><a' +
' href="#" id="selall">sel.<br />all</a><a' +
' href="#" id="selinv">sel.<br />inv.</a><a' +
' href="#" id="selzip">zip</a>' +
'</span><span id="wnp"><a' +
' href="#" id="npirc">📋irc</a><a' +
' href="#" id="nptxt">📋txt</a>' +
'</span><a' +
' href="#" id="wtico">♫</a>' +
'</div>' +
'<div id="widgeti">' +
' <div id="pctl"><a href="#" id="bprev">⏮</a><a href="#" id="bplay">▶</a><a href="#" id="bnext">⏭</a></div>' +
' <canvas id="pvol" width="288" height="38"></canvas>' +
' <canvas id="barpos"></canvas>' +
' <canvas id="barbuf"></canvas>' +
'</div>'
);
// extract songs + add play column // extract songs + add play column
function MPlayer() { function MPlayer() {
this.id = Date.now(); this.id = Date.now();
@@ -79,6 +101,8 @@ var widget = (function () {
var ret = {}, var ret = {},
widget = ebi('widget'), widget = ebi('widget'),
wtico = ebi('wtico'), wtico = ebi('wtico'),
nptxt = ebi('nptxt'),
npirc = ebi('npirc'),
touchmode = false, touchmode = false,
side_open = false, side_open = false,
was_paused = true; was_paused = true;
@@ -116,6 +140,35 @@ var widget = (function () {
return false; return false;
}; };
npirc.onclick = nptxt.onclick = function (e) {
ev(e);
var th = ebi('files').tHead.rows[0].cells,
tr = QS('#files tr.play').cells,
irc = this.getAttribute('id') == 'npirc',
ck = irc ? '06' : '',
cv = irc ? '07' : '',
m = ck + 'np: ';
for (var a = 1, aa = th.length; a < aa; a++) {
var tk = a == 1 ? '' : th[a].getAttribute('name').split('/').slice(-1)[0];
var tv = tr[a].getAttribute('html') || tr[a].textContent;
m += tk + '(' + cv + tv + ck + ') // ';
}
m += '[' + cv + s2ms(mp.au.currentTime) + ck + '/' + cv + s2ms(mp.au.duration) + ck + ']';
var o = document.createElement('input');
o.style.cssText = 'position:fixed;top:45%;left:48%;padding:1em;z-index:9';
o.value = m;
document.body.appendChild(o);
o.focus();
o.select();
document.execCommand("copy");
o.value = 'copied to clipboard ';
setTimeout(function () {
document.body.removeChild(o);
}, 500);
};
return ret; return ret;
})(); })();
@@ -189,8 +242,8 @@ var pbar = (function () {
}; };
r.drawpos = function () { r.drawpos = function () {
if (!mp.au) if (!mp.au || isNaN(mp.au.duration) || isNaN(mp.au.currentTime))
return; return; // not-init || unsupp-codec
var bc = r.buf, var bc = r.buf,
pc = r.pos, pc = r.pos,
@@ -513,6 +566,7 @@ function play(tid, seek, call_depth) {
clmod(trs[a], 'play'); clmod(trs[a], 'play');
} }
ebi(oid).parentElement.parentElement.className += ' play'; ebi(oid).parentElement.parentElement.className += ' play';
clmod(ebi('wtoggle'), 'np', 1);
try { try {
if (attempt_play) if (attempt_play)
@@ -928,7 +982,6 @@ var treectl = (function () {
treesz = icfg_get('treesz', 16); treesz = icfg_get('treesz', 16);
treesz = Math.min(Math.max(treesz, 4), 50); treesz = Math.min(Math.max(treesz, 4), 50);
console.log('treesz [' + treesz + ']');
function entree(e) { function entree(e) {
ev(e); ev(e);
@@ -987,7 +1040,7 @@ var treectl = (function () {
} }
else { else {
var top = Math.max(0, parseInt(wrap.offsetTop)), var top = Math.max(0, parseInt(wrap.offsetTop)),
treeh = (winh - atop) - 4; treeh = winh - atop;
tree.style.top = top + 'px'; tree.style.top = top + 'px';
tree.style.height = treeh < 10 ? '' : treeh + 'px'; tree.style.height = treeh < 10 ? '' : treeh + 'px';

View File

@@ -20,11 +20,12 @@ var up2k = null;
try { try {
var cf = crypto.subtle || crypto.webkitSubtle; var cf = crypto.subtle || crypto.webkitSubtle;
cf.digest('SHA-512', new Uint8Array(1)).then( cf.digest('SHA-512', new Uint8Array(1)).then(
function (x) { up2k = up2k_init(cf) }, function (x) { console.log('sha-ok'); up2k = up2k_init(cf); },
function (x) { up2k = up2k_init(false) } function (x) { console.log('sha-ng:', x); up2k = up2k_init(false); }
); );
} }
catch (ex) { catch (ex) {
console.log('sha-na:', ex);
try { try {
up2k = up2k_init(false); up2k = up2k_init(false);
} }