diff --git a/README.md b/README.md index 7c42b833..a84f4b3b 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,7 @@ made in Norway 🇳🇴 * [copyparty.exe](#copypartyexe) - download [copyparty.exe](https://github.com/9001/copyparty/releases/latest/download/copyparty.exe) (win8+) or [copyparty32.exe](https://github.com/9001/copyparty/releases/latest/download/copyparty32.exe) (win7+) * [zipapp](#zipapp) - another emergency alternative, [copyparty.pyz](https://github.com/9001/copyparty/releases/latest/download/copyparty.pyz) * [install on android](#install-on-android) +* [install on iOS](#install-on-iOS) * [reporting bugs](#reporting-bugs) - ideas for context to include, and where to submit them * [devnotes](#devnotes) - for build instructions etc, see [./docs/devnotes.md](./docs/devnotes.md) @@ -155,6 +156,7 @@ just run **[copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/ * or if you cannot install python, you can use [copyparty.exe](#copypartyexe) instead * or install [on arch](#arch-package) ╱ [on NixOS](#nixos-module) ╱ [through nix](#nix-package) * or if you are on android, [install copyparty in termux](#install-on-android) +* or maybe an iPhone or iPad? [install in a-Shell on iOS](#install-on-iOS) * or maybe you have a [synology nas / dsm](./docs/synology-dsm.md) * or if you have [uv](https://docs.astral.sh/uv/) installed, run `uv tool run copyparty` * or if your computer is messed up and nothing else works, [try the pyz](#zipapp) @@ -241,7 +243,7 @@ also see [comparison to similar software](./docs/versus.md) * ☑ [upnp / zeroconf / mdns / ssdp](#zeroconf) * ☑ [event hooks](#event-hooks) / script runner * ☑ [reverse-proxy support](https://github.com/9001/copyparty#reverse-proxy) - * ☑ cross-platform (Windows, Linux, Macos, Android, FreeBSD, arm32/arm64, ppc64le, s390x, risc-v/riscv64) + * ☑ cross-platform (Windows, Linux, Macos, Android, iOS, FreeBSD, arm32/arm64, ppc64le, s390x, risc-v/riscv64) * upload * ☑ basic: plain multipart, ie6 support * ☑ [up2k](#uploading): js, resumable, multithreaded @@ -2632,6 +2634,8 @@ there is no iPhone app, but the following shortcuts are almost as good: * can download links and rehost the target file on copyparty (see first comment inside the shortcut) * pics become lowres if you share from gallery to shortcut, so better to launch the shortcut and pick stuff from there +if you want to run the copyparty server on your iPhone or iPad, see [install on iOS](#install-on-iOS) + # performance @@ -2965,6 +2969,27 @@ if you want thumbnails (photos+videos) and you're okay with spending another 132 * or if you want to use `vips` for photo-thumbs instead, `pkg install libvips && python -m pip install --user -U wheel && python -m pip install --user -U pyvips && (cd /data/data/com.termux/files/usr/lib/; ln -s libgobject-2.0.so{,.0}; ln -s libvips.so{,.42})` +# install on iOS + +first install one of the following: +* [a-Shell mini](https://apps.apple.com/us/app/a-shell-mini/id1543537943) gives you the essential features +* [a-Shell](https://apps.apple.com/us/app/a-shell/id1473805438) also enables audio transcoding and better thubmnails + +and then copypaste the following command into `a-Shell`: + +```sh +curl https://github.com/9001/copyparty/raw/refs/heads/hovudstraum/contrib/setup-ashell.sh | sh +``` + +what this does: +* creates a basic [config file](#accounts-and-volumes) named `cpc` which you can edit with `vim cpc` +* adds the command `cpp` to launch copyparty with that config file + +known issues: +* cannot run in the background; it needs to be on-screen to accept connections / uploads / downloads +* the best way to exit copyparty is to swipe away the app + + # reporting bugs ideas for context to include, and where to submit them diff --git a/contrib/setup-ashell.sh b/contrib/setup-ashell.sh new file mode 100644 index 00000000..006da444 --- /dev/null +++ b/contrib/setup-ashell.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# this script will install copyparty onto an iOS device (iPhone/iPad) +# +# step 1: install a-Shell: +# https://apps.apple.com/us/app/a-shell/id1473805438 +# +# step 2: copypaste the following command into a-Shell: +# curl https://github.com/9001/copyparty/raw/refs/heads/hovudstraum/contrib/setup-ashell.sh +# +# step 3: launch copyparty with this command: cpp +# +# if you ever want to upgrade copyparty, just repeat step 2 + + + +cd "$HOME/Documents" +curl -Locopyparty https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py + + + +# create the config file? (cannot use heredoc because body too large) +[ -e cpc ] || { +echo '[global]' >cpc +echo ' p: 80, 443, 3923 # enable http and https on these ports' >>cpc +echo ' e2dsa # enable file indexing and filesystem scanning' >>cpc +echo ' e2ts # and enable multimedia indexing' >>cpc +echo ' ver # show copyparty version in the controlpanel' >>cpc +echo ' qrz: 2 # enable qr-code and make it big' >>cpc +echo ' qrp: 1 # reduce qr-code padding' >>cpc +echo ' qr-fg: -1 # optimize for basic/simple terminals' >>cpc +echo ' qr-wait: 0.3 # less chance of getting scrolled away' >>cpc +echo '' >>cpc +echo ' # enable these by uncommenting them:' >>cpc +echo ' # ftp: 21 # enable ftp server on port 21' >>cpc +echo ' # tftp: 69 # enable tftp server on port 69' >>cpc +echo '' >>cpc +echo '[/]' >>cpc +echo ' ~/Documents' >>cpc +echo ' accs:' >>cpc +echo ' A: *' >>cpc +} + + + +# create the launcher? +[ -e cpp ] || { +echo '#!/bin/sh' >cpp +echo '' >>cpp +echo '# change the font so the qr-code draws correctly:' >>cpp +echo 'config -n "Menlo" # name' >>cpp +echo 'config -s 8 # size' >>cpp +echo '' >>cpp +echo '# launch copyparty' >>cpp +echo 'exec copyparty -c cpc "$@"' >>cpp +} + + + +chmod 755 copyparty cpp +echo +echo ================================= +echo +echo 'okay, all done!' +echo +echo 'you can edit your config' +echo 'with this command: vim cpc' +echo +echo 'you can run copyparty' +echo 'with this command: cpp' +echo diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 1a0ed743..e14f0573 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1114,6 +1114,7 @@ def add_qr(ap, tty): 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("--qrz", metavar="N", type=int, default=0, help="[\033[32m1\033[0m]=1x, [\033[32m2\033[0m]=2x, [\033[32m0\033[0m]=auto (try [\033[32m2\033[0m] on broken fonts)") ap2.add_argument("--qr-pin", metavar="N", type=int, default=0, help="sticky/pin the qr-code to always stay on-screen; [\033[32m0\033[0m]=disabled, [\033[32m1\033[0m]=with-url, [\033[32m2\033[0m]=just-qr") + ap2.add_argument("--qr-wait", metavar="SEC", type=float, default=0, help="wait \033[33mSEC\033[0m before printing the qr-code to the log") def add_fs(ap): diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 92a797d4..39ac5093 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -819,6 +819,10 @@ class SvcHub(object): t = "%s\033[s\033[1;%dr\033[%dH%s%s\033[u" % (t, sh - 1, sh, qr, url) self.pr(t, file=sys.stderr) + def sleepy_qr(self): + time.sleep(self.args.qr_wait) + self.log("qr-code", self.tcpsrv.qr) + def cb_httpsrv_up(self) -> None: self.httpsrv_up += 1 if self.httpsrv_up != self.broker.num_workers: @@ -834,7 +838,10 @@ class SvcHub(object): if self.args.qr_pin: self.sticky_qr() else: - self.log("qr-code", self.tcpsrv.qr) + if self.args.qr_wait: + Daemon(self.sleepy_qr, "qr_w8") + else: + self.log("qr-code", self.tcpsrv.qr) else: self.log("root", "workers OK\n") diff --git a/docs/versus.md b/docs/versus.md index 70b3c21d..d505a51a 100644 --- a/docs/versus.md +++ b/docs/versus.md @@ -140,7 +140,7 @@ symbol legend, * `zero setup` = you can get a mostly working setup by just launching the app, without having to install any software or configure whatever * `a`/copyparty remarks: * no gui for server settings; only for client-side stuff - * can theoretically run on iOS / iPads using [iSH](https://ish.app/), but only the iPad will offer sufficient multitasking i think + * runs on iOS / iPads using [a-Shell](https://holzschu.github.io/a-Shell_iOS/) (pretty good) or [iSH](https://ish.app/) (very slow) but cannot run in the background and is not able to share all of your phone storage (just a separate dedicated folder) * [android app](https://f-droid.org/en/packages/me.ocv.partyup/) is for uploading only * no iOS app but has [shortcuts](https://github.com/9001/copyparty#ios-shortcuts) for easy uploading * `b`/hfs2 runs on linux through wine diff --git a/scripts/toc.sh b/scripts/toc.sh index 8c3e22e9..611e092a 100755 --- a/scripts/toc.sh +++ b/scripts/toc.sh @@ -20,7 +20,7 @@ cat $f | awk ' o{next} /^#/{s=1;rs=0;pr()} /^#* *(nix package)/{rs=1} - /^#* *(themes|install on android|dev env setup|just the sfx|complete release|optional gpl stuff|nixos module|reverse-proxy perf)|```/{s=rs} + /^#* *(themes|install on android|install on iOS|dev env setup|just the sfx|complete release|optional gpl stuff|nixos module|reverse-proxy perf)|```/{s=rs} /^#/{ lv=length($1); sub(/[^ ]+ /,""); diff --git a/tests/util.py b/tests/util.py index 546851b4..897bc108 100644 --- a/tests/util.py +++ b/tests/util.py @@ -161,7 +161,7 @@ class Cfg(Namespace): ex = "ac_convt au_vol dl_list mtab_age reg_cap s_thead s_tbody tail_tmax tail_who th_convt ups_who zip_who" ka.update(**{k: 9 for k in ex.split()}) - ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs" + ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs" ka.update(**{k: 0 for k in ex.split()}) ex = "ah_alg bname chmod_f chpw_db doctitle df exit favico ipa html_head lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i shr tcolor textfiles txt_eol unlist vname xff_src zipmaxt R RS SR"