From 2f6c4e0e34829151d15e24d0aa8ae9432affaf0e Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 29 Nov 2020 19:32:22 +0100 Subject: [PATCH] refactoring --- copyparty/web/browser.html | 2 + copyparty/web/browser.js | 131 ++++----------------------------- copyparty/web/md.html | 10 +-- copyparty/web/md.js | 4 +- copyparty/web/md2.js | 7 +- copyparty/web/mde.html | 1 + copyparty/web/mde.js | 2 + copyparty/web/up2k.js | 141 +++++++++++------------------------- copyparty/web/util.js | 109 ++++++++++++++++++++++++++++ scripts/copyparty-repack.sh | 9 ++- 10 files changed, 188 insertions(+), 228 deletions(-) create mode 100644 copyparty/web/util.js diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index cc023a81..9d326ecc 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -68,6 +68,8 @@ + + {%- if can_read %} {%- endif %} diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 2871de4d..cdecea51 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1,75 +1,9 @@ "use strict"; -// error handler for mobile devices -function hcroak(msg) { - document.body.innerHTML = msg; - window.onerror = undefined; - throw 'fatal_err'; -} -function croak(msg) { - document.body.textContent = msg; - window.onerror = undefined; - throw msg; -} -function esc(txt) { - return txt.replace(/[&"<>]/g, function (c) { - return { - '&': '&', - '"': '"', - '<': '<', - '>': '>' - }[c]; - }); -} -window.onerror = function (msg, url, lineNo, columnNo, error) { - window.onerror = undefined; - var html = ['

you hit a bug!

please screenshot this error and send me a copy arigathanks gozaimuch (ed/irc.rizon.net or ed#2644)

', - esc(String(msg)), '

', esc(url + ' @' + lineNo + ':' + columnNo), '

']; - - if (error) { - var find = ['desc', 'stack', 'trace']; - for (var a = 0; a < find.length; a++) - if (String(error[find[a]]) !== 'undefined') - html.push('

' + find[a] + '

' + - esc(String(error[find[a]])).replace(/\n/g, '
\n')); - } - document.body.style.fontSize = '0.8em'; - document.body.style.padding = '0 1em 1em 1em'; - hcroak(html.join('\n')); -}; - - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith -if (!String.prototype.endsWith) { - String.prototype.endsWith = function (search, this_len) { - if (this_len === undefined || this_len > this.length) { - this_len = this.length; - } - return this.substring(this_len - search.length, this_len) === search; - }; -} - - -// https://stackoverflow.com/a/950146 -function import_js(url, cb) { - var head = document.head || document.getElementsByTagName('head')[0]; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = url; - - script.onreadystatechange = cb; - script.onload = cb; - - head.appendChild(script); -} - - -function o(id) { - return document.getElementById(id); -} +window.onerror = vis_exh; function dbg(msg) { - o('path').innerHTML = msg; + ebi('path').innerHTML = msg; } function ev(e) { @@ -78,40 +12,7 @@ function ev(e) { return e; } - -function sortTable(table, col) { - var tb = table.tBodies[0], // use `` to ignore `` and `` rows - th = table.tHead.rows[0].cells, - tr = Array.prototype.slice.call(tb.rows, 0), - i, reverse = th[col].className == 'sort1' ? -1 : 1; - for (var a = 0, thl = th.length; a < thl; a++) - th[a].className = ''; - th[col].className = 'sort' + reverse; - var stype = th[col].getAttribute('sort'); - tr = tr.sort(function (a, b) { - var v1 = a.cells[col].textContent.trim(); - var v2 = b.cells[col].textContent.trim(); - if (stype == 'int') { - v1 = parseInt(v1.replace(/,/g, '')); - v2 = parseInt(v2.replace(/,/g, '')); - return reverse * (v1 - v2); - } - return reverse * (v1.localeCompare(v2)); - }); - for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); -} -function makeSortable(table) { - var th = table.tHead, i; - th && (th = th.rows[0]) && (th = th.cells); - if (th) i = th.length; - else return; // if no `` then do nothing - while (--i >= 0) (function (i) { - th[i].onclick = function () { - sortTable(table, i); - }; - }(i)); -} -makeSortable(o('files')); +makeSortable(ebi('files')); // extract songs + add play column @@ -142,7 +43,7 @@ var mp = (function () { } for (var a = 0, aa = tracks.length; a < aa; a++) - o('trk' + a).onclick = ev_play; + ebi('trk' + a).onclick = ev_play; ret.vol = localStorage.getItem('vol'); if (ret.vol !== null) @@ -199,7 +100,7 @@ var widget = (function () { ret.paused = function (paused) { if (was_paused != paused) { was_paused = paused; - o('bplay').innerHTML = paused ? '▶' : '⏸'; + ebi('bplay').innerHTML = paused ? '▶' : '⏸'; } }; var click_handler = function (e) { @@ -223,8 +124,8 @@ var widget = (function () { // buffer/position bar var pbar = (function () { var r = {}; - r.bcan = o('barbuf'); - r.pcan = o('barpos'); + r.bcan = ebi('barbuf'); + r.pcan = ebi('barpos'); r.bctx = r.bcan.getContext('2d'); r.pctx = r.pcan.getContext('2d'); @@ -289,7 +190,7 @@ var pbar = (function () { // volume bar var vbar = (function () { var r = {}; - r.can = o('pvol'); + r.can = ebi('pvol'); r.ctx = r.can.getContext('2d'); var bctx = r.ctx; @@ -386,7 +287,7 @@ var vbar = (function () { else play(0); }; - o('bplay').onclick = function (e) { + ebi('bplay').onclick = function (e) { ev(e); if (mp.au) { if (mp.au.paused) @@ -397,15 +298,15 @@ var vbar = (function () { else play(0); }; - o('bprev').onclick = function (e) { + ebi('bprev').onclick = function (e) { ev(e); bskip(-1); }; - o('bnext').onclick = function (e) { + ebi('bnext').onclick = function (e) { ev(e); bskip(1); }; - o('barpos').onclick = function (e) { + ebi('barpos').onclick = function (e) { if (!mp.au) { //dbg((new Date()).getTime()); return play(0); @@ -471,7 +372,7 @@ function ev_play(e) { function setclass(id, clas) { - o(id).setAttribute('class', clas); + ebi(id).setAttribute('class', clas); } @@ -608,7 +509,7 @@ function show_modal(html) { // hide fullscreen message function unblocked() { - var dom = o('blocked'); + var dom = ebi('blocked'); if (dom) dom.parentNode.removeChild(dom); } @@ -620,8 +521,8 @@ function autoplay_blocked(tid) { '
' + '
Cancel
(show file list)
'); - var go = o('blk_go'); - var na = o('blk_na'); + var go = ebi('blk_go'); + var na = ebi('blk_na'); var fn = mp.tracks[mp.au.tid].split(/\//).pop(); fn = decodeURIComponent(fn.replace(/\+/g, ' ')); diff --git a/copyparty/web/md.html b/copyparty/web/md.html index fced2989..29498133 100644 --- a/copyparty/web/md.html +++ b/copyparty/web/md.html @@ -144,17 +144,11 @@ var md_opt = { toggle(); })(); -if (!String.startsWith) { - String.prototype.startsWith = function(s, i) { - i = i>0 ? i|0 : 0; - return this.substring(i, i + s.length) === s; - }; -} - + {%- if edit %} - + {%- endif %} diff --git a/copyparty/web/md.js b/copyparty/web/md.js index 73666c12..68b0a6a5 100644 --- a/copyparty/web/md.js +++ b/copyparty/web/md.js @@ -1,3 +1,5 @@ +"use strict"; + var dom_toc = document.getElementById('toc'); var dom_wrap = document.getElementById('mw'); var dom_hbar = document.getElementById('mh'); @@ -34,7 +36,7 @@ function cls(dom, name, add) { } -function static(obj) { +function statify(obj) { return JSON.parse(JSON.stringify(obj)); } diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js index 2b12b9fb..0db410db 100644 --- a/copyparty/web/md2.js +++ b/copyparty/web/md2.js @@ -1,3 +1,6 @@ +"use strict"; + + // server state var server_md = dom_src.value; @@ -1000,9 +1003,9 @@ action_stack = (function () { ref = newtxt; dbg('undos(%d) redos(%d)', hist.un.length, hist.re.length); if (hist.un.length > 0) - dbg(static(hist.un.slice(-1)[0])); + dbg(statify(hist.un.slice(-1)[0])); if (hist.re.length > 0) - dbg(static(hist.re.slice(-1)[0])); + dbg(statify(hist.re.slice(-1)[0])); } return { diff --git a/copyparty/web/mde.html b/copyparty/web/mde.html index 0666ff5d..7a6847fa 100644 --- a/copyparty/web/mde.html +++ b/copyparty/web/mde.html @@ -42,6 +42,7 @@ var lightswitch = (function () { })(); + diff --git a/copyparty/web/mde.js b/copyparty/web/mde.js index fd16cba0..4630bd39 100644 --- a/copyparty/web/mde.js +++ b/copyparty/web/mde.js @@ -1,3 +1,5 @@ +"use strict"; + var dom_wrap = document.getElementById('mw'); var dom_nav = document.getElementById('mn'); var dom_doc = document.getElementById('m'); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 7340f7b2..d827c563 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1,61 +1,6 @@ "use strict"; -// error handler for mobile devices -function hcroak(msg) { - document.body.innerHTML = msg; - window.onerror = undefined; - throw 'fatal_err'; -} -function croak(msg) { - document.body.textContent = msg; - window.onerror = undefined; - throw msg; -} -function esc(txt) { - return txt.replace(/[&"<>]/g, function (c) { - return { - '&': '&', - '"': '"', - '<': '<', - '>': '>' - }[c]; - }); -} -window.onerror = function (msg, url, lineNo, columnNo, error) { - window.onerror = undefined; - var html = ['

you hit a bug!

please screenshot this error and send me a copy arigathanks gozaimuch (ed/irc.rizon.net or ed#2644)

', - esc(String(msg)), '

', esc(url + ' @' + lineNo + ':' + columnNo), '

']; - - if (error) { - var find = ['desc', 'stack', 'trace']; - for (var a = 0; a < find.length; a++) - if (String(error[find[a]]) !== 'undefined') - html.push('

' + find[a] + '

' + - esc(String(error[find[a]])).replace(/\n/g, '
\n')); - } - document.body.style.fontSize = '0.8em'; - document.body.style.padding = '0 1em 1em 1em'; - hcroak(html.join('\n')); -}; - - -// https://stackoverflow.com/a/950146 -function import_js(url, cb) { - var head = document.head || document.getElementsByTagName('head')[0]; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = url; - - script.onreadystatechange = cb; - script.onload = cb; - - head.appendChild(script); -} - - -function o(id) { - return document.getElementById(id); -} +window.onerror = vis_exh; (function () { @@ -150,21 +95,21 @@ function up2k_init(have_crypto) { // show modal message function showmodal(msg) { - o('u2notbtn').innerHTML = msg; - o('u2btn').style.display = 'none'; - o('u2notbtn').style.display = 'block'; - o('u2conf').style.opacity = '0.5'; + ebi('u2notbtn').innerHTML = msg; + ebi('u2btn').style.display = 'none'; + ebi('u2notbtn').style.display = 'block'; + ebi('u2conf').style.opacity = '0.5'; } // hide modal message function unmodal() { - o('u2notbtn').style.display = 'none'; - o('u2btn').style.display = 'block'; - o('u2conf').style.opacity = '1'; - o('u2notbtn').innerHTML = ''; + ebi('u2notbtn').style.display = 'none'; + ebi('u2btn').style.display = 'block'; + ebi('u2conf').style.opacity = '1'; + ebi('u2notbtn').innerHTML = ''; } - var post_url = o('op_bup').getElementsByTagName('form')[0].getAttribute('action'); + var post_url = ebi('op_bup').getElementsByTagName('form')[0].getAttribute('action'); if (post_url && post_url.charAt(post_url.length - 1) !== '/') post_url += '/'; @@ -181,25 +126,25 @@ function up2k_init(have_crypto) { import_js('/.cpr/deps/sha512.js', unmodal); if (is_https) - o('u2foot').innerHTML = shame + ' so this uploader will do like 500kB/s at best'; + ebi('u2foot').innerHTML = shame + ' so this uploader will do like 500kB/s at best'; else - o('u2foot').innerHTML = 'seems like ' + shame + ' so do that if you want more performance'; + ebi('u2foot').innerHTML = 'seems like ' + shame + ' so do that if you want more performance'; } }; // show uploader if the user only has write-access - if (!o('files')) + if (!ebi('files')) goto('up2k'); // shows or clears an error message in the basic uploader ui function setmsg(msg) { if (msg !== undefined) { - o('u2err').setAttribute('class', 'err'); - o('u2err').innerHTML = msg; + ebi('u2err').setAttribute('class', 'err'); + ebi('u2err').innerHTML = msg; } else { - o('u2err').setAttribute('class', ''); - o('u2err').innerHTML = ''; + ebi('u2err').setAttribute('class', ''); + ebi('u2err').innerHTML = ''; } } @@ -210,7 +155,7 @@ function up2k_init(have_crypto) { } // handle user intent to use the basic uploader instead - o('u2nope').onclick = function (e) { + ebi('u2nope').onclick = function (e) { e.preventDefault(); setmsg(''); goto('bup'); @@ -229,9 +174,9 @@ function up2k_init(have_crypto) { function cfg_get(name) { var val = localStorage.getItem(name); if (val === null) - return parseInt(o(name).value); + return parseInt(ebi(name).value); - o(name).value = val; + ebi(name).value = val; return val; } @@ -242,7 +187,7 @@ function up2k_init(have_crypto) { else val = (val == '1'); - o(name).checked = val; + ebi(name).checked = val; return val; } @@ -250,7 +195,7 @@ function up2k_init(have_crypto) { localStorage.setItem( name, val ? '1' : '0'); - o(name).checked = val; + ebi(name).checked = val; return val; } @@ -284,9 +229,9 @@ function up2k_init(have_crypto) { return un2k("this is the basic uploader; up2k needs at least
chrome 21 // firefox 13 // edge 12 // opera 12 // safari 5.1"); function nav() { - o('file' + fdom_ctr).click(); + ebi('file' + fdom_ctr).click(); } - o('u2btn').addEventListener('click', nav, false); + ebi('u2btn').addEventListener('click', nav, false); function ondrag(ev) { ev.stopPropagation(); @@ -294,8 +239,8 @@ function up2k_init(have_crypto) { ev.dataTransfer.dropEffect = 'copy'; ev.dataTransfer.effectAllowed = 'copy'; } - o('u2btn').addEventListener('dragover', ondrag, false); - o('u2btn').addEventListener('dragenter', ondrag, false); + ebi('u2btn').addEventListener('dragover', ondrag, false); + ebi('u2btn').addEventListener('dragenter', ondrag, false); function gotfile(ev) { ev.stopPropagation(); @@ -357,7 +302,7 @@ function up2k_init(have_crypto) { var tr = document.createElement('tr'); tr.innerHTML = 'hashing'.format(st.files.length); tr.getElementsByTagName('td')[0].textContent = entry.name; - o('u2tab').appendChild(tr); + ebi('u2tab').appendChild(tr); st.files.push(entry); st.todo.hash.push(entry); @@ -374,14 +319,14 @@ function up2k_init(have_crypto) { alert(msg); } } - o('u2btn').addEventListener('drop', gotfile, false); + ebi('u2btn').addEventListener('drop', gotfile, false); function more_one_file() { fdom_ctr++; var elm = document.createElement('div') elm.innerHTML = ''.format(fdom_ctr); - o('u2form').appendChild(elm); - o('file' + fdom_ctr).addEventListener('change', gotfile, false); + ebi('u2form').appendChild(elm); + ebi('file' + fdom_ctr).addEventListener('change', gotfile, false); } more_one_file(); @@ -602,7 +547,7 @@ function up2k_init(have_crypto) { pb_html += '
'.format( t.n, a, pb_perc); - o('f{0}p'.format(t.n)).innerHTML = pb_html; + ebi('f{0}p'.format(t.n)).innerHTML = pb_html; var reader = new FileReader(); @@ -677,7 +622,7 @@ function up2k_init(have_crypto) { alert('{0} ms, {1} MB/s\n'.format(t.t2 - t.t1, spd.toFixed(3)) + t.hash.join('\n')); } - o('f{0}t'.format(t.n)).innerHTML = 'connecting'; + ebi('f{0}t'.format(t.n)).innerHTML = 'connecting'; st.busy.hash.splice(st.busy.hash.indexOf(t), 1); st.todo.handshake.push(t); }; @@ -706,7 +651,7 @@ function up2k_init(have_crypto) { if (response.name !== t.name) { // file exists; server renamed us t.name = response.name; - o('f{0}n'.format(t.n)).textContent = t.name; + ebi('f{0}n'.format(t.n)).textContent = t.name; } t.postlist = []; @@ -736,13 +681,13 @@ function up2k_init(have_crypto) { msg = 'uploading'; done = false; } - o('f{0}t'.format(t.n)).innerHTML = msg; + ebi('f{0}t'.format(t.n)).innerHTML = msg; st.busy.handshake.splice(st.busy.handshake.indexOf(t), 1); if (done) { var spd1 = (t.size / ((t.t2 - t.t1) / 1000.)) / (1024 * 1024.); var spd2 = (t.size / ((t.t3 - t.t2) / 1000.)) / (1024 * 1024.); - o('f{0}p'.format(t.n)).innerHTML = 'hash {0}, up {1} MB/s'.format( + ebi('f{0}p'.format(t.n)).innerHTML = 'hash {0}, up {1} MB/s'.format( spd1.toFixed(2), spd2.toFixed(2)); } tasker(); @@ -803,7 +748,7 @@ function up2k_init(have_crypto) { t.postlist.splice(t.postlist.indexOf(npart), 1); if (t.postlist.length == 0) { t.t3 = new Date().getTime(); - o('f{0}t'.format(t.n)).innerHTML = 'verifying'; + ebi('f{0}t'.format(t.n)).innerHTML = 'verifying'; st.todo.handshake.push(t); } tasker(); @@ -834,7 +779,7 @@ function up2k_init(have_crypto) { // function prog(nfile, nchunk, color, percent) { - var n1 = o('f{0}p{1}'.format(nfile, nchunk)); + var n1 = ebi('f{0}p{1}'.format(nfile, nchunk)); var n2 = n1.getElementsByTagName('div')[0]; if (percent === undefined) { n1.style.background = color; @@ -857,7 +802,7 @@ function up2k_init(have_crypto) { dir.preventDefault(); } catch (ex) { } - var obj = o('nthread'); + var obj = ebi('nthread'); if (dir.target) { obj.style.background = '#922'; var v = Math.floor(parseInt(obj.value)); @@ -892,19 +837,19 @@ function up2k_init(have_crypto) { this.click(); } - o('nthread_add').onclick = function (ev) { + ebi('nthread_add').onclick = function (ev) { ev.preventDefault(); bumpthread(1); }; - o('nthread_sub').onclick = function (ev) { + ebi('nthread_sub').onclick = function (ev) { ev.preventDefault(); bumpthread(-1); }; - o('nthread').addEventListener('input', bumpthread, false); - o('multitask').addEventListener('click', tgl_multitask, false); + ebi('nthread').addEventListener('input', bumpthread, false); + ebi('multitask').addEventListener('click', tgl_multitask, false); - var nodes = o('u2conf').getElementsByTagName('a'); + var nodes = ebi('u2conf').getElementsByTagName('a'); for (var a = nodes.length - 1; a >= 0; a--) nodes[a].addEventListener('touchend', nop, false); diff --git a/copyparty/web/util.js b/copyparty/web/util.js new file mode 100644 index 00000000..f8aae712 --- /dev/null +++ b/copyparty/web/util.js @@ -0,0 +1,109 @@ +"use strict"; + +// error handler for mobile devices +function hcroak(msg) { + document.body.innerHTML = msg; + window.onerror = undefined; + throw 'fatal_err'; +} +function croak(msg) { + document.body.textContent = msg; + window.onerror = undefined; + throw msg; +} +function esc(txt) { + return txt.replace(/[&"<>]/g, function (c) { + return { + '&': '&', + '"': '"', + '<': '<', + '>': '>' + }[c]; + }); +} +function vis_exh(msg, url, lineNo, columnNo, error) { + window.onerror = undefined; + var html = ['

you hit a bug!

please screenshot this error and send me a copy arigathanks gozaimuch (ed/irc.rizon.net or ed#2644)

', + esc(String(msg)), '

', esc(url + ' @' + lineNo + ':' + columnNo), '

']; + + if (error) { + var find = ['desc', 'stack', 'trace']; + for (var a = 0; a < find.length; a++) + if (String(error[find[a]]) !== 'undefined') + html.push('

' + find[a] + '

' + + esc(String(error[find[a]])).replace(/\n/g, '
\n')); + } + document.body.style.fontSize = '0.8em'; + document.body.style.padding = '0 1em 1em 1em'; + hcroak(html.join('\n')); +}; + + +function ebi(id) { + return document.getElementById(id); +} + + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +if (!String.prototype.endsWith) { + String.prototype.endsWith = function (search, this_len) { + if (this_len === undefined || this_len > this.length) { + this_len = this.length; + } + return this.substring(this_len - search.length, this_len) === search; + }; +} +if (!String.startsWith) { + String.prototype.startsWith = function (s, i) { + i = i > 0 ? i | 0 : 0; + return this.substring(i, i + s.length) === s; + }; +} + + +// https://stackoverflow.com/a/950146 +function import_js(url, cb) { + var head = document.head || document.getElementsByTagName('head')[0]; + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = url; + + script.onreadystatechange = cb; + script.onload = cb; + + head.appendChild(script); +} + + +function sortTable(table, col) { + var tb = table.tBodies[0], // use `` to ignore `` and `` rows + th = table.tHead.rows[0].cells, + tr = Array.prototype.slice.call(tb.rows, 0), + i, reverse = th[col].className == 'sort1' ? -1 : 1; + for (var a = 0, thl = th.length; a < thl; a++) + th[a].className = ''; + th[col].className = 'sort' + reverse; + var stype = th[col].getAttribute('sort'); + tr = tr.sort(function (a, b) { + var v1 = a.cells[col].textContent.trim(); + var v2 = b.cells[col].textContent.trim(); + if (stype == 'int') { + v1 = parseInt(v1.replace(/,/g, '')); + v2 = parseInt(v2.replace(/,/g, '')); + return reverse * (v1 - v2); + } + return reverse * (v1.localeCompare(v2)); + }); + for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); +} +function makeSortable(table) { + var th = table.tHead, i; + th && (th = th.rows[0]) && (th = th.cells); + if (th) i = th.length; + else return; // if no `` then do nothing + while (--i >= 0) (function (i) { + th[i].onclick = function () { + sortTable(table, i); + }; + }(i)); +} \ No newline at end of file diff --git a/scripts/copyparty-repack.sh b/scripts/copyparty-repack.sh index 8296fad7..a6c3d77f 100755 --- a/scripts/copyparty-repack.sh +++ b/scripts/copyparty-repack.sh @@ -19,6 +19,7 @@ set -e # -rwxr-xr-x 0 ed ed 183808 Nov 19 00:43 copyparty-extras/sfx-lite/copyparty-sfx.py +command -v gtar && tar=gtar || tar=tar td="$(mktemp -d)" od="$(pwd)" cd "$td" @@ -28,7 +29,7 @@ pwd # debug: if cache exists, use that instead of bothering github cache="$od/.copyparty-repack.cache" [ -e "$cache" ] && - tar -xvf "$cache" || + $tar -xvf "$cache" || { # get download links from github curl https://api.github.com/repos/9001/copyparty/releases/latest | @@ -43,7 +44,7 @@ cache="$od/.copyparty-repack.cache" tr -d '\r' | tr '\n' '\0' | xargs -0 curl -L --remote-name-all # debug: create cache - #tar -czvf "$cache" * + #$tar -czvf "$cache" * } @@ -56,7 +57,7 @@ mv copyparty-*.tar.gz copyparty-extras/ # unpack the source code ( cd copyparty-extras/ -tar -xvf *.tar.gz +$tar -xvf *.tar.gz ) @@ -92,7 +93,7 @@ cp -pv "$od/$0" copyparty-extras/ # create the bundle fn=copyparty-$(date +%Y-%m%d-%H%M%S).tgz -tar -czvf "$od/$fn" * +$tar -czvf "$od/$fn" * cd "$od" rm -rf "$td"