From 190ccee8206ad9bee033ada0b19ba02e5237dc8f Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 4 Feb 2023 13:41:34 +0000 Subject: [PATCH] add optional version number on controlpanel --- copyparty/__main__.py | 1 + copyparty/httpcli.py | 2 ++ copyparty/web/splash.html | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index e84cab05..4c5c0684 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -992,6 +992,7 @@ def add_ui(ap, retry): ap2.add_argument("--txt-max", metavar="KiB", type=int, default=64, help="max size of embedded textfiles on ?doc= (anything bigger will be lazy-loaded by JS)") ap2.add_argument("--doctitle", metavar="TXT", type=u, default="copyparty", help="title / service-name to show in html documents") ap2.add_argument("--pb-url", metavar="URL", type=u, default="https://github.com/9001/copyparty", help="powered-by link; disable with -np") + ap2.add_argument("--ver", action="store_true", help="show version on the control panel (incompatible by -np)") ap2.add_argument("--md-sbf", metavar="FLAGS", type=u, default="downloads forms popups scripts top-navigation-by-user-activation", help="list of capabilities to ALLOW for README.md docs (volflag=md_sbf); see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox") ap2.add_argument("--lg-sbf", metavar="FLAGS", type=u, default="downloads forms popups scripts top-navigation-by-user-activation", help="list of capabilities to ALLOW for prologue/epilogue docs (volflag=lg_sbf)") ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README.md documents (volflags: no_sb_md | sb_md)") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index cb10df67..7d483a8f 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -28,6 +28,7 @@ except: pass from .__init__ import ANYWIN, PY2, TYPE_CHECKING, EnvParams, unicode +from .__version__ import S_VERSION from .authsrv import VFS # typechk from .bos import bos from .star import StreamTar @@ -2875,6 +2876,7 @@ class HttpCli(object): dbwt=vs["dbwt"], url_suf=suf, k304=self.k304(), + ver=S_VERSION if self.args.ver else "", ) self.reply(html.encode("utf-8")) return True diff --git a/copyparty/web/splash.html b/copyparty/web/splash.html index 71aacd85..f5711d0f 100644 --- a/copyparty/web/splash.html +++ b/copyparty/web/splash.html @@ -99,7 +99,7 @@ π {%- if not this.args.nb %} - powered by copyparty + powered by copyparty {{ver}} {%- endif %}