diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py
index 388ae939..af497365 100644
--- a/copyparty/httpcli.py
+++ b/copyparty/httpcli.py
@@ -1924,7 +1924,13 @@ class HttpCli(object):
vstate = {("/" + k).rstrip("/") + "/": v for k, v in vs["volstate"].items()}
else:
vstate = {}
- vs = {"scanning": None, "hashq": None, "tagq": None, "mtpq": None}
+ vs = {
+ "scanning": None,
+ "hashq": None,
+ "tagq": None,
+ "mtpq": None,
+ "dbwt": None,
+ }
if self.uparam.get("ls") in ["v", "t", "txt"]:
if self.uname == "*":
@@ -1934,7 +1940,7 @@ class HttpCli(object):
if vstate:
txt += "\nstatus:"
- for k in ["scanning", "hashq", "tagq", "mtpq"]:
+ for k in ["scanning", "hashq", "tagq", "mtpq", "dbwt"]:
txt += " {}({})".format(k, vs[k])
if rvol:
@@ -1963,6 +1969,7 @@ class HttpCli(object):
hashq=vs["hashq"],
tagq=vs["tagq"],
mtpq=vs["mtpq"],
+ dbwt=vs["dbwt"],
url_suf=suf,
k304=self.k304(),
)
diff --git a/copyparty/up2k.py b/copyparty/up2k.py
index 6beedf1c..12573cf3 100644
--- a/copyparty/up2k.py
+++ b/copyparty/up2k.py
@@ -231,6 +231,7 @@ class Up2k(object):
"hashq": self.n_hashq,
"tagq": self.n_tagq,
"mtpq": mtpq,
+ "dbwt": min(1000 * 24 * 60 * 60 - 1, int(time.time() - self.db_act)),
}
return json.dumps(ret, indent=4)
diff --git a/copyparty/web/splash.html b/copyparty/web/splash.html
index dad4671a..b003b454 100644
--- a/copyparty/web/splash.html
+++ b/copyparty/web/splash.html
@@ -36,6 +36,7 @@
hash-q | {{ hashq }} |
tag-q | {{ tagq }} |
mtp-q | {{ mtpq }} |
+ db-act | {{ dbwt }} |
|
{%- endif %}
diff --git a/copyparty/web/splash.js b/copyparty/web/splash.js
index 701daff4..751b49f9 100644
--- a/copyparty/web/splash.js
+++ b/copyparty/web/splash.js
@@ -23,6 +23,12 @@ var Ls = {
"r1": "gå hjem",
".s1": "kartlegg",
"t1": "handling",
+ "u2": "tid siden noen sist skrev til serveren$N( opplastning / navneendring / ... )$N$N17d = 17 dager$N1h23 = 1 time 23 minutter$N4m56 = 4 minuter 56 sekunder",
+ },
+ "eng": {
+ "d2": "shows the state of all active threads",
+ "e2": "reload config files (accounts/volumes/volflags),$Nand rescan all e2ds volumes",
+ "u2": "time since the last server write$N( upload / rename / ... )$N$N17d = 17 days$N1h23 = 1 hour 23 minutes$N4m56 = 4 minutes 56 seconds",
}
},
d = Ls[sread("lang") || lang];
@@ -43,3 +49,7 @@ tt.init();
var o = QS('input[name="cppwd"]');
if (!ebi('c') && o.offsetTop + o.offsetHeight < window.innerHeight)
o.focus();
+
+o = ebi('u');
+if (o && /[0-9]+$/.exec(o.innerHTML))
+ o.innerHTML = shumantime(o.innerHTML);
diff --git a/copyparty/web/util.js b/copyparty/web/util.js
index 821df19f..577c6dbe 100644
--- a/copyparty/web/util.js
+++ b/copyparty/web/util.js
@@ -653,6 +653,30 @@ function humantime(v) {
}
+function shumantime(v) {
+ if (v < 10)
+ return f2f(v, 2) + 's';
+ if (v < 60)
+ return f2f(v, 1) + 's';
+
+ v = parseInt(v);
+ var st = [[60 * 60 * 24, 'd'], [60 * 60, 'h'], [60, 'm']];
+
+ for (var a = 0; a < st.length; a++) {
+ var mod = st[a][0],
+ ch = st[a][1];
+
+ if (v < mod)
+ continue;
+
+ var v1 = parseInt(v / mod),
+ v2 = ('0' + parseInt(v % mod)).slice(-2);
+
+ return v1 + ch + (v1 >= 10 ? '' : v2);
+ }
+}
+
+
function clamp(v, a, b) {
return Math.min(Math.max(v, a), b);
}