mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 00:22:13 -06:00
this commit sponsored by eslint
This commit is contained in:
parent
19b09c898a
commit
c4b322b883
12
.eslintrc.json
Normal file
12
.eslintrc.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
|
@ -756,9 +756,12 @@ class HttpCli(object):
|
|||
cli_dt = time.strptime(cli_lastmod, "%a, %d %b %Y %H:%M:%S GMT")
|
||||
cli_ts = calendar.timegm(cli_dt)
|
||||
return file_lastmod, int(file_ts) > int(cli_ts)
|
||||
except:
|
||||
self.log("bad lastmod format: {}".format(cli_lastmod))
|
||||
self.log(" expected format: {}".format(file_lastmod))
|
||||
except Exception as ex:
|
||||
self.log(
|
||||
"lastmod {}\nremote: [{}]\n local: [{}]".format(
|
||||
repr(ex), cli_lastmod, file_lastmod
|
||||
)
|
||||
)
|
||||
return file_lastmod, file_lastmod != cli_lastmod
|
||||
|
||||
return file_lastmod, True
|
||||
|
|
|
@ -25,7 +25,7 @@ var mp = (function () {
|
|||
'tracks': tracks,
|
||||
'cover_url': ''
|
||||
};
|
||||
var re_audio = new RegExp('\.(opus|ogg|m4a|aac|mp3|wav|flac)$', 'i');
|
||||
var re_audio = /\.(opus|ogg|m4a|aac|mp3|wav|flac)$/i;
|
||||
|
||||
var trs = ebi('files').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
||||
for (var a = 0, aa = trs.length; a < aa; a++) {
|
||||
|
@ -468,7 +468,6 @@ function play(tid, call_depth) {
|
|||
function evau_error(e) {
|
||||
var err = '';
|
||||
var eplaya = (e && e.target) || (window.event && window.event.srcElement);
|
||||
var url = eplaya.src;
|
||||
|
||||
switch (eplaya.error.code) {
|
||||
case eplaya.error.MEDIA_ERR_ABORTED:
|
||||
|
@ -516,7 +515,7 @@ function unblocked() {
|
|||
|
||||
|
||||
// show ui to manually start playback of a linked song
|
||||
function autoplay_blocked(tid) {
|
||||
function autoplay_blocked() {
|
||||
show_modal(
|
||||
'<div id="blk_play"><a href="#" id="blk_go"></a></div>' +
|
||||
'<div id="blk_abrt"><a href="#" id="blk_na">Cancel<br />(show file list)</a></div>');
|
||||
|
|
|
@ -299,7 +299,7 @@ function convert_markdown(md_text, dest_dom) {
|
|||
}
|
||||
|
||||
// separate <code> for each line in <pre>
|
||||
var nodes = md_dom.getElementsByTagName('pre');
|
||||
nodes = md_dom.getElementsByTagName('pre');
|
||||
for (var a = nodes.length - 1; a >= 0; a--) {
|
||||
var el = nodes[a];
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ redraw = (function () {
|
|||
onresize();
|
||||
}
|
||||
function modetoggle() {
|
||||
mode = dom_nsbs.innerHTML;
|
||||
var mode = dom_nsbs.innerHTML;
|
||||
dom_nsbs.innerHTML = mode == 'editor' ? 'preview' : 'editor';
|
||||
mode += ' single';
|
||||
dom_wrap.setAttribute('class', mode);
|
||||
|
@ -304,7 +304,7 @@ function Modpoll() {
|
|||
this.periodic();
|
||||
|
||||
return this;
|
||||
};
|
||||
}
|
||||
var modpoll = new Modpoll();
|
||||
|
||||
|
||||
|
@ -743,7 +743,8 @@ function fmt_table(e) {
|
|||
lpipe = tab[1].indexOf('|') < tab[1].indexOf('-'),
|
||||
rpipe = tab[1].lastIndexOf('|') > tab[1].lastIndexOf('-'),
|
||||
re_lpipe = lpipe ? /^\s*\|\s*/ : /^\s*/,
|
||||
re_rpipe = rpipe ? /\s*\|\s*$/ : /\s*$/;
|
||||
re_rpipe = rpipe ? /\s*\|\s*$/ : /\s*$/,
|
||||
ncols;
|
||||
|
||||
// the second row defines the table,
|
||||
// need to process that first
|
||||
|
@ -868,9 +869,8 @@ function mark_uni(e) {
|
|||
dom_tbox.setAttribute('class', '');
|
||||
|
||||
var txt = dom_src.value,
|
||||
ptn = new RegExp('([^' + js_uni_whitelist + ']+)', 'g');
|
||||
|
||||
mod = txt.replace(/\r/g, "").replace(ptn, "\u2588\u2770$1\u2771");
|
||||
ptn = new RegExp('([^' + js_uni_whitelist + ']+)', 'g'),
|
||||
mod = txt.replace(/\r/g, "").replace(ptn, "\u2588\u2770$1\u2771");
|
||||
|
||||
if (txt == mod) {
|
||||
alert('no results; no modifications were made');
|
||||
|
@ -906,7 +906,12 @@ function iter_uni(e) {
|
|||
// configure whitelist
|
||||
function cfg_uni(e) {
|
||||
if (e) e.preventDefault();
|
||||
esc_uni_whitelist = prompt("unicode whitelist", esc_uni_whitelist);
|
||||
|
||||
var reply = prompt("unicode whitelist", esc_uni_whitelist);
|
||||
if (reply === null)
|
||||
return;
|
||||
|
||||
esc_uni_whitelist = reply;
|
||||
js_uni_whitelist = eval('\'' + esc_uni_whitelist + '\'');
|
||||
}
|
||||
|
||||
|
@ -1126,7 +1131,6 @@ action_stack = (function () {
|
|||
}
|
||||
|
||||
return {
|
||||
push: push,
|
||||
undo: undo,
|
||||
redo: redo,
|
||||
push: schedule_push,
|
||||
|
|
|
@ -33,7 +33,7 @@ function goto(dest) {
|
|||
for (var a = obj.length - 1; a >= 0; a--)
|
||||
obj[a].classList.remove('act');
|
||||
|
||||
var obj = document.querySelectorAll('#ops>a');
|
||||
obj = document.querySelectorAll('#ops>a');
|
||||
for (var a = obj.length - 1; a >= 0; a--)
|
||||
obj[a].classList.remove('act');
|
||||
|
||||
|
@ -130,7 +130,7 @@ function up2k_init(have_crypto) {
|
|||
else
|
||||
ebi('u2foot').innerHTML = 'seems like ' + shame + ' so do that if you want more performance';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// show uploader if the user only has write-access
|
||||
if (!ebi('files'))
|
||||
|
@ -396,17 +396,6 @@ function up2k_init(have_crypto) {
|
|||
/// hashing
|
||||
//
|
||||
|
||||
// https://gist.github.com/jonleighton/958841
|
||||
function buf2b64_maybe_fucky(buffer) {
|
||||
var ret = '';
|
||||
var view = new DataView(buffer);
|
||||
for (var i = 0; i < view.byteLength; i++) {
|
||||
ret += String.fromCharCode(view.getUint8(i));
|
||||
}
|
||||
return window.btoa(ret).replace(
|
||||
/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
||||
}
|
||||
|
||||
// https://gist.github.com/jonleighton/958841
|
||||
function buf2b64(arrayBuffer) {
|
||||
var base64 = '';
|
||||
|
@ -447,20 +436,6 @@ function up2k_init(have_crypto) {
|
|||
return base64;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
|
||||
function buf2hex(buffer) {
|
||||
var hexCodes = [];
|
||||
var view = new DataView(buffer);
|
||||
for (var i = 0; i < view.byteLength; i += 4) {
|
||||
var value = view.getUint32(i) // 4 bytes per iter
|
||||
var stringValue = value.toString(16) // doesn't pad
|
||||
var padding = '00000000'
|
||||
var paddedValue = (padding + stringValue).slice(-padding.length)
|
||||
hexCodes.push(paddedValue);
|
||||
}
|
||||
return hexCodes.join("");
|
||||
}
|
||||
|
||||
function get_chunksize(filesize) {
|
||||
var chunksize = 1024 * 1024;
|
||||
var stepsize = 512 * 1024;
|
||||
|
|
|
@ -36,7 +36,7 @@ function vis_exh(msg, url, lineNo, columnNo, error) {
|
|||
document.body.style.fontSize = '0.8em';
|
||||
document.body.style.padding = '0 1em 1em 1em';
|
||||
hcroak(html.join('\n'));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function ebi(id) {
|
||||
|
|
|
@ -72,7 +72,6 @@ chmod 755 \
|
|||
( cd copyparty-extras/sfx-full/
|
||||
./copyparty-sfx.py -h
|
||||
cd ../copyparty-*/
|
||||
sed -ri 's`^command -v git >/dev/null`false`' ./scripts/make-sfx.sh # TODO remove on next rls
|
||||
./scripts/make-sfx.sh re no-ogv no-cm
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue