Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d9057cc62 | ||
|
|
c4b322b883 | ||
|
|
19b09c898a |
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": {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (0, 5, 7)
|
VERSION = (0, 6, 0)
|
||||||
CODENAME = "fuse jelly"
|
CODENAME = "CHRISTMAAAAAS"
|
||||||
BUILD_DT = (2020, 11, 30)
|
BUILD_DT = (2020, 12, 1)
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -756,9 +756,12 @@ class HttpCli(object):
|
|||||||
cli_dt = time.strptime(cli_lastmod, "%a, %d %b %Y %H:%M:%S GMT")
|
cli_dt = time.strptime(cli_lastmod, "%a, %d %b %Y %H:%M:%S GMT")
|
||||||
cli_ts = calendar.timegm(cli_dt)
|
cli_ts = calendar.timegm(cli_dt)
|
||||||
return file_lastmod, int(file_ts) > int(cli_ts)
|
return file_lastmod, int(file_ts) > int(cli_ts)
|
||||||
except:
|
except Exception as ex:
|
||||||
self.log("bad lastmod format: {}".format(cli_lastmod))
|
self.log(
|
||||||
self.log(" expected format: {}".format(file_lastmod))
|
"lastmod {}\nremote: [{}]\n local: [{}]".format(
|
||||||
|
repr(ex), cli_lastmod, file_lastmod
|
||||||
|
)
|
||||||
|
)
|
||||||
return file_lastmod, file_lastmod != cli_lastmod
|
return file_lastmod, file_lastmod != cli_lastmod
|
||||||
|
|
||||||
return file_lastmod, True
|
return file_lastmod, True
|
||||||
|
|||||||
12
copyparty/web/Makefile
Normal file
12
copyparty/web/Makefile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# run me to zopfli all the static files
|
||||||
|
# which should help on really slow connections
|
||||||
|
# but then why are you using copyparty in the first place
|
||||||
|
|
||||||
|
pk: $(addsuffix .gz, $(wildcard *.js *.css))
|
||||||
|
un: $(addsuffix .un, $(wildcard *.gz))
|
||||||
|
|
||||||
|
%.gz: %
|
||||||
|
pigz -11 -J 34 -I 5730 $<
|
||||||
|
|
||||||
|
%.un: %
|
||||||
|
pigz -d $<
|
||||||
@@ -25,7 +25,7 @@ var mp = (function () {
|
|||||||
'tracks': tracks,
|
'tracks': tracks,
|
||||||
'cover_url': ''
|
'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');
|
var trs = ebi('files').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
||||||
for (var a = 0, aa = trs.length; a < aa; a++) {
|
for (var a = 0, aa = trs.length; a < aa; a++) {
|
||||||
@@ -468,7 +468,6 @@ function play(tid, call_depth) {
|
|||||||
function evau_error(e) {
|
function evau_error(e) {
|
||||||
var err = '';
|
var err = '';
|
||||||
var eplaya = (e && e.target) || (window.event && window.event.srcElement);
|
var eplaya = (e && e.target) || (window.event && window.event.srcElement);
|
||||||
var url = eplaya.src;
|
|
||||||
|
|
||||||
switch (eplaya.error.code) {
|
switch (eplaya.error.code) {
|
||||||
case eplaya.error.MEDIA_ERR_ABORTED:
|
case eplaya.error.MEDIA_ERR_ABORTED:
|
||||||
@@ -516,7 +515,7 @@ function unblocked() {
|
|||||||
|
|
||||||
|
|
||||||
// show ui to manually start playback of a linked song
|
// show ui to manually start playback of a linked song
|
||||||
function autoplay_blocked(tid) {
|
function autoplay_blocked() {
|
||||||
show_modal(
|
show_modal(
|
||||||
'<div id="blk_play"><a href="#" id="blk_go"></a></div>' +
|
'<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>');
|
'<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>
|
// 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--) {
|
for (var a = nodes.length - 1; a >= 0; a--) {
|
||||||
var el = nodes[a];
|
var el = nodes[a];
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ redraw = (function () {
|
|||||||
onresize();
|
onresize();
|
||||||
}
|
}
|
||||||
function modetoggle() {
|
function modetoggle() {
|
||||||
mode = dom_nsbs.innerHTML;
|
var mode = dom_nsbs.innerHTML;
|
||||||
dom_nsbs.innerHTML = mode == 'editor' ? 'preview' : 'editor';
|
dom_nsbs.innerHTML = mode == 'editor' ? 'preview' : 'editor';
|
||||||
mode += ' single';
|
mode += ' single';
|
||||||
dom_wrap.setAttribute('class', mode);
|
dom_wrap.setAttribute('class', mode);
|
||||||
@@ -304,7 +304,7 @@ function Modpoll() {
|
|||||||
this.periodic();
|
this.periodic();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
var modpoll = new Modpoll();
|
var modpoll = new Modpoll();
|
||||||
|
|
||||||
|
|
||||||
@@ -743,7 +743,8 @@ function fmt_table(e) {
|
|||||||
lpipe = tab[1].indexOf('|') < tab[1].indexOf('-'),
|
lpipe = tab[1].indexOf('|') < tab[1].indexOf('-'),
|
||||||
rpipe = tab[1].lastIndexOf('|') > tab[1].lastIndexOf('-'),
|
rpipe = tab[1].lastIndexOf('|') > tab[1].lastIndexOf('-'),
|
||||||
re_lpipe = lpipe ? /^\s*\|\s*/ : /^\s*/,
|
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,
|
// the second row defines the table,
|
||||||
// need to process that first
|
// need to process that first
|
||||||
@@ -868,9 +869,8 @@ function mark_uni(e) {
|
|||||||
dom_tbox.setAttribute('class', '');
|
dom_tbox.setAttribute('class', '');
|
||||||
|
|
||||||
var txt = dom_src.value,
|
var txt = dom_src.value,
|
||||||
ptn = new RegExp('([^' + js_uni_whitelist + ']+)', 'g');
|
ptn = new RegExp('([^' + js_uni_whitelist + ']+)', 'g'),
|
||||||
|
mod = txt.replace(/\r/g, "").replace(ptn, "\u2588\u2770$1\u2771");
|
||||||
mod = txt.replace(/\r/g, "").replace(ptn, "\u2588\u2770$1\u2771");
|
|
||||||
|
|
||||||
if (txt == mod) {
|
if (txt == mod) {
|
||||||
alert('no results; no modifications were made');
|
alert('no results; no modifications were made');
|
||||||
@@ -906,7 +906,12 @@ function iter_uni(e) {
|
|||||||
// configure whitelist
|
// configure whitelist
|
||||||
function cfg_uni(e) {
|
function cfg_uni(e) {
|
||||||
if (e) e.preventDefault();
|
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 + '\'');
|
js_uni_whitelist = eval('\'' + esc_uni_whitelist + '\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,7 +1131,6 @@ action_stack = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
push: push,
|
|
||||||
undo: undo,
|
undo: undo,
|
||||||
redo: redo,
|
redo: redo,
|
||||||
push: schedule_push,
|
push: schedule_push,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function goto(dest) {
|
|||||||
for (var a = obj.length - 1; a >= 0; a--)
|
for (var a = obj.length - 1; a >= 0; a--)
|
||||||
obj[a].classList.remove('act');
|
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--)
|
for (var a = obj.length - 1; a >= 0; a--)
|
||||||
obj[a].classList.remove('act');
|
obj[a].classList.remove('act');
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ function up2k_init(have_crypto) {
|
|||||||
else
|
else
|
||||||
ebi('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
|
// show uploader if the user only has write-access
|
||||||
if (!ebi('files'))
|
if (!ebi('files'))
|
||||||
@@ -396,17 +396,6 @@ function up2k_init(have_crypto) {
|
|||||||
/// hashing
|
/// 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
|
// https://gist.github.com/jonleighton/958841
|
||||||
function buf2b64(arrayBuffer) {
|
function buf2b64(arrayBuffer) {
|
||||||
var base64 = '';
|
var base64 = '';
|
||||||
@@ -447,20 +436,6 @@ function up2k_init(have_crypto) {
|
|||||||
return base64;
|
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) {
|
function get_chunksize(filesize) {
|
||||||
var chunksize = 1024 * 1024;
|
var chunksize = 1024 * 1024;
|
||||||
var stepsize = 512 * 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.fontSize = '0.8em';
|
||||||
document.body.style.padding = '0 1em 1em 1em';
|
document.body.style.padding = '0 1em 1em 1em';
|
||||||
hcroak(html.join('\n'));
|
hcroak(html.join('\n'));
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
function ebi(id) {
|
function ebi(id) {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ set -e
|
|||||||
# -rwxr-xr-x 0 ed ed 183808 Nov 19 00:43 copyparty-extras/sfx-lite/copyparty-sfx.py
|
# -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
|
command -v gtar && tar() { gtar "$@"; }
|
||||||
|
command -v gsed && sed() { gsed "$@"; }
|
||||||
td="$(mktemp -d)"
|
td="$(mktemp -d)"
|
||||||
od="$(pwd)"
|
od="$(pwd)"
|
||||||
cd "$td"
|
cd "$td"
|
||||||
@@ -29,7 +30,7 @@ pwd
|
|||||||
# debug: if cache exists, use that instead of bothering github
|
# debug: if cache exists, use that instead of bothering github
|
||||||
cache="$od/.copyparty-repack.cache"
|
cache="$od/.copyparty-repack.cache"
|
||||||
[ -e "$cache" ] &&
|
[ -e "$cache" ] &&
|
||||||
$tar -xvf "$cache" ||
|
tar -xvf "$cache" ||
|
||||||
{
|
{
|
||||||
# get download links from github
|
# get download links from github
|
||||||
curl https://api.github.com/repos/9001/copyparty/releases/latest |
|
curl https://api.github.com/repos/9001/copyparty/releases/latest |
|
||||||
@@ -44,7 +45,7 @@ cache="$od/.copyparty-repack.cache"
|
|||||||
tr -d '\r' | tr '\n' '\0' | xargs -0 curl -L --remote-name-all
|
tr -d '\r' | tr '\n' '\0' | xargs -0 curl -L --remote-name-all
|
||||||
|
|
||||||
# debug: create cache
|
# debug: create cache
|
||||||
#$tar -czvf "$cache" *
|
#tar -czvf "$cache" *
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ mv copyparty-*.tar.gz copyparty-extras/
|
|||||||
|
|
||||||
# unpack the source code
|
# unpack the source code
|
||||||
( cd copyparty-extras/
|
( cd copyparty-extras/
|
||||||
$tar -xvf *.tar.gz
|
tar -xvf *.tar.gz
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -87,13 +88,13 @@ rm -rf copyparty-{0..9}*.*.*{0..9}
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# and include the repacker itself too
|
# and include the repacker itself too
|
||||||
cp -pv "$od/$0" copyparty-extras/
|
cp -pv "$od/$0" copyparty-extras/
|
||||||
|
|
||||||
|
|
||||||
# create the bundle
|
# create the bundle
|
||||||
fn=copyparty-$(date +%Y-%m%d-%H%M%S).tgz
|
fn=copyparty-$(date +%Y-%m%d-%H%M%S).tgz
|
||||||
$tar -czvf "$od/$fn" *
|
tar -czvf "$od/$fn" *
|
||||||
cd "$od"
|
cd "$od"
|
||||||
rm -rf "$td"
|
rm -rf "$td"
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ cd sfx
|
|||||||
}
|
}
|
||||||
|
|
||||||
ver=
|
ver=
|
||||||
command -v git >/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//; s/-g?/./g')";
|
ver="$(printf '%s\n' "$git_ver" | sed -r 's/^v//; s/-g?/./g')";
|
||||||
t_ver=
|
t_ver=
|
||||||
|
|||||||
Reference in New Issue
Block a user