mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
Merge branch 'hovudstraum' of https://github.com/JanluOfficial/copyparty into hovudstraum
This commit is contained in:
commit
6001f126f6
|
@ -52,6 +52,7 @@ if PY2:
|
|||
|
||||
sys.dont_write_bytecode = True
|
||||
bytes = str
|
||||
files_decoder = lambda s: unicode(s, 'utf8')
|
||||
else:
|
||||
from urllib.parse import quote_from_bytes as quote
|
||||
from urllib.parse import unquote_to_bytes as unquote
|
||||
|
@ -61,6 +62,7 @@ else:
|
|||
from queue import Queue
|
||||
|
||||
unicode = str
|
||||
files_decoder = unicode
|
||||
|
||||
|
||||
WTF8 = "replace" if PY2 else "surrogateescape"
|
||||
|
@ -1532,7 +1534,7 @@ source file/folder selection uses rsync syntax, meaning that:
|
|||
""")
|
||||
|
||||
ap.add_argument("url", type=unicode, help="server url, including destination folder")
|
||||
ap.add_argument("files", type=unicode, nargs="+", help="files and/or folders to process")
|
||||
ap.add_argument("files", type=files_decoder, nargs="+", help="files and/or folders to process")
|
||||
ap.add_argument("-v", action="store_true", help="verbose")
|
||||
ap.add_argument("-a", metavar="PASSWD", help="password or $filepath")
|
||||
ap.add_argument("-s", action="store_true", help="file-search (disables upload)")
|
||||
|
|
|
@ -1548,6 +1548,7 @@ def add_ui(ap, retry):
|
|||
ap2 = ap.add_argument_group('ui options')
|
||||
ap2.add_argument("--grid", action="store_true", help="show grid/thumbnails by default (volflag=grid)")
|
||||
ap2.add_argument("--gsel", action="store_true", help="select files in grid by ctrl-click (volflag=gsel)")
|
||||
ap2.add_argument("--localtime", action="store_true", help="default to local timezone instead of UTC")
|
||||
ap2.add_argument("--lang", metavar="LANG", type=u, default="eng", help="language; one of the following: \033[32meng nor chi\033[0m")
|
||||
ap2.add_argument("--theme", metavar="NUM", type=int, default=0, help="default theme to use (0..7)")
|
||||
ap2.add_argument("--themes", metavar="NUM", type=int, default=8, help="number of themes installed")
|
||||
|
|
|
@ -2775,6 +2775,7 @@ class AuthSrv(object):
|
|||
"dth3x": vf["th3x"],
|
||||
"dvol": self.args.au_vol,
|
||||
"idxh": int(self.args.ih),
|
||||
"dutc": not self.args.localtime,
|
||||
"themes": self.args.themes,
|
||||
"turbolvl": self.args.turbo,
|
||||
"nosubtle": self.args.nosubtle,
|
||||
|
|
|
@ -3109,6 +3109,20 @@ class HttpCli(object):
|
|||
if "fperms" in vfs.flags:
|
||||
set_fperms(f, vfs.flags)
|
||||
|
||||
dbv, vrem = vfs.get_dbv(rem)
|
||||
self.conn.hsrv.broker.say(
|
||||
"up2k.hash_file",
|
||||
dbv.realpath,
|
||||
dbv.vpath,
|
||||
dbv.flags,
|
||||
vrem,
|
||||
sanitized,
|
||||
self.ip,
|
||||
bos.stat(fn).st_mtime,
|
||||
self.uname,
|
||||
True,
|
||||
)
|
||||
|
||||
vpath = "{}/{}".format(self.vpath, sanitized).lstrip("/")
|
||||
self.redirect(vpath, "?edit")
|
||||
return True
|
||||
|
@ -5363,6 +5377,7 @@ class HttpCli(object):
|
|||
else:
|
||||
shr_dbv = None
|
||||
|
||||
wret: dict[str, Any] = {}
|
||||
ret: list[dict[str, Any]] = []
|
||||
t0 = time.time()
|
||||
lim = time.time() - self.args.unpost
|
||||
|
@ -5384,7 +5399,13 @@ class HttpCli(object):
|
|||
x = self.conn.hsrv.broker.ask(
|
||||
"up2k.get_unfinished_by_user", self.uname, "" if bad_xff else self.ip
|
||||
)
|
||||
uret = x.get()
|
||||
zdsa: dict[str, Any] = x.get()
|
||||
uret: list[dict[str, Any]] = []
|
||||
if "timeout" in zdsa:
|
||||
wret["nou"] = 1
|
||||
else:
|
||||
uret = zdsa["f"]
|
||||
nu = len(uret)
|
||||
|
||||
if not self.args.unpost:
|
||||
allvols = []
|
||||
|
@ -5430,6 +5451,8 @@ class HttpCli(object):
|
|||
|
||||
if len(ret) > 2000:
|
||||
ret = ret[:2000]
|
||||
if len(ret) >= 2000:
|
||||
wret["oc"] = 1
|
||||
|
||||
for rv in ret:
|
||||
rv["vp"] = quotep(rv["vp"])
|
||||
|
@ -5449,6 +5472,13 @@ class HttpCli(object):
|
|||
)
|
||||
rv["vp"] += "?k=" + fk[:nfk]
|
||||
|
||||
if not allvols:
|
||||
wret["noc"] = 1
|
||||
ret = []
|
||||
|
||||
nc = len(ret)
|
||||
ret = uret + ret
|
||||
|
||||
if shr_dbv:
|
||||
# translate vpaths from share-target to share-url
|
||||
# to satisfy access checks
|
||||
|
@ -5463,12 +5493,11 @@ class HttpCli(object):
|
|||
for v in ret:
|
||||
v["vp"] = self.args.SR + v["vp"]
|
||||
|
||||
if not allvols:
|
||||
ret = [{"kinshi": 1}]
|
||||
|
||||
jtxt = '{"u":%s,"c":%s}' % (uret, json.dumps(ret, separators=(",\n", ": ")))
|
||||
zi = len(uret.split('\n"pd":')) - 1
|
||||
self.log("%s #%d+%d %.2fsec" % (lm, zi, len(ret), time.time() - t0))
|
||||
wret["f"] = ret
|
||||
wret["nu"] = nu
|
||||
wret["nc"] = nc
|
||||
jtxt = json.dumps(wret, separators=(",\n", ": "))
|
||||
self.log("%s #%d+%d %.2fsec" % (lm, nu, nc, time.time() - t0))
|
||||
self.reply(jtxt.encode("utf-8", "replace"), mime="application/json")
|
||||
return True
|
||||
|
||||
|
|
|
@ -1026,6 +1026,8 @@ class SvcHub(object):
|
|||
except:
|
||||
raise Exception("invalid --mv-retry [%s]" % (self.args.mv_retry,))
|
||||
|
||||
al.js_utc = "false" if al.localtime else "true"
|
||||
|
||||
al.tcolor = al.tcolor.lstrip("#")
|
||||
if len(al.tcolor) == 3: # fc5 => ffcc55
|
||||
al.tcolor = "".join([x * 2 for x in al.tcolor])
|
||||
|
|
|
@ -399,12 +399,14 @@ class Up2k(object):
|
|||
|
||||
return "{}"
|
||||
|
||||
def get_unfinished_by_user(self, uname, ip) -> str:
|
||||
def get_unfinished_by_user(self, uname, ip) -> dict[str, Any]:
|
||||
# returns dict due to ExceptionalQueue
|
||||
if PY2 or not self.reg_mutex.acquire(timeout=2):
|
||||
return '[{"timeout":1}]'
|
||||
return {"timeout":1}
|
||||
|
||||
ret: list[tuple[int, str, int, int, int]] = []
|
||||
userset = set([(uname or "\n"), "*"])
|
||||
n = 1000
|
||||
try:
|
||||
for ptop, tab2 in self.registry.items():
|
||||
cfg = self.flags.get(ptop, {}).get("u2abort", 1)
|
||||
|
@ -419,7 +421,6 @@ class Up2k(object):
|
|||
or (addr and addr != job["addr"])
|
||||
):
|
||||
continue
|
||||
|
||||
zt5 = (
|
||||
int(job["t0"]),
|
||||
djoin(job["vtop"], job["prel"], job["name"]),
|
||||
|
@ -428,6 +429,9 @@ class Up2k(object):
|
|||
len(job["hash"]),
|
||||
)
|
||||
ret.append(zt5)
|
||||
n -= 1
|
||||
if not n:
|
||||
break
|
||||
finally:
|
||||
self.reg_mutex.release()
|
||||
|
||||
|
@ -444,7 +448,7 @@ class Up2k(object):
|
|||
}
|
||||
for (at, vp, sz, nn, nh) in ret
|
||||
]
|
||||
return json.dumps(ret2, separators=(",\n", ": "))
|
||||
return {"f": ret2}
|
||||
|
||||
def get_unfinished(self) -> str:
|
||||
if PY2 or not self.reg_mutex.acquire(timeout=0.5):
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<tr><td>{{ f.lead }}</td><td><a href="{{ f.href }}">{{ f.name|e }}</a></td><td>{{ f.sz }}</td>
|
||||
{%- if f.tags is defined %}
|
||||
{%- for k in taglist %}<td>{{ f.tags[k]|e }}</td>{%- endfor %}
|
||||
{%- endif %}<td>{{ f.ext|e }}</td><td>{{ f.dt }}</td></tr>
|
||||
{%- endif %}<td>{{ f.ext }}</td><td>{{ f.dt }}</td></tr>
|
||||
{%- endfor %}
|
||||
|
||||
</tbody>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,6 +33,7 @@
|
|||
|
||||
var SR="{{ r }}",
|
||||
lang="{{ lang }}",
|
||||
dutc={{ this.args.js_utc }},
|
||||
dfavico="{{ favico }}";
|
||||
|
||||
var STG = window.localStorage;
|
||||
|
|
|
@ -10,7 +10,7 @@ function render() {
|
|||
fn = esc(uricom_dec(vsp[1])),
|
||||
at = f.at,
|
||||
td = now - f.at,
|
||||
ts = !at ? '(?)' : unix2iso(at),
|
||||
ts = !at ? '(?)' : unix2ui(at),
|
||||
sa = !at ? '(?)' : td > 60 ? shumantime(td) : (td + 's'),
|
||||
sz = ('' + f.sz).replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
var SR="{{ r }}",
|
||||
shr="{{ shr }}",
|
||||
lang="{{ lang }}",
|
||||
dutc={{ this.args.js_utc }},
|
||||
dfavico="{{ favico }}";
|
||||
|
||||
var STG = window.localStorage;
|
||||
|
|
|
@ -66,7 +66,7 @@ function showqr(href) {
|
|||
for (var b = 7; b < 9; b++) {
|
||||
var v = buf[ibuf++];
|
||||
tr[a].cells[b].innerHTML =
|
||||
v ? unix2iso(v).replace(' ', ', ') : 'never';
|
||||
v ? unix2ui(v).replace(' ', ', ') : 'never';
|
||||
}
|
||||
|
||||
for (var a = 0; a < tr.length; a++)
|
||||
|
|
|
@ -51,7 +51,6 @@ var Ls = {
|
|||
"ta2": "repeat to confirm new password:",
|
||||
"ta3": "found a typo; please try again",
|
||||
},
|
||||
|
||||
"chi": {
|
||||
"a1": "更新",
|
||||
"b1": "你好 <small>(你尚未登录)</small>",
|
||||
|
@ -94,7 +93,6 @@ var Ls = {
|
|||
"af1": "显示最近上传的文件", //m
|
||||
"ag1": "查看已知 IdP 用户", //m
|
||||
},
|
||||
|
||||
"deu": {
|
||||
"a1": "Neu laden",
|
||||
"b1": "Tach, wie geht's? <small>(Du bist nicht angemeldet)</small>",
|
||||
|
@ -136,7 +134,90 @@ var Ls = {
|
|||
"ae1": "Aktive Downloads:",
|
||||
"af1": "Zeige neue Uploads",
|
||||
},
|
||||
|
||||
"fin": {
|
||||
"a1": "päivitä",
|
||||
"b1": "hei sie muukalainen <small>(et ole kirjautunut sisään)</small>",
|
||||
"c1": "kirjaudu ulos",
|
||||
"d1": "tulosta pinojälki",
|
||||
"d2": "näytä kaikkien aktiivisten säikeiden tila",
|
||||
"e1": "päivitä konffit",
|
||||
"e2": "lataa konfiguraatiotiedostot uudelleen (käyttäjätilit/asemat/asemaflagit),$Nja skannaa kaikki e2ds asemat uudelleen$N$Nhuom: kaikki global-asetuksiin$Ntehdyt muutokset vaativat täyden$Nuudelleenkäynnistyksen",
|
||||
"f1": "voit selata:",
|
||||
"g1": "voit ladata:",
|
||||
"cc1": "muuta:",
|
||||
"h1": "poista k304 käytöstä",
|
||||
"i1": "ota k304 käyttöön",
|
||||
"j1": "k304 katkaisee yhteytesi jokaisella HTTP 304:llä, mikä voi estää joitain bugisia välityspalvelimia jumittumasta/lopettamasta sivujen lataamista, <em>mutta</em> se myös vähentää suorituskykyä",
|
||||
"k1": "nollaa asetukset",
|
||||
"l1": "kirjaudu sisään:",
|
||||
"m1": "tervetuloa takaisin,",
|
||||
"n1": "404: ei löytynyt mitään ┐( ´ -`)┌",
|
||||
"o1": 'tai ehkä sinulla ei vain ole käyttöoikeuksia? kokeile salasanaa tai <a href="' + SR + '/?h">mene kotiin</a>',
|
||||
"p1": "403: pääsy kielletty ~┻━┻",
|
||||
"q1": 'kokeile salasanaa tai <a href="' + SR + '/?h">mene kotiin</a>',
|
||||
"r1": "mene kotiin",
|
||||
".s1": "uudelleenkartoita",
|
||||
"t1": "toiminto",
|
||||
"u2": "aika viimeisestä palvelimen kirjoituksesta$N( lataus / uudelleennimeäminen / tms. )$N$N17d = 17 päivää$N1h23 = 1 tunti 23 minuuttia$N4m56 = 4 minuuttia 56 sekuntia",
|
||||
"v1": "yhdistä",
|
||||
"v2": "käytä tätä palvelinta paikallisena kiintolevynä",
|
||||
"w1": "vaihda https:ään",
|
||||
"x1": "vaihda salasana",
|
||||
"y1": "muokkaa jakoja",
|
||||
"z1": "avaa tämä jako:",
|
||||
"ta1": "täytä ensin uusi salasana",
|
||||
"ta2": "toista vahvistaaksesi uuden salasanan:",
|
||||
"ta3": "löytyi kirjoitusvirhe; yritä uudelleen",
|
||||
"aa1": "saapuvat:",
|
||||
"ab1": "poista no304 käytöstä",
|
||||
"ac1": "ota no304 käyttöön",
|
||||
"ad1": "no304:n lopettaa välimuistin käytön kokonaan; kokeile tätä jos k304 ei riittänyt. Tuhlaa valtavan määrän verkkoliikennettä!",
|
||||
"ae1": "lähtevät:",
|
||||
"af1": "näytä viimeaikaiset lataukset",
|
||||
"ag1": "näytä tunnetut IdP-käyttäjät",
|
||||
},
|
||||
"spa": {
|
||||
"a1": "actualizar",
|
||||
"b1": "hola <small>(no has iniciado sesión)</small>",
|
||||
"c1": "cerrar sesión",
|
||||
"d1": "volcar estado de la pila",
|
||||
"d2": "muestra el estado de todos los hilos activos",
|
||||
"e1": "recargar configuración",
|
||||
"e2": "recargar archivos de configuración (cuentas/volúmenes/indicadores de vol.),$Ny reescanear todos los volúmenes e2ds$N$Nnota: cualquier cambio en la configuración global$Nrequiere un reinicio completo para surtir efecto",
|
||||
"f1": "puedes explorar:",
|
||||
"g1": "puedes subir a:",
|
||||
"cc1": "otras cosas:",
|
||||
"h1": "desactivar k304",
|
||||
"i1": "activar k304",
|
||||
"j1": "activar k304 desconectará tu cliente en cada HTTP 304, lo que puede evitar que algunos proxies con errores se atasquen (dejando de cargar páginas de repente), <em>pero</em> también ralentizará las cosas en general",
|
||||
"k1": "restablecer config. de cliente",
|
||||
"l1": "inicia sesión para más:",
|
||||
"m1": "bienvenido de nuevo,",
|
||||
"n1": "404 no encontrado ┐( ´ -`)┌",
|
||||
"o1": '¿o quizás no tienes acceso? -- prueba con una contraseña o <a href=\"' + SR + '/?h\">vuelve al inicio</a>',
|
||||
"p1": "403 prohibido ~┻━┻",
|
||||
"q1": 'usa una contraseña o <a href=\"' + SR + '/?h\">vuelve al inicio</a>',
|
||||
"r1": "ir al inicio",
|
||||
".s1": "reescanear",
|
||||
"t1": "acción",
|
||||
"u2": "tiempo desde la última escritura en el servidor$N( subida / renombrar / ... )$N$N17d = 17 días$N1h23 = 1 hora 23 minutos$N4m56 = 4 minutos 56 segundos",
|
||||
"v1": "conectar",
|
||||
"v2": "usar este servidor como un disco duro local",
|
||||
"w1": "cambiar a https",
|
||||
"x1": "cambiar contraseña",
|
||||
"y1": "editar recursos compartidos",
|
||||
"z1": "desbloquear este recurso compartido:",
|
||||
"ta1": "primero escribe tu nueva contraseña",
|
||||
"ta2": "repite para confirmar la nueva contraseña:",
|
||||
"ta3": "hay un error; por favor, inténtalo de nuevo",
|
||||
"aa1": "archivos entrantes:",
|
||||
"ab1": "desactivar no304",
|
||||
"ac1": "activar no304",
|
||||
"ad1": "activar no304 desactivará todo el almacenamiento en caché; prueba esto si k304 no fue suficiente. ¡Esto desperdiciará una gran cantidad de tráfico de red!",
|
||||
"ae1": "descargas activas:",
|
||||
"af1": "mostrar subidas recientes",
|
||||
"ag1": "mostrar usuarios IdP conocidos"
|
||||
},
|
||||
"rus": {
|
||||
"a1": "обновить",
|
||||
"b1": "приветик, незнакомец <small>(вы не авторизованы)</small>",
|
||||
|
|
|
@ -2511,8 +2511,8 @@ function up2k_init(subtle) {
|
|||
var msg = [];
|
||||
for (var a = 0, aa = Math.min(20, response.hits.length); a < aa; a++) {
|
||||
var hit = response.hits[a],
|
||||
tr = unix2iso(hit.ts),
|
||||
tu = unix2iso(t.lmod),
|
||||
tr = unix2ui(hit.ts),
|
||||
tu = unix2ui(t.lmod),
|
||||
diff = parseInt(t.lmod) - parseInt(hit.ts),
|
||||
cdiff = (Math.abs(diff) <= 2) ? '3c0' : 'f0b',
|
||||
sdiff = '<span style="color:#' + cdiff + '">diff ' + diff;
|
||||
|
@ -3187,7 +3187,7 @@ function up2k_init(subtle) {
|
|||
return;
|
||||
|
||||
try {
|
||||
ebi('lifew').innerHTML = unix2iso((st.lifetime || lifetime) +
|
||||
ebi('lifew').innerHTML = unix2ui((st.lifetime || lifetime) +
|
||||
Date.now() / 1000 - new Date().getTimezoneOffset() * 60
|
||||
).replace(' ', ', ').slice(0, -3);
|
||||
}
|
||||
|
|
|
@ -907,11 +907,29 @@ function noq_href(el) {
|
|||
}
|
||||
|
||||
|
||||
function pad2(v) {
|
||||
return ('0' + v).slice(-2);
|
||||
}
|
||||
|
||||
|
||||
function unix2iso(ts) {
|
||||
return new Date(ts * 1000).toISOString().replace("T", " ").slice(0, -5);
|
||||
}
|
||||
|
||||
|
||||
function unix2iso_localtime(ts) {
|
||||
var o = new Date(ts * 1000),
|
||||
p = pad2;
|
||||
return "{0}-{1}-{2} {3}:{4}:{5}".format(
|
||||
o.getFullYear(),
|
||||
p(o.getMonth() + 1),
|
||||
p(o.getDate()),
|
||||
p(o.getHours()),
|
||||
p(o.getMinutes()),
|
||||
p(o.getSeconds()));
|
||||
}
|
||||
|
||||
|
||||
function s2ms(s) {
|
||||
s = Math.floor(s);
|
||||
var m = Math.floor(s / 60);
|
||||
|
@ -1203,6 +1221,13 @@ function scfg_bind(obj, oname, cname, defval, cb) {
|
|||
}
|
||||
|
||||
|
||||
window.unix2ui = (function () {
|
||||
var v = sread('utctid');
|
||||
v = v ? (v === '0') : (window.dutc === false);
|
||||
return v ? unix2iso_localtime : unix2iso;
|
||||
})();
|
||||
|
||||
|
||||
function hist_push(url) {
|
||||
console.log("h-push " + url);
|
||||
try {
|
||||
|
|
|
@ -143,7 +143,7 @@ class Cfg(Namespace):
|
|||
def __init__(self, a=None, v=None, c=None, **ka0):
|
||||
ka = {}
|
||||
|
||||
ex = "chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only ih ihead magic nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz reflink rmagic rss smb srch_dbg srch_excl stats uqe vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
|
||||
ex = "chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only ih ihead localtime magic nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz reflink rmagic rss smb srch_dbg srch_excl stats uqe vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
|
||||
ka.update(**{k: False for k in ex.split()})
|
||||
|
||||
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump re_dhash see_dots plain_ip"
|
||||
|
|
Loading…
Reference in a new issue