Skip to content

Commit ca98d54

Browse files
committed
install on iOS; closes 9001#328
1 parent 6c76614 commit ca98d54

File tree

7 files changed

+109
-5
lines changed

7 files changed

+109
-5
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ made in Norway 🇳🇴
141141
* [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+)
142142
* [zipapp](#zipapp) - another emergency alternative, [copyparty.pyz](https://github.com/9001/copyparty/releases/latest/download/copyparty.pyz)
143143
* [install on android](#install-on-android)
144+
* [install on iOS](#install-on-iOS)
144145
* [reporting bugs](#reporting-bugs) - ideas for context to include, and where to submit them
145146
* [devnotes](#devnotes) - for build instructions etc, see [./docs/devnotes.md](./docs/devnotes.md)
146147

@@ -155,6 +156,7 @@ just run **[copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/
155156
* or if you cannot install python, you can use [copyparty.exe](#copypartyexe) instead
156157
* or install [on arch](#arch-package)[on NixOS](#nixos-module)[through nix](#nix-package)
157158
* or if you are on android, [install copyparty in termux](#install-on-android)
159+
* or maybe an iPhone or iPad? [install in a-Shell on iOS](#install-on-iOS)
158160
* or maybe you have a [synology nas / dsm](./docs/synology-dsm.md)
159161
* or if you have [uv](https://docs.astral.sh/uv/) installed, run `uv tool run copyparty`
160162
* 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)
241243
*[upnp / zeroconf / mdns / ssdp](#zeroconf)
242244
*[event hooks](#event-hooks) / script runner
243245
*[reverse-proxy support](https://github.com/9001/copyparty#reverse-proxy)
244-
* ☑ cross-platform (Windows, Linux, Macos, Android, FreeBSD, arm32/arm64, ppc64le, s390x, risc-v/riscv64)
246+
* ☑ cross-platform (Windows, Linux, Macos, Android, iOS, FreeBSD, arm32/arm64, ppc64le, s390x, risc-v/riscv64)
245247
* upload
246248
* ☑ basic: plain multipart, ie6 support
247249
*[up2k](#uploading): js, resumable, multithreaded
@@ -2632,6 +2634,8 @@ there is no iPhone app, but the following shortcuts are almost as good:
26322634
* can download links and rehost the target file on copyparty (see first comment inside the shortcut)
26332635
* pics become lowres if you share from gallery to shortcut, so better to launch the shortcut and pick stuff from there
26342636
2637+
if you want to run the copyparty server on your iPhone or iPad, see [install on iOS](#install-on-iOS)
2638+
26352639
26362640
# performance
26372641
@@ -2965,6 +2969,27 @@ if you want thumbnails (photos+videos) and you're okay with spending another 132
29652969
* 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})`
29662970
29672971
2972+
# install on iOS
2973+
2974+
first install one of the following:
2975+
* [a-Shell mini](https://apps.apple.com/us/app/a-shell-mini/id1543537943) gives you the essential features
2976+
* [a-Shell](https://apps.apple.com/us/app/a-shell/id1473805438) also enables audio transcoding and better thubmnails
2977+
2978+
and then copypaste the following command into `a-Shell`:
2979+
2980+
```sh
2981+
curl https://github.com/9001/copyparty/raw/refs/heads/hovudstraum/contrib/setup-ashell.sh | sh
2982+
```
2983+
2984+
what this does:
2985+
* creates a basic [config file](#accounts-and-volumes) named `cpc` which you can edit with `vim cpc`
2986+
* adds the command `cpp` to launch copyparty with that config file
2987+
2988+
known issues:
2989+
* cannot run in the background; it needs to be on-screen to accept connections / uploads / downloads
2990+
* the best way to exit copyparty is to swipe away the app
2991+
2992+
29682993
# reporting bugs
29692994
29702995
ideas for context to include, and where to submit them

contrib/setup-ashell.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
#
3+
# this script will install copyparty onto an iOS device (iPhone/iPad)
4+
#
5+
# step 1: install a-Shell:
6+
# https://apps.apple.com/us/app/a-shell/id1473805438
7+
#
8+
# step 2: copypaste the following command into a-Shell:
9+
# curl https://github.com/9001/copyparty/raw/refs/heads/hovudstraum/contrib/setup-ashell.sh
10+
#
11+
# step 3: launch copyparty with this command: cpp
12+
#
13+
# if you ever want to upgrade copyparty, just repeat step 2
14+
15+
16+
17+
cd "$HOME/Documents"
18+
curl -Locopyparty https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py
19+
20+
21+
22+
# create the config file? (cannot use heredoc because body too large)
23+
[ -e cpc ] || {
24+
echo '[global]' >cpc
25+
echo ' p: 80, 443, 3923 # enable http and https on these ports' >>cpc
26+
echo ' e2dsa # enable file indexing and filesystem scanning' >>cpc
27+
echo ' e2ts # and enable multimedia indexing' >>cpc
28+
echo ' ver # show copyparty version in the controlpanel' >>cpc
29+
echo ' qrz: 2 # enable qr-code and make it big' >>cpc
30+
echo ' qrp: 1 # reduce qr-code padding' >>cpc
31+
echo ' qr-fg: -1 # optimize for basic/simple terminals' >>cpc
32+
echo ' qr-wait: 0.3 # less chance of getting scrolled away' >>cpc
33+
echo '' >>cpc
34+
echo ' # enable these by uncommenting them:' >>cpc
35+
echo ' # ftp: 21 # enable ftp server on port 21' >>cpc
36+
echo ' # tftp: 69 # enable tftp server on port 69' >>cpc
37+
echo '' >>cpc
38+
echo '[/]' >>cpc
39+
echo ' ~/Documents' >>cpc
40+
echo ' accs:' >>cpc
41+
echo ' A: *' >>cpc
42+
}
43+
44+
45+
46+
# create the launcher?
47+
[ -e cpp ] || {
48+
echo '#!/bin/sh' >cpp
49+
echo '' >>cpp
50+
echo '# change the font so the qr-code draws correctly:' >>cpp
51+
echo 'config -n "Menlo" # name' >>cpp
52+
echo 'config -s 8 # size' >>cpp
53+
echo '' >>cpp
54+
echo '# launch copyparty' >>cpp
55+
echo 'exec copyparty -c cpc "$@"' >>cpp
56+
}
57+
58+
59+
60+
chmod 755 copyparty cpp
61+
echo
62+
echo =================================
63+
echo
64+
echo 'okay, all done!'
65+
echo
66+
echo 'you can edit your config'
67+
echo 'with this command: vim cpc'
68+
echo
69+
echo 'you can run copyparty'
70+
echo 'with this command: cpp'
71+
echo

copyparty/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ def add_qr(ap, tty):
11141114
ap2.add_argument("--qrp", metavar="CELLS", type=int, default=4, help="padding (spec says 4 or more, but 1 is usually fine)")
11151115
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)")
11161116
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")
1117+
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")
11171118

11181119

11191120
def add_fs(ap):

copyparty/svchub.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,10 @@ def unlock():
819819
t = "%s\033[s\033[1;%dr\033[%dH%s%s\033[u" % (t, sh - 1, sh, qr, url)
820820
self.pr(t, file=sys.stderr)
821821

822+
def sleepy_qr(self):
823+
time.sleep(self.args.qr_wait)
824+
self.log("qr-code", self.tcpsrv.qr)
825+
822826
def cb_httpsrv_up(self) -> None:
823827
self.httpsrv_up += 1
824828
if self.httpsrv_up != self.broker.num_workers:
@@ -834,7 +838,10 @@ def cb_httpsrv_up(self) -> None:
834838
if self.args.qr_pin:
835839
self.sticky_qr()
836840
else:
837-
self.log("qr-code", self.tcpsrv.qr)
841+
if self.args.qr_wait:
842+
Daemon(self.sleepy_qr, "qr_w8")
843+
else:
844+
self.log("qr-code", self.tcpsrv.qr)
838845
else:
839846
self.log("root", "workers OK\n")
840847

docs/versus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ symbol legend,
140140
* `zero setup` = you can get a mostly working setup by just launching the app, without having to install any software or configure whatever
141141
* `a`/copyparty remarks:
142142
* no gui for server settings; only for client-side stuff
143-
* can theoretically run on iOS / iPads using [iSH](https://ish.app/), but only the iPad will offer sufficient multitasking i think
143+
* 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)
144144
* [android app](https://f-droid.org/en/packages/me.ocv.partyup/) is for uploading only
145145
* no iOS app but has [shortcuts](https://github.com/9001/copyparty#ios-shortcuts) for easy uploading
146146
* `b`/hfs2 runs on linux through wine

scripts/toc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cat $f | awk '
2020
o{next}
2121
/^#/{s=1;rs=0;pr()}
2222
/^#* *(nix package)/{rs=1}
23-
/^#* *(themes|install on android|dev env setup|just the sfx|complete release|optional gpl stuff|nixos module|reverse-proxy perf)|```/{s=rs}
23+
/^#* *(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}
2424
/^#/{
2525
lv=length($1);
2626
sub(/[^ ]+ /,"");

tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __init__(self, a=None, v=None, c=None, **ka0):
161161
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"
162162
ka.update(**{k: 9 for k in ex.split()})
163163

164-
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"
164+
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"
165165
ka.update(**{k: 0 for k in ex.split()})
166166

167167
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"

0 commit comments

Comments
 (0)