mirror of
https://github.com/9001/copyparty.git
synced 2025-11-05 06:13:20 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3f1d19756 | ||
|
|
93c2bd6ef6 | ||
|
|
4d0e5ff6db | ||
|
|
0893f06919 | ||
|
|
46b6abde3f | ||
|
|
0696610dee | ||
|
|
edf0d3684c | ||
|
|
7af159f5f6 |
@@ -212,6 +212,7 @@ pip install black bandit pylint flake8 # vscode tooling
|
|||||||
in the `scripts` folder:
|
in the `scripts` folder:
|
||||||
|
|
||||||
* run `make -C deps-docker` to build all dependencies
|
* run `make -C deps-docker` to build all dependencies
|
||||||
|
* `git tag v1.2.3 && git push origin --tags`
|
||||||
* create github release with `make-tgz-release.sh`
|
* create github release with `make-tgz-release.sh`
|
||||||
* upload to pypi with `make-pypi-release.(sh|bat)`
|
* upload to pypi with `make-pypi-release.(sh|bat)`
|
||||||
* create sfx with `make-sfx.sh`
|
* create sfx with `make-sfx.sh`
|
||||||
|
|||||||
@@ -1008,6 +1008,12 @@ def main():
|
|||||||
log = null_log
|
log = null_log
|
||||||
dbg = null_log
|
dbg = null_log
|
||||||
|
|
||||||
|
if ar.a and ar.a.startswith("$"):
|
||||||
|
fn = ar.a[1:]
|
||||||
|
log("reading password from file [{}]".format(fn))
|
||||||
|
with open(fn, "rb") as f:
|
||||||
|
ar.a = f.read().decode("utf-8").strip()
|
||||||
|
|
||||||
if WINDOWS:
|
if WINDOWS:
|
||||||
os.system("rem")
|
os.system("rem")
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (0, 9, 7)
|
VERSION = (0, 9, 8)
|
||||||
CODENAME = "the strongest music server"
|
CODENAME = "the strongest music server"
|
||||||
BUILD_DT = (2021, 3, 8)
|
BUILD_DT = (2021, 3, 15)
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -837,7 +837,11 @@ def chkcmd(*argv):
|
|||||||
def gzip_orig_sz(fn):
|
def gzip_orig_sz(fn):
|
||||||
with open(fsenc(fn), "rb") as f:
|
with open(fsenc(fn), "rb") as f:
|
||||||
f.seek(-4, 2)
|
f.seek(-4, 2)
|
||||||
return struct.unpack(b"I", f.read(4))[0]
|
rv = f.read(4)
|
||||||
|
try:
|
||||||
|
return struct.unpack(b"I", rv)[0]
|
||||||
|
except:
|
||||||
|
return struct.unpack("I", rv)[0]
|
||||||
|
|
||||||
|
|
||||||
def py_desc():
|
def py_desc():
|
||||||
@@ -847,7 +851,11 @@ def py_desc():
|
|||||||
if ofs > 0:
|
if ofs > 0:
|
||||||
py_ver = py_ver[:ofs]
|
py_ver = py_ver[:ofs]
|
||||||
|
|
||||||
|
try:
|
||||||
bitness = struct.calcsize(b"P") * 8
|
bitness = struct.calcsize(b"P") * 8
|
||||||
|
except:
|
||||||
|
bitness = struct.calcsize("P") * 8
|
||||||
|
|
||||||
host_os = platform.system()
|
host_os = platform.system()
|
||||||
compiler = platform.python_compiler()
|
compiler = platform.python_compiler()
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ function dbg(msg) {
|
|||||||
ebi('path').innerHTML = msg;
|
ebi('path').innerHTML = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
makeSortable(ebi('files'));
|
makeSortable(ebi('files'), reload_mp);
|
||||||
|
|
||||||
|
|
||||||
// extract songs + add play column
|
// extract songs + add play column
|
||||||
@@ -739,9 +739,11 @@ var treectl = (function () {
|
|||||||
var treesz = icfg_get('treesz', 16);
|
var 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 + ']');
|
console.log('treesz [' + treesz + ']');
|
||||||
|
var entreed = false;
|
||||||
|
|
||||||
function entree(e) {
|
function entree(e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
|
entreed = true;
|
||||||
ebi('path').style.display = 'none';
|
ebi('path').style.display = 'none';
|
||||||
|
|
||||||
var tree = ebi('tree');
|
var tree = ebi('tree');
|
||||||
@@ -749,22 +751,29 @@ var treectl = (function () {
|
|||||||
|
|
||||||
swrite('entreed', 'tree');
|
swrite('entreed', 'tree');
|
||||||
get_tree("", get_evpath(), true);
|
get_tree("", get_evpath(), true);
|
||||||
|
window.addEventListener('scroll', onscroll);
|
||||||
|
window.addEventListener('resize', onresize);
|
||||||
onresize();
|
onresize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function detree(e) {
|
function detree(e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
|
entreed = false;
|
||||||
ebi('tree').style.display = 'none';
|
ebi('tree').style.display = 'none';
|
||||||
ebi('path').style.display = 'inline-block';
|
ebi('path').style.display = 'inline-block';
|
||||||
ebi('wrap').style.marginLeft = '0';
|
ebi('wrap').style.marginLeft = '0';
|
||||||
swrite('entreed', 'na');
|
swrite('entreed', 'na');
|
||||||
|
window.removeEventListener('resize', onresize);
|
||||||
|
window.removeEventListener('scroll', onscroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onscroll() {
|
function onscroll() {
|
||||||
|
if (!entreed)
|
||||||
|
return;
|
||||||
|
|
||||||
var top = ebi('wrap').getBoundingClientRect().top;
|
var top = ebi('wrap').getBoundingClientRect().top;
|
||||||
ebi('tree').style.top = Math.max(0, parseInt(top)) + 'px';
|
ebi('tree').style.top = Math.max(0, parseInt(top)) + 'px';
|
||||||
}
|
}
|
||||||
window.addEventListener('scroll', onscroll);
|
|
||||||
|
|
||||||
function periodic() {
|
function periodic() {
|
||||||
onscroll();
|
onscroll();
|
||||||
@@ -773,6 +782,9 @@ var treectl = (function () {
|
|||||||
periodic();
|
periodic();
|
||||||
|
|
||||||
function onresize(e) {
|
function onresize(e) {
|
||||||
|
if (!entreed)
|
||||||
|
return;
|
||||||
|
|
||||||
var q = '#tree';
|
var q = '#tree';
|
||||||
var nq = 0;
|
var nq = 0;
|
||||||
while (dyn) {
|
while (dyn) {
|
||||||
@@ -786,7 +798,6 @@ var treectl = (function () {
|
|||||||
ebi('wrap').style.marginLeft = w + 'em';
|
ebi('wrap').style.marginLeft = w + 'em';
|
||||||
onscroll();
|
onscroll();
|
||||||
}
|
}
|
||||||
window.addEventListener('resize', onresize);
|
|
||||||
|
|
||||||
function get_tree(top, dst, rst) {
|
function get_tree(top, dst, rst) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@@ -1349,9 +1360,19 @@ function ev_row_tgl(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reload_mp() {
|
||||||
|
if (mp && mp.au) {
|
||||||
|
mp.au.pause();
|
||||||
|
mp.au = null;
|
||||||
|
}
|
||||||
|
widget.close();
|
||||||
|
mp = init_mp();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function reload_browser(not_mp) {
|
function reload_browser(not_mp) {
|
||||||
filecols.set_style();
|
filecols.set_style();
|
||||||
makeSortable(ebi('files'));
|
makeSortable(ebi('files'), reload_mp);
|
||||||
|
|
||||||
var parts = get_evpath().split('/');
|
var parts = get_evpath().split('/');
|
||||||
var rm = document.querySelectorAll('#path>a+a+a');
|
var rm = document.querySelectorAll('#path>a+a+a');
|
||||||
@@ -1375,14 +1396,8 @@ function reload_browser(not_mp) {
|
|||||||
oo[a].textContent = hsz;
|
oo[a].textContent = hsz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!not_mp) {
|
if (!not_mp)
|
||||||
if (mp && mp.au) {
|
reload_mp();
|
||||||
mp.au.pause();
|
|
||||||
mp.au = null;
|
|
||||||
}
|
|
||||||
widget.close();
|
|
||||||
mp = init_mp();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window['up2k'])
|
if (window['up2k'])
|
||||||
up2k.set_fsearch();
|
up2k.set_fsearch();
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ function sortTable(table, col) {
|
|||||||
});
|
});
|
||||||
for (i = 0; i < tr.length; ++i) tb.appendChild(tr[vl[i][1]]);
|
for (i = 0; i < tr.length; ++i) tb.appendChild(tr[vl[i][1]]);
|
||||||
}
|
}
|
||||||
function makeSortable(table) {
|
function makeSortable(table, cb) {
|
||||||
var th = table.tHead, i;
|
var th = table.tHead, i;
|
||||||
th && (th = th.rows[0]) && (th = th.cells);
|
th && (th = th.rows[0]) && (th = th.cells);
|
||||||
if (th) i = th.length;
|
if (th) i = th.length;
|
||||||
@@ -137,6 +137,8 @@ function makeSortable(table) {
|
|||||||
th[i].onclick = function (e) {
|
th[i].onclick = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
sortTable(table, i);
|
sortTable(table, i);
|
||||||
|
if (cb)
|
||||||
|
cb();
|
||||||
};
|
};
|
||||||
}(i));
|
}(i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ 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 gnutar && tar() { gnutar "$@"; }
|
||||||
command -v gtar && tar() { gtar "$@"; }
|
command -v gtar && tar() { gtar "$@"; }
|
||||||
command -v gsed && sed() { gsed "$@"; }
|
command -v gsed && sed() { gsed "$@"; }
|
||||||
td="$(mktemp -d)"
|
td="$(mktemp -d)"
|
||||||
@@ -29,11 +30,11 @@ pwd
|
|||||||
|
|
||||||
|
|
||||||
dl_text() {
|
dl_text() {
|
||||||
command -v curl && exec curl "$@"
|
command -v curl >/dev/null && exec curl "$@"
|
||||||
exec wget -O- "$@"
|
exec wget -O- "$@"
|
||||||
}
|
}
|
||||||
dl_files() {
|
dl_files() {
|
||||||
command -v curl && exec curl -L --remote-name-all "$@"
|
command -v curl >/dev/null && exec curl -L --remote-name-all "$@"
|
||||||
exec wget "$@"
|
exec wget "$@"
|
||||||
}
|
}
|
||||||
export -f dl_files
|
export -f dl_files
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ tmv "$f"
|
|||||||
|
|
||||||
# up2k goes from 28k to 22k laff
|
# up2k goes from 28k to 22k laff
|
||||||
echo entabbening
|
echo entabbening
|
||||||
find | grep -E '\.(js|css|html|py)$' | while IFS= read -r f; do
|
find | grep -E '\.(js|css|html)$' | while IFS= read -r f; do
|
||||||
unexpand -t 4 --first-only <"$f" >t
|
unexpand -t 4 --first-only <"$f" >t
|
||||||
tmv "$f"
|
tmv "$f"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# coding: latin-1
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import os, sys, time, shutil, signal, tarfile, hashlib, platform, tempfile
|
import os, sys, time, shutil, runpy, tarfile, hashlib, platform, tempfile, traceback
|
||||||
import subprocess as sp
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
run me with any version of python, i will unpack and run copyparty
|
run me with any version of python, i will unpack and run copyparty
|
||||||
@@ -344,20 +343,24 @@ def get_payload():
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def confirm():
|
def confirm(rv):
|
||||||
msg()
|
msg()
|
||||||
|
msg(traceback.format_exc())
|
||||||
msg("*** hit enter to exit ***")
|
msg("*** hit enter to exit ***")
|
||||||
try:
|
try:
|
||||||
raw_input() if PY2 else input()
|
raw_input() if PY2 else input()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
sys.exit(rv)
|
||||||
|
|
||||||
|
|
||||||
def run(tmp, j2ver):
|
def run(tmp, j2ver):
|
||||||
global cpp
|
global cpp
|
||||||
|
|
||||||
msg("jinja2:", j2ver or "bundled")
|
msg("jinja2:", j2ver or "bundled")
|
||||||
msg("sfxdir:", tmp)
|
msg("sfxdir:", tmp)
|
||||||
|
msg()
|
||||||
|
|
||||||
# "systemd-tmpfiles-clean.timer"?? HOW do you even come up with this shit
|
# "systemd-tmpfiles-clean.timer"?? HOW do you even come up with this shit
|
||||||
try:
|
try:
|
||||||
@@ -373,30 +376,16 @@ def run(tmp, j2ver):
|
|||||||
if j2ver:
|
if j2ver:
|
||||||
del ld[-1]
|
del ld[-1]
|
||||||
|
|
||||||
cmd = (
|
for x in ld:
|
||||||
"import sys, runpy; "
|
sys.path.insert(0, x)
|
||||||
+ "".join(['sys.path.insert(0, r"' + x + '"); ' for x in ld])
|
|
||||||
+ 'runpy.run_module("copyparty", run_name="__main__")'
|
|
||||||
)
|
|
||||||
cmd = [sys.executable, "-c", cmd] + list(sys.argv[1:])
|
|
||||||
|
|
||||||
cmd = [str(x) for x in cmd]
|
|
||||||
msg("\n", cmd, "\n")
|
|
||||||
cpp = sp.Popen(cmd)
|
|
||||||
try:
|
try:
|
||||||
cpp.wait()
|
runpy.run_module(str("copyparty"), run_name=str("__main__"))
|
||||||
|
except SystemExit as ex:
|
||||||
|
if ex.code:
|
||||||
|
confirm(ex.code)
|
||||||
except:
|
except:
|
||||||
cpp.wait()
|
confirm(1)
|
||||||
|
|
||||||
if cpp.returncode != 0:
|
|
||||||
confirm()
|
|
||||||
|
|
||||||
sys.exit(cpp.returncode)
|
|
||||||
|
|
||||||
|
|
||||||
def bye(sig, frame):
|
|
||||||
if cpp is not None:
|
|
||||||
cpp.terminate()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -430,8 +419,6 @@ def main():
|
|||||||
|
|
||||||
# skip 0
|
# skip 0
|
||||||
|
|
||||||
signal.signal(signal.SIGTERM, bye)
|
|
||||||
|
|
||||||
tmp = unpack()
|
tmp = unpack()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -439,7 +426,7 @@ def main():
|
|||||||
except:
|
except:
|
||||||
j2ver = None
|
j2ver = None
|
||||||
|
|
||||||
return run(tmp, j2ver)
|
run(tmp, j2ver)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user