readme + better window title

This commit is contained in:
ed 2022-10-09 00:04:02 +02:00
parent d16dd26c65
commit 69406d4344
5 changed files with 39 additions and 13 deletions

View file

@ -56,6 +56,7 @@ try the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running fro
* [other tricks](#other-tricks) * [other tricks](#other-tricks)
* [searching](#searching) - search by size, date, path/name, mp3-tags, ... * [searching](#searching) - search by size, date, path/name, mp3-tags, ...
* [server config](#server-config) - using arguments or config files, or a mix of both * [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` * [ftp-server](#ftp-server) - an FTP server can be started using `--ftp 3921`
* [file indexing](#file-indexing) - enables dedup and music search ++ * [file indexing](#file-indexing) - enables dedup and music search ++
* [exclude-patterns](#exclude-patterns) - to save some time * [exclude-patterns](#exclude-patterns) - to save some time
@ -167,7 +168,7 @@ feature summary
* ☑ volumes (mountpoints) * ☑ volumes (mountpoints)
* ☑ [accounts](#accounts-and-volumes) * ☑ [accounts](#accounts-and-volumes)
* ☑ [ftp-server](#ftp-server) * ☑ [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 * upload
* ☑ basic: plain multipart, ie6 support * ☑ basic: plain multipart, ie6 support
* ☑ [up2k](#uploading): js, resumable, multithreaded * ☑ [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 * 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 ## ftp-server
an FTP server can be started using `--ftp 3921`, and/or `--ftps` for explicit TLS (ftpes) 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 $? 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` if you want thumbnails, `apt -y install ffmpeg`

View file

@ -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("--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("--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("--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-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("--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)") ap2.add_argument("--qrp", metavar="CELLS", type=int, default=4, help="padding (spec says 4 or more, but 1 is usually fine)")

View file

@ -344,17 +344,29 @@ class TcpSrv(object):
vs2 = {} vs2 = {}
for k, eps in vs.items(): for k, eps in vs.items():
vs2[k] = { filt = {ep: 1 for ep in eps if ":" not in ep}
ep: 1 have = set(filt)
for ep in eps.keys() for ep in sorted(eps):
if ":" not in ep or ep.split(":")[0] not in 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 = "" title = ""
vs = vs2 vs = vs2
for p in self.args.wintitle.split(" "): for p in self.args.wintitle.split(" "):
if p.startswith("$"): 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) title += "{} ".format(p)
@ -364,13 +376,13 @@ class TcpSrv(object):
def _qr(self, t1: dict[str, list[int]], t2: dict[str, list[int]]) -> str: def _qr(self, t1: dict[str, list[int]], t2: dict[str, list[int]]) -> str:
ip = None ip = None
for ip in list(t1) + list(t2): for ip in list(t1) + list(t2):
if ip.startswith(self.args.qr_ip): if ip.startswith(self.args.qri):
break break
ip = "" ip = ""
if not ip: if not ip:
# maybe /bin/ip is missing or smth # maybe /bin/ip is missing or smth
ip = self.args.qr_ip ip = self.args.qri
if not ip: if not ip:
return "" return ""

View file

@ -215,7 +215,7 @@ brew install python@2
pip install virtualenv pip install virtualenv
# readme toc # 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 <README.md >p1; grep -E '^## quickstart' -B2 -A999999 <README.md >p2; (cat p1; grep quickstart -A1000 <toc; cat p2) >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 <README.md >p1; grep -E '^## quickstart' -B2 -A999999 <README.md >p2; (cat p1; grep quickstart -A1000 <toc; cat p2) >README.md; rm p1 p2 toc
# fix firefox phantom breakpoints, # fix firefox phantom breakpoints,
# suggestions from bugtracker, doesnt work (debugger is not attachable) # suggestions from bugtracker, doesnt work (debugger is not attachable)

View file

@ -1,6 +1,6 @@
FROM alpine:3 FROM alpine:3
WORKDIR /z WORKDIR /z
ENV ver_asmcrypto=5b994303a9d3e27e0915f72a10b6c2c51535a4dc \ ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \
ver_hashwasm=4.9.0 \ ver_hashwasm=4.9.0 \
ver_marked=4.0.18 \ ver_marked=4.0.18 \
ver_mde=2.18.0 \ ver_mde=2.18.0 \