diff --git a/README.md b/README.md index 3171a4e3..95c61d4e 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ try the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running fro * [other tricks](#other-tricks) * [searching](#searching) - search by size, date, path/name, mp3-tags, ... * [server config](#server-config) - using arguments or config files, or a mix of both + * [qr-code](#qr-code) - print a qr-code [(screenshot)](https://user-images.githubusercontent.com/241032/194728533-6f00849b-c6ac-43c6-9359-83e454d11e00.png) for quick access * [ftp-server](#ftp-server) - an FTP server can be started using `--ftp 3921` * [file indexing](#file-indexing) - enables dedup and music search ++ * [exclude-patterns](#exclude-patterns) - to save some time @@ -167,7 +168,7 @@ feature summary * ☑ volumes (mountpoints) * ☑ [accounts](#accounts-and-volumes) * ☑ [ftp-server](#ftp-server) - * ☑ [qr-code](https://user-images.githubusercontent.com/241032/194706154-57f50367-7877-4be9-a759-5b782530ff64.png) for quick access + * ☑ [qr-code](#qr-code) for quick access * upload * ☑ basic: plain multipart, ie6 support * ☑ [up2k](#uploading): js, resumable, multithreaded @@ -682,6 +683,19 @@ using arguments or config files, or a mix of both: * or click the `[reload cfg]` button in the control-panel when logged in as admin +## qr-code + +print a qr-code [(screenshot)](https://user-images.githubusercontent.com/241032/194728533-6f00849b-c6ac-43c6-9359-83e454d11e00.png) for quick access, great between phones on android hotspots which keep changing the subnet + +* `--qr` enables it +* `--qrs` does https instead of http +* `--qrl lootbox/?pw=hunter2` appends to the url, linking to the `lootbox` folder with password `hunter2` +* `--qrz 1` forces 1x zoom instead of autoscaling to fit the terminal size + * 1x may render incorrectly on some terminals/fonts, but 2x should always work + +it will use your external ip (default route) unless `--qri` specifies an ip-prefix or domain + + ## ftp-server an FTP server can be started using `--ftp 3921`, and/or `--ftps` for explicit TLS (ftpes) @@ -1338,7 +1352,7 @@ apt update && apt -y full-upgrade && apt update && termux-setup-storage && apt - echo $? ``` -after the initial setup, you can launch copyparty at any time by running `copyparty` anywhere in Termux -- and if you run it with `--qr` you'll get a [neat qr-code](https://user-images.githubusercontent.com/241032/194706154-57f50367-7877-4be9-a759-5b782530ff64.png) pointing to your external ip +after the initial setup, you can launch copyparty at any time by running `copyparty` anywhere in Termux -- and if you run it with `--qr` you'll get a [neat qr-code](#qr-code) pointing to your external ip if you want thumbnails, `apt -y install ffmpeg` diff --git a/copyparty/__main__.py b/copyparty/__main__.py index d7591ca0..18c0a98e 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -585,7 +585,7 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names ap2.add_argument("--qr", action="store_true", help="show http:// QR-code on startup") ap2.add_argument("--qrs", action="store_true", help="show https:// QR-code on startup") ap2.add_argument("--qrl", metavar="PATH", type=u, default="", help="location to include in the url, for example [\033[32mpriv/?pw=hunter2\033[0m]") - ap2.add_argument("--qr-ip", metavar="PREFIX", type=u, default="", help="select IP which starts with PREFIX") + ap2.add_argument("--qri", metavar="PREFIX", type=u, default="", help="select IP which starts with PREFIX") ap2.add_argument("--qr-fg", metavar="COLOR", type=int, default=16, help="foreground") ap2.add_argument("--qr-bg", metavar="COLOR", type=int, default=229, help="background (white=255)") ap2.add_argument("--qrp", metavar="CELLS", type=int, default=4, help="padding (spec says 4 or more, but 1 is usually fine)") diff --git a/copyparty/tcpsrv.py b/copyparty/tcpsrv.py index 47ac0ddc..60660f02 100644 --- a/copyparty/tcpsrv.py +++ b/copyparty/tcpsrv.py @@ -344,17 +344,29 @@ class TcpSrv(object): vs2 = {} for k, eps in vs.items(): - vs2[k] = { - ep: 1 - for ep in eps.keys() - if ":" not in ep or ep.split(":")[0] not in eps - } + filt = {ep: 1 for ep in eps if ":" not in ep} + have = set(filt) + for ep in sorted(eps): + ip = ep.split(":")[0] + if ip not in have: + have.add(ip) + filt[ep] = 1 + + lo = [x for x in filt if x.startswith("127.")] + if len(filt) > 3 and lo: + for ip in lo: + filt.pop(ip) + + vs2[k] = filt title = "" vs = vs2 for p in self.args.wintitle.split(" "): if p.startswith("$"): - p = " and ".join(sorted(vs.get(p[1:], {"(None)": 1}).keys())) + seps = list(sorted(vs.get(p[1:], {"(None)": 1}).keys())) + p = ", ".join(seps[:3]) + if len(seps) > 3: + p += ", ..." title += "{} ".format(p) @@ -364,13 +376,13 @@ class TcpSrv(object): def _qr(self, t1: dict[str, list[int]], t2: dict[str, list[int]]) -> str: ip = None for ip in list(t1) + list(t2): - if ip.startswith(self.args.qr_ip): + if ip.startswith(self.args.qri): break ip = "" if not ip: # maybe /bin/ip is missing or smth - ip = self.args.qr_ip + ip = self.args.qri if not ip: return "" diff --git a/docs/notes.sh b/docs/notes.sh index 68c30cb2..b1ee4374 100644 --- a/docs/notes.sh +++ b/docs/notes.sh @@ -215,7 +215,7 @@ brew install python@2 pip install virtualenv # readme toc -cat README.md | awk 'function pr() { if (!h) {return}; if (/^ *[*!#|]/||!s) {printf "%s\n",h;h=0;return}; if (/.../) {printf "%s - %s\n",h,$0;h=0}; }; /^#/{s=1;pr()} /^#* *(install on android|dev env setup|just the sfx|complete release|optional gpl stuff)|`$/{s=0} /^#/{lv=length($1);sub(/[^ ]+ /,"");bab=$0;gsub(/ /,"-",bab); h=sprintf("%" ((lv-1)*4+1) "s [%s](#%s)", "*",$0,bab);next} !h{next} {sub(/ .*/,"");sub(/[:;,]$/,"")} {pr()}' > toc; grep -E '^## readme toc' -B1000 -A2 p1; grep -E '^## quickstart' -B2 -A999999 p2; (cat p1; grep quickstart -A1000 README.md; rm p1 p2 toc +cat README.md | awk 'function pr() { if (!h) {return}; if (/^ *[*!#|]/||!s) {printf "%s\n",h;h=0;return}; if (/.../) {printf "%s - %s\n",h,$0;h=0}; }; /^#/{s=1;pr()} /^#* *(install on android|dev env setup|just the sfx|complete release|optional gpl stuff)|`$/{s=0} /^#/{lv=length($1);sub(/[^ ]+ /,"");bab=$0;gsub(/ /,"-",bab);gsub(/\./,"",bab); h=sprintf("%" ((lv-1)*4+1) "s [%s](#%s)", "*",$0,bab);next} !h{next} {sub(/ .*/,"");sub(/[:;,]$/,"")} {pr()}' > toc; grep -E '^## readme toc' -B1000 -A2 p1; grep -E '^## quickstart' -B2 -A999999 p2; (cat p1; grep quickstart -A1000 README.md; rm p1 p2 toc # fix firefox phantom breakpoints, # suggestions from bugtracker, doesnt work (debugger is not attachable) diff --git a/scripts/deps-docker/Dockerfile b/scripts/deps-docker/Dockerfile index 19512ca0..96e6482b 100644 --- a/scripts/deps-docker/Dockerfile +++ b/scripts/deps-docker/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3 WORKDIR /z -ENV ver_asmcrypto=5b994303a9d3e27e0915f72a10b6c2c51535a4dc \ +ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \ ver_hashwasm=4.9.0 \ ver_marked=4.0.18 \ ver_mde=2.18.0 \