Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
231a03bcfd | ||
|
|
bc85723657 | ||
|
|
be32b743c6 | ||
|
|
83c9843059 | ||
|
|
11cf43626d | ||
|
|
a6dc5e2ce3 | ||
|
|
38593a0394 | ||
|
|
95309afeea | ||
|
|
c2bf6fe2a3 | ||
|
|
99ac324fbd | ||
|
|
5562de330f | ||
|
|
95014236ac | ||
|
|
6aa7386138 | ||
|
|
3226a1f588 | ||
|
|
b4cf890cd8 | ||
|
|
ce09e323af | ||
|
|
941aedb177 | ||
|
|
87a0d502a3 | ||
|
|
cab7c1b0b8 | ||
|
|
d5892341b6 | ||
|
|
646557a43e | ||
|
|
ed8d34ab43 | ||
|
|
5e34463c77 | ||
|
|
1b14eb7959 | ||
|
|
ed48c2d0ed | ||
|
|
26fe84b660 | ||
|
|
5938230270 | ||
|
|
1a33a047fa |
@@ -1,8 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (0, 13, 10)
|
VERSION = (0, 13, 13)
|
||||||
CODENAME = "future-proof"
|
CODENAME = "future-proof"
|
||||||
BUILD_DT = (2021, 8, 30)
|
BUILD_DT = (2021, 9, 3)
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import gzip
|
|||||||
import time
|
import time
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
|
import base64
|
||||||
import string
|
import string
|
||||||
import socket
|
import socket
|
||||||
import ctypes
|
import ctypes
|
||||||
@@ -192,7 +193,21 @@ class HttpCli(object):
|
|||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
self.vpath = unquotep(vpath) # not query, so + means +
|
self.vpath = unquotep(vpath) # not query, so + means +
|
||||||
|
|
||||||
pwd = uparam.get("pw")
|
pwd = None
|
||||||
|
ba = self.headers.get("authorization")
|
||||||
|
if ba:
|
||||||
|
try:
|
||||||
|
ba = ba.split(" ")[1].encode("ascii")
|
||||||
|
ba = base64.b64decode(ba).decode("utf-8")
|
||||||
|
# try "pwd", "x:pwd", "pwd:x"
|
||||||
|
for ba in [ba] + ba.split(":", 1)[::-1]:
|
||||||
|
if self.asrv.iacct.get(ba):
|
||||||
|
pwd = ba
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
pwd = uparam.get("pw") or pwd
|
||||||
self.uname = self.asrv.iacct.get(pwd, "*")
|
self.uname = self.asrv.iacct.get(pwd, "*")
|
||||||
self.rvol = self.asrv.vfs.aread[self.uname]
|
self.rvol = self.asrv.vfs.aread[self.uname]
|
||||||
self.wvol = self.asrv.vfs.awrite[self.uname]
|
self.wvol = self.asrv.vfs.awrite[self.uname]
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ class TcpSrv(object):
|
|||||||
eps = self.ips_linux()
|
eps = self.ips_linux()
|
||||||
|
|
||||||
if "0.0.0.0" not in listen_ips:
|
if "0.0.0.0" not in listen_ips:
|
||||||
eps = {k: v for k, v in eps if k in listen_ips}
|
eps = {k: v for k, v in eps.items() if k in listen_ips}
|
||||||
|
|
||||||
default_route = None
|
default_route = None
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
|||||||
@@ -270,13 +270,14 @@ class ThumbSrv(object):
|
|||||||
fmts += ["RGBA", "LA"]
|
fmts += ["RGBA", "LA"]
|
||||||
args["method"] = 6
|
args["method"] = 6
|
||||||
else:
|
else:
|
||||||
pass # default q = 75
|
# default q = 75
|
||||||
|
args["progressive"] = True
|
||||||
|
|
||||||
if im.mode not in fmts:
|
if im.mode not in fmts:
|
||||||
# print("conv {}".format(im.mode))
|
# print("conv {}".format(im.mode))
|
||||||
im = im.convert("RGB")
|
im = im.convert("RGB")
|
||||||
|
|
||||||
im.save(tpath, quality=40, method=6)
|
im.save(tpath, **args)
|
||||||
|
|
||||||
def conv_ffmpeg(self, abspath, tpath):
|
def conv_ffmpeg(self, abspath, tpath):
|
||||||
ret, _ = ffprobe(abspath)
|
ret, _ = ffprobe(abspath)
|
||||||
|
|||||||
@@ -343,17 +343,19 @@ html.light #ggrid>a.sel {
|
|||||||
}
|
}
|
||||||
#wtgrid,
|
#wtgrid,
|
||||||
#wtico {
|
#wtico {
|
||||||
cursor: url(/.cpr/dd/4.png), pointer;
|
|
||||||
animation: cursor 500ms;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: .9em;
|
font-size: .9em;
|
||||||
top: -.04em;
|
top: -.04em;
|
||||||
}
|
}
|
||||||
#wtgrid {
|
#wtgrid {
|
||||||
font-size: .75em;
|
font-size: .75em;
|
||||||
|
padding: .1em;
|
||||||
top: -.12em;
|
top: -.12em;
|
||||||
}
|
}
|
||||||
#wtgrid:hover,
|
#wtico {
|
||||||
|
cursor: url(/.cpr/dd/4.png), pointer;
|
||||||
|
animation: cursor 500ms;
|
||||||
|
}
|
||||||
#wtico:hover {
|
#wtico:hover {
|
||||||
animation: cursor 500ms infinite;
|
animation: cursor 500ms infinite;
|
||||||
}
|
}
|
||||||
@@ -381,23 +383,25 @@ html.light #ggrid>a.sel {
|
|||||||
background: #3c3c3c;
|
background: #3c3c3c;
|
||||||
box-shadow: 0 0 .5em #222;
|
box-shadow: 0 0 .5em #222;
|
||||||
border-radius: .3em 0 0 0;
|
border-radius: .3em 0 0 0;
|
||||||
padding: 0;
|
padding: 0 0 0 .1em;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
#wzip, #wnp {
|
#wfm, #wzip, #wnp {
|
||||||
display: none;
|
display: none;
|
||||||
margin-right: .3em;
|
}
|
||||||
padding-right: .3em;
|
#wzip, #wnp {
|
||||||
|
margin-right: .2em;
|
||||||
|
padding-right: .2em;
|
||||||
border-right: .1em solid #555;
|
border-right: .1em solid #555;
|
||||||
}
|
}
|
||||||
#wnp a {
|
#wfm.act+#wzip,
|
||||||
position: relative;
|
#wfm.act+#wzip+#wnp {
|
||||||
font-size: .47em;
|
margin-left: .2em;
|
||||||
margin: 0 .1em;
|
padding-left: .2em;
|
||||||
top: -.4em;
|
border-left: .1em solid #555;
|
||||||
}
|
}
|
||||||
#wnp a+a {
|
#wfm.act {
|
||||||
margin-left: .33em;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
#wtoggle,
|
#wtoggle,
|
||||||
#wtoggle * {
|
#wtoggle * {
|
||||||
@@ -411,6 +415,7 @@ html.light #ggrid>a.sel {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#wfm a,
|
#wfm a,
|
||||||
|
#wnp a,
|
||||||
#wzip a {
|
#wzip a {
|
||||||
font-size: .5em;
|
font-size: .5em;
|
||||||
padding: 0 .3em;
|
padding: 0 .3em;
|
||||||
@@ -418,10 +423,14 @@ html.light #ggrid>a.sel {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
#wfm span {
|
#wfm span,
|
||||||
|
#wnp span {
|
||||||
font-size: .6em;
|
font-size: .6em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
#wnp span {
|
||||||
|
font-size: .7em;
|
||||||
|
}
|
||||||
#wfm a:not(.en) {
|
#wfm a:not(.en) {
|
||||||
opacity: .3;
|
opacity: .3;
|
||||||
color: #f6c;
|
color: #f6c;
|
||||||
@@ -806,8 +815,6 @@ input.eq_gain {
|
|||||||
width: 1em;
|
width: 1em;
|
||||||
border-radius: .2em;
|
border-radius: .2em;
|
||||||
margin: -1.2em auto 0 auto;
|
margin: -1.2em auto 0 auto;
|
||||||
top: 2em;
|
|
||||||
position: relative;
|
|
||||||
background: #444;
|
background: #444;
|
||||||
}
|
}
|
||||||
#files th span {
|
#files th span {
|
||||||
@@ -1535,6 +1542,7 @@ html.light #bbox-overlay figcaption a {
|
|||||||
|
|
||||||
#op_up2k {
|
#op_up2k {
|
||||||
padding: 0 1em 1em 1em;
|
padding: 0 1em 1em 1em;
|
||||||
|
min-height: 60em;
|
||||||
}
|
}
|
||||||
#u2form {
|
#u2form {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ ebi('widget').innerHTML = (
|
|||||||
' href="#" id="selinv" tt="invert selection">sel.<br />inv.</a><a' +
|
' href="#" id="selinv" tt="invert selection">sel.<br />inv.</a><a' +
|
||||||
' href="#" id="selzip" tt="download selection as archive">zip</a>' +
|
' href="#" id="selzip" tt="download selection as archive">zip</a>' +
|
||||||
'</span><span id="wnp"><a' +
|
'</span><span id="wnp"><a' +
|
||||||
' href="#" id="npirc" tt="copy irc-formatted track info">📋irc</a><a' +
|
' href="#" id="npirc" tt="copy irc-formatted track info">📋<span>irc</span></a><a' +
|
||||||
' href="#" id="nptxt" tt="copy plaintext track info">📋txt</a>' +
|
' href="#" id="nptxt" tt="copy plaintext track info">📋<span>txt</span></a>' +
|
||||||
'</span><a' +
|
'</span><a' +
|
||||||
' href="#" id="wtgrid" tt="toggle grid/list view$NHotkey: G">田</a><a' +
|
' href="#" id="wtgrid" tt="toggle grid/list view$NHotkey: G">田</a><a' +
|
||||||
' href="#" id="wtico">♫</a>' +
|
' href="#" id="wtico">♫</a>' +
|
||||||
@@ -1252,6 +1252,9 @@ function play(tid, is_ev, seek, call_depth) {
|
|||||||
if (mp.order.length == 0)
|
if (mp.order.length == 0)
|
||||||
return console.log('no audio found wait what');
|
return console.log('no audio found wait what');
|
||||||
|
|
||||||
|
if (crashed)
|
||||||
|
return;
|
||||||
|
|
||||||
mp.stopfade(true);
|
mp.stopfade(true);
|
||||||
|
|
||||||
var tn = tid;
|
var tn = tid;
|
||||||
@@ -1718,7 +1721,7 @@ var fileman = (function () {
|
|||||||
bcut.style.display = have_mv && has(perms, 'move') ? '' : 'none';
|
bcut.style.display = have_mv && has(perms, 'move') ? '' : 'none';
|
||||||
bpst.style.display = have_mv && has(perms, 'write') ? '' : 'none';
|
bpst.style.display = have_mv && has(perms, 'write') ? '' : 'none';
|
||||||
bpst.setAttribute('tt', 'paste ' + r.clip.length + ' items$NHotkey: ctrl-V');
|
bpst.setAttribute('tt', 'paste ' + r.clip.length + ' items$NHotkey: ctrl-V');
|
||||||
ebi('wfm').style.display = QS('#wfm a.en:not([display])') ? '' : 'none';
|
clmod(ebi('wfm'), 'act', QS('#wfm a.en:not([style])'));
|
||||||
};
|
};
|
||||||
|
|
||||||
r.rename = function (e) {
|
r.rename = function (e) {
|
||||||
@@ -1785,7 +1788,7 @@ var fileman = (function () {
|
|||||||
|
|
||||||
html = html.concat([
|
html = html.concat([
|
||||||
'<button id="rn_cancel" tt="abort and close this window">❌ cancel</button>',
|
'<button id="rn_cancel" tt="abort and close this window">❌ cancel</button>',
|
||||||
'<button id="rn_apply">✅ apply rename</button>',
|
'<button id="rn_apply">✅ APPLY RENAME</button>',
|
||||||
'<a id="rn_adv" class="tgl btn" href="#" tt="batch / metadata / pattern renaming">advanced</a>',
|
'<a id="rn_adv" class="tgl btn" href="#" tt="batch / metadata / pattern renaming">advanced</a>',
|
||||||
'<a id="rn_case" class="tgl btn" href="#" tt="case-sensitive regex">case</a>',
|
'<a id="rn_case" class="tgl btn" href="#" tt="case-sensitive regex">case</a>',
|
||||||
'</div>',
|
'</div>',
|
||||||
@@ -1877,18 +1880,21 @@ var fileman = (function () {
|
|||||||
f[n].inew.focus();
|
f[n].inew.focus();
|
||||||
f[n].inew.setSelectionRange(0, f[n].inew.value.lastIndexOf('.'), "forward");
|
f[n].inew.setSelectionRange(0, f[n].inew.value.lastIndexOf('.'), "forward");
|
||||||
}
|
}
|
||||||
function rn_cancel() {
|
function rn_cancel(e) {
|
||||||
|
ev(e);
|
||||||
rui.parentNode.removeChild(rui);
|
rui.parentNode.removeChild(rui);
|
||||||
}
|
}
|
||||||
|
|
||||||
ebi('rn_cancel').onclick = rn_cancel;
|
ebi('rn_cancel').onclick = rn_cancel;
|
||||||
ebi('rn_apply').onclick = rn_apply;
|
ebi('rn_apply').onclick = rn_apply;
|
||||||
ebi('rn_adv').onclick = function () {
|
ebi('rn_adv').onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
adv = !adv;
|
adv = !adv;
|
||||||
bcfg_set('rn_adv', adv);
|
bcfg_set('rn_adv', adv);
|
||||||
sadv();
|
sadv();
|
||||||
};
|
};
|
||||||
ebi('rn_case').onclick = function () {
|
ebi('rn_case').onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
cs = !cs;
|
cs = !cs;
|
||||||
bcfg_set('rn_case', cs);
|
bcfg_set('rn_case', cs);
|
||||||
};
|
};
|
||||||
@@ -1915,7 +1921,8 @@ var fileman = (function () {
|
|||||||
ipre.appendChild(o);
|
ipre.appendChild(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inew.onclick = function () {
|
inew.onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
modal.prompt('provide a name for your new preset', ifmt.value, function (name) {
|
modal.prompt('provide a name for your new preset', ifmt.value, function (name) {
|
||||||
if (!name)
|
if (!name)
|
||||||
return toast.warn(3, 'aborted');
|
return toast.warn(3, 'aborted');
|
||||||
@@ -1926,7 +1933,8 @@ var fileman = (function () {
|
|||||||
ipre.value = name;
|
ipre.value = name;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
idel.onclick = function () {
|
idel.onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
delete presets[ipre.value];
|
delete presets[ipre.value];
|
||||||
jwrite('rn_pre', presets);
|
jwrite('rn_pre', presets);
|
||||||
spresets();
|
spresets();
|
||||||
@@ -1984,7 +1992,8 @@ var fileman = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function rn_apply() {
|
function rn_apply(e) {
|
||||||
|
ev(e);
|
||||||
while (f.length && (!f[0].ok || f[0].ofn == f[0].inew.value))
|
while (f.length && (!f[0].ok || f[0].ofn == f[0].inew.value))
|
||||||
f.shift();
|
f.shift();
|
||||||
|
|
||||||
@@ -2089,9 +2098,18 @@ var fileman = (function () {
|
|||||||
clmod(els[a], 'fcut', 1);
|
clmod(els[a], 'fcut', 1);
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
toast.inf(1.5, 'cut ' + sel.length + ' items');
|
try {
|
||||||
jwrite('fman_clip', vps);
|
vps = JSON.stringify(vps);
|
||||||
r.tx(1);
|
if (vps.length > 1024 * 1024)
|
||||||
|
throw 'a';
|
||||||
|
|
||||||
|
swrite('fman_clip', vps);
|
||||||
|
r.tx(1);
|
||||||
|
toast.inf(1.5, 'cut ' + sel.length + ' items');
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
toast.warn(30, 'cut ' + sel.length + ' items\n\nbut: only <b>this</b> browser-tab can paste them\n(since the selection is so absolutely massive)');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
r.paste = function (e) {
|
r.paste = function (e) {
|
||||||
@@ -2378,7 +2396,8 @@ var thegrid = (function () {
|
|||||||
}
|
}
|
||||||
var uns = QS('#ggrid a[ref="unsearch"]');
|
var uns = QS('#ggrid a[ref="unsearch"]');
|
||||||
if (uns)
|
if (uns)
|
||||||
uns.onclick = function () {
|
uns.onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
ebi('unsearch').click();
|
ebi('unsearch').click();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -2700,10 +2719,10 @@ document.onkeydown = function (e) {
|
|||||||
return ebi('gridsel').click();
|
return ebi('gridsel').click();
|
||||||
|
|
||||||
if (k == 'KeyA')
|
if (k == 'KeyA')
|
||||||
return QSA('#ghead>a[z]')[0].click();
|
return QSA('#ghead a[z]')[0].click();
|
||||||
|
|
||||||
if (k == 'KeyD')
|
if (k == 'KeyD')
|
||||||
return QSA('#ghead>a[z]')[1].click();
|
return QSA('#ghead a[z]')[1].click();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3575,6 +3594,7 @@ var filecols = (function () {
|
|||||||
if (ttv) {
|
if (ttv) {
|
||||||
th.setAttribute("tt", ttv);
|
th.setAttribute("tt", ttv);
|
||||||
th.setAttribute("ttd", "u");
|
th.setAttribute("ttd", "u");
|
||||||
|
th.setAttribute("ttm", "12");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -4138,6 +4158,7 @@ var unpost = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ct.onclick = function (e) {
|
ct.onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
var tgt = e.target.closest('a[me]');
|
var tgt = e.target.closest('a[me]');
|
||||||
if (!tgt)
|
if (!tgt)
|
||||||
return;
|
return;
|
||||||
@@ -4179,7 +4200,8 @@ var unpost = (function () {
|
|||||||
tfilt = setTimeout(r.load, 250);
|
tfilt = setTimeout(r.load, 250);
|
||||||
};
|
};
|
||||||
|
|
||||||
ebi('unpost_nofilt').onclick = function () {
|
ebi('unpost_nofilt').onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
filt.value = '';
|
filt.value = '';
|
||||||
r.load();
|
r.load();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ html {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
padding: .3em 0;
|
padding: .3em 0;
|
||||||
margin: -.3em 0 0 0;
|
margin: -.3em 0 0 0;
|
||||||
line-height: 1.5em;
|
line-height: 1.3em;
|
||||||
color: #000;
|
color: #000;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -60,6 +60,15 @@ html {
|
|||||||
border-radius: .5em 0 0 .5em;
|
border-radius: .5em 0 0 .5em;
|
||||||
transition: left .3s, width .3s, padding .3s, opacity .3s;
|
transition: left .3s, width .3s, padding .3s, opacity .3s;
|
||||||
}
|
}
|
||||||
|
#toastb {
|
||||||
|
max-height: 70vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
#toast.scroll #toastb {
|
||||||
|
overflow-y: scroll;
|
||||||
|
margin-right: -1.2em;
|
||||||
|
padding-right: .7em;
|
||||||
|
}
|
||||||
#toast pre {
|
#toast pre {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -230,3 +239,6 @@ html.light #tt em {
|
|||||||
#modali:focus {
|
#modali:focus {
|
||||||
border-color: #06d;
|
border-color: #06d;
|
||||||
}
|
}
|
||||||
|
#repl_pre {
|
||||||
|
max-width: 24em;
|
||||||
|
}
|
||||||
@@ -1880,17 +1880,18 @@ function up2k_init(subtle) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ebi('nthread').onkeydown = bumpthread2;
|
ebi('nthread').onkeydown = bumpthread2;
|
||||||
ebi('nthread').addEventListener('input', bumpthread, false);
|
ebi('nthread').oninput = bumpthread;
|
||||||
ebi('multitask').addEventListener('click', tgl_multitask, false);
|
ebi('multitask').onclick = tgl_multitask;
|
||||||
ebi('ask_up').addEventListener('click', tgl_ask_up, false);
|
ebi('ask_up').onclick = tgl_ask_up;
|
||||||
ebi('flag_en').addEventListener('click', tgl_flag_en, false);
|
ebi('flag_en').onclick = tgl_flag_en;
|
||||||
ebi('u2turbo').addEventListener('click', tgl_turbo, false);
|
ebi('u2turbo').onclick = tgl_turbo;
|
||||||
ebi('u2tdate').addEventListener('click', tgl_datechk, false);
|
ebi('u2tdate').onclick = tgl_datechk;
|
||||||
var o = ebi('fsearch');
|
var o = ebi('fsearch');
|
||||||
if (o)
|
if (o)
|
||||||
o.addEventListener('click', tgl_fsearch, false);
|
o.addEventListener('click', tgl_fsearch, false);
|
||||||
|
|
||||||
ebi('u2etas').onclick = function () {
|
ebi('u2etas').onclick = function (e) {
|
||||||
|
ev(e);
|
||||||
clmod(ebi('u2etas'), 'o', 't');
|
clmod(ebi('u2etas'), 'o', 't');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ if (!window['console'])
|
|||||||
|
|
||||||
var is_touch = 'ontouchstart' in window,
|
var is_touch = 'ontouchstart' in window,
|
||||||
IPHONE = /iPhone|iPad|iPod/i.test(navigator.userAgent),
|
IPHONE = /iPhone|iPad|iPod/i.test(navigator.userAgent),
|
||||||
ANDROID = /android/i.test(navigator.userAgent);
|
ANDROID = /android/i.test(navigator.userAgent),
|
||||||
|
WINDOWS = navigator.platform ? navigator.platform == 'Win32' : /Windows/.test(navigator.userAgent);
|
||||||
|
|
||||||
|
|
||||||
var ebi = document.getElementById.bind(document),
|
var ebi = document.getElementById.bind(document),
|
||||||
@@ -28,6 +29,35 @@ function esc(txt) {
|
|||||||
}[c];
|
}[c];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
window.onunhandledrejection = function (e) {
|
||||||
|
console.log("REJ: " + e.reason);
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
console.hist = [];
|
||||||
|
var hook = function (t) {
|
||||||
|
var orig = console[t].bind(console),
|
||||||
|
cfun = function () {
|
||||||
|
console.hist.push(Date.now() + ' ' + t + ': ' + Array.from(arguments).join(', '));
|
||||||
|
if (console.hist.length > 100)
|
||||||
|
console.hist = console.hist.slice(50);
|
||||||
|
|
||||||
|
orig.apply(console, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
console['std' + t] = orig;
|
||||||
|
console[t] = cfun;
|
||||||
|
};
|
||||||
|
hook('log');
|
||||||
|
console.log('log-capture ok');
|
||||||
|
hook('debug');
|
||||||
|
hook('warn');
|
||||||
|
hook('error');
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (console.stdlog)
|
||||||
|
console.log = console.stdlog;
|
||||||
|
console.log(ex);
|
||||||
|
}
|
||||||
var crashed = false, ignexd = {};
|
var crashed = false, ignexd = {};
|
||||||
function vis_exh(msg, url, lineNo, columnNo, error) {
|
function vis_exh(msg, url, lineNo, columnNo, error) {
|
||||||
if ((msg + '').indexOf('ResizeObserver') !== -1)
|
if ((msg + '').indexOf('ResizeObserver') !== -1)
|
||||||
@@ -39,23 +69,59 @@ function vis_exh(msg, url, lineNo, columnNo, error) {
|
|||||||
|
|
||||||
crashed = true;
|
crashed = true;
|
||||||
window.onerror = undefined;
|
window.onerror = undefined;
|
||||||
var con = is_touch ? '' : '<br /> (and if you can, press F12 and include the "Console" tab in the screenshot too)',
|
var html = [
|
||||||
html = ['<h1>you hit a bug!</h1><p style="font-size:1.3em;margin:0">try to <a href="#" onclick="localStorage.clear();location.reload();">reset copyparty settings</a> if you are stuck here, or <a href="#" onclick="ignex();">ignore this</a> / <a href="#" onclick="ignex(true);">ignore all</a></p><p>please send me a screenshot arigathanks gozaimuch: <code>ed/irc.rizon.net</code> or <code>ed#2644</code>' + con + '</p><p>',
|
'<h1>you hit a bug!</h1>',
|
||||||
esc(url + ' @' + lineNo + ':' + columnNo), '<br />' + esc(String(msg)) + '</p>'];
|
'<p style="font-size:1.3em;margin:0">try to <a href="#" onclick="localStorage.clear();location.reload();">reset copyparty settings</a> if you are stuck here, or <a href="#" onclick="ignex();">ignore this</a> / <a href="#" onclick="ignex(true);">ignore all</a></p>',
|
||||||
|
'<p style="color:#fff">please send me a screenshot arigathanks gozaimuch: <code>ed/irc.rizon.net</code> or <code>ed#2644</code></p>',
|
||||||
|
'<p class="b">' + esc(url + ' @' + lineNo + ':' + columnNo), '<br />' + esc(String(msg)) + '</p>',
|
||||||
|
'<p><b>UA:</b> ' + esc(navigator.userAgent + '')
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
var ua = '',
|
||||||
|
ad = navigator.userAgentData,
|
||||||
|
adb = ad.brands;
|
||||||
|
|
||||||
|
for (var a = 0; a < adb.length; a++)
|
||||||
|
if (!/Not.*A.*Brand/.exec(adb[a].brand))
|
||||||
|
ua += adb[a].brand + '/' + adb[a].version + ', ';
|
||||||
|
ua += ad.platform;
|
||||||
|
|
||||||
|
html.push('<br /><b>UAD:</b> ' + esc(ua.slice(0, 100)));
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
html.push('</p>');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (error) {
|
if (error) {
|
||||||
var find = ['desc', 'stack', 'trace'];
|
var find = ['desc', 'stack', 'trace'];
|
||||||
for (var a = 0; a < find.length; a++)
|
for (var a = 0; a < find.length; a++)
|
||||||
if (String(error[find[a]]) !== 'undefined')
|
if (String(error[find[a]]) !== 'undefined')
|
||||||
html.push('<h3>' + find[a] + '</h3>' +
|
html.push('<p class="b"><b>' + find[a] + ':</b><br />' +
|
||||||
esc(String(error[find[a]])).replace(/\n/g, '<br />\n'));
|
esc(String(error[find[a]])).replace(/\n/g, '<br />\n') + '</p>');
|
||||||
}
|
}
|
||||||
ignexd[ekey] = true;
|
ignexd[ekey] = true;
|
||||||
html.push('<h3>localStore</h3>' + esc(JSON.stringify(localStorage)));
|
|
||||||
|
var ls = jcp(localStorage);
|
||||||
|
if (ls.fman_clip)
|
||||||
|
ls.fman_clip = ls.fman_clip.length + ' items';
|
||||||
|
|
||||||
|
var lsk = Object.keys(ls);
|
||||||
|
lsk.sort();
|
||||||
|
html.push('<p class="b">');
|
||||||
|
for (var a = 0; a < lsk.length; a++)
|
||||||
|
html.push(' <b>' + esc(lsk[a]) + '</b> <code>' + esc(ls[lsk[a]]) + '</code> ');
|
||||||
|
html.push('</p>');
|
||||||
}
|
}
|
||||||
catch (e) { }
|
catch (e) { }
|
||||||
|
|
||||||
|
if (console.hist.length) {
|
||||||
|
html.push('<p class="b"><b>console:</b><ul><li>' + Date.now() + ' @</li>');
|
||||||
|
for (var a = console.hist.length - 1, aa = Math.max(0, console.hist.length - 20); a >= aa; a--)
|
||||||
|
html.push('<li>' + esc(console.hist[a]) + '</li>');
|
||||||
|
html.push('</ul>')
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var exbox = ebi('exbox');
|
var exbox = ebi('exbox');
|
||||||
if (!exbox) {
|
if (!exbox) {
|
||||||
@@ -64,10 +130,19 @@ function vis_exh(msg, url, lineNo, columnNo, error) {
|
|||||||
document.body.appendChild(exbox);
|
document.body.appendChild(exbox);
|
||||||
|
|
||||||
var s = mknod('style');
|
var s = mknod('style');
|
||||||
s.innerHTML = '#exbox{background:#333;color:#ddd;font-family:sans-serif;font-size:0.8em;padding:0 1em 1em 1em;z-index:80386;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;overflow:auto;width:calc(100% - 2em)} #exbox h1{margin:.5em 1em 0 0;padding:0} #exbox h3{border-top:1px solid #999;margin:1em 0 0 0} #exbox a{text-decoration:underline;color:#fc0} #exbox code{color:#bf7;background:#222;padding:.1em;margin:.2em;font-size:1.1em;font-family:monospace,monospace} #exbox,#exbox *{line-height:1.5em;overflow-wrap:break-word}';
|
s.innerHTML = (
|
||||||
|
'#exbox{background:#333;color:#ddd;font-family:sans-serif;font-size:0.8em;padding:0 1em 1em 1em;z-index:80386;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;overflow:auto;width:calc(100% - 2em)} ' +
|
||||||
|
'#exbox,#exbox *{line-height:1.5em;overflow-wrap:break-word} ' +
|
||||||
|
'#exbox code{color:#bf7;background:#222;padding:.1em;margin:.2em;font-size:1.1em;font-family:monospace,monospace} ' +
|
||||||
|
'#exbox a{text-decoration:underline;color:#fc0} ' +
|
||||||
|
'#exbox h1{margin:.5em 1em 0 0;padding:0} ' +
|
||||||
|
'#exbox p.b{border-top:1px solid #999;margin:1em 0 0 0;font-size:1em} ' +
|
||||||
|
'#exbox ul, #exbox li {margin:0 0 0 .5em;padding:0} ' +
|
||||||
|
'#exbox b{color:#fff}'
|
||||||
|
);
|
||||||
document.head.appendChild(s);
|
document.head.appendChild(s);
|
||||||
}
|
}
|
||||||
exbox.innerHTML = html.join('\n').replace(/https?:\/\/[^ \/]+\//g, '/');
|
exbox.innerHTML = html.join('\n').replace(/https?:\/\/[^ \/]+\//g, '/').replace(/js\?_=[a-zA-Z]{4}/g, 'js');
|
||||||
exbox.style.display = 'block';
|
exbox.style.display = 'block';
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -575,6 +650,9 @@ var timer = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function doevents() {
|
function doevents() {
|
||||||
|
if (crashed)
|
||||||
|
return;
|
||||||
|
|
||||||
if (Date.now() - r.last < 69)
|
if (Date.now() - r.last < 69)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -620,6 +698,7 @@ var tt = (function () {
|
|||||||
r.el = this;
|
r.el = this;
|
||||||
var pos = this.getBoundingClientRect(),
|
var pos = this.getBoundingClientRect(),
|
||||||
dir = this.getAttribute('ttd') || '',
|
dir = this.getAttribute('ttd') || '',
|
||||||
|
margin = parseFloat(this.getAttribute('ttm') || 0),
|
||||||
top = pos.top < window.innerHeight / 2,
|
top = pos.top < window.innerHeight / 2,
|
||||||
big = this.className.indexOf(' ttb') !== -1;
|
big = this.className.indexOf(' ttb') !== -1;
|
||||||
|
|
||||||
@@ -631,23 +710,22 @@ var tt = (function () {
|
|||||||
r.tt.style.top = '0';
|
r.tt.style.top = '0';
|
||||||
|
|
||||||
r.tt.innerHTML = msg.replace(/\$N/g, "<br />");
|
r.tt.innerHTML = msg.replace(/\$N/g, "<br />");
|
||||||
var tw = r.tt.offsetWidth,
|
|
||||||
x = pos.left + (pos.right - pos.left) / 2 - tw / 2;
|
|
||||||
|
|
||||||
if (x < 0)
|
|
||||||
x = 8;
|
|
||||||
|
|
||||||
if (x + tw >= window.innerWidth - 8) {
|
|
||||||
x = window.innerWidth - tw - 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
r.tt.style.left = x + 'px';
|
|
||||||
r.tt.style.top = top ? pos.bottom + 'px' : 'auto';
|
|
||||||
r.tt.style.bottom = top ? 'auto' : (window.innerHeight - pos.top) + 'px';
|
|
||||||
|
|
||||||
r.el.addEventListener('mouseleave', r.hide);
|
r.el.addEventListener('mouseleave', r.hide);
|
||||||
window.addEventListener('scroll', r.hide);
|
window.addEventListener('scroll', r.hide);
|
||||||
clmod(r.tt, 'show', 1);
|
clmod(r.tt, 'show', 1);
|
||||||
|
|
||||||
|
var tw = r.tt.offsetWidth,
|
||||||
|
x = pos.left + (pos.right - pos.left) / 2 - tw / 2;
|
||||||
|
|
||||||
|
if (x + tw >= window.innerWidth - 24)
|
||||||
|
x = window.innerWidth - tw - 24;
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
x = 12;
|
||||||
|
|
||||||
|
r.tt.style.left = x + 'px';
|
||||||
|
r.tt.style.top = top ? (margin + pos.bottom) + 'px' : 'auto';
|
||||||
|
r.tt.style.bottom = top ? 'auto' : (margin + window.innerHeight - pos.top) + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
r.hide = function (e) {
|
r.hide = function (e) {
|
||||||
@@ -727,6 +805,7 @@ function lf2br(txt) {
|
|||||||
var toast = (function () {
|
var toast = (function () {
|
||||||
var r = {},
|
var r = {},
|
||||||
te = null,
|
te = null,
|
||||||
|
scrolling = false,
|
||||||
obj = mknod('div');
|
obj = mknod('div');
|
||||||
|
|
||||||
obj.setAttribute('id', 'toast');
|
obj.setAttribute('id', 'toast');
|
||||||
@@ -734,8 +813,30 @@ var toast = (function () {
|
|||||||
r.visible = false;
|
r.visible = false;
|
||||||
r.txt = null;
|
r.txt = null;
|
||||||
|
|
||||||
|
function scrollchk() {
|
||||||
|
if (scrolling)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tb = ebi('toastb'),
|
||||||
|
vis = tb.offsetHeight,
|
||||||
|
all = tb.scrollHeight;
|
||||||
|
|
||||||
|
if (8 + vis >= all)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clmod(obj, 'scroll', 1);
|
||||||
|
scrolling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function unscroll() {
|
||||||
|
timer.rm(scrollchk);
|
||||||
|
clmod(obj, 'scroll');
|
||||||
|
scrolling = false;
|
||||||
|
}
|
||||||
|
|
||||||
r.hide = function (e) {
|
r.hide = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
|
unscroll();
|
||||||
clearTimeout(te);
|
clearTimeout(te);
|
||||||
clmod(obj, 'vis');
|
clmod(obj, 'vis');
|
||||||
r.visible = false;
|
r.visible = false;
|
||||||
@@ -746,11 +847,12 @@ var toast = (function () {
|
|||||||
if (ms)
|
if (ms)
|
||||||
te = setTimeout(r.hide, ms * 1000);
|
te = setTimeout(r.hide, ms * 1000);
|
||||||
|
|
||||||
obj.innerHTML = '<a href="#" id="toastc">x</a>' + lf2br(txt);
|
obj.innerHTML = '<a href="#" id="toastc">x</a><div id="toastb">' + lf2br(txt) + '</div>';
|
||||||
obj.className = cl;
|
obj.className = cl;
|
||||||
ms += obj.offsetWidth;
|
ms += obj.offsetWidth;
|
||||||
obj.className += ' vis';
|
obj.className += ' vis';
|
||||||
ebi('toastc').onclick = r.hide;
|
ebi('toastc').onclick = r.hide;
|
||||||
|
timer.add(scrollchk);
|
||||||
r.visible = true;
|
r.visible = true;
|
||||||
r.txt = txt;
|
r.txt = txt;
|
||||||
};
|
};
|
||||||
@@ -776,8 +878,12 @@ var modal = (function () {
|
|||||||
var r = {},
|
var r = {},
|
||||||
q = [],
|
q = [],
|
||||||
o = null,
|
o = null,
|
||||||
|
cb_up = null,
|
||||||
cb_ok = null,
|
cb_ok = null,
|
||||||
cb_ng = null;
|
cb_ng = null,
|
||||||
|
prim = '<a href="#" id="modal-ok">OK</a>',
|
||||||
|
sec = '<a href="#" id="modal-ng">Cancel</a>',
|
||||||
|
ok_cancel = WINDOWS ? prim + sec : sec + prim;
|
||||||
|
|
||||||
r.busy = false;
|
r.busy = false;
|
||||||
|
|
||||||
@@ -805,6 +911,8 @@ var modal = (function () {
|
|||||||
|
|
||||||
document.addEventListener('focus', onfocus);
|
document.addEventListener('focus', onfocus);
|
||||||
timer.add(onfocus);
|
timer.add(onfocus);
|
||||||
|
if (cb_up)
|
||||||
|
setTimeout(cb_up, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
r.hide = function () {
|
r.hide = function () {
|
||||||
@@ -859,41 +967,44 @@ var modal = (function () {
|
|||||||
q.shift()();
|
q.shift()();
|
||||||
}
|
}
|
||||||
|
|
||||||
r.alert = function (html, cb) {
|
r.alert = function (html, cb, fun) {
|
||||||
q.push(function () {
|
q.push(function () {
|
||||||
_alert(lf2br(html), cb);
|
_alert(lf2br(html), cb, fun);
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
function _alert(html, cb) {
|
function _alert(html, cb, fun) {
|
||||||
cb_ok = cb_ng = cb;
|
cb_ok = cb_ng = cb;
|
||||||
|
cb_up = fun;
|
||||||
html += '<div id="modalb"><a href="#" id="modal-ok">OK</a></div>';
|
html += '<div id="modalb"><a href="#" id="modal-ok">OK</a></div>';
|
||||||
r.show(html);
|
r.show(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
r.confirm = function (html, cok, cng) {
|
r.confirm = function (html, cok, cng, fun) {
|
||||||
q.push(function () {
|
q.push(function () {
|
||||||
_confirm(lf2br(html), cok, cng);
|
_confirm(lf2br(html), cok, cng, fun);
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
function _confirm(html, cok, cng) {
|
function _confirm(html, cok, cng, fun) {
|
||||||
cb_ok = cok;
|
cb_ok = cok;
|
||||||
cb_ng = cng === undefined ? cok : null;
|
cb_ng = cng === undefined ? cok : null;
|
||||||
html += '<div id="modalb"><a href="#" id="modal-ok">OK</a><a href="#" id="modal-ng">Cancel</a></div>';
|
cb_up = fun;
|
||||||
|
html += '<div id="modalb">' + ok_cancel + '</div>';
|
||||||
r.show(html);
|
r.show(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
r.prompt = function (html, v, cok, cng) {
|
r.prompt = function (html, v, cok, cng, fun) {
|
||||||
q.push(function () {
|
q.push(function () {
|
||||||
_prompt(lf2br(html), v, cok, cng);
|
_prompt(lf2br(html), v, cok, cng, fun);
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
function _prompt(html, v, cok, cng) {
|
function _prompt(html, v, cok, cng, fun) {
|
||||||
cb_ok = cok;
|
cb_ok = cok;
|
||||||
cb_ng = cng === undefined ? cok : null;
|
cb_ng = cng === undefined ? cok : null;
|
||||||
html += '<input id="modali" type="text" /><div id="modalb"><a href="#" id="modal-ok">OK</a><a href="#" id="modal-ng">Cancel</a></div>';
|
cb_up = fun;
|
||||||
|
html += '<input id="modali" type="text" /><div id="modalb">' + ok_cancel + '</div>';
|
||||||
r.show(html);
|
r.show(html);
|
||||||
|
|
||||||
ebi('modali').value = v || '';
|
ebi('modali').value = v || '';
|
||||||
@@ -914,9 +1025,69 @@ function winpopup(txt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var last_repl = null;
|
||||||
|
function repl_load() {
|
||||||
|
var ipre = ebi('repl_pre'),
|
||||||
|
tb = ebi('modali');
|
||||||
|
|
||||||
|
function getpres() {
|
||||||
|
var o, ret = jread("repl_pre", []);
|
||||||
|
if (!ret.length)
|
||||||
|
ret = [
|
||||||
|
'var v=Object.keys(localStorage); v.sort(); JSON.stringify(v)',
|
||||||
|
'console.hist.slice(-10).join("\\n")'
|
||||||
|
];
|
||||||
|
|
||||||
|
ipre.innerHTML = '<option value=""></option>';
|
||||||
|
for (var a = 0; a < ret.length; a++) {
|
||||||
|
o = mknod('option');
|
||||||
|
o.setAttribute('value', ret[a]);
|
||||||
|
o.textContent = ret[a];
|
||||||
|
ipre.appendChild(o);
|
||||||
|
}
|
||||||
|
last_repl = ipre.value = (last_repl || (ret.length ? ret.slice(-1)[0] : ''));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
ebi('repl_pdel').onclick = function (e) {
|
||||||
|
var val = ipre.value,
|
||||||
|
pres = getpres();
|
||||||
|
|
||||||
|
apop(pres, val);
|
||||||
|
jwrite('repl_pre', pres);
|
||||||
|
getpres();
|
||||||
|
};
|
||||||
|
ebi('repl_pnew').onclick = function (e) {
|
||||||
|
var val = tb.value,
|
||||||
|
pres = getpres();
|
||||||
|
|
||||||
|
apop(pres, ipre.value);
|
||||||
|
pres.push(val);
|
||||||
|
jwrite('repl_pre', pres);
|
||||||
|
getpres();
|
||||||
|
ipre.value = val;
|
||||||
|
};
|
||||||
|
ipre.oninput = ipre.onchange = function () {
|
||||||
|
tb.value = last_repl = ipre.value;
|
||||||
|
};
|
||||||
|
tb.oninput = function () {
|
||||||
|
last_repl = this.value;
|
||||||
|
};
|
||||||
|
getpres();
|
||||||
|
tb.value = last_repl;
|
||||||
|
setTimeout(function () {
|
||||||
|
tb.setSelectionRange(0, tb.value.length, "forward");
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
function repl(e) {
|
function repl(e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
modal.prompt('js repl (prefix with <code>,</code> to allow raise)', 'var v=Object.keys(localStorage); v.sort(); JSON.stringify(v)', function (cmd) {
|
var html = [
|
||||||
|
'<p>js repl (prefix with <code>,</code> to allow raise)</p>',
|
||||||
|
'<p><select id="repl_pre"></select>',
|
||||||
|
' <button id="repl_pdel">❌ del</button>',
|
||||||
|
' <button id="repl_pnew">💾 SAVE</button></p>'
|
||||||
|
];
|
||||||
|
|
||||||
|
modal.prompt(html.join(''), '', function (cmd) {
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return toast.inf(3, 'eval aborted');
|
return toast.inf(3, 'eval aborted');
|
||||||
|
|
||||||
@@ -929,7 +1100,7 @@ function repl(e) {
|
|||||||
catch (ex) {
|
catch (ex) {
|
||||||
modal.alert('<h6>exception</h6>' + esc(ex + ''));
|
modal.alert('<h6>exception</h6>' + esc(ex + ''));
|
||||||
}
|
}
|
||||||
});
|
}, undefined, repl_load);
|
||||||
}
|
}
|
||||||
if (ebi('repl'))
|
if (ebi('repl'))
|
||||||
ebi('repl').onclick = repl;
|
ebi('repl').onclick = repl;
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
/* video */
|
/* video, alternative 1:
|
||||||
|
top-left icon, just like the other formats
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
#ggrid>a:is(
|
#ggrid>a:is(
|
||||||
[href$=".mkv"i],
|
[href$=".mkv"i],
|
||||||
[href$=".mp4"i],
|
[href$=".mp4"i],
|
||||||
@@ -6,6 +9,40 @@
|
|||||||
):before {
|
):before {
|
||||||
content: '📺';
|
content: '📺';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* video, alternative 2:
|
||||||
|
play-icon in the middle of the thumbnail
|
||||||
|
=======================================================================
|
||||||
|
*/
|
||||||
|
#ggrid>a:is(
|
||||||
|
[href$=".mkv"i],
|
||||||
|
[href$=".mp4"i],
|
||||||
|
[href$=".webm"i],
|
||||||
|
) {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
#ggrid>a:is(
|
||||||
|
[href$=".mkv"i],
|
||||||
|
[href$=".mp4"i],
|
||||||
|
[href$=".webm"i],
|
||||||
|
):before {
|
||||||
|
content: '▶';
|
||||||
|
opacity: .8;
|
||||||
|
margin: 0;
|
||||||
|
padding: 1em .5em 1em .7em;
|
||||||
|
border-radius: 9em;
|
||||||
|
line-height: 0;
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: none;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
left: calc(50% - 1em);
|
||||||
|
top: calc(50% - 1.4em);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* audio */
|
/* audio */
|
||||||
@@ -21,6 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* image */
|
/* image */
|
||||||
#ggrid>a:is(
|
#ggrid>a:is(
|
||||||
[href$=".jpg"i],
|
[href$=".jpg"i],
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
/* adjust the button area a bit */
|
/* adjust the button area a bit */
|
||||||
#u2conf.has_btn {width: 35em !important; margin: 5em auto}
|
#u2conf.has_btn {width: 35em !important; margin: 5em auto}
|
||||||
|
|
||||||
|
/* a */
|
||||||
|
#op_up2k {min-height: 0}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<a href="#" onclick="this.parentNode.innerHTML='';">show advanced options</a>
|
<a href="#" onclick="this.parentNode.innerHTML='';">show advanced options</a>
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ sqlite3 .hist/up2k.db 'select * from mt where k="fgsfds" or k="t:mtp"' | tee /de
|
|||||||
for ((f=420;f<1200;f++)); do sz=$(ffmpeg -y -f lavfi -i sine=frequency=$f:duration=2 -vf volume=0.1 -ac 1 -ar 44100 -f s16le /dev/shm/a.wav 2>/dev/null; base64 -w0 </dev/shm/a.wav | gzip -c | wc -c); printf '%d %d\n' $f $sz; done | tee /dev/stderr | sort -nrk2,2
|
for ((f=420;f<1200;f++)); do sz=$(ffmpeg -y -f lavfi -i sine=frequency=$f:duration=2 -vf volume=0.1 -ac 1 -ar 44100 -f s16le /dev/shm/a.wav 2>/dev/null; base64 -w0 </dev/shm/a.wav | gzip -c | wc -c); printf '%d %d\n' $f $sz; done | tee /dev/stderr | sort -nrk2,2
|
||||||
ffmpeg -y -f lavfi -i sine=frequency=1050:duration=2 -vf volume=0.1 -ac 1 -ar 44100 /dev/shm/a.wav
|
ffmpeg -y -f lavfi -i sine=frequency=1050:duration=2 -vf volume=0.1 -ac 1 -ar 44100 /dev/shm/a.wav
|
||||||
|
|
||||||
|
# play icon calibration pics
|
||||||
|
for w in 150 170 190 210 230 250; do for h in 130 150 170 190 210; do /c/Program\ Files/ImageMagick-7.0.11-Q16-HDRI/magick.exe convert -size ${w}x${h} xc:brown -fill orange -draw "circle $((w/2)),$((h/2)) $((w/2)),$((h/3))" $w-$h.png; done; done
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## vscode
|
## vscode
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ gtar=$(command -v gtar || command -v gnutar) || true
|
|||||||
sed() { gsed "$@"; }
|
sed() { gsed "$@"; }
|
||||||
find() { gfind "$@"; }
|
find() { gfind "$@"; }
|
||||||
sort() { gsort "$@"; }
|
sort() { gsort "$@"; }
|
||||||
|
shuf() { gshuf "$@"; }
|
||||||
|
nproc() { gnproc; }
|
||||||
sha1sum() { shasum "$@"; }
|
sha1sum() { shasum "$@"; }
|
||||||
unexpand() { gunexpand "$@"; }
|
unexpand() { gunexpand "$@"; }
|
||||||
command -v grealpath >/dev/null &&
|
command -v grealpath >/dev/null &&
|
||||||
@@ -144,6 +146,7 @@ tmpdir="$(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ver=
|
ver=
|
||||||
|
[ -z "$repack" ] &&
|
||||||
git describe --tags >/dev/null 2>/dev/null && {
|
git describe --tags >/dev/null 2>/dev/null && {
|
||||||
git_ver="$(git describe --tags)"; # v0.5.5-2-gb164aa0
|
git_ver="$(git describe --tags)"; # v0.5.5-2-gb164aa0
|
||||||
ver="$(printf '%s\n' "$git_ver" | sed -r 's/^v//')";
|
ver="$(printf '%s\n' "$git_ver" | sed -r 's/^v//')";
|
||||||
@@ -224,7 +227,7 @@ done
|
|||||||
rm -rf copyparty/web/dd
|
rm -rf copyparty/web/dd
|
||||||
f=copyparty/web/browser.css
|
f=copyparty/web/browser.css
|
||||||
gzip -d "$f"
|
gzip -d "$f"
|
||||||
sed -r 's/(cursor: )url\([^)]+\), (pointer)/\1\2/; /[0-9]+% \{cursor:/d; /animation: cursor/d' <$f >t
|
sed -r 's/(cursor: ?)url\([^)]+\), ?(pointer)/\1\2/; /[0-9]+% \{cursor:/d; /animation: ?cursor/d' <$f >t
|
||||||
tmv "$f"
|
tmv "$f"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,14 +265,27 @@ done
|
|||||||
|
|
||||||
gzres() {
|
gzres() {
|
||||||
command -v pigz &&
|
command -v pigz &&
|
||||||
pk='pigz -11 -I 256' ||
|
pk='pigz -11 -I 2560' ||
|
||||||
pk='gzip'
|
pk='gzip'
|
||||||
|
|
||||||
echo "$pk"
|
np=$(nproc)
|
||||||
find | grep -E '\.(js|css)$' | grep -vF /deps/ | while IFS= read -r f; do
|
echo "$pk #$np"
|
||||||
|
|
||||||
|
while IFS=' ' read -r _ f; do
|
||||||
|
while true; do
|
||||||
|
na=$(ps auxwww | grep -F "$pk" | wc -l)
|
||||||
|
[ $na -le $np ] && break
|
||||||
|
sleep 0.2
|
||||||
|
done
|
||||||
echo -n .
|
echo -n .
|
||||||
$pk "$f"
|
$pk "$f" &
|
||||||
done
|
done < <(
|
||||||
|
find -printf '%s %p\n' |
|
||||||
|
grep -E '\.(js|css)$' |
|
||||||
|
grep -vF /deps/ |
|
||||||
|
sort -nr
|
||||||
|
)
|
||||||
|
wait
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +319,7 @@ for d in copyparty dep-j2; do find $d -type f; done |
|
|||||||
sed -r 's/(.*)\.(.*)/\2 \1/' | LC_ALL=C sort |
|
sed -r 's/(.*)\.(.*)/\2 \1/' | LC_ALL=C sort |
|
||||||
sed -r 's/([^ ]*) (.*)/\2.\1/' | grep -vE '/list1?$' > list1
|
sed -r 's/([^ ]*) (.*)/\2.\1/' | grep -vE '/list1?$' > list1
|
||||||
|
|
||||||
(grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1) >list || true
|
(grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1 | shuf) >list || true
|
||||||
|
|
||||||
echo creating tar
|
echo creating tar
|
||||||
args=(--owner=1000 --group=1000)
|
args=(--owner=1000 --group=1000)
|
||||||
|
|||||||
Reference in New Issue
Block a user