Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce4e489802 | ||
|
|
fd7c71d6a3 | ||
|
|
fad2268566 | ||
|
|
a95ea03cd0 | ||
|
|
f6be390579 | ||
|
|
4f264a0a9c | ||
|
|
d27144340f | ||
|
|
299cff3ff7 | ||
|
|
42c199e78e | ||
|
|
1b2d39857b | ||
|
|
ed908b9868 | ||
|
|
d162502c38 | ||
|
|
bf11b2a421 | ||
|
|
77274e9d59 | ||
|
|
8306e3d9de | ||
|
|
deb6711b51 | ||
|
|
7ef6fd13cf | ||
|
|
65c4e03574 | ||
|
|
c9fafb202d | ||
|
|
d4d9069130 | ||
|
|
7eca90cc21 | ||
|
|
6ecf4fdceb | ||
|
|
8cae7a715b | ||
|
|
c75b0c25a6 | ||
|
|
9dd5dec093 | ||
|
|
ec05f8ccd5 | ||
|
|
a1c7a095ee | ||
|
|
77df17d191 | ||
|
|
fa5845ff5f | ||
|
|
17fa490687 | ||
|
|
1eff87c3bd | ||
|
|
d123d2bff0 | ||
|
|
5ac3864874 | ||
|
|
c599e2aaa3 | ||
|
|
2e53f7979a | ||
|
|
f61511d8c8 | ||
|
|
47415a7120 | ||
|
|
db7becacd2 | ||
|
|
28b63e587b | ||
|
|
9cb93ae1ed | ||
|
|
e3e51fb83a | ||
|
|
49c7124776 | ||
|
|
60fb1207fc | ||
|
|
48470f6b50 | ||
|
|
1d308eeb4c | ||
|
|
84f5f41747 | ||
|
|
19189afb34 | ||
|
|
23e77a3389 | ||
|
|
ecced0c4f2 | ||
|
|
d4a8071de5 | ||
|
|
261236e302 | ||
|
|
0de09860f6 | ||
|
|
bfb39969a4 | ||
|
|
256dad8cc0 | ||
|
|
a247ba9ca3 | ||
|
|
0a9a807772 | ||
|
|
41fa6b2552 | ||
|
|
f425ff51ae | ||
|
|
7cde9a2976 | ||
|
|
5dcd88a6c8 | ||
|
|
c3ef3fdc1f | ||
|
|
b9ba783c1c | ||
|
|
d1bca1f52f | ||
|
|
94352f278b | ||
|
|
4fb87ebe32 | ||
|
|
3cbb7243ab | ||
|
|
fff45552da | ||
|
|
95157d02c9 | ||
|
|
3090c74832 | ||
|
|
4195762d2a | ||
|
|
dc3b7a2720 | ||
|
|
ad200f2b97 | ||
|
|
897f9d328d | ||
|
|
efbe34f29d | ||
|
|
dbfc899d79 | ||
|
|
74fb4b0cb8 | ||
|
|
68e7000275 | ||
|
|
38c2dcce3e | ||
|
|
5b3a5fe76b | ||
|
|
d5a9bd80b2 | ||
|
|
71c5565949 | ||
|
|
db33d68d42 | ||
|
|
e1c20c7a18 | ||
|
|
d3f1b45ce3 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -34,7 +34,7 @@ remove the ones that are not relevant:
|
|||||||
### Server details (if you're NOT using docker/podman)
|
### Server details (if you're NOT using docker/podman)
|
||||||
remove the ones that are not relevant:
|
remove the ones that are not relevant:
|
||||||
* **server OS / version:**
|
* **server OS / version:**
|
||||||
* **what copyparty did you grab:** (sfx/exe/pip/aur/...)
|
* **what copyparty did you grab:** (sfx/exe/pip/arch/...)
|
||||||
* **how you're running it:** (in a terminal, as a systemd-service, ...)
|
* **how you're running it:** (in a terminal, as a systemd-service, ...)
|
||||||
* run copyparty with `--version` and grab the last 3 lines (they start with `copyparty`, `CPython`, `sqlite`) and paste them below this line:
|
* run copyparty with `--version` and grab the last 3 lines (they start with `copyparty`, `CPython`, `sqlite`) and paste them below this line:
|
||||||
* **copyparty arguments and/or config-file:**
|
* **copyparty arguments and/or config-file:**
|
||||||
|
|||||||
97
README.md
97
README.md
@@ -8,12 +8,14 @@ turn almost any device into a file server with resumable uploads/downloads using
|
|||||||
* 🔌 protocols: [http](#the-browser) // [webdav](#webdav-server) // [ftp](#ftp-server) // [tftp](#tftp-server) // [smb/cifs](#smb-server)
|
* 🔌 protocols: [http](#the-browser) // [webdav](#webdav-server) // [ftp](#ftp-server) // [tftp](#tftp-server) // [smb/cifs](#smb-server)
|
||||||
* 📱 [android app](#android-app) // [iPhone shortcuts](#ios-shortcuts)
|
* 📱 [android app](#android-app) // [iPhone shortcuts](#ios-shortcuts)
|
||||||
|
|
||||||
👉 **[Get started](#quickstart)!** or visit the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running from a basement in finland
|
👉 **[Get started](#quickstart)!** or visit the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running on a nuc in my basement
|
||||||
|
|
||||||
📷 **screenshots:** [browser](#the-browser) // [upload](#uploading) // [unpost](#unpost) // [thumbnails](#thumbnails) // [search](#searching) // [fsearch](#file-search) // [zip-DL](#zip-downloads) // [md-viewer](#markdown-viewer)
|
📷 **screenshots:** [browser](#the-browser) // [upload](#uploading) // [unpost](#unpost) // [thumbnails](#thumbnails) // [search](#searching) // [fsearch](#file-search) // [zip-DL](#zip-downloads) // [md-viewer](#markdown-viewer)
|
||||||
|
|
||||||
🎬 **videos:** [upload](https://a.ocv.me/pub/demo/pics-vids/up2k.webm) // [cli-upload](https://a.ocv.me/pub/demo/pics-vids/u2cli.webm) // [race-the-beam](https://a.ocv.me/pub/g/nerd-stuff/cpp/2024-0418-race-the-beam.webm)
|
🎬 **videos:** [upload](https://a.ocv.me/pub/demo/pics-vids/up2k.webm) // [cli-upload](https://a.ocv.me/pub/demo/pics-vids/u2cli.webm) // [race-the-beam](https://a.ocv.me/pub/g/nerd-stuff/cpp/2024-0418-race-the-beam.webm)
|
||||||
|
|
||||||
|
made in Norway 🇳🇴
|
||||||
|
|
||||||
|
|
||||||
## readme toc
|
## readme toc
|
||||||
|
|
||||||
@@ -50,8 +52,11 @@ turn almost any device into a file server with resumable uploads/downloads using
|
|||||||
* [rss feeds](#rss-feeds) - monitor a folder with your RSS reader
|
* [rss feeds](#rss-feeds) - monitor a folder with your RSS reader
|
||||||
* [recent uploads](#recent-uploads) - list all recent uploads
|
* [recent uploads](#recent-uploads) - list all recent uploads
|
||||||
* [media player](#media-player) - plays almost every audio format there is
|
* [media player](#media-player) - plays almost every audio format there is
|
||||||
|
* [playlists](#playlists) - create and play [m3u8](https://en.wikipedia.org/wiki/M3U) playlists
|
||||||
|
* [creating a playlist](#creating-a-playlist) - with a standalone mediaplayer or copyparty
|
||||||
* [audio equalizer](#audio-equalizer) - and [dynamic range compressor](https://en.wikipedia.org/wiki/Dynamic_range_compression)
|
* [audio equalizer](#audio-equalizer) - and [dynamic range compressor](https://en.wikipedia.org/wiki/Dynamic_range_compression)
|
||||||
* [fix unreliable playback on android](#fix-unreliable-playback-on-android) - due to phone / app settings
|
* [fix unreliable playback on android](#fix-unreliable-playback-on-android) - due to phone / app settings
|
||||||
|
* [textfile viewer](#textfile-viewer) - with realtime streaming of logfiles and such ([demo](https://a.ocv.me/pub/demo/logtail/))
|
||||||
* [markdown viewer](#markdown-viewer) - and there are *two* editors
|
* [markdown viewer](#markdown-viewer) - and there are *two* editors
|
||||||
* [markdown vars](#markdown-vars) - dynamic docs with serverside variable expansion
|
* [markdown vars](#markdown-vars) - dynamic docs with serverside variable expansion
|
||||||
* [other tricks](#other-tricks)
|
* [other tricks](#other-tricks)
|
||||||
@@ -102,7 +107,7 @@ turn almost any device into a file server with resumable uploads/downloads using
|
|||||||
* [feature chickenbits](#feature-chickenbits) - buggy feature? rip it out
|
* [feature chickenbits](#feature-chickenbits) - buggy feature? rip it out
|
||||||
* [feature beefybits](#feature-beefybits) - force-enable features with known issues on your OS/env
|
* [feature beefybits](#feature-beefybits) - force-enable features with known issues on your OS/env
|
||||||
* [packages](#packages) - the party might be closer than you think
|
* [packages](#packages) - the party might be closer than you think
|
||||||
* [arch package](#arch-package) - now [available on aur](https://aur.archlinux.org/packages/copyparty) maintained by [@icxes](https://github.com/icxes)
|
* [arch package](#arch-package) - `pacman -S copyparty` (in [arch linux extra](https://archlinux.org/packages/extra/any/copyparty/))
|
||||||
* [fedora package](#fedora-package) - does not exist yet
|
* [fedora package](#fedora-package) - does not exist yet
|
||||||
* [nix package](#nix-package) - `nix profile install github:9001/copyparty`
|
* [nix package](#nix-package) - `nix profile install github:9001/copyparty`
|
||||||
* [nixos module](#nixos-module)
|
* [nixos module](#nixos-module)
|
||||||
@@ -147,6 +152,7 @@ just run **[copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/
|
|||||||
* or if you are on android, [install copyparty in termux](#install-on-android)
|
* or if you are on android, [install copyparty in termux](#install-on-android)
|
||||||
* or maybe you have a [synology nas / dsm](./docs/synology-dsm.md)
|
* or maybe you have a [synology nas / dsm](./docs/synology-dsm.md)
|
||||||
* or if your computer is messed up and nothing else works, [try the pyz](#zipapp)
|
* or if your computer is messed up and nothing else works, [try the pyz](#zipapp)
|
||||||
|
* or if your OS is dead, give the [bootable flashdrive / cd-rom](https://a.ocv.me/pub/stuff/edcd001/enterprise-edition/) a spin
|
||||||
* or if you don't trust copyparty yet and want to isolate it a little, then...
|
* or if you don't trust copyparty yet and want to isolate it a little, then...
|
||||||
* ...maybe [prisonparty](./bin/prisonparty.sh) to create a tiny [chroot](https://wiki.archlinux.org/title/Chroot) (very portable),
|
* ...maybe [prisonparty](./bin/prisonparty.sh) to create a tiny [chroot](https://wiki.archlinux.org/title/Chroot) (very portable),
|
||||||
* ...or [bubbleparty](./bin/bubbleparty.sh) to wrap it in [bubblewrap](https://github.com/containers/bubblewrap) (much better)
|
* ...or [bubbleparty](./bin/bubbleparty.sh) to wrap it in [bubblewrap](https://github.com/containers/bubblewrap) (much better)
|
||||||
@@ -250,8 +256,10 @@ also see [comparison to similar software](./docs/versus.md)
|
|||||||
* ☑ file manager (cut/paste, delete, [batch-rename](#batch-rename))
|
* ☑ file manager (cut/paste, delete, [batch-rename](#batch-rename))
|
||||||
* ☑ audio player (with [OS media controls](https://user-images.githubusercontent.com/241032/215347492-b4250797-6c90-4e09-9a4c-721edf2fb15c.png) and opus/mp3 transcoding)
|
* ☑ audio player (with [OS media controls](https://user-images.githubusercontent.com/241032/215347492-b4250797-6c90-4e09-9a4c-721edf2fb15c.png) and opus/mp3 transcoding)
|
||||||
* ☑ play video files as audio (converted on server)
|
* ☑ play video files as audio (converted on server)
|
||||||
|
* ☑ create and play [m3u8 playlists](#playlists)
|
||||||
* ☑ image gallery with webm player
|
* ☑ image gallery with webm player
|
||||||
* ☑ textfile browser with syntax hilighting
|
* ☑ [textfile browser](#textfile-viewer) with syntax hilighting
|
||||||
|
* ☑ realtime streaming of growing files (logfiles and such)
|
||||||
* ☑ [thumbnails](#thumbnails)
|
* ☑ [thumbnails](#thumbnails)
|
||||||
* ☑ ...of images using Pillow, pyvips, or FFmpeg
|
* ☑ ...of images using Pillow, pyvips, or FFmpeg
|
||||||
* ☑ ...of videos using FFmpeg
|
* ☑ ...of videos using FFmpeg
|
||||||
@@ -302,6 +310,8 @@ project goals / philosophy
|
|||||||
* adaptable, malleable, hackable
|
* adaptable, malleable, hackable
|
||||||
* no build steps; modify the js/python without needing node.js or anything like that
|
* no build steps; modify the js/python without needing node.js or anything like that
|
||||||
|
|
||||||
|
becoming rich is specifically *not* a motivation, but if you wanna donate then see my [github profile](https://github.com/9001) regarding donations for my FOSS stuff in general (also THANKS!)
|
||||||
|
|
||||||
|
|
||||||
## notes
|
## notes
|
||||||
|
|
||||||
@@ -411,6 +421,9 @@ upgrade notes
|
|||||||
|
|
||||||
"frequently" asked questions
|
"frequently" asked questions
|
||||||
|
|
||||||
|
* CopyParty?
|
||||||
|
* nope! the name is either copyparty (all-lowercase) or Copyparty -- it's [one word](https://en.wiktionary.org/wiki/copyparty) after all :>
|
||||||
|
|
||||||
* can I change the 🌲 spinning pine-tree loading animation?
|
* can I change the 🌲 spinning pine-tree loading animation?
|
||||||
* [yeah...](https://github.com/9001/copyparty/tree/hovudstraum/docs/rice#boring-loader-spinner) :-(
|
* [yeah...](https://github.com/9001/copyparty/tree/hovudstraum/docs/rice#boring-loader-spinner) :-(
|
||||||
|
|
||||||
@@ -550,6 +563,8 @@ a client can request to see dotfiles in directory listings if global option `-ed
|
|||||||
|
|
||||||
dotfiles do not appear in search results unless one of the above is true, **and** the global option / volflag `dotsrch` is set
|
dotfiles do not appear in search results unless one of the above is true, **and** the global option / volflag `dotsrch` is set
|
||||||
|
|
||||||
|
> even if user has permission to see dotfiles, they are default-hidden unless `--see-dots` is set, and/or user has enabled the `dotfiles` option in the settings tab
|
||||||
|
|
||||||
config file example, where the same permission to see dotfiles is given in two different ways just for reference:
|
config file example, where the same permission to see dotfiles is given in two different ways just for reference:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -686,7 +701,10 @@ enabling `multiselect` lets you click files to select them, and then shift-click
|
|||||||
* `multiselect` is mostly intended for phones/tablets, but the `sel` option in the `[⚙️] settings` tab is better suited for desktop use, allowing selection by CTRL-clicking and range-selection with SHIFT-click, all without affecting regular clicking
|
* `multiselect` is mostly intended for phones/tablets, but the `sel` option in the `[⚙️] settings` tab is better suited for desktop use, allowing selection by CTRL-clicking and range-selection with SHIFT-click, all without affecting regular clicking
|
||||||
* the `sel` option can be made default globally with `--gsel` or per-volume with volflag `gsel`
|
* the `sel` option can be made default globally with `--gsel` or per-volume with volflag `gsel`
|
||||||
|
|
||||||
to show `/icons/exe.png` as the thumbnail for all .exe files, `--ext-th=exe=/icons/exe.png` (optionally as a volflag)
|
to show `/icons/exe.png` and `/icons/elf.gif` as the thumbnail for all `.exe` and `.elf` files respectively, do this: `--ext-th=exe=/icons/exe.png --ext-th=elf=/icons/elf.gif`
|
||||||
|
* optionally as separate volflags for each mapping; see config file example below
|
||||||
|
* the supported image formats are [jpg, png, gif, webp, ico](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types)
|
||||||
|
* be careful with svg; chrome will crash if you have too many unique svg files showing on the same page (the limit is 250 or so) -- showing the same handful of svg files thousands of times is ok however
|
||||||
|
|
||||||
config file example:
|
config file example:
|
||||||
|
|
||||||
@@ -703,6 +721,7 @@ config file example:
|
|||||||
dthumb # disable ALL thumbnails and audio transcoding
|
dthumb # disable ALL thumbnails and audio transcoding
|
||||||
dvthumb # only disable video thumbnails
|
dvthumb # only disable video thumbnails
|
||||||
ext-th: exe=/ico/exe.png # /ico/exe.png is the thumbnail of *.exe
|
ext-th: exe=/ico/exe.png # /ico/exe.png is the thumbnail of *.exe
|
||||||
|
ext-th: elf=/ico/elf.gif # ...and /ico/elf.gif is used for *.elf
|
||||||
th-covers: folder.png,folder.jpg,cover.png,cover.jpg # the default
|
th-covers: folder.png,folder.jpg,cover.png,cover.jpg # the default
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -730,6 +749,7 @@ select which type of archive you want in the `[⚙️] config` tab:
|
|||||||
* `up2k.db` and `dir.txt` is always excluded
|
* `up2k.db` and `dir.txt` is always excluded
|
||||||
* bsdtar supports streaming unzipping: `curl foo?zip | bsdtar -xv`
|
* bsdtar supports streaming unzipping: `curl foo?zip | bsdtar -xv`
|
||||||
* good, because copyparty's zip is faster than tar on small files
|
* good, because copyparty's zip is faster than tar on small files
|
||||||
|
* but `?tar` is better for large files, especially if the total exceeds 4 GiB
|
||||||
* `zip_crc` will take longer to download since the server has to read each file twice
|
* `zip_crc` will take longer to download since the server has to read each file twice
|
||||||
* this is only to support MS-DOS PKZIP v2.04g (october 1993) and older
|
* this is only to support MS-DOS PKZIP v2.04g (october 1993) and older
|
||||||
* how are you accessing copyparty actually
|
* how are you accessing copyparty actually
|
||||||
@@ -908,6 +928,7 @@ semi-intentional limitations:
|
|||||||
|
|
||||||
* cleanup of expired shares only works when global option `e2d` is set, and/or at least one volume on the server has volflag `e2d`
|
* cleanup of expired shares only works when global option `e2d` is set, and/or at least one volume on the server has volflag `e2d`
|
||||||
* only folders from the same volume are shared; if you are sharing a folder which contains other volumes, then the contents of those volumes will not be available
|
* only folders from the same volume are shared; if you are sharing a folder which contains other volumes, then the contents of those volumes will not be available
|
||||||
|
* if you change [password hashing](#password-hashing) settings after creating a password-protected share, then that share will stop working
|
||||||
* related to [IdP volumes being forgotten on shutdown](https://github.com/9001/copyparty/blob/hovudstraum/docs/idp.md#idp-volumes-are-forgotten-on-shutdown), any shares pointing into a user's IdP volume will be unavailable until that user makes their first request after a restart
|
* related to [IdP volumes being forgotten on shutdown](https://github.com/9001/copyparty/blob/hovudstraum/docs/idp.md#idp-volumes-are-forgotten-on-shutdown), any shares pointing into a user's IdP volume will be unavailable until that user makes their first request after a restart
|
||||||
* no option to "delete after first access" because tricky
|
* no option to "delete after first access" because tricky
|
||||||
* when linking something to discord (for example) it'll get accessed by their scraper and that would count as a hit
|
* when linking something to discord (for example) it'll get accessed by their scraper and that would count as a hit
|
||||||
@@ -1034,11 +1055,13 @@ click the `play` link next to an audio file, or copy the link target to [share i
|
|||||||
|
|
||||||
open the `[🎺]` media-player-settings tab to configure it,
|
open the `[🎺]` media-player-settings tab to configure it,
|
||||||
* "switches":
|
* "switches":
|
||||||
|
* `[🔁]` repeats one single song forever
|
||||||
* `[🔀]` shuffles the files inside each folder
|
* `[🔀]` shuffles the files inside each folder
|
||||||
* `[preload]` starts loading the next track when it's about to end, reduces the silence between songs
|
* `[preload]` starts loading the next track when it's about to end, reduces the silence between songs
|
||||||
* `[full]` does a full preload by downloading the entire next file; good for unreliable connections, bad for slow connections
|
* `[full]` does a full preload by downloading the entire next file; good for unreliable connections, bad for slow connections
|
||||||
* `[~s]` toggles the seekbar waveform display
|
* `[~s]` toggles the seekbar waveform display
|
||||||
* `[/np]` enables buttons to copy the now-playing info as an irc message
|
* `[/np]` enables buttons to copy the now-playing info as an irc message
|
||||||
|
* `[📻]` enables buttons to create an [m3u playlist](#playlists) with the selected songs
|
||||||
* `[os-ctl]` makes it possible to control audio playback from the lockscreen of your device (enables [mediasession](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession))
|
* `[os-ctl]` makes it possible to control audio playback from the lockscreen of your device (enables [mediasession](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession))
|
||||||
* `[seek]` allows seeking with lockscreen controls (buggy on some devices)
|
* `[seek]` allows seeking with lockscreen controls (buggy on some devices)
|
||||||
* `[art]` shows album art on the lockscreen
|
* `[art]` shows album art on the lockscreen
|
||||||
@@ -1057,11 +1080,39 @@ open the `[🎺]` media-player-settings tab to configure it,
|
|||||||
* "transcode to":
|
* "transcode to":
|
||||||
* `[opus]` produces an `opus` whenever transcoding is necessary (the best choice on Android and PCs)
|
* `[opus]` produces an `opus` whenever transcoding is necessary (the best choice on Android and PCs)
|
||||||
* `[awo]` is `opus` in a `weba` file, good for iPhones (iOS 17.5 and newer) but Apple is still fixing some state-confusion bugs as of iOS 18.2.1
|
* `[awo]` is `opus` in a `weba` file, good for iPhones (iOS 17.5 and newer) but Apple is still fixing some state-confusion bugs as of iOS 18.2.1
|
||||||
* `[caf]` is `opus` in a `caf` file, good for iPhones (iOS 11 through 17), technically unsupported by Apple but works for the mos tpart
|
* `[caf]` is `opus` in a `caf` file, good for iPhones (iOS 11 through 17), technically unsupported by Apple but works for the most part
|
||||||
* `[mp3]` -- the myth, the legend, the undying master of mediocre sound quality that definitely works everywhere
|
* `[mp3]` -- the myth, the legend, the undying master of mediocre sound quality that definitely works everywhere
|
||||||
* "tint" reduces the contrast of the playback bar
|
* "tint" reduces the contrast of the playback bar
|
||||||
|
|
||||||
|
|
||||||
|
### playlists
|
||||||
|
|
||||||
|
create and play [m3u8](https://en.wikipedia.org/wiki/M3U) playlists -- see example [text](https://a.ocv.me/pub/demo/music/?doc=example-playlist.m3u) and [player](https://a.ocv.me/pub/demo/music/#m3u=example-playlist.m3u)
|
||||||
|
|
||||||
|
click a file with the extension `m3u` or `m3u8` (for example `mixtape.m3u` or `touhou.m3u8` ) and you get two choices: Play / Edit
|
||||||
|
|
||||||
|
playlists can include songs across folders anywhere on the server, but filekeys/dirkeys are NOT supported, so the listener must have read-access or get-access to the files
|
||||||
|
|
||||||
|
|
||||||
|
### creating a playlist
|
||||||
|
|
||||||
|
with a standalone mediaplayer or copyparty
|
||||||
|
|
||||||
|
you can use foobar2000, deadbeef, just about any standalone player should work -- but you might need to edit the filepaths in the playlist so they fit with the server-URLs
|
||||||
|
|
||||||
|
alternatively, you can create the playlist using copyparty itself:
|
||||||
|
|
||||||
|
* open the `[🎺]` media-player-settings tab and enable the `[📻]` create-playlist feature -- this adds two new buttons in the bottom-right tray, `[📻add]` and `[📻copy]` which appear when you listen to music, or when you select a few audiofiles
|
||||||
|
|
||||||
|
* click the `📻add` button while a song is playing (or when you've selected some songs) and they'll be added to "the list" (you can't see it yet)
|
||||||
|
|
||||||
|
* at any time, click `📻copy` to send the playlist to your clipboard
|
||||||
|
* you can then continue adding more songs if you'd like
|
||||||
|
* if you want to wipe the playlist and start from scratch, just refresh the page
|
||||||
|
|
||||||
|
* create a new textfile, name it `something.m3u` and paste the playlist there
|
||||||
|
|
||||||
|
|
||||||
### audio equalizer
|
### audio equalizer
|
||||||
|
|
||||||
and [dynamic range compressor](https://en.wikipedia.org/wiki/Dynamic_range_compression)
|
and [dynamic range compressor](https://en.wikipedia.org/wiki/Dynamic_range_compression)
|
||||||
@@ -1078,6 +1129,18 @@ not available on iPhones / iPads because AudioContext currently breaks backgroun
|
|||||||
due to phone / app settings, android phones may randomly stop playing music when the power saver kicks in, especially at the end of an album -- you can fix it by [disabling power saving](https://user-images.githubusercontent.com/241032/235262123-c328cca9-3930-4948-bd18-3949b9fd3fcf.png) in the [app settings](https://user-images.githubusercontent.com/241032/235262121-2ffc51ae-7821-4310-a322-c3b7a507890c.png) of the browser you use for music streaming (preferably a dedicated one)
|
due to phone / app settings, android phones may randomly stop playing music when the power saver kicks in, especially at the end of an album -- you can fix it by [disabling power saving](https://user-images.githubusercontent.com/241032/235262123-c328cca9-3930-4948-bd18-3949b9fd3fcf.png) in the [app settings](https://user-images.githubusercontent.com/241032/235262121-2ffc51ae-7821-4310-a322-c3b7a507890c.png) of the browser you use for music streaming (preferably a dedicated one)
|
||||||
|
|
||||||
|
|
||||||
|
## textfile viewer
|
||||||
|
|
||||||
|
with realtime streaming of logfiles and such ([demo](https://a.ocv.me/pub/demo/logtail/)) , and terminal colors work too
|
||||||
|
|
||||||
|
click `-txt-` next to a textfile to open the viewer, which has the following toolbar buttons:
|
||||||
|
|
||||||
|
* `✏️ edit` opens the textfile editor
|
||||||
|
* `📡 follow` starts monitoring the file for changes, streaming new lines in realtime
|
||||||
|
* similar to `tail -f`
|
||||||
|
* [link directly](https://a.ocv.me/pub/demo/logtail/?doc=lipsum.txt&tail) to a file with tailing enabled by adding `&tail` to the textviewer URL
|
||||||
|
|
||||||
|
|
||||||
## markdown viewer
|
## markdown viewer
|
||||||
|
|
||||||
and there are *two* editors
|
and there are *two* editors
|
||||||
@@ -1438,7 +1501,6 @@ the same arguments can be set as volflags, in addition to `d2d`, `d2ds`, `d2t`,
|
|||||||
note:
|
note:
|
||||||
* upload-times can be displayed in the file listing by enabling the `.up_at` metadata key, either globally with `-e2d -mte +.up_at` or per-volume with volflags `e2d,mte=+.up_at` (will have a ~17% performance impact on directory listings)
|
* upload-times can be displayed in the file listing by enabling the `.up_at` metadata key, either globally with `-e2d -mte +.up_at` or per-volume with volflags `e2d,mte=+.up_at` (will have a ~17% performance impact on directory listings)
|
||||||
* `e2tsr` is probably always overkill, since `e2ds`/`e2dsa` would pick up any file modifications and `e2ts` would then reindex those, unless there is a new copyparty version with new parsers and the release note says otherwise
|
* `e2tsr` is probably always overkill, since `e2ds`/`e2dsa` would pick up any file modifications and `e2ts` would then reindex those, unless there is a new copyparty version with new parsers and the release note says otherwise
|
||||||
* the rescan button in the admin panel has no effect unless the volume has `-e2ds` or higher
|
|
||||||
|
|
||||||
config file example (these options are recommended btw):
|
config file example (these options are recommended btw):
|
||||||
|
|
||||||
@@ -2166,10 +2228,14 @@ if your distro/OS is not mentioned below, there might be some hints in the [«on
|
|||||||
|
|
||||||
## arch package
|
## arch package
|
||||||
|
|
||||||
now [available on aur](https://aur.archlinux.org/packages/copyparty) maintained by [@icxes](https://github.com/icxes)
|
`pacman -S copyparty` (in [arch linux extra](https://archlinux.org/packages/extra/any/copyparty/))
|
||||||
|
|
||||||
it comes with a [systemd service](./contrib/package/arch/copyparty.service) and expects to find one or more [config files](./docs/example.conf) in `/etc/copyparty.d/`
|
it comes with a [systemd service](./contrib/package/arch/copyparty.service) and expects to find one or more [config files](./docs/example.conf) in `/etc/copyparty.d/`
|
||||||
|
|
||||||
|
after installing it, you may want to `cp /usr/lib/systemd/system/copyparty.service /etc/systemd/system/` and then `vim /etc/systemd/system/copyparty.service` to change what user/group it is running as (you only need to do this once)
|
||||||
|
|
||||||
|
NOTE: there used to be an aur package; this evaporated when copyparty was adopted by the official archlinux repos. If you're still using the aur package, please move
|
||||||
|
|
||||||
|
|
||||||
## fedora package
|
## fedora package
|
||||||
|
|
||||||
@@ -2372,6 +2438,9 @@ interact with copyparty using non-browser clients
|
|||||||
* and for screenshots on macos, see [./contrib/ishare.iscu](./contrib/#ishareiscu)
|
* and for screenshots on macos, see [./contrib/ishare.iscu](./contrib/#ishareiscu)
|
||||||
* and for screenshots on linux, see [./contrib/flameshot.sh](./contrib/flameshot.sh)
|
* and for screenshots on linux, see [./contrib/flameshot.sh](./contrib/flameshot.sh)
|
||||||
|
|
||||||
|
* [Custom Uploader](https://f-droid.org/en/packages/com.nyx.custom_uploader/) (an Android app) as an alternative to copyparty's own [PartyUP!](#android-app)
|
||||||
|
* works if you set UploadURL to `https://your.com/foo/?want=url&pw=hunter2` and FormDataName `f`
|
||||||
|
|
||||||
* contextlet (web browser integration); see [contrib contextlet](contrib/#send-to-cppcontextletjson)
|
* contextlet (web browser integration); see [contrib contextlet](contrib/#send-to-cppcontextletjson)
|
||||||
|
|
||||||
* [igloo irc](https://iglooirc.com/): Method: `post` Host: `https://you.com/up/?want=url&pw=hunter2` Multipart: `yes` File parameter: `f`
|
* [igloo irc](https://iglooirc.com/): Method: `post` Host: `https://you.com/up/?want=url&pw=hunter2` Multipart: `yes` File parameter: `f`
|
||||||
@@ -2383,6 +2452,8 @@ copyparty returns a truncated sha512sum of your PUT/POST as base64; you can gene
|
|||||||
|
|
||||||
you can provide passwords using header `PW: hunter2`, cookie `cppwd=hunter2`, url-param `?pw=hunter2`, or with basic-authentication (either as the username or password)
|
you can provide passwords using header `PW: hunter2`, cookie `cppwd=hunter2`, url-param `?pw=hunter2`, or with basic-authentication (either as the username or password)
|
||||||
|
|
||||||
|
> for basic-authentication, all of the following are accepted: `password` / `whatever:password` / `password:whatever` (the username is ignored)
|
||||||
|
|
||||||
NOTE: curl will not send the original filename if you use `-T` combined with url-params! Also, make sure to always leave a trailing slash in URLs unless you want to override the filename
|
NOTE: curl will not send the original filename if you use `-T` combined with url-params! Also, make sure to always leave a trailing slash in URLs unless you want to override the filename
|
||||||
|
|
||||||
|
|
||||||
@@ -2471,6 +2542,11 @@ below are some tweaks roughly ordered by usefulness:
|
|||||||
|
|
||||||
when uploading files,
|
when uploading files,
|
||||||
|
|
||||||
|
* when uploading from very fast storage (NVMe SSD) with chrome/firefox, enable `[wasm]` in the `[⚙️] settings` tab to more effectively use all CPU-cores for hashing
|
||||||
|
* don't do this on Safari (runs faster without)
|
||||||
|
* don't do this on older browsers; likely to provoke browser-bugs (browser eats all RAM and crashes)
|
||||||
|
* can be made default-enabled serverside with `--nosubtle 137` (chrome v137+) or `--nosubtle 2` (chrome+firefox)
|
||||||
|
|
||||||
* chrome is recommended (unfortunately), at least compared to firefox:
|
* chrome is recommended (unfortunately), at least compared to firefox:
|
||||||
* up to 90% faster when hashing, especially on SSDs
|
* up to 90% faster when hashing, especially on SSDs
|
||||||
* up to 40% faster when uploading over extremely fast internets
|
* up to 40% faster when uploading over extremely fast internets
|
||||||
@@ -2651,7 +2727,7 @@ enable [thumbnails](#thumbnails) of...
|
|||||||
* **images:** `Pillow` and/or `pyvips` and/or `ffmpeg` (requires py2.7 or py3.5+)
|
* **images:** `Pillow` and/or `pyvips` and/or `ffmpeg` (requires py2.7 or py3.5+)
|
||||||
* **videos/audio:** `ffmpeg` and `ffprobe` somewhere in `$PATH`
|
* **videos/audio:** `ffmpeg` and `ffprobe` somewhere in `$PATH`
|
||||||
* **HEIF pictures:** `pyvips` or `ffmpeg` or `pyheif-pillow-opener` (requires Linux or a C compiler)
|
* **HEIF pictures:** `pyvips` or `ffmpeg` or `pyheif-pillow-opener` (requires Linux or a C compiler)
|
||||||
* **AVIF pictures:** `pyvips` or `ffmpeg` or `pillow-avif-plugin`
|
* **AVIF pictures:** `pyvips` or `ffmpeg` or `pillow-avif-plugin` or pillow v11.3+
|
||||||
* **JPEG XL pictures:** `pyvips` or `ffmpeg`
|
* **JPEG XL pictures:** `pyvips` or `ffmpeg`
|
||||||
|
|
||||||
enable sending [zeromq messages](#zeromq) from event-hooks: `pyzmq`
|
enable sending [zeromq messages](#zeromq) from event-hooks: `pyzmq`
|
||||||
@@ -2678,10 +2754,11 @@ set any of the following environment variables to disable its associated optiona
|
|||||||
| `PRTY_NO_CFSSL` | never attempt to generate self-signed certificates using [cfssl](https://github.com/cloudflare/cfssl) |
|
| `PRTY_NO_CFSSL` | never attempt to generate self-signed certificates using [cfssl](https://github.com/cloudflare/cfssl) |
|
||||||
| `PRTY_NO_FFMPEG` | **audio transcoding** goes byebye, **thumbnailing** must be handled by Pillow/libvips |
|
| `PRTY_NO_FFMPEG` | **audio transcoding** goes byebye, **thumbnailing** must be handled by Pillow/libvips |
|
||||||
| `PRTY_NO_FFPROBE` | **audio transcoding** goes byebye, **thumbnailing** must be handled by Pillow/libvips, **metadata-scanning** must be handled by mutagen |
|
| `PRTY_NO_FFPROBE` | **audio transcoding** goes byebye, **thumbnailing** must be handled by Pillow/libvips, **metadata-scanning** must be handled by mutagen |
|
||||||
|
| `PRTY_NO_MAGIC` | do not use [magic](https://pypi.org/project/python-magic/) for filetype detection |
|
||||||
| `PRTY_NO_MUTAGEN` | do not use [mutagen](https://pypi.org/project/mutagen/) for reading metadata from media files; will fallback to ffprobe |
|
| `PRTY_NO_MUTAGEN` | do not use [mutagen](https://pypi.org/project/mutagen/) for reading metadata from media files; will fallback to ffprobe |
|
||||||
| `PRTY_NO_PIL` | disable all [Pillow](https://pypi.org/project/pillow/)-based thumbnail support; will fallback to libvips or ffmpeg |
|
| `PRTY_NO_PIL` | disable all [Pillow](https://pypi.org/project/pillow/)-based thumbnail support; will fallback to libvips or ffmpeg |
|
||||||
| `PRTY_NO_PILF` | disable Pillow `ImageFont` text rendering, used for folder thumbnails |
|
| `PRTY_NO_PILF` | disable Pillow `ImageFont` text rendering, used for folder thumbnails |
|
||||||
| `PRTY_NO_PIL_AVIF` | disable 3rd-party Pillow plugin for [AVIF support](https://pypi.org/project/pillow-avif-plugin/) |
|
| `PRTY_NO_PIL_AVIF` | disable Pillow avif support (internal and/or [plugin](https://pypi.org/project/pillow-avif-plugin/)) |
|
||||||
| `PRTY_NO_PIL_HEIF` | disable 3rd-party Pillow plugin for [HEIF support](https://pypi.org/project/pyheif-pillow-opener/) |
|
| `PRTY_NO_PIL_HEIF` | disable 3rd-party Pillow plugin for [HEIF support](https://pypi.org/project/pyheif-pillow-opener/) |
|
||||||
| `PRTY_NO_PIL_WEBP` | disable use of native webp support in Pillow |
|
| `PRTY_NO_PIL_WEBP` | disable use of native webp support in Pillow |
|
||||||
| `PRTY_NO_PSUTIL` | do not use [psutil](https://pypi.org/project/psutil/) for reaping stuck hooks and plugins on Windows |
|
| `PRTY_NO_PSUTIL` | do not use [psutil](https://pypi.org/project/psutil/) for reaping stuck hooks and plugins on Windows |
|
||||||
@@ -2778,5 +2855,7 @@ if there's a wall of base64 in the log (thread stacks) then please include that,
|
|||||||
|
|
||||||
for build instructions etc, see [./docs/devnotes.md](./docs/devnotes.md)
|
for build instructions etc, see [./docs/devnotes.md](./docs/devnotes.md)
|
||||||
|
|
||||||
|
specifically you may want to [build the sfx](https://github.com/9001/copyparty/blob/hovudstraum/docs/devnotes.md#just-the-sfx) or [build from scratch](https://github.com/9001/copyparty/blob/hovudstraum/docs/devnotes.md#build-from-scratch)
|
||||||
|
|
||||||
see [./docs/TODO.md](./docs/TODO.md) for planned features / fixes / changes
|
see [./docs/TODO.md](./docs/TODO.md) for planned features / fixes / changes
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ example usage as a volflag in a copyparty config file:
|
|||||||
### CONFIG
|
### CONFIG
|
||||||
|
|
||||||
# filetypes to process; ignores everything else
|
# filetypes to process; ignores everything else
|
||||||
EXTS = "mp3 flac ogg opus m4a aac wav wma"
|
EXTS = "mp3 flac ogg oga opus m4a aac wav wma"
|
||||||
|
|
||||||
# the name of the subdir to put the normalized files in
|
# the name of the subdir to put the normalized files in
|
||||||
SUBDIR = "normalized"
|
SUBDIR = "normalized"
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ def main():
|
|||||||
## selecting it inside the print at the end:
|
## selecting it inside the print at the end:
|
||||||
##
|
##
|
||||||
|
|
||||||
|
# move all uploads to one specific folder
|
||||||
|
into_junk = {"vp": "/junk"}
|
||||||
|
|
||||||
# create a subfolder named after the filetype and move it into there
|
# create a subfolder named after the filetype and move it into there
|
||||||
into_subfolder = {"vp": ext}
|
into_subfolder = {"vp": ext}
|
||||||
|
|
||||||
@@ -92,8 +95,8 @@ def main():
|
|||||||
by_category = {} # no action
|
by_category = {} # no action
|
||||||
|
|
||||||
# now choose the default effect to apply; can be any of these:
|
# now choose the default effect to apply; can be any of these:
|
||||||
# into_subfolder into_toplevel into_sibling by_category
|
# into_junk into_subfolder into_toplevel into_sibling by_category
|
||||||
effect = {"vp": "/junk"}
|
effect = into_sibling
|
||||||
|
|
||||||
##
|
##
|
||||||
## but we can keep going, adding more speicifc rules
|
## but we can keep going, adding more speicifc rules
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import os
|
|||||||
import stat
|
import stat
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import sys
|
import sys
|
||||||
|
from urllib.parse import unquote_to_bytes as unquote
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -28,14 +29,17 @@ which does the following respectively,
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
MOUNT_BASE = b"/run/media/egon/"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
label = sys.argv[1].split(":usb-eject:")[1].split(":")[0]
|
label = sys.argv[1].split(":usb-eject:")[1].split(":")[0]
|
||||||
mp = "/run/media/egon/" + label
|
mp = MOUNT_BASE + unquote(label)
|
||||||
# print("ejecting [%s]... " % (mp,), end="")
|
# print("ejecting [%s]... " % (mp,), end="")
|
||||||
mp = os.path.abspath(os.path.realpath(mp.encode("utf-8")))
|
mp = os.path.abspath(os.path.realpath(mp))
|
||||||
st = os.lstat(mp)
|
st = os.lstat(mp)
|
||||||
if not stat.S_ISDIR(st.st_mode):
|
if not stat.S_ISDIR(st.st_mode) or not mp.startswith(MOUNT_BASE):
|
||||||
raise Exception("not a regular directory")
|
raise Exception("not a regular directory")
|
||||||
|
|
||||||
# if you're running copyparty as root (thx for the faith)
|
# if you're running copyparty as root (thx for the faith)
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ set -e
|
|||||||
# modifies the keyfinder python lib to load the .so in ~/pe
|
# modifies the keyfinder python lib to load the .so in ~/pe
|
||||||
|
|
||||||
|
|
||||||
|
export FORCE_COLOR=1
|
||||||
|
|
||||||
linux=1
|
linux=1
|
||||||
|
|
||||||
win=
|
win=
|
||||||
@@ -186,12 +188,15 @@ install_keyfinder() {
|
|||||||
echo "so not found at $sop"
|
echo "so not found at $sop"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x=${-//[^x]/}; set -x; cat /etc/alpine-release
|
||||||
# rm -rf /Users/ed/Library/Python/3.9/lib/python/site-packages/*keyfinder*
|
# rm -rf /Users/ed/Library/Python/3.9/lib/python/site-packages/*keyfinder*
|
||||||
CFLAGS="-I$h/pe/keyfinder/include -I/opt/local/include -I/usr/include/ffmpeg" \
|
CFLAGS="-I$h/pe/keyfinder/include -I/opt/local/include -I/usr/include/ffmpeg" \
|
||||||
|
CXXFLAGS="-I$h/pe/keyfinder/include -I/opt/local/include -I/usr/include/ffmpeg" \
|
||||||
LDFLAGS="-L$h/pe/keyfinder/lib -L$h/pe/keyfinder/lib64 -L/opt/local/lib" \
|
LDFLAGS="-L$h/pe/keyfinder/lib -L$h/pe/keyfinder/lib64 -L/opt/local/lib" \
|
||||||
PKG_CONFIG_PATH=/c/msys64/mingw64/lib/pkgconfig \
|
PKG_CONFIG_PATH="/c/msys64/mingw64/lib/pkgconfig:$h/pe/keyfinder/lib/pkgconfig" \
|
||||||
$pybin -m pip install --user keyfinder
|
$pybin -m pip install --user keyfinder
|
||||||
|
[ "$x" ] || set +x
|
||||||
|
|
||||||
pypath="$($pybin -c 'import keyfinder; print(keyfinder.__file__)')"
|
pypath="$($pybin -c 'import keyfinder; print(keyfinder.__file__)')"
|
||||||
for pyso in "${pypath%/*}"/*.so; do
|
for pyso in "${pypath%/*}"/*.so; do
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
S_VERSION = "2.10"
|
S_VERSION = "2.11"
|
||||||
S_BUILD_DT = "2025-02-19"
|
S_BUILD_DT = "2025-05-18"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
u2c.py: upload to copyparty
|
u2c.py: upload to copyparty
|
||||||
@@ -1289,7 +1289,7 @@ class Ctl(object):
|
|||||||
if self.ar.jw:
|
if self.ar.jw:
|
||||||
print("%s %s" % (wark, vp))
|
print("%s %s" % (wark, vp))
|
||||||
else:
|
else:
|
||||||
zd = datetime.datetime.fromtimestamp(file.lmod, UTC)
|
zd = datetime.datetime.fromtimestamp(max(0, file.lmod), UTC)
|
||||||
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
||||||
zd.year,
|
zd.year,
|
||||||
zd.month,
|
zd.month,
|
||||||
|
|||||||
@@ -2,19 +2,38 @@
|
|||||||
# not accept more consecutive clients than what copyparty is able to;
|
# not accept more consecutive clients than what copyparty is able to;
|
||||||
# nginx default is 512 (worker_processes 1, worker_connections 512)
|
# nginx default is 512 (worker_processes 1, worker_connections 512)
|
||||||
#
|
#
|
||||||
|
# ======================================================================
|
||||||
|
#
|
||||||
|
# to reverse-proxy a specific path/subpath/location below a domain
|
||||||
|
# (rather than a complete subdomain), for example "/qw/er", you must
|
||||||
|
# run copyparty with --rp-loc /qw/as and also change the following:
|
||||||
|
# location / {
|
||||||
|
# proxy_pass http://cpp_tcp;
|
||||||
|
# to this:
|
||||||
|
# location /qw/er/ {
|
||||||
|
# proxy_pass http://cpp_tcp/qw/er/;
|
||||||
|
#
|
||||||
|
# ======================================================================
|
||||||
|
#
|
||||||
# rarely, in some extreme usecases, it can be good to add -j0
|
# rarely, in some extreme usecases, it can be good to add -j0
|
||||||
# (40'000 requests per second, or 20gbps upload/download in parallel)
|
# (40'000 requests per second, or 20gbps upload/download in parallel)
|
||||||
# but this is usually counterproductive and slightly buggy
|
# but this is usually counterproductive and slightly buggy
|
||||||
#
|
#
|
||||||
|
# ======================================================================
|
||||||
|
#
|
||||||
# on fedora/rhel, remember to setsebool -P httpd_can_network_connect 1
|
# on fedora/rhel, remember to setsebool -P httpd_can_network_connect 1
|
||||||
#
|
#
|
||||||
# if you are behind cloudflare (or another protection service),
|
# ======================================================================
|
||||||
|
#
|
||||||
|
# if you are behind cloudflare (or another CDN/WAF/protection service),
|
||||||
# remember to reject all connections which are not coming from your
|
# remember to reject all connections which are not coming from your
|
||||||
# protection service -- for cloudflare in particular, you can
|
# protection service -- for cloudflare in particular, you can
|
||||||
# generate the list of permitted IP ranges like so:
|
# generate the list of permitted IP ranges like so:
|
||||||
# (curl -s https://www.cloudflare.com/ips-v{4,6} | sed 's/^/allow /; s/$/;/'; echo; echo "deny all;") > /etc/nginx/cloudflare-only.conf
|
# (curl -s https://www.cloudflare.com/ips-v{4,6} | sed 's/^/allow /; s/$/;/'; echo; echo "deny all;") > /etc/nginx/cloudflare-only.conf
|
||||||
#
|
#
|
||||||
# and then enable it below by uncomenting the cloudflare-only.conf line
|
# and then enable it below by uncomenting the cloudflare-only.conf line
|
||||||
|
#
|
||||||
|
# ======================================================================
|
||||||
|
|
||||||
|
|
||||||
upstream cpp_tcp {
|
upstream cpp_tcp {
|
||||||
|
|||||||
@@ -1,29 +1,31 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
with lib;
|
pkgs,
|
||||||
|
lib,
|
||||||
let
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
mkKeyValue = key: value:
|
mkKeyValue = key: value:
|
||||||
if value == true then
|
if value == true
|
||||||
# sets with a true boolean value are coerced to just the key name
|
then
|
||||||
|
# sets with a true boolean value are coerced to just the key name
|
||||||
key
|
key
|
||||||
else if value == false then
|
else if value == false
|
||||||
# or omitted completely when false
|
then
|
||||||
|
# or omitted completely when false
|
||||||
""
|
""
|
||||||
else
|
else (generators.mkKeyValueDefault {inherit mkValueString;} ": " key value);
|
||||||
(generators.mkKeyValueDefault { inherit mkValueString; } ": " key value);
|
|
||||||
|
|
||||||
mkAttrsString = value: (generators.toKeyValue { inherit mkKeyValue; } value);
|
mkAttrsString = value: (generators.toKeyValue {inherit mkKeyValue;} value);
|
||||||
|
|
||||||
mkValueString = value:
|
mkValueString = value:
|
||||||
if isList value then
|
if isList value
|
||||||
(concatStringsSep ", " (map mkValueString value))
|
then (concatStringsSep ", " (map mkValueString value))
|
||||||
else if isAttrs value then
|
else if isAttrs value
|
||||||
"\n" + (mkAttrsString value)
|
then "\n" + (mkAttrsString value)
|
||||||
else
|
else (generators.mkValueStringDefault {} value);
|
||||||
(generators.mkValueStringDefault { } value);
|
|
||||||
|
|
||||||
mkSectionName = value: "[" + (escape [ "[" "]" ] value) + "]";
|
mkSectionName = value: "[" + (escape ["[" "]"] value) + "]";
|
||||||
|
|
||||||
mkSection = name: attrs: ''
|
mkSection = name: attrs: ''
|
||||||
${mkSectionName name}
|
${mkSectionName name}
|
||||||
@@ -49,12 +51,12 @@ let
|
|||||||
${concatStringsSep "\n" (mapAttrsToList mkVolume cfg.volumes)}
|
${concatStringsSep "\n" (mapAttrsToList mkVolume cfg.volumes)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
name = "copyparty";
|
|
||||||
cfg = config.services.copyparty;
|
cfg = config.services.copyparty;
|
||||||
configFile = pkgs.writeText "${name}.conf" configStr;
|
configFile = pkgs.writeText "copyparty.conf" configStr;
|
||||||
runtimeConfigPath = "/run/${name}/${name}.conf";
|
runtimeConfigPath = "/run/copyparty/copyparty.conf";
|
||||||
home = "/var/lib/${name}";
|
externalCacheDir = "/var/cache/copyparty";
|
||||||
defaultShareDir = "${home}/data";
|
externalStateDir = "/var/lib/copyparty";
|
||||||
|
defaultShareDir = "${externalStateDir}/data";
|
||||||
in {
|
in {
|
||||||
options.services.copyparty = {
|
options.services.copyparty = {
|
||||||
enable = mkEnableOption "web-based file manager";
|
enable = mkEnableOption "web-based file manager";
|
||||||
@@ -68,6 +70,35 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkHashWrapper = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Make a shell script wrapper called 'copyparty-hash' with all options set here,
|
||||||
|
that launches the hashing cli.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "copyparty";
|
||||||
|
description = ''
|
||||||
|
The user that copyparty will run under.
|
||||||
|
|
||||||
|
If changed from default, you are responsible for making sure the user exists.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "copyparty";
|
||||||
|
description = ''
|
||||||
|
The group that copyparty will run under.
|
||||||
|
|
||||||
|
If changed from default, you are responsible for making sure the user exists.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
openFilesLimit = mkOption {
|
openFilesLimit = mkOption {
|
||||||
default = 4096;
|
default = 4096;
|
||||||
type = types.either types.int types.str;
|
type = types.either types.int types.str;
|
||||||
@@ -79,22 +110,25 @@ in {
|
|||||||
description = ''
|
description = ''
|
||||||
Global settings to apply.
|
Global settings to apply.
|
||||||
Directly maps to values in the [global] section of the copyparty config.
|
Directly maps to values in the [global] section of the copyparty config.
|
||||||
|
Cannot set "c" or "hist", those are set by this module.
|
||||||
See `${getExe cfg.package} --help` for more details.
|
See `${getExe cfg.package} --help` for more details.
|
||||||
'';
|
'';
|
||||||
default = {
|
default = {
|
||||||
i = "127.0.0.1";
|
i = "127.0.0.1";
|
||||||
no-reload = true;
|
no-reload = true;
|
||||||
|
hist = externalCacheDir;
|
||||||
};
|
};
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
i = "0.0.0.0";
|
i = "0.0.0.0";
|
||||||
no-reload = true;
|
no-reload = true;
|
||||||
|
hist = ${externalCacheDir};
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
accounts = mkOption {
|
accounts = mkOption {
|
||||||
type = types.attrsOf (types.submodule ({ ... }: {
|
type = types.attrsOf (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
passwordFile = mkOption {
|
passwordFile = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@@ -109,7 +143,7 @@ in {
|
|||||||
description = ''
|
description = ''
|
||||||
A set of copyparty accounts to create.
|
A set of copyparty accounts to create.
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = {};
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
ed.passwordFile = "/run/keys/copyparty/ed";
|
ed.passwordFile = "/run/keys/copyparty/ed";
|
||||||
@@ -118,10 +152,10 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
volumes = mkOption {
|
volumes = mkOption {
|
||||||
type = types.attrsOf (types.submodule ({ ... }: {
|
type = types.attrsOf (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
type = types.str;
|
type = types.path;
|
||||||
description = ''
|
description = ''
|
||||||
Path of a directory to share.
|
Path of a directory to share.
|
||||||
'';
|
'';
|
||||||
@@ -177,7 +211,7 @@ in {
|
|||||||
nohash = "\.iso$";
|
nohash = "\.iso$";
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
@@ -185,7 +219,7 @@ in {
|
|||||||
default = {
|
default = {
|
||||||
"/" = {
|
"/" = {
|
||||||
path = defaultShareDir;
|
path = defaultShareDir;
|
||||||
access = { r = "*"; };
|
access = {r = "*";};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
@@ -204,52 +238,65 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (let
|
||||||
|
command = "${getExe cfg.package} -c ${runtimeConfigPath}";
|
||||||
|
in {
|
||||||
systemd.services.copyparty = {
|
systemd.services.copyparty = {
|
||||||
description = "http file sharing hub";
|
description = "http file sharing hub";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = ["multi-user.target"];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
PYTHONUNBUFFERED = "true";
|
PYTHONUNBUFFERED = "true";
|
||||||
XDG_CONFIG_HOME = "${home}/.config";
|
XDG_CONFIG_HOME = externalStateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
preStart = let
|
preStart = let
|
||||||
replaceSecretCommand = name: attrs:
|
replaceSecretCommand = name: attrs: "${getExe pkgs.replace-secret} '${
|
||||||
"${getExe pkgs.replace-secret} '${
|
passwordPlaceholder name
|
||||||
passwordPlaceholder name
|
}' '${attrs.passwordFile}' ${runtimeConfigPath}";
|
||||||
}' '${attrs.passwordFile}' ${runtimeConfigPath}";
|
|
||||||
in ''
|
in ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
install -m 600 ${configFile} ${runtimeConfigPath}
|
install -m 600 ${configFile} ${runtimeConfigPath}
|
||||||
${concatStringsSep "\n"
|
${concatStringsSep "\n"
|
||||||
(mapAttrsToList replaceSecretCommand cfg.accounts)}
|
(mapAttrsToList replaceSecretCommand cfg.accounts)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${getExe cfg.package} -c ${runtimeConfigPath}";
|
ExecStart = command;
|
||||||
|
|
||||||
# Hardening options
|
# Hardening options
|
||||||
User = "copyparty";
|
User = cfg.user;
|
||||||
Group = "copyparty";
|
Group = cfg.group;
|
||||||
RuntimeDirectory = name;
|
RuntimeDirectory = ["copyparty"];
|
||||||
RuntimeDirectoryMode = "0700";
|
RuntimeDirectoryMode = "0700";
|
||||||
StateDirectory = [ name "${name}/data" "${name}/.config" ];
|
StateDirectory = ["copyparty"];
|
||||||
StateDirectoryMode = "0700";
|
StateDirectoryMode = "0700";
|
||||||
WorkingDirectory = home;
|
CacheDirectory = lib.mkIf (cfg.settings ? hist) ["copyparty"];
|
||||||
|
CacheDirectoryMode = lib.mkIf (cfg.settings ? hist) "0700";
|
||||||
|
WorkingDirectory = externalStateDir;
|
||||||
|
BindReadOnlyPaths =
|
||||||
|
[
|
||||||
|
"/nix/store"
|
||||||
|
"-/etc/resolv.conf"
|
||||||
|
"-/etc/nsswitch.conf"
|
||||||
|
"-/etc/hosts"
|
||||||
|
"-/etc/localtime"
|
||||||
|
]
|
||||||
|
++ (mapAttrsToList (k: v: "-${v.passwordFile}") cfg.accounts);
|
||||||
|
BindPaths =
|
||||||
|
(
|
||||||
|
if cfg.settings ? hist
|
||||||
|
then [cfg.settings.hist]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ [externalStateDir]
|
||||||
|
++ (mapAttrsToList (k: v: v.path) cfg.volumes);
|
||||||
|
# ProtectSystem = "strict";
|
||||||
|
# Note that unlike what 'ro' implies,
|
||||||
|
# this actually makes it impossible to read anything in the root FS,
|
||||||
|
# except for things explicitly mounted via `RuntimeDirectory`, `StateDirectory`, `CacheDirectory`, and `BindReadOnlyPaths`.
|
||||||
|
# This is because TemporaryFileSystem creates a *new* *empty* filesystem for the process, so only bindmounts are visible.
|
||||||
TemporaryFileSystem = "/:ro";
|
TemporaryFileSystem = "/:ro";
|
||||||
BindReadOnlyPaths = [
|
|
||||||
"/nix/store"
|
|
||||||
"-/etc/resolv.conf"
|
|
||||||
"-/etc/nsswitch.conf"
|
|
||||||
"-/etc/hosts"
|
|
||||||
"-/etc/localtime"
|
|
||||||
] ++ (mapAttrsToList (k: v: "-${v.passwordFile}") cfg.accounts);
|
|
||||||
BindPaths = [ home ] ++ (mapAttrsToList (k: v: v.path) cfg.volumes);
|
|
||||||
# Would re-mount paths ignored by temporary root
|
|
||||||
#ProtectSystem = "strict";
|
|
||||||
ProtectHome = true;
|
|
||||||
PrivateTmp = true;
|
PrivateTmp = true;
|
||||||
PrivateDevices = true;
|
PrivateDevices = true;
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
@@ -269,15 +316,48 @@ in {
|
|||||||
NoNewPrivileges = true;
|
NoNewPrivileges = true;
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
RestrictRealtime = true;
|
RestrictRealtime = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups.copyparty = { };
|
# ensure volumes exist:
|
||||||
users.users.copyparty = {
|
systemd.tmpfiles.settings."copyparty" = (
|
||||||
|
lib.attrsets.mapAttrs' (
|
||||||
|
name: value:
|
||||||
|
lib.attrsets.nameValuePair (value.path) {
|
||||||
|
d = {
|
||||||
|
#: in front of things means it wont change it if the directory already exists.
|
||||||
|
group = ":${cfg.group}";
|
||||||
|
user = ":${cfg.user}";
|
||||||
|
mode = ":755";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cfg.volumes
|
||||||
|
);
|
||||||
|
|
||||||
|
users.groups.copyparty = lib.mkIf (cfg.user == "copyparty" && cfg.group == "copyparty") {};
|
||||||
|
users.users.copyparty = lib.mkIf (cfg.user == "copyparty" && cfg.group == "copyparty") {
|
||||||
description = "Service user for copyparty";
|
description = "Service user for copyparty";
|
||||||
group = "copyparty";
|
group = "copyparty";
|
||||||
home = home;
|
home = externalStateDir;
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
};
|
};
|
||||||
};
|
environment.systemPackages = lib.mkIf cfg.mkHashWrapper [
|
||||||
|
(pkgs.writeShellScriptBin
|
||||||
|
"copyparty-hash"
|
||||||
|
''
|
||||||
|
set -a # automatically export variables
|
||||||
|
# set same environment variables as the systemd service
|
||||||
|
${lib.pipe config.systemd.services.copyparty.environment [
|
||||||
|
(lib.filterAttrs (n: v: v != null && n != "PATH"))
|
||||||
|
(lib.mapAttrs (_: v: "${v}"))
|
||||||
|
(lib.toShellVars)
|
||||||
|
]}
|
||||||
|
PATH=${config.systemd.services.copyparty.environment.PATH}:$PATH
|
||||||
|
|
||||||
|
exec ${command} --ah-cli
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Maintainer: icxes <dev.null@need.moe>
|
# Maintainer: icxes <dev.null@need.moe>
|
||||||
pkgname=copyparty
|
pkgname=copyparty
|
||||||
pkgver="1.16.19"
|
pkgver="1.18.1"
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="File server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++"
|
pkgdesc="File server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++"
|
||||||
arch=("any")
|
arch=("any")
|
||||||
@@ -22,7 +22,7 @@ optdepends=("ffmpeg: thumbnails for videos, images (slower) and audio, music tag
|
|||||||
)
|
)
|
||||||
source=("https://github.com/9001/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
source=("https://github.com/9001/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
||||||
backup=("etc/${pkgname}.d/init" )
|
backup=("etc/${pkgname}.d/init" )
|
||||||
sha256sums=("e18a4a6943d47e87c94ac0bf76006de7674ad78155608b23192e527472e59291")
|
sha256sums=("4f8069987574a580017531ffe7d30bcfc573979cca419f9becebae6b4228525a")
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, makeWrapper, fetchurl, utillinux, python, jinja2, impacket, pyftpdlib, pyopenssl, argon2-cffi, pillow, pyvips, pyzmq, ffmpeg, mutagen,
|
{ lib, stdenv, makeWrapper, fetchurl, util-linux, python, jinja2, impacket, pyftpdlib, pyopenssl, argon2-cffi, pillow, pyvips, pyzmq, ffmpeg, mutagen,
|
||||||
|
|
||||||
# use argon2id-hashed passwords in config files (sha2 is always available)
|
# use argon2id-hashed passwords in config files (sha2 is always available)
|
||||||
withHashedPasswords ? true,
|
withHashedPasswords ? true,
|
||||||
@@ -61,7 +61,7 @@ in stdenv.mkDerivation {
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm755 $src $out/share/copyparty-sfx.py
|
install -Dm755 $src $out/share/copyparty-sfx.py
|
||||||
makeWrapper ${pyEnv.interpreter} $out/bin/copyparty \
|
makeWrapper ${pyEnv.interpreter} $out/bin/copyparty \
|
||||||
--set PATH '${lib.makeBinPath ([ utillinux ] ++ lib.optional withMediaProcessing ffmpeg)}:$PATH' \
|
--set PATH '${lib.makeBinPath ([ util-linux ] ++ lib.optional withMediaProcessing ffmpeg)}:$PATH' \
|
||||||
--add-flags "$out/share/copyparty-sfx.py"
|
--add-flags "$out/share/copyparty-sfx.py"
|
||||||
'';
|
'';
|
||||||
meta.mainProgram = "copyparty";
|
meta.mainProgram = "copyparty";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"url": "https://github.com/9001/copyparty/releases/download/v1.16.19/copyparty-sfx.py",
|
"url": "https://github.com/9001/copyparty/releases/download/v1.18.1/copyparty-sfx.py",
|
||||||
"version": "1.16.19",
|
"version": "1.18.1",
|
||||||
"hash": "sha256-IdQdoY7uNAQ4LoBrANud9vekL/Mske57D+m6RXfwgW8="
|
"hash": "sha256-Dzz5JXvVH+nCVc8Bc0DV3UdZanzDHRnwGKJYx7N8WZc="
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,23 @@ almost the same as minimal-up2k.html except this one...:
|
|||||||
|
|
||||||
-- looks slightly better
|
-- looks slightly better
|
||||||
|
|
||||||
|
|
||||||
|
========================
|
||||||
|
== USAGE INSTRUCTIONS ==
|
||||||
|
|
||||||
|
1. create a volume which anyone can read from (if you haven't already)
|
||||||
|
2. copy this file into that volume, so anyone can download it
|
||||||
|
3. enable the plugin by telling the webbrowser to load this file;
|
||||||
|
assuming the URL to the public volume is /res/, and
|
||||||
|
assuming you're using config-files, then add this to your config:
|
||||||
|
|
||||||
|
[global]
|
||||||
|
js-browser: /res/minimal-up2k.js
|
||||||
|
|
||||||
|
alternatively, if you're not using config-files, then
|
||||||
|
add the following commandline argument instead:
|
||||||
|
--js-browser=/res/minimal-up2k.js
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var u2min = `
|
var u2min = `
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ web/deps/prismd.css
|
|||||||
web/deps/scp.woff2
|
web/deps/scp.woff2
|
||||||
web/deps/sha512.ac.js
|
web/deps/sha512.ac.js
|
||||||
web/deps/sha512.hw.js
|
web/deps/sha512.hw.js
|
||||||
|
web/idp.html
|
||||||
web/iiam.gif
|
web/iiam.gif
|
||||||
web/md.css
|
web/md.css
|
||||||
web/md.html
|
web/md.html
|
||||||
|
|||||||
@@ -964,6 +964,7 @@ def add_general(ap, nc, srvname):
|
|||||||
ap2.add_argument("--name", metavar="TXT", type=u, default=srvname, help="server name (displayed topleft in browser and in mDNS)")
|
ap2.add_argument("--name", metavar="TXT", type=u, default=srvname, help="server name (displayed topleft in browser and in mDNS)")
|
||||||
ap2.add_argument("--mime", metavar="EXT=MIME", type=u, action="append", help="map file \033[33mEXT\033[0mension to \033[33mMIME\033[0mtype, for example [\033[32mjpg=image/jpeg\033[0m]")
|
ap2.add_argument("--mime", metavar="EXT=MIME", type=u, action="append", help="map file \033[33mEXT\033[0mension to \033[33mMIME\033[0mtype, for example [\033[32mjpg=image/jpeg\033[0m]")
|
||||||
ap2.add_argument("--mimes", action="store_true", help="list default mimetype mapping and exit")
|
ap2.add_argument("--mimes", action="store_true", help="list default mimetype mapping and exit")
|
||||||
|
ap2.add_argument("--rmagic", action="store_true", help="do expensive analysis to improve accuracy of returned mimetypes; will make file-downloads, rss, and webdav slower (volflag=rmagic)")
|
||||||
ap2.add_argument("--license", action="store_true", help="show licenses and exit")
|
ap2.add_argument("--license", action="store_true", help="show licenses and exit")
|
||||||
ap2.add_argument("--version", action="store_true", help="show versions and exit")
|
ap2.add_argument("--version", action="store_true", help="show versions and exit")
|
||||||
|
|
||||||
@@ -1003,6 +1004,9 @@ def add_upload(ap):
|
|||||||
ap2 = ap.add_argument_group('upload options')
|
ap2 = ap.add_argument_group('upload options')
|
||||||
ap2.add_argument("--dotpart", action="store_true", help="dotfile incomplete uploads, hiding them from clients unless \033[33m-ed\033[0m")
|
ap2.add_argument("--dotpart", action="store_true", help="dotfile incomplete uploads, hiding them from clients unless \033[33m-ed\033[0m")
|
||||||
ap2.add_argument("--plain-ip", action="store_true", help="when avoiding filename collisions by appending the uploader's ip to the filename: append the plaintext ip instead of salting and hashing the ip")
|
ap2.add_argument("--plain-ip", action="store_true", help="when avoiding filename collisions by appending the uploader's ip to the filename: append the plaintext ip instead of salting and hashing the ip")
|
||||||
|
ap2.add_argument("--put-name", metavar="TXT", type=u, default="put-{now.6f}-{cip}.bin", help="filename for nameless uploads (when uploader doesn't provide a name); default is [\033[32mput-UNIXTIME-IP.bin\033[0m] (the \033[32m.6f\033[0m means six decimal places) (volflag=put_name)")
|
||||||
|
ap2.add_argument("--put-ck", metavar="ALG", type=u, default="sha512", help="default checksum-hasher for PUT/WebDAV uploads: no / md5 / sha1 / sha256 / sha512 / b2 / blake2 / b2s / blake2s (volflag=put_ck)")
|
||||||
|
ap2.add_argument("--bup-ck", metavar="ALG", type=u, default="sha512", help="default checksum-hasher for bup/basic-uploader: no / md5 / sha1 / sha256 / sha512 / b2 / blake2 / b2s / blake2s (volflag=bup_ck)")
|
||||||
ap2.add_argument("--unpost", metavar="SEC", type=int, default=3600*12, help="grace period where uploads can be deleted by the uploader, even without delete permissions; 0=disabled, default=12h")
|
ap2.add_argument("--unpost", metavar="SEC", type=int, default=3600*12, help="grace period where uploads can be deleted by the uploader, even without delete permissions; 0=disabled, default=12h")
|
||||||
ap2.add_argument("--u2abort", metavar="NUM", type=int, default=1, help="clients can abort incomplete uploads by using the unpost tab (requires \033[33m-e2d\033[0m). [\033[32m0\033[0m] = never allowed (disable feature), [\033[32m1\033[0m] = allow if client has the same IP as the upload AND is using the same account, [\033[32m2\033[0m] = just check the IP, [\033[32m3\033[0m] = just check account-name (volflag=u2abort)")
|
ap2.add_argument("--u2abort", metavar="NUM", type=int, default=1, help="clients can abort incomplete uploads by using the unpost tab (requires \033[33m-e2d\033[0m). [\033[32m0\033[0m] = never allowed (disable feature), [\033[32m1\033[0m] = allow if client has the same IP as the upload AND is using the same account, [\033[32m2\033[0m] = just check the IP, [\033[32m3\033[0m] = just check account-name (volflag=u2abort)")
|
||||||
ap2.add_argument("--blank-wt", metavar="SEC", type=int, default=300, help="file write grace period (any client can write to a blank file last-modified more recently than \033[33mSEC\033[0m seconds ago)")
|
ap2.add_argument("--blank-wt", metavar="SEC", type=int, default=300, help="file write grace period (any client can write to a blank file last-modified more recently than \033[33mSEC\033[0m seconds ago)")
|
||||||
@@ -1025,7 +1029,8 @@ def add_upload(ap):
|
|||||||
ap2.add_argument("--df", metavar="GiB", type=u, default="0", help="ensure \033[33mGiB\033[0m free disk space by rejecting upload requests; assumes gigabytes unless a unit suffix is given: [\033[32m256m\033[0m], [\033[32m4\033[0m], [\033[32m2T\033[0m] (volflag=df)")
|
ap2.add_argument("--df", metavar="GiB", type=u, default="0", help="ensure \033[33mGiB\033[0m free disk space by rejecting upload requests; assumes gigabytes unless a unit suffix is given: [\033[32m256m\033[0m], [\033[32m4\033[0m], [\033[32m2T\033[0m] (volflag=df)")
|
||||||
ap2.add_argument("--sparse", metavar="MiB", type=int, default=4, help="windows-only: minimum size of incoming uploads through up2k before they are made into sparse files")
|
ap2.add_argument("--sparse", metavar="MiB", type=int, default=4, help="windows-only: minimum size of incoming uploads through up2k before they are made into sparse files")
|
||||||
ap2.add_argument("--turbo", metavar="LVL", type=int, default=0, help="configure turbo-mode in up2k client; [\033[32m-1\033[0m] = forbidden/always-off, [\033[32m0\033[0m] = default-off and warn if enabled, [\033[32m1\033[0m] = default-off, [\033[32m2\033[0m] = on, [\033[32m3\033[0m] = on and disable datecheck")
|
ap2.add_argument("--turbo", metavar="LVL", type=int, default=0, help="configure turbo-mode in up2k client; [\033[32m-1\033[0m] = forbidden/always-off, [\033[32m0\033[0m] = default-off and warn if enabled, [\033[32m1\033[0m] = default-off, [\033[32m2\033[0m] = on, [\033[32m3\033[0m] = on and disable datecheck")
|
||||||
ap2.add_argument("--u2j", metavar="JOBS", type=int, default=2, help="web-client: number of file chunks to upload in parallel; 1 or 2 is good for low-latency (same-country) connections, 4-8 for android clients, 16 for cross-atlantic (max=64)")
|
ap2.add_argument("--nosubtle", metavar="N", type=int, default=0, help="when to use a wasm-hasher instead of the browser's builtin; faster on chrome, but buggy in older chrome versions. [\033[32m0\033[0m] = only when necessary (non-https), [\033[32m1\033[0m] = always (all browsers), [\033[32m2\033[0m] = always on chrome/firefox, [\033[32m3\033[0m] = always on chrome, [\033[32mN\033[0m] = chrome-version N and newer (recommendation: 137)")
|
||||||
|
ap2.add_argument("--u2j", metavar="JOBS", type=int, default=2, help="web-client: number of file chunks to upload in parallel; 1 or 2 is good when latency is low (same-country), 2~4 for android-clients, 2~6 for cross-atlantic. Max is 6 in most browsers. Big values increase network-speed but may reduce HDD-speed")
|
||||||
ap2.add_argument("--u2sz", metavar="N,N,N", type=u, default="1,64,96", help="web-client: default upload chunksize (MiB); sets \033[33mmin,default,max\033[0m in the settings gui. Each HTTP POST will aim for \033[33mdefault\033[0m, and never exceed \033[33mmax\033[0m. Cloudflare max is 96. Big values are good for cross-atlantic but may increase HDD fragmentation on some FS. Disable this optimization with [\033[32m1,1,1\033[0m]")
|
ap2.add_argument("--u2sz", metavar="N,N,N", type=u, default="1,64,96", help="web-client: default upload chunksize (MiB); sets \033[33mmin,default,max\033[0m in the settings gui. Each HTTP POST will aim for \033[33mdefault\033[0m, and never exceed \033[33mmax\033[0m. Cloudflare max is 96. Big values are good for cross-atlantic but may increase HDD fragmentation on some FS. Disable this optimization with [\033[32m1,1,1\033[0m]")
|
||||||
ap2.add_argument("--u2ow", metavar="NUM", type=int, default=0, help="web-client: default setting for when to replace/overwrite existing files; [\033[32m0\033[0m]=never, [\033[32m1\033[0m]=if-client-newer, [\033[32m2\033[0m]=always (volflag=u2ow)")
|
ap2.add_argument("--u2ow", metavar="NUM", type=int, default=0, help="web-client: default setting for when to replace/overwrite existing files; [\033[32m0\033[0m]=never, [\033[32m1\033[0m]=if-client-newer, [\033[32m2\033[0m]=always (volflag=u2ow)")
|
||||||
ap2.add_argument("--u2sort", metavar="TXT", type=u, default="s", help="upload order; [\033[32ms\033[0m]=smallest-first, [\033[32mn\033[0m]=alphabetical, [\033[32mfs\033[0m]=force-s, [\033[32mfn\033[0m]=force-n -- alphabetical is a bit slower on fiber/LAN but makes it easier to eyeball if everything went fine")
|
ap2.add_argument("--u2sort", metavar="TXT", type=u, default="s", help="upload order; [\033[32ms\033[0m]=smallest-first, [\033[32mn\033[0m]=alphabetical, [\033[32mfs\033[0m]=force-s, [\033[32mfn\033[0m]=force-n -- alphabetical is a bit slower on fiber/LAN but makes it easier to eyeball if everything went fine")
|
||||||
@@ -1088,12 +1093,16 @@ def add_cert(ap, cert_path):
|
|||||||
|
|
||||||
|
|
||||||
def add_auth(ap):
|
def add_auth(ap):
|
||||||
|
idp_db = os.path.join(E.cfg, "idp.db")
|
||||||
ses_db = os.path.join(E.cfg, "sessions.db")
|
ses_db = os.path.join(E.cfg, "sessions.db")
|
||||||
ap2 = ap.add_argument_group('IdP / identity provider / user authentication options')
|
ap2 = ap.add_argument_group('IdP / identity provider / user authentication options')
|
||||||
ap2.add_argument("--idp-h-usr", metavar="HN", type=u, default="", help="bypass the copyparty authentication checks if the request-header \033[33mHN\033[0m contains a username to associate the request with (for use with authentik/oauth/...)\n\033[1;31mWARNING:\033[0m if you enable this, make sure clients are unable to specify this header themselves; must be washed away and replaced by a reverse-proxy")
|
ap2.add_argument("--idp-h-usr", metavar="HN", type=u, default="", help="bypass the copyparty authentication checks if the request-header \033[33mHN\033[0m contains a username to associate the request with (for use with authentik/oauth/...)\n\033[1;31mWARNING:\033[0m if you enable this, make sure clients are unable to specify this header themselves; must be washed away and replaced by a reverse-proxy")
|
||||||
ap2.add_argument("--idp-h-grp", metavar="HN", type=u, default="", help="assume the request-header \033[33mHN\033[0m contains the groupname of the requesting user; can be referenced in config files for group-based access control")
|
ap2.add_argument("--idp-h-grp", metavar="HN", type=u, default="", help="assume the request-header \033[33mHN\033[0m contains the groupname of the requesting user; can be referenced in config files for group-based access control")
|
||||||
ap2.add_argument("--idp-h-key", metavar="HN", type=u, default="", help="optional but recommended safeguard; your reverse-proxy will insert a secret header named \033[33mHN\033[0m into all requests, and the other IdP headers will be ignored if this header is not present")
|
ap2.add_argument("--idp-h-key", metavar="HN", type=u, default="", help="optional but recommended safeguard; your reverse-proxy will insert a secret header named \033[33mHN\033[0m into all requests, and the other IdP headers will be ignored if this header is not present")
|
||||||
ap2.add_argument("--idp-gsep", metavar="RE", type=u, default="|:;+,", help="if there are multiple groups in \033[33m--idp-h-grp\033[0m, they are separated by one of the characters in \033[33mRE\033[0m")
|
ap2.add_argument("--idp-gsep", metavar="RE", type=u, default="|:;+,", help="if there are multiple groups in \033[33m--idp-h-grp\033[0m, they are separated by one of the characters in \033[33mRE\033[0m")
|
||||||
|
ap2.add_argument("--idp-db", metavar="PATH", type=u, default=idp_db, help="where to store the known IdP users/groups (if you run multiple copyparty instances, make sure they use different DBs)")
|
||||||
|
ap2.add_argument("--idp-store", metavar="N", type=int, default=1, help="how to use \033[33m--idp-db\033[0m; [\033[32m0\033[0m] = entirely disable, [\033[32m1\033[0m] = write-only (effectively disabled), [\033[32m2\033[0m] = remember users, [\033[32m3\033[0m] = remember users and groups.\nNOTE: Will remember and restore the IdP-volumes of all users for all eternity if set to 2 or 3, even when user is deleted from your IdP")
|
||||||
|
ap2.add_argument("--idp-adm", metavar="U,U", type=u, default="", help="comma-separated list of users allowed to use /?idp (the cache management UI)")
|
||||||
ap2.add_argument("--no-bauth", action="store_true", help="disable basic-authentication support; do not accept passwords from the 'Authenticate' header at all. NOTE: This breaks support for the android app")
|
ap2.add_argument("--no-bauth", action="store_true", help="disable basic-authentication support; do not accept passwords from the 'Authenticate' header at all. NOTE: This breaks support for the android app")
|
||||||
ap2.add_argument("--bauth-last", action="store_true", help="keeps basic-authentication enabled, but only as a last-resort; if a cookie is also provided then the cookie wins")
|
ap2.add_argument("--bauth-last", action="store_true", help="keeps basic-authentication enabled, but only as a last-resort; if a cookie is also provided then the cookie wins")
|
||||||
ap2.add_argument("--ses-db", metavar="PATH", type=u, default=ses_db, help="where to store the sessions database (if you run multiple copyparty instances, make sure they use different DBs)")
|
ap2.add_argument("--ses-db", metavar="PATH", type=u, default=ses_db, help="where to store the sessions database (if you run multiple copyparty instances, make sure they use different DBs)")
|
||||||
@@ -1266,6 +1275,7 @@ def add_optouts(ap):
|
|||||||
ap2.add_argument("--no-tarcmp", action="store_true", help="disable download as compressed tar (?tar=gz, ?tar=bz2, ?tar=xz, ?tar=gz:9, ...)")
|
ap2.add_argument("--no-tarcmp", action="store_true", help="disable download as compressed tar (?tar=gz, ?tar=bz2, ?tar=xz, ?tar=gz:9, ...)")
|
||||||
ap2.add_argument("--no-lifetime", action="store_true", help="do not allow clients (or server config) to schedule an upload to be deleted after a given time")
|
ap2.add_argument("--no-lifetime", action="store_true", help="do not allow clients (or server config) to schedule an upload to be deleted after a given time")
|
||||||
ap2.add_argument("--no-pipe", action="store_true", help="disable race-the-beam (lockstep download of files which are currently being uploaded) (volflag=nopipe)")
|
ap2.add_argument("--no-pipe", action="store_true", help="disable race-the-beam (lockstep download of files which are currently being uploaded) (volflag=nopipe)")
|
||||||
|
ap2.add_argument("--no-tail", action="store_true", help="disable streaming a growing files with ?tail (volflag=notail)")
|
||||||
ap2.add_argument("--no-db-ip", action="store_true", help="do not write uploader-IP into the database; will also disable unpost, you may want \033[32m--forget-ip\033[0m instead (volflag=no_db_ip)")
|
ap2.add_argument("--no-db-ip", action="store_true", help="do not write uploader-IP into the database; will also disable unpost, you may want \033[32m--forget-ip\033[0m instead (volflag=no_db_ip)")
|
||||||
|
|
||||||
|
|
||||||
@@ -1308,6 +1318,9 @@ def add_salt(ap, fk_salt, dk_salt, ah_salt):
|
|||||||
ap2.add_argument("--fk-salt", metavar="SALT", type=u, default=fk_salt, help="per-file accesskey salt; used to generate unpredictable URLs for hidden files")
|
ap2.add_argument("--fk-salt", metavar="SALT", type=u, default=fk_salt, help="per-file accesskey salt; used to generate unpredictable URLs for hidden files")
|
||||||
ap2.add_argument("--dk-salt", metavar="SALT", type=u, default=dk_salt, help="per-directory accesskey salt; used to generate unpredictable URLs to share folders with users who only have the 'get' permission")
|
ap2.add_argument("--dk-salt", metavar="SALT", type=u, default=dk_salt, help="per-directory accesskey salt; used to generate unpredictable URLs to share folders with users who only have the 'get' permission")
|
||||||
ap2.add_argument("--warksalt", metavar="SALT", type=u, default="hunter2", help="up2k file-hash salt; serves no purpose, no reason to change this (but delete all databases if you do)")
|
ap2.add_argument("--warksalt", metavar="SALT", type=u, default="hunter2", help="up2k file-hash salt; serves no purpose, no reason to change this (but delete all databases if you do)")
|
||||||
|
ap2.add_argument("--show-ah-salt", action="store_true", help="on startup, print the effective value of \033[33m--ah-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)")
|
||||||
|
ap2.add_argument("--show-fk-salt", action="store_true", help="on startup, print the effective value of \033[33m--fk-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)")
|
||||||
|
ap2.add_argument("--show-dk-salt", action="store_true", help="on startup, print the effective value of \033[33m--dk-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)")
|
||||||
|
|
||||||
|
|
||||||
def add_shutdown(ap):
|
def add_shutdown(ap):
|
||||||
@@ -1349,7 +1362,7 @@ def add_admin(ap):
|
|||||||
|
|
||||||
def add_thumbnail(ap):
|
def add_thumbnail(ap):
|
||||||
th_ram = (RAM_AVAIL or RAM_TOTAL or 9) * 0.6
|
th_ram = (RAM_AVAIL or RAM_TOTAL or 9) * 0.6
|
||||||
th_ram = int(max(min(th_ram, 6), 1) * 10) / 10
|
th_ram = int(max(min(th_ram, 6), 0.3) * 10) / 10
|
||||||
ap2 = ap.add_argument_group('thumbnail options')
|
ap2 = ap.add_argument_group('thumbnail options')
|
||||||
ap2.add_argument("--no-thumb", action="store_true", help="disable all thumbnails (volflag=dthumb)")
|
ap2.add_argument("--no-thumb", action="store_true", help="disable all thumbnails (volflag=dthumb)")
|
||||||
ap2.add_argument("--no-vthumb", action="store_true", help="disable video thumbnails (volflag=dvthumb)")
|
ap2.add_argument("--no-vthumb", action="store_true", help="disable video thumbnails (volflag=dvthumb)")
|
||||||
@@ -1376,8 +1389,8 @@ def add_thumbnail(ap):
|
|||||||
ap2.add_argument("--th-r-vips", metavar="T,T", type=u, default="avif,exr,fit,fits,fts,gif,hdr,heic,jp2,jpeg,jpg,jpx,jxl,nii,pfm,pgm,png,ppm,svg,tif,tiff,webp", help="image formats to decode using pyvips")
|
ap2.add_argument("--th-r-vips", metavar="T,T", type=u, default="avif,exr,fit,fits,fts,gif,hdr,heic,jp2,jpeg,jpg,jpx,jxl,nii,pfm,pgm,png,ppm,svg,tif,tiff,webp", help="image formats to decode using pyvips")
|
||||||
ap2.add_argument("--th-r-ffi", metavar="T,T", type=u, default="apng,avif,avifs,bmp,cbz,dds,dib,fit,fits,fts,gif,hdr,heic,heics,heif,heifs,icns,ico,jp2,jpeg,jpg,jpx,jxl,pbm,pcx,pfm,pgm,png,pnm,ppm,psd,qoi,sgi,tga,tif,tiff,webp,xbm,xpm", help="image formats to decode using ffmpeg")
|
ap2.add_argument("--th-r-ffi", metavar="T,T", type=u, default="apng,avif,avifs,bmp,cbz,dds,dib,fit,fits,fts,gif,hdr,heic,heics,heif,heifs,icns,ico,jp2,jpeg,jpg,jpx,jxl,pbm,pcx,pfm,pgm,png,pnm,ppm,psd,qoi,sgi,tga,tif,tiff,webp,xbm,xpm", help="image formats to decode using ffmpeg")
|
||||||
ap2.add_argument("--th-r-ffv", metavar="T,T", type=u, default="3gp,asf,av1,avc,avi,flv,h264,h265,hevc,m4v,mjpeg,mjpg,mkv,mov,mp4,mpeg,mpeg2,mpegts,mpg,mpg2,mts,nut,ogm,ogv,rm,ts,vob,webm,wmv", help="video formats to decode using ffmpeg")
|
ap2.add_argument("--th-r-ffv", metavar="T,T", type=u, default="3gp,asf,av1,avc,avi,flv,h264,h265,hevc,m4v,mjpeg,mjpg,mkv,mov,mp4,mpeg,mpeg2,mpegts,mpg,mpg2,mts,nut,ogm,ogv,rm,ts,vob,webm,wmv", help="video formats to decode using ffmpeg")
|
||||||
ap2.add_argument("--th-r-ffa", metavar="T,T", type=u, default="aac,ac3,aif,aiff,alac,alaw,amr,apac,ape,au,bonk,dfpwm,dts,flac,gsm,ilbc,it,itgz,itxz,itz,m4a,mdgz,mdxz,mdz,mo3,mod,mp2,mp3,mpc,mptm,mt2,mulaw,ogg,okt,opus,ra,s3m,s3gz,s3xz,s3z,tak,tta,ulaw,wav,wma,wv,xm,xmgz,xmxz,xmz,xpk", help="audio formats to decode using ffmpeg")
|
ap2.add_argument("--th-r-ffa", metavar="T,T", type=u, default="aac,ac3,aif,aiff,alac,alaw,amr,apac,ape,au,bonk,dfpwm,dts,flac,gsm,ilbc,it,itgz,itxz,itz,m4a,mdgz,mdxz,mdz,mo3,mod,mp2,mp3,mpc,mptm,mt2,mulaw,oga,ogg,okt,opus,ra,s3m,s3gz,s3xz,s3z,tak,tta,ulaw,wav,wma,wv,xm,xmgz,xmxz,xmz,xpk", help="audio formats to decode using ffmpeg")
|
||||||
ap2.add_argument("--th-spec-cnv", metavar="T,T", type=u, default="it,itgz,itxz,itz,mdgz,mdxz,mdz,mo3,mod,s3m,s3gz,s3xz,s3z,xm,xmgz,xmxz,xmz,xpk", help="audio formats which provoke https://trac.ffmpeg.org/ticket/10797 (huge ram usage for s3xmodit spectrograms)")
|
ap2.add_argument("--th-spec-cnv", metavar="T", type=u, default="it,itgz,itxz,itz,mdgz,mdxz,mdz,mo3,mod,s3m,s3gz,s3xz,s3z,xm,xmgz,xmxz,xmz,xpk", help="audio formats which provoke https://trac.ffmpeg.org/ticket/10797 (huge ram usage for s3xmodit spectrograms)")
|
||||||
ap2.add_argument("--au-unpk", metavar="E=F.C", type=u, default="mdz=mod.zip, mdgz=mod.gz, mdxz=mod.xz, s3z=s3m.zip, s3gz=s3m.gz, s3xz=s3m.xz, xmz=xm.zip, xmgz=xm.gz, xmxz=xm.xz, itz=it.zip, itgz=it.gz, itxz=it.xz, cbz=jpg.cbz", help="audio/image formats to decompress before passing to ffmpeg")
|
ap2.add_argument("--au-unpk", metavar="E=F.C", type=u, default="mdz=mod.zip, mdgz=mod.gz, mdxz=mod.xz, s3z=s3m.zip, s3gz=s3m.gz, s3xz=s3m.xz, xmz=xm.zip, xmgz=xm.gz, xmxz=xm.xz, itz=it.zip, itgz=it.gz, itxz=it.xz, cbz=jpg.cbz", help="audio/image formats to decompress before passing to ffmpeg")
|
||||||
|
|
||||||
|
|
||||||
@@ -1392,6 +1405,16 @@ def add_transcoding(ap):
|
|||||||
ap2.add_argument("--ac-maxage", metavar="SEC", type=int, default=86400, help="delete cached transcode output after \033[33mSEC\033[0m seconds")
|
ap2.add_argument("--ac-maxage", metavar="SEC", type=int, default=86400, help="delete cached transcode output after \033[33mSEC\033[0m seconds")
|
||||||
|
|
||||||
|
|
||||||
|
def add_tail(ap):
|
||||||
|
ap2 = ap.add_argument_group('tailing options (realtime streaming of a growing file)')
|
||||||
|
ap2.add_argument("--tail-who", metavar="LVL", type=int, default=2, help="who can tail? [\033[32m0\033[0m]=nobody, [\033[32m1\033[0m]=admins, [\033[32m2\033[0m]=authenticated-with-read-access, [\033[32m3\033[0m]=everyone-with-read-access (volflag=tail_who)")
|
||||||
|
ap2.add_argument("--tail-cmax", metavar="N", type=int, default=64, help="do not allow starting a new tail if more than \033[33mN\033[0m active downloads")
|
||||||
|
ap2.add_argument("--tail-tmax", metavar="SEC", type=float, default=0, help="terminate connection after \033[33mSEC\033[0m seconds; [\033[32m0\033[0m]=never (volflag=tail_tmax)")
|
||||||
|
ap2.add_argument("--tail-rate", metavar="SEC", type=float, default=0.2, help="check for new data every \033[33mSEC\033[0m seconds (volflag=tail_rate)")
|
||||||
|
ap2.add_argument("--tail-ka", metavar="SEC", type=float, default=3.0, help="send a zerobyte if connection is idle for \033[33mSEC\033[0m seconds to prevent disconnect")
|
||||||
|
ap2.add_argument("--tail-fd", metavar="SEC", type=float, default=1.0, help="check if file was replaced (new fd) if idle for \033[33mSEC\033[0m seconds (volflag=tail_fd)")
|
||||||
|
|
||||||
|
|
||||||
def add_rss(ap):
|
def add_rss(ap):
|
||||||
ap2 = ap.add_argument_group('RSS options')
|
ap2 = ap.add_argument_group('RSS options')
|
||||||
ap2.add_argument("--rss", action="store_true", help="enable RSS output (experimental) (volflag=rss)")
|
ap2.add_argument("--rss", action="store_true", help="enable RSS output (experimental) (volflag=rss)")
|
||||||
@@ -1487,6 +1510,7 @@ def add_ui(ap, retry):
|
|||||||
ap2.add_argument("--sort", metavar="C,C,C", type=u, default="href", help="default sort order, comma-separated column IDs (see header tooltips), prefix with '-' for descending. Examples: \033[32mhref -href ext sz ts tags/Album tags/.tn\033[0m (volflag=sort)")
|
ap2.add_argument("--sort", metavar="C,C,C", type=u, default="href", help="default sort order, comma-separated column IDs (see header tooltips), prefix with '-' for descending. Examples: \033[32mhref -href ext sz ts tags/Album tags/.tn\033[0m (volflag=sort)")
|
||||||
ap2.add_argument("--nsort", action="store_true", help="default-enable natural sort of filenames with leading numbers (volflag=nsort)")
|
ap2.add_argument("--nsort", action="store_true", help="default-enable natural sort of filenames with leading numbers (volflag=nsort)")
|
||||||
ap2.add_argument("--hsortn", metavar="N", type=int, default=2, help="number of sorting rules to include in media URLs by default (volflag=hsortn)")
|
ap2.add_argument("--hsortn", metavar="N", type=int, default=2, help="number of sorting rules to include in media URLs by default (volflag=hsortn)")
|
||||||
|
ap2.add_argument("--see-dots", action="store_true", help="default-enable seeing dotfiles; only takes effect if user has the necessary permissions")
|
||||||
ap2.add_argument("--unlist", metavar="REGEX", type=u, default="", help="don't show files matching \033[33mREGEX\033[0m in file list. Purely cosmetic! Does not affect API calls, just the browser. Example: [\033[32m\\.(js|css)$\033[0m] (volflag=unlist)")
|
ap2.add_argument("--unlist", metavar="REGEX", type=u, default="", help="don't show files matching \033[33mREGEX\033[0m in file list. Purely cosmetic! Does not affect API calls, just the browser. Example: [\033[32m\\.(js|css)$\033[0m] (volflag=unlist)")
|
||||||
ap2.add_argument("--favico", metavar="TXT", type=u, default="c 000 none" if retry else "🎉 000 none", help="\033[33mfavicon-text\033[0m [ \033[33mforeground\033[0m [ \033[33mbackground\033[0m ] ], set blank to disable")
|
ap2.add_argument("--favico", metavar="TXT", type=u, default="c 000 none" if retry else "🎉 000 none", help="\033[33mfavicon-text\033[0m [ \033[33mforeground\033[0m [ \033[33mbackground\033[0m ] ], set blank to disable")
|
||||||
ap2.add_argument("--ext-th", metavar="E=VP", type=u, action="append", help="use thumbnail-image \033[33mVP\033[0m for file-extension \033[33mE\033[0m, example: [\033[32mexe=/.res/exe.png\033[0m] (volflag=ext_th)")
|
ap2.add_argument("--ext-th", metavar="E=VP", type=u, action="append", help="use thumbnail-image \033[33mVP\033[0m for file-extension \033[33mE\033[0m, example: [\033[32mexe=/.res/exe.png\033[0m] (volflag=ext_th)")
|
||||||
@@ -1511,6 +1535,7 @@ def add_ui(ap, retry):
|
|||||||
ap2.add_argument("--lg-sba", metavar="TXT", type=u, default="", help="the value of the iframe 'allow' attribute for prologue/epilogue docs (volflag=lg_sba); see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#iframes")
|
ap2.add_argument("--lg-sba", metavar="TXT", type=u, default="", help="the value of the iframe 'allow' attribute for prologue/epilogue docs (volflag=lg_sba); see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#iframes")
|
||||||
ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README/PREADME.md documents (volflags: no_sb_md | sb_md)")
|
ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README/PREADME.md documents (volflags: no_sb_md | sb_md)")
|
||||||
ap2.add_argument("--no-sb-lg", action="store_true", help="don't sandbox prologue/epilogue docs (volflags: no_sb_lg | sb_lg); enables non-js support")
|
ap2.add_argument("--no-sb-lg", action="store_true", help="don't sandbox prologue/epilogue docs (volflags: no_sb_lg | sb_lg); enables non-js support")
|
||||||
|
ap2.add_argument("--have-unlistc", action="store_true", help=argparse.SUPPRESS)
|
||||||
|
|
||||||
|
|
||||||
def add_debug(ap):
|
def add_debug(ap):
|
||||||
@@ -1596,6 +1621,7 @@ def run_argparse(
|
|||||||
add_hooks(ap)
|
add_hooks(ap)
|
||||||
add_stats(ap)
|
add_stats(ap)
|
||||||
add_txt(ap)
|
add_txt(ap)
|
||||||
|
add_tail(ap)
|
||||||
add_og(ap)
|
add_og(ap)
|
||||||
add_ui(ap, retry)
|
add_ui(ap, retry)
|
||||||
add_admin(ap)
|
add_admin(ap)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (1, 16, 20)
|
VERSION = (1, 18, 2)
|
||||||
CODENAME = "COPYparty"
|
CODENAME = "logtail"
|
||||||
BUILD_DT = (2025, 4, 13)
|
BUILD_DT = (2025, 7, 7)
|
||||||
|
|
||||||
S_VERSION = ".".join(map(str, VERSION))
|
S_VERSION = ".".join(map(str, VERSION))
|
||||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from .util import (
|
|||||||
DEF_MTE,
|
DEF_MTE,
|
||||||
DEF_MTH,
|
DEF_MTH,
|
||||||
EXTS,
|
EXTS,
|
||||||
|
HAVE_SQLITE3,
|
||||||
IMPLICATIONS,
|
IMPLICATIONS,
|
||||||
MIMES,
|
MIMES,
|
||||||
SQLITE_VER,
|
SQLITE_VER,
|
||||||
@@ -32,6 +33,7 @@ from .util import (
|
|||||||
afsenc,
|
afsenc,
|
||||||
get_df,
|
get_df,
|
||||||
humansize,
|
humansize,
|
||||||
|
min_ex,
|
||||||
odfusion,
|
odfusion,
|
||||||
read_utf8,
|
read_utf8,
|
||||||
relchk,
|
relchk,
|
||||||
@@ -44,6 +46,9 @@ from .util import (
|
|||||||
vsplit,
|
vsplit,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if HAVE_SQLITE3:
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
if True: # pylint: disable=using-constant-test
|
if True: # pylint: disable=using-constant-test
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
@@ -72,7 +77,9 @@ SSEELOG = " ({})".format(SEE_LOG)
|
|||||||
BAD_CFG = "invalid config; {}".format(SEE_LOG)
|
BAD_CFG = "invalid config; {}".format(SEE_LOG)
|
||||||
SBADCFG = " ({})".format(BAD_CFG)
|
SBADCFG = " ({})".format(BAD_CFG)
|
||||||
|
|
||||||
PTN_U_GRP = re.compile(r"\$\{u%([+-])([^}]+)\}")
|
PTN_U_GRP = re.compile(r"\$\{u(%[+-][^}]+)\}")
|
||||||
|
PTN_G_GRP = re.compile(r"\$\{g(%[+-][^}]+)\}")
|
||||||
|
PTN_SIGIL = re.compile(r"(\${[ug][}%])")
|
||||||
|
|
||||||
|
|
||||||
class CfgEx(Exception):
|
class CfgEx(Exception):
|
||||||
@@ -357,7 +364,6 @@ class VFS(object):
|
|||||||
self.flags = flags # config options
|
self.flags = flags # config options
|
||||||
self.root = self
|
self.root = self
|
||||||
self.dev = 0 # st_dev
|
self.dev = 0 # st_dev
|
||||||
self.badcfg1 = False
|
|
||||||
self.nodes: dict[str, VFS] = {} # child nodes
|
self.nodes: dict[str, VFS] = {} # child nodes
|
||||||
self.histtab: dict[str, str] = {} # all realpath->histpath
|
self.histtab: dict[str, str] = {} # all realpath->histpath
|
||||||
self.dbpaths: dict[str, str] = {} # all realpath->dbpath
|
self.dbpaths: dict[str, str] = {} # all realpath->dbpath
|
||||||
@@ -877,6 +883,7 @@ class AuthSrv(object):
|
|||||||
self.warn_anonwrite = warn_anonwrite
|
self.warn_anonwrite = warn_anonwrite
|
||||||
self.line_ctr = 0
|
self.line_ctr = 0
|
||||||
self.indent = ""
|
self.indent = ""
|
||||||
|
self.is_lxc = args.c == ["/z/initcfg"]
|
||||||
|
|
||||||
# fwd-decl
|
# fwd-decl
|
||||||
self.vfs = VFS(log_func, "", "", "", AXS(), {})
|
self.vfs = VFS(log_func, "", "", "", AXS(), {})
|
||||||
@@ -887,6 +894,8 @@ class AuthSrv(object):
|
|||||||
self.defpw: dict[str, str] = {}
|
self.defpw: dict[str, str] = {}
|
||||||
self.grps: dict[str, list[str]] = {}
|
self.grps: dict[str, list[str]] = {}
|
||||||
self.re_pwd: Optional[re.Pattern] = None
|
self.re_pwd: Optional[re.Pattern] = None
|
||||||
|
self.cfg_files_loaded: list[str] = []
|
||||||
|
self.badcfg1 = False
|
||||||
|
|
||||||
# all volumes observed since last restart
|
# all volumes observed since last restart
|
||||||
self.idp_vols: dict[str, str] = {} # vpath->abspath
|
self.idp_vols: dict[str, str] = {} # vpath->abspath
|
||||||
@@ -931,6 +940,10 @@ class AuthSrv(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self.idp_accs[uname] = gnames
|
self.idp_accs[uname] = gnames
|
||||||
|
try:
|
||||||
|
self._update_idp_db(uname, gname)
|
||||||
|
except:
|
||||||
|
self.log("failed to update the --idp-db:\n%s" % (min_ex(),), 3)
|
||||||
|
|
||||||
t = "reinitializing due to new user from IdP: [%r:%r]"
|
t = "reinitializing due to new user from IdP: [%r:%r]"
|
||||||
self.log(t % (uname, gnames), 3)
|
self.log(t % (uname, gnames), 3)
|
||||||
@@ -943,6 +956,22 @@ class AuthSrv(object):
|
|||||||
broker.ask("reload", False, True).get()
|
broker.ask("reload", False, True).get()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _update_idp_db(self, uname: str, gname: str) -> None:
|
||||||
|
if not self.args.idp_store:
|
||||||
|
return
|
||||||
|
|
||||||
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
|
db = sqlite3.connect(self.args.idp_db)
|
||||||
|
cur = db.cursor()
|
||||||
|
|
||||||
|
cur.execute("delete from us where un = ?", (uname,))
|
||||||
|
cur.execute("insert into us values (?,?)", (uname, gname))
|
||||||
|
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
|
||||||
def _map_volume_idp(
|
def _map_volume_idp(
|
||||||
self,
|
self,
|
||||||
src: str,
|
src: str,
|
||||||
@@ -963,15 +992,27 @@ class AuthSrv(object):
|
|||||||
un_gn = [("", "")]
|
un_gn = [("", "")]
|
||||||
|
|
||||||
for un, gn in un_gn:
|
for un, gn in un_gn:
|
||||||
m = PTN_U_GRP.search(dst0)
|
rejected = False
|
||||||
if m:
|
for ptn in [PTN_U_GRP, PTN_G_GRP]:
|
||||||
req, gnc = m.groups()
|
m = ptn.search(dst0)
|
||||||
hit = gnc in (un_gns.get(un) or [])
|
if not m:
|
||||||
if req == "+":
|
|
||||||
if not hit:
|
|
||||||
continue
|
|
||||||
elif hit:
|
|
||||||
continue
|
continue
|
||||||
|
zs = m.group(1)
|
||||||
|
zs = zs.replace(",%+", "\n%+")
|
||||||
|
zs = zs.replace(",%-", "\n%-")
|
||||||
|
for rule in zs.split("\n"):
|
||||||
|
gnc = rule[2:]
|
||||||
|
if ptn == PTN_U_GRP:
|
||||||
|
# is user member of group?
|
||||||
|
hit = gnc in (un_gns.get(un) or [])
|
||||||
|
else:
|
||||||
|
# is it this specific group?
|
||||||
|
hit = gn == gnc
|
||||||
|
|
||||||
|
if rule.startswith("%+") != hit:
|
||||||
|
rejected = True
|
||||||
|
if rejected:
|
||||||
|
continue
|
||||||
|
|
||||||
# if ap/vp has a user/group placeholder, make sure to keep
|
# if ap/vp has a user/group placeholder, make sure to keep
|
||||||
# track so the same user/group is mapped when setting perms;
|
# track so the same user/group is mapped when setting perms;
|
||||||
@@ -986,6 +1027,8 @@ class AuthSrv(object):
|
|||||||
|
|
||||||
src = src1.replace("${g}", gn or "\n")
|
src = src1.replace("${g}", gn or "\n")
|
||||||
dst = dst1.replace("${g}", gn or "\n")
|
dst = dst1.replace("${g}", gn or "\n")
|
||||||
|
src = PTN_G_GRP.sub(gn or "\n", src)
|
||||||
|
dst = PTN_G_GRP.sub(gn or "\n", dst)
|
||||||
if src == src1 and dst == dst1:
|
if src == src1 and dst == dst1:
|
||||||
gn = ""
|
gn = ""
|
||||||
|
|
||||||
@@ -1077,6 +1120,7 @@ class AuthSrv(object):
|
|||||||
* any non-zero value from IdP group header
|
* any non-zero value from IdP group header
|
||||||
* otherwise take --grps / [groups]
|
* otherwise take --grps / [groups]
|
||||||
"""
|
"""
|
||||||
|
self.load_idp_db(bool(self.idp_accs))
|
||||||
ret = {un: gns[:] for un, gns in self.idp_accs.items()}
|
ret = {un: gns[:] for un, gns in self.idp_accs.items()}
|
||||||
ret.update({zs: [""] for zs in acct if zs not in ret})
|
ret.update({zs: [""] for zs in acct if zs not in ret})
|
||||||
for gn, uns in grps.items():
|
for gn, uns in grps.items():
|
||||||
@@ -1482,8 +1526,10 @@ class AuthSrv(object):
|
|||||||
daxs: dict[str, AXS] = {}
|
daxs: dict[str, AXS] = {}
|
||||||
mflags: dict[str, dict[str, Any]] = {} # vpath:flags
|
mflags: dict[str, dict[str, Any]] = {} # vpath:flags
|
||||||
mount: dict[str, tuple[str, str]] = {} # dst:src (vp:(ap,vp0))
|
mount: dict[str, tuple[str, str]] = {} # dst:src (vp:(ap,vp0))
|
||||||
|
cfg_files_loaded: list[str] = []
|
||||||
|
|
||||||
self.idp_vols = {} # yolo
|
self.idp_vols = {} # yolo
|
||||||
|
self.badcfg1 = False
|
||||||
|
|
||||||
if self.args.a:
|
if self.args.a:
|
||||||
# list of username:password
|
# list of username:password
|
||||||
@@ -1544,6 +1590,7 @@ class AuthSrv(object):
|
|||||||
zst = [(max(0, len(x) - 2) * " ") + "└" + x[-1] for x in zstt]
|
zst = [(max(0, len(x) - 2) * " ") + "└" + x[-1] for x in zstt]
|
||||||
t = "loaded {} config files:\n{}"
|
t = "loaded {} config files:\n{}"
|
||||||
self.log(t.format(len(zst), "\n".join(zst)))
|
self.log(t.format(len(zst), "\n".join(zst)))
|
||||||
|
cfg_files_loaded = zst
|
||||||
|
|
||||||
except:
|
except:
|
||||||
lns = lns[: self.line_ctr]
|
lns = lns[: self.line_ctr]
|
||||||
@@ -1568,9 +1615,14 @@ class AuthSrv(object):
|
|||||||
if not mount and not self.args.idp_h_usr:
|
if not mount and not self.args.idp_h_usr:
|
||||||
# -h says our defaults are CWD at root and read/write for everyone
|
# -h says our defaults are CWD at root and read/write for everyone
|
||||||
axs = AXS(["*"], ["*"], None, None)
|
axs = AXS(["*"], ["*"], None, None)
|
||||||
if os.path.exists("/z/initcfg"):
|
if self.is_lxc:
|
||||||
t = "Read-access has been disabled due to failsafe: Docker detected, but the config does not define any volumes. This failsafe is to prevent unintended access if this is due to accidental loss of config. You can override this safeguard and allow read/write to all of /w/ by adding the following arguments to the docker container: -v .::rw"
|
t = "Read-access has been disabled due to failsafe: Docker detected, but %s. This failsafe is to prevent unintended access if this is due to accidental loss of config. You can override this safeguard and allow read/write to all of /w/ by adding the following arguments to the docker container: -v .::rw"
|
||||||
self.log(t, 1)
|
if len(cfg_files_loaded) == 1:
|
||||||
|
self.log(t % ("no config-file was provided",), 1)
|
||||||
|
t = "it is strongly recommended to add a config-file instead, for example based on https://github.com/9001/copyparty/blob/hovudstraum/docs/examples/docker/basic-docker-compose/copyparty.conf"
|
||||||
|
self.log(t, 3)
|
||||||
|
else:
|
||||||
|
self.log(t % ("the config does not define any volumes",), 1)
|
||||||
axs = AXS()
|
axs = AXS()
|
||||||
elif self.args.c:
|
elif self.args.c:
|
||||||
t = "Read-access has been disabled due to failsafe: No volumes were defined by the config-file. This failsafe is to prevent unintended access if this is due to accidental loss of config. You can override this safeguard and allow read/write to the working-directory by adding the following arguments: -v .::rw"
|
t = "Read-access has been disabled due to failsafe: No volumes were defined by the config-file. This failsafe is to prevent unintended access if this is due to accidental loss of config. You can override this safeguard and allow read/write to the working-directory by adding the following arguments: -v .::rw"
|
||||||
@@ -1578,7 +1630,7 @@ class AuthSrv(object):
|
|||||||
axs = AXS()
|
axs = AXS()
|
||||||
vfs = VFS(self.log_func, absreal("."), "", "", axs, {})
|
vfs = VFS(self.log_func, absreal("."), "", "", axs, {})
|
||||||
if not axs.uread:
|
if not axs.uread:
|
||||||
vfs.badcfg1 = True
|
self.badcfg1 = True
|
||||||
elif "" not in mount:
|
elif "" not in mount:
|
||||||
# there's volumes but no root; make root inaccessible
|
# there's volumes but no root; make root inaccessible
|
||||||
zsd = {"d2d": True, "tcolor": self.args.tcolor}
|
zsd = {"d2d": True, "tcolor": self.args.tcolor}
|
||||||
@@ -1629,7 +1681,7 @@ class AuthSrv(object):
|
|||||||
shr = enshare[1:-1]
|
shr = enshare[1:-1]
|
||||||
shrs = enshare[1:]
|
shrs = enshare[1:]
|
||||||
if enshare:
|
if enshare:
|
||||||
import sqlite3
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
zsd = {"d2d": True, "tcolor": self.args.tcolor}
|
zsd = {"d2d": True, "tcolor": self.args.tcolor}
|
||||||
shv = VFS(self.log_func, "", shr, shr, AXS(), zsd)
|
shv = VFS(self.log_func, "", shr, shr, AXS(), zsd)
|
||||||
@@ -1852,7 +1904,7 @@ class AuthSrv(object):
|
|||||||
is_shr = shr and zv.vpath.split("/")[0] == shr
|
is_shr = shr and zv.vpath.split("/")[0] == shr
|
||||||
if histp and not is_shr and histp in rhisttab:
|
if histp and not is_shr and histp in rhisttab:
|
||||||
zv2 = rhisttab[histp]
|
zv2 = rhisttab[histp]
|
||||||
t = "invalid config; multiple volumes share the same histpath (database+thumbnails location):\n histpath: %s\n volume 1: /%s [%s]\n volume 2: %s [%s]"
|
t = "invalid config; multiple volumes share the same histpath (database+thumbnails location):\n histpath: %s\n volume 1: /%s [%s]\n volume 2: /%s [%s]"
|
||||||
t = t % (histp, zv2.vpath, zv2.realpath, zv.vpath, zv.realpath)
|
t = t % (histp, zv2.vpath, zv2.realpath, zv.vpath, zv.realpath)
|
||||||
self.log(t, 1)
|
self.log(t, 1)
|
||||||
raise Exception(t)
|
raise Exception(t)
|
||||||
@@ -1866,7 +1918,7 @@ class AuthSrv(object):
|
|||||||
is_shr = shr and zv.vpath.split("/")[0] == shr
|
is_shr = shr and zv.vpath.split("/")[0] == shr
|
||||||
if dbp and not is_shr and dbp in rdbpaths:
|
if dbp and not is_shr and dbp in rdbpaths:
|
||||||
zv2 = rdbpaths[dbp]
|
zv2 = rdbpaths[dbp]
|
||||||
t = "invalid config; multiple volumes share the same dbpath (database location):\n dbpath: %s\n volume 1: /%s [%s]\n volume 2: %s [%s]"
|
t = "invalid config; multiple volumes share the same dbpath (database location):\n dbpath: %s\n volume 1: /%s [%s]\n volume 2: /%s [%s]"
|
||||||
t = t % (dbp, zv2.vpath, zv2.realpath, zv.vpath, zv.realpath)
|
t = t % (dbp, zv2.vpath, zv2.realpath, zv.vpath, zv.realpath)
|
||||||
self.log(t, 1)
|
self.log(t, 1)
|
||||||
raise Exception(t)
|
raise Exception(t)
|
||||||
@@ -2010,6 +2062,8 @@ class AuthSrv(object):
|
|||||||
elif self.args.re_maxage:
|
elif self.args.re_maxage:
|
||||||
vol.flags["scan"] = self.args.re_maxage
|
vol.flags["scan"] = self.args.re_maxage
|
||||||
|
|
||||||
|
self.args.have_unlistc = False
|
||||||
|
|
||||||
all_mte = {}
|
all_mte = {}
|
||||||
errors = False
|
errors = False
|
||||||
for vol in vfs.all_nodes.values():
|
for vol in vfs.all_nodes.values():
|
||||||
@@ -2049,12 +2103,13 @@ class AuthSrv(object):
|
|||||||
if vf not in vol.flags:
|
if vf not in vol.flags:
|
||||||
vol.flags[vf] = getattr(self.args, ga)
|
vol.flags[vf] = getattr(self.args, ga)
|
||||||
|
|
||||||
zs = "forget_ip nrand u2abort u2ow ups_who zip_who"
|
zs = "forget_ip nrand tail_who u2abort u2ow ups_who zip_who"
|
||||||
for k in zs.split():
|
for k in zs.split():
|
||||||
if k in vol.flags:
|
if k in vol.flags:
|
||||||
vol.flags[k] = int(vol.flags[k])
|
vol.flags[k] = int(vol.flags[k])
|
||||||
|
|
||||||
for k in ("convt",):
|
zs = "convt tail_fd tail_rate tail_tmax"
|
||||||
|
for k in zs.split():
|
||||||
if k in vol.flags:
|
if k in vol.flags:
|
||||||
vol.flags[k] = float(vol.flags[k])
|
vol.flags[k] = float(vol.flags[k])
|
||||||
|
|
||||||
@@ -2070,10 +2125,17 @@ class AuthSrv(object):
|
|||||||
if vol.flags.get("og"):
|
if vol.flags.get("og"):
|
||||||
self.args.uqe = True
|
self.args.uqe = True
|
||||||
|
|
||||||
|
if "unlistcr" in vol.flags or "unlistcw" in vol.flags:
|
||||||
|
self.args.have_unlistc = True
|
||||||
|
|
||||||
zs = str(vol.flags.get("tcolor", "")).lstrip("#")
|
zs = str(vol.flags.get("tcolor", "")).lstrip("#")
|
||||||
if len(zs) == 3: # fc5 => ffcc55
|
if len(zs) == 3: # fc5 => ffcc55
|
||||||
vol.flags["tcolor"] = "".join([x * 2 for x in zs])
|
vol.flags["tcolor"] = "".join([x * 2 for x in zs])
|
||||||
|
|
||||||
|
# volflag syntax currently doesn't allow for ':' in value
|
||||||
|
zs = vol.flags["put_name"]
|
||||||
|
vol.flags["put_name2"] = zs.replace("{now.", "{now:.")
|
||||||
|
|
||||||
if vol.flags.get("neversymlink"):
|
if vol.flags.get("neversymlink"):
|
||||||
vol.flags["hardlinkonly"] = True # was renamed
|
vol.flags["hardlinkonly"] = True # was renamed
|
||||||
if vol.flags.get("hardlinkonly"):
|
if vol.flags.get("hardlinkonly"):
|
||||||
@@ -2379,7 +2441,7 @@ class AuthSrv(object):
|
|||||||
idp_vn, _ = vfs.get(idp_vp, "*", False, False)
|
idp_vn, _ = vfs.get(idp_vp, "*", False, False)
|
||||||
idp_vp0 = idp_vn.vpath0
|
idp_vp0 = idp_vn.vpath0
|
||||||
|
|
||||||
sigils = set(re.findall(r"(\${[ug][}%])", idp_vp0))
|
sigils = set(PTN_SIGIL.findall(idp_vp0))
|
||||||
if len(sigils) > 1:
|
if len(sigils) > 1:
|
||||||
t = '\nWARNING: IdP-volume "/%s" created by "/%s" has multiple IdP placeholders: %s'
|
t = '\nWARNING: IdP-volume "/%s" created by "/%s" has multiple IdP placeholders: %s'
|
||||||
self.idp_warn.append(t % (idp_vp, idp_vp0, list(sigils)))
|
self.idp_warn.append(t % (idp_vp, idp_vp0, list(sigils)))
|
||||||
@@ -2429,6 +2491,7 @@ class AuthSrv(object):
|
|||||||
self.defpw = defpw
|
self.defpw = defpw
|
||||||
self.grps = grps
|
self.grps = grps
|
||||||
self.iacct = {v: k for k, v in acct.items()}
|
self.iacct = {v: k for k, v in acct.items()}
|
||||||
|
self.cfg_files_loaded = cfg_files_loaded
|
||||||
|
|
||||||
self.load_sessions()
|
self.load_sessions()
|
||||||
|
|
||||||
@@ -2548,6 +2611,7 @@ class AuthSrv(object):
|
|||||||
"txt_ext": self.args.textfiles.replace(",", " "),
|
"txt_ext": self.args.textfiles.replace(",", " "),
|
||||||
"def_hcols": list(vf.get("mth") or []),
|
"def_hcols": list(vf.get("mth") or []),
|
||||||
"unlist0": vf.get("unlist") or "",
|
"unlist0": vf.get("unlist") or "",
|
||||||
|
"see_dots": self.args.see_dots,
|
||||||
"dgrid": "grid" in vf,
|
"dgrid": "grid" in vf,
|
||||||
"dgsel": "gsel" in vf,
|
"dgsel": "gsel" in vf,
|
||||||
"dnsort": "nsort" in vf,
|
"dnsort": "nsort" in vf,
|
||||||
@@ -2559,6 +2623,7 @@ class AuthSrv(object):
|
|||||||
"idxh": int(self.args.ih),
|
"idxh": int(self.args.ih),
|
||||||
"themes": self.args.themes,
|
"themes": self.args.themes,
|
||||||
"turbolvl": self.args.turbo,
|
"turbolvl": self.args.turbo,
|
||||||
|
"nosubtle": self.args.nosubtle,
|
||||||
"u2j": self.args.u2j,
|
"u2j": self.args.u2j,
|
||||||
"u2sz": self.args.u2sz,
|
"u2sz": self.args.u2sz,
|
||||||
"u2ts": vf["u2ts"],
|
"u2ts": vf["u2ts"],
|
||||||
@@ -2587,6 +2652,43 @@ class AuthSrv(object):
|
|||||||
zs = str(vol.flags.get("tcolor") or self.args.tcolor)
|
zs = str(vol.flags.get("tcolor") or self.args.tcolor)
|
||||||
vol.flags["tcolor"] = zs.lstrip("#")
|
vol.flags["tcolor"] = zs.lstrip("#")
|
||||||
|
|
||||||
|
def load_idp_db(self, quiet=False) -> None:
|
||||||
|
# mutex me
|
||||||
|
level = self.args.idp_store
|
||||||
|
if level < 2 or not self.args.idp_h_usr:
|
||||||
|
return
|
||||||
|
|
||||||
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
|
db = sqlite3.connect(self.args.idp_db)
|
||||||
|
cur = db.cursor()
|
||||||
|
from_cache = cur.execute("select un, gs from us").fetchall()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
self.idp_accs.clear()
|
||||||
|
self.idp_usr_gh.clear()
|
||||||
|
|
||||||
|
gsep = self.args.idp_gsep
|
||||||
|
n = []
|
||||||
|
for uname, gname in from_cache:
|
||||||
|
if level < 3:
|
||||||
|
if uname in self.idp_accs:
|
||||||
|
continue
|
||||||
|
gname = ""
|
||||||
|
gnames = [x.strip() for x in gsep.split(gname)]
|
||||||
|
gnames.sort()
|
||||||
|
|
||||||
|
# self.idp_usr_gh[uname] = gname
|
||||||
|
self.idp_accs[uname] = gnames
|
||||||
|
n.append(uname)
|
||||||
|
|
||||||
|
if n and not quiet:
|
||||||
|
t = ", ".join(n[:9])
|
||||||
|
if len(n) > 9:
|
||||||
|
t += "..."
|
||||||
|
self.log("found %d IdP users in db (%s)" % (len(n), t))
|
||||||
|
|
||||||
def load_sessions(self, quiet=False) -> None:
|
def load_sessions(self, quiet=False) -> None:
|
||||||
# mutex me
|
# mutex me
|
||||||
if self.args.no_ses:
|
if self.args.no_ses:
|
||||||
@@ -2594,7 +2696,7 @@ class AuthSrv(object):
|
|||||||
self.sesa = {}
|
self.sesa = {}
|
||||||
return
|
return
|
||||||
|
|
||||||
import sqlite3
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
ases = {}
|
ases = {}
|
||||||
blen = (self.args.ses_len // 4) * 4 # 3 bytes in 4 chars
|
blen = (self.args.ses_len // 4) * 4 # 3 bytes in 4 chars
|
||||||
@@ -2641,7 +2743,7 @@ class AuthSrv(object):
|
|||||||
if self.args.no_ses:
|
if self.args.no_ses:
|
||||||
return
|
return
|
||||||
|
|
||||||
import sqlite3
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
db = sqlite3.connect(self.args.ses_db)
|
db = sqlite3.connect(self.args.ses_db)
|
||||||
cur = db.cursor()
|
cur = db.cursor()
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import calendar
|
import calendar
|
||||||
import errno
|
import errno
|
||||||
import filecmp
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from .__init__ import ANYWIN
|
from .__init__ import ANYWIN
|
||||||
from .util import Netdev, load_resource, runcmd, wrename, wunlink
|
from .util import Netdev, atomic_move, load_resource, runcmd, wunlink
|
||||||
|
|
||||||
HAVE_CFSSL = not os.environ.get("PRTY_NO_CFSSL")
|
HAVE_CFSSL = not os.environ.get("PRTY_NO_CFSSL")
|
||||||
|
|
||||||
@@ -122,7 +120,7 @@ def _gen_ca(log: "RootLogger", args):
|
|||||||
wunlink(nlog, bname + ".key", VF)
|
wunlink(nlog, bname + ".key", VF)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
wrename(nlog, bname + "-key.pem", bname + ".key", VF)
|
atomic_move(nlog, bname + "-key.pem", bname + ".key", VF)
|
||||||
wunlink(nlog, bname + ".csr", VF)
|
wunlink(nlog, bname + ".csr", VF)
|
||||||
|
|
||||||
log("cert", "new ca OK", 2)
|
log("cert", "new ca OK", 2)
|
||||||
@@ -215,7 +213,7 @@ def _gen_srv(log: "RootLogger", args, netdevs: dict[str, Netdev]):
|
|||||||
wunlink(nlog, bname + ".key", VF)
|
wunlink(nlog, bname + ".key", VF)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
wrename(nlog, bname + "-key.pem", bname + ".key", VF)
|
atomic_move(nlog, bname + "-key.pem", bname + ".key", VF)
|
||||||
wunlink(nlog, bname + ".csr", VF)
|
wunlink(nlog, bname + ".csr", VF)
|
||||||
|
|
||||||
with open(os.path.join(args.crt_dir, "ca.pem"), "rb") as f:
|
with open(os.path.join(args.crt_dir, "ca.pem"), "rb") as f:
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ def vf_bmap() -> dict[str, str]:
|
|||||||
"no_forget": "noforget",
|
"no_forget": "noforget",
|
||||||
"no_pipe": "nopipe",
|
"no_pipe": "nopipe",
|
||||||
"no_robots": "norobots",
|
"no_robots": "norobots",
|
||||||
|
"no_tail": "notail",
|
||||||
"no_thumb": "dthumb",
|
"no_thumb": "dthumb",
|
||||||
"no_vthumb": "dvthumb",
|
"no_vthumb": "dvthumb",
|
||||||
"no_athumb": "dathumb",
|
"no_athumb": "dathumb",
|
||||||
@@ -51,6 +52,7 @@ def vf_bmap() -> dict[str, str]:
|
|||||||
"og_no_head",
|
"og_no_head",
|
||||||
"og_s_title",
|
"og_s_title",
|
||||||
"rand",
|
"rand",
|
||||||
|
"rmagic",
|
||||||
"rss",
|
"rss",
|
||||||
"wo_up_readme",
|
"wo_up_readme",
|
||||||
"xdev",
|
"xdev",
|
||||||
@@ -75,6 +77,7 @@ def vf_vmap() -> dict[str, str]:
|
|||||||
"th_x3": "th3x",
|
"th_x3": "th3x",
|
||||||
}
|
}
|
||||||
for k in (
|
for k in (
|
||||||
|
"bup_ck",
|
||||||
"dbd",
|
"dbd",
|
||||||
"forget_ip",
|
"forget_ip",
|
||||||
"hsortn",
|
"hsortn",
|
||||||
@@ -95,9 +98,15 @@ def vf_vmap() -> dict[str, str]:
|
|||||||
"og_title_i",
|
"og_title_i",
|
||||||
"og_tpl",
|
"og_tpl",
|
||||||
"og_ua",
|
"og_ua",
|
||||||
|
"put_ck",
|
||||||
|
"put_name",
|
||||||
"mv_retry",
|
"mv_retry",
|
||||||
"rm_retry",
|
"rm_retry",
|
||||||
"sort",
|
"sort",
|
||||||
|
"tail_fd",
|
||||||
|
"tail_rate",
|
||||||
|
"tail_tmax",
|
||||||
|
"tail_who",
|
||||||
"tcolor",
|
"tcolor",
|
||||||
"unlist",
|
"unlist",
|
||||||
"u2abort",
|
"u2abort",
|
||||||
@@ -165,6 +174,9 @@ flagcats = {
|
|||||||
"daw": "enable full WebDAV write support (dangerous);\nPUT-operations will now \033[1;31mOVERWRITE\033[0;35m existing files",
|
"daw": "enable full WebDAV write support (dangerous);\nPUT-operations will now \033[1;31mOVERWRITE\033[0;35m existing files",
|
||||||
"nosub": "forces all uploads into the top folder of the vfs",
|
"nosub": "forces all uploads into the top folder of the vfs",
|
||||||
"magic": "enables filetype detection for nameless uploads",
|
"magic": "enables filetype detection for nameless uploads",
|
||||||
|
"put_name": "fallback filename for nameless uploads",
|
||||||
|
"put_ck": "default checksum-hasher for PUT/WebDAV uploads",
|
||||||
|
"bup_ck": "default checksum-hasher for bup/basic uploads",
|
||||||
"gz": "allows server-side gzip compression of uploads with ?gz",
|
"gz": "allows server-side gzip compression of uploads with ?gz",
|
||||||
"xz": "allows server-side lzma compression of uploads with ?xz",
|
"xz": "allows server-side lzma compression of uploads with ?xz",
|
||||||
"pk": "forces server-side compression, optional arg: xz,9",
|
"pk": "forces server-side compression, optional arg: xz,9",
|
||||||
@@ -268,6 +280,8 @@ flagcats = {
|
|||||||
"nodirsz": "don't show total folder size",
|
"nodirsz": "don't show total folder size",
|
||||||
"robots": "allows indexing by search engines (default)",
|
"robots": "allows indexing by search engines (default)",
|
||||||
"norobots": "kindly asks search engines to leave",
|
"norobots": "kindly asks search engines to leave",
|
||||||
|
"unlistcr": "don't list read-access in controlpanel",
|
||||||
|
"unlistcw": "don't list write-access in controlpanel",
|
||||||
"no_sb_md": "disable js sandbox for markdown files",
|
"no_sb_md": "disable js sandbox for markdown files",
|
||||||
"no_sb_lg": "disable js sandbox for prologue/epilogue",
|
"no_sb_lg": "disable js sandbox for prologue/epilogue",
|
||||||
"sb_md": "enable js sandbox for markdown files (default)",
|
"sb_md": "enable js sandbox for markdown files (default)",
|
||||||
@@ -298,6 +312,13 @@ flagcats = {
|
|||||||
"exp_md": "placeholders to expand in markdown files; see --help",
|
"exp_md": "placeholders to expand in markdown files; see --help",
|
||||||
"exp_lg": "placeholders to expand in prologue/epilogue; see --help",
|
"exp_lg": "placeholders to expand in prologue/epilogue; see --help",
|
||||||
},
|
},
|
||||||
|
"tailing": {
|
||||||
|
"notail": "disable ?tail (download a growing file continuously)",
|
||||||
|
"tail_fd=1": "check if file was replaced (new fd) every 1 sec",
|
||||||
|
"tail_rate=0.2": "check for new data every 0.2 sec",
|
||||||
|
"tail_tmax=30": "kill connection after 30 sec",
|
||||||
|
"tail_who=2": "restrict ?tail access (1=admins,2=authed,3=everyone)",
|
||||||
|
},
|
||||||
"others": {
|
"others": {
|
||||||
"dots": "allow all users with read-access to\nenable the option to show dotfiles in listings",
|
"dots": "allow all users with read-access to\nenable the option to show dotfiles in listings",
|
||||||
"fk=8": 'generates per-file accesskeys,\nwhich are then required at the "g" permission;\nkeys are invalidated if filesize or inode changes',
|
"fk=8": 'generates per-file accesskeys,\nwhich are then required at the "g" permission;\nkeys are invalidated if filesize or inode changes',
|
||||||
@@ -306,6 +327,7 @@ flagcats = {
|
|||||||
"dks": "per-directory accesskeys allow browsing into subdirs",
|
"dks": "per-directory accesskeys allow browsing into subdirs",
|
||||||
"dky": 'allow seeing files (not folders) inside a specific folder\nwith "g" perm, and does not require a valid dirkey to do so',
|
"dky": 'allow seeing files (not folders) inside a specific folder\nwith "g" perm, and does not require a valid dirkey to do so',
|
||||||
"rss": "allow '?rss' URL suffix (experimental)",
|
"rss": "allow '?rss' URL suffix (experimental)",
|
||||||
|
"rmagic": "expensive analysis for mimetype accuracy",
|
||||||
"ups_who=2": "restrict viewing the list of recent uploads",
|
"ups_who=2": "restrict viewing the list of recent uploads",
|
||||||
"zip_who=2": "restrict access to download-as-zip/tar",
|
"zip_who=2": "restrict access to download-as-zip/tar",
|
||||||
"zipmaxn=9k": "reject download-as-zip if more than 9000 files",
|
"zipmaxn=9k": "reject download-as-zip if more than 9000 files",
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ from .util import (
|
|||||||
vol_san,
|
vol_san,
|
||||||
vroots,
|
vroots,
|
||||||
vsplit,
|
vsplit,
|
||||||
wrename,
|
|
||||||
wunlink,
|
wunlink,
|
||||||
yieldfile,
|
yieldfile,
|
||||||
)
|
)
|
||||||
@@ -190,11 +189,11 @@ class HttpCli(object):
|
|||||||
self.log_src = conn.log_src # mypy404
|
self.log_src = conn.log_src # mypy404
|
||||||
self.gen_fk = self._gen_fk if self.args.log_fk else gen_filekey
|
self.gen_fk = self._gen_fk if self.args.log_fk else gen_filekey
|
||||||
self.tls: bool = hasattr(self.s, "cipher")
|
self.tls: bool = hasattr(self.s, "cipher")
|
||||||
|
self.is_vproxied = bool(self.args.R)
|
||||||
|
|
||||||
# placeholders; assigned by run()
|
# placeholders; assigned by run()
|
||||||
self.keepalive = False
|
self.keepalive = False
|
||||||
self.is_https = False
|
self.is_https = False
|
||||||
self.is_vproxied = False
|
|
||||||
self.in_hdr_recv = True
|
self.in_hdr_recv = True
|
||||||
self.headers: dict[str, str] = {}
|
self.headers: dict[str, str] = {}
|
||||||
self.mode = " " # http verb
|
self.mode = " " # http verb
|
||||||
@@ -402,7 +401,6 @@ class HttpCli(object):
|
|||||||
self.bad_xff = True
|
self.bad_xff = True
|
||||||
else:
|
else:
|
||||||
self.ip = cli_ip
|
self.ip = cli_ip
|
||||||
self.is_vproxied = bool(self.args.R)
|
|
||||||
self.log_src = self.conn.set_rproxy(self.ip)
|
self.log_src = self.conn.set_rproxy(self.ip)
|
||||||
self.host = self.headers.get("x-forwarded-host") or self.host
|
self.host = self.headers.get("x-forwarded-host") or self.host
|
||||||
trusted_xff = True
|
trusted_xff = True
|
||||||
@@ -535,6 +533,7 @@ class HttpCli(object):
|
|||||||
else:
|
else:
|
||||||
t = "incorrect --rp-loc or webserver config; expected vpath starting with %r but got %r"
|
t = "incorrect --rp-loc or webserver config; expected vpath starting with %r but got %r"
|
||||||
self.log(t % (self.args.R, vpath), 1)
|
self.log(t % (self.args.R, vpath), 1)
|
||||||
|
self.is_vproxied = False
|
||||||
|
|
||||||
self.ouparam = uparam.copy()
|
self.ouparam = uparam.copy()
|
||||||
|
|
||||||
@@ -1234,10 +1233,19 @@ class HttpCli(object):
|
|||||||
else:
|
else:
|
||||||
return self.tx_404(True)
|
return self.tx_404(True)
|
||||||
else:
|
else:
|
||||||
vfs = self.asrv.vfs
|
if (
|
||||||
if vfs.badcfg1:
|
self.asrv.badcfg1
|
||||||
t = "<h2>access denied due to failsafe; check server log</h2>"
|
and "h" not in self.ouparam
|
||||||
html = self.j2s("splash", this=self, msg=t)
|
and "hc" not in self.ouparam
|
||||||
|
):
|
||||||
|
zs1 = "copyparty refused to start due to a failsafe: invalid server config; check server log"
|
||||||
|
zs2 = 'you may <a href="/?h">access the controlpanel</a> but nothing will work until you shutdown the copyparty container and %s config-file (or provide the configuration as command-line arguments)'
|
||||||
|
if self.asrv.is_lxc and len(self.asrv.cfg_files_loaded) == 1:
|
||||||
|
zs2 = zs2 % ("add a",)
|
||||||
|
else:
|
||||||
|
zs2 = zs2 % ("fix the",)
|
||||||
|
|
||||||
|
html = self.j2s("msg", h1=zs1, h2=zs2)
|
||||||
self.reply(html.encode("utf-8", "replace"), 500)
|
self.reply(html.encode("utf-8", "replace"), 500)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1291,6 +1299,9 @@ class HttpCli(object):
|
|||||||
if "ru" in self.uparam:
|
if "ru" in self.uparam:
|
||||||
return self.tx_rups()
|
return self.tx_rups()
|
||||||
|
|
||||||
|
if "idp" in self.uparam:
|
||||||
|
return self.tx_idp()
|
||||||
|
|
||||||
if "h" in self.uparam:
|
if "h" in self.uparam:
|
||||||
return self.tx_mounts()
|
return self.tx_mounts()
|
||||||
|
|
||||||
@@ -1404,7 +1415,13 @@ class HttpCli(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
ap = ""
|
||||||
|
use_magic = "rmagic" in self.vn.flags
|
||||||
|
|
||||||
for i in hits:
|
for i in hits:
|
||||||
|
if use_magic:
|
||||||
|
ap = os.path.join(self.vn.realpath, i["rp"])
|
||||||
|
|
||||||
iurl = html_escape("%s%s" % (baseurl, i["rp"]), True, True)
|
iurl = html_escape("%s%s" % (baseurl, i["rp"]), True, True)
|
||||||
title = unquotep(i["rp"].split("?")[0].split("/")[-1])
|
title = unquotep(i["rp"].split("?")[0].split("/")[-1])
|
||||||
title = html_escape(title, True, True)
|
title = html_escape(title, True, True)
|
||||||
@@ -1412,8 +1429,8 @@ class HttpCli(object):
|
|||||||
tag_a = str(i["tags"].get("artist") or "")
|
tag_a = str(i["tags"].get("artist") or "")
|
||||||
desc = "%s - %s" % (tag_a, tag_t) if tag_t and tag_a else (tag_t or tag_a)
|
desc = "%s - %s" % (tag_a, tag_t) if tag_t and tag_a else (tag_t or tag_a)
|
||||||
desc = html_escape(desc, True, True) if desc else title
|
desc = html_escape(desc, True, True) if desc else title
|
||||||
mime = html_escape(guess_mime(title))
|
mime = html_escape(guess_mime(title, ap))
|
||||||
lmod = formatdate(i["ts"])
|
lmod = formatdate(max(0, i["ts"]))
|
||||||
zsa = (iurl, iurl, title, desc, lmod, iurl, mime, i["sz"])
|
zsa = (iurl, iurl, title, desc, lmod, iurl, mime, i["sz"])
|
||||||
zs = (
|
zs = (
|
||||||
"""\
|
"""\
|
||||||
@@ -1565,12 +1582,15 @@ class HttpCli(object):
|
|||||||
None, 207, "text/xml; charset=" + enc, {"Transfer-Encoding": "chunked"}
|
None, 207, "text/xml; charset=" + enc, {"Transfer-Encoding": "chunked"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ap = ""
|
||||||
|
use_magic = "rmagic" in vn.flags
|
||||||
|
|
||||||
ret = '<?xml version="1.0" encoding="{}"?>\n<D:multistatus xmlns:D="DAV:">'
|
ret = '<?xml version="1.0" encoding="{}"?>\n<D:multistatus xmlns:D="DAV:">'
|
||||||
ret = ret.format(uenc)
|
ret = ret.format(uenc)
|
||||||
for x in fgen:
|
for x in fgen:
|
||||||
rp = vjoin(vtop, x["vp"])
|
rp = vjoin(vtop, x["vp"])
|
||||||
st: os.stat_result = x["st"]
|
st: os.stat_result = x["st"]
|
||||||
mtime = st.st_mtime
|
mtime = max(0, st.st_mtime)
|
||||||
if stat.S_ISLNK(st.st_mode):
|
if stat.S_ISLNK(st.st_mode):
|
||||||
try:
|
try:
|
||||||
st = bos.stat(os.path.join(tap, x["vp"]))
|
st = bos.stat(os.path.join(tap, x["vp"]))
|
||||||
@@ -1591,7 +1611,9 @@ class HttpCli(object):
|
|||||||
"supportedlock": '<D:lockentry xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>',
|
"supportedlock": '<D:lockentry xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>',
|
||||||
}
|
}
|
||||||
if not isdir:
|
if not isdir:
|
||||||
pvs["getcontenttype"] = html_escape(guess_mime(rp))
|
if use_magic:
|
||||||
|
ap = os.path.join(tap, x["vp"])
|
||||||
|
pvs["getcontenttype"] = html_escape(guess_mime(rp, ap))
|
||||||
pvs["getcontentlength"] = str(st.st_size)
|
pvs["getcontentlength"] = str(st.st_size)
|
||||||
|
|
||||||
for k, v in pvs.items():
|
for k, v in pvs.items():
|
||||||
@@ -2100,8 +2122,7 @@ class HttpCli(object):
|
|||||||
suffix = "-{:.6f}-{}".format(time.time(), self.dip())
|
suffix = "-{:.6f}-{}".format(time.time(), self.dip())
|
||||||
nameless = not fn
|
nameless = not fn
|
||||||
if nameless:
|
if nameless:
|
||||||
suffix += ".bin"
|
fn = vfs.flags["put_name2"].format(now=time.time(), cip=self.dip())
|
||||||
fn = "put" + suffix
|
|
||||||
|
|
||||||
params = {"suffix": suffix, "fdir": fdir}
|
params = {"suffix": suffix, "fdir": fdir}
|
||||||
if self.args.nw:
|
if self.args.nw:
|
||||||
@@ -2181,28 +2202,26 @@ class HttpCli(object):
|
|||||||
# small toctou, but better than clobbering a hardlink
|
# small toctou, but better than clobbering a hardlink
|
||||||
wunlink(self.log, path, vfs.flags)
|
wunlink(self.log, path, vfs.flags)
|
||||||
|
|
||||||
halg = "sha512"
|
|
||||||
hasher = None
|
hasher = None
|
||||||
copier = hashcopy
|
copier = hashcopy
|
||||||
if "ck" in self.ouparam or "ck" in self.headers:
|
halg = self.ouparam.get("ck") or self.headers.get("ck") or vfs.flags["put_ck"]
|
||||||
halg = zs = self.ouparam.get("ck") or self.headers.get("ck") or ""
|
if halg == "sha512":
|
||||||
if not zs or zs == "no":
|
pass
|
||||||
copier = justcopy
|
elif halg == "no":
|
||||||
halg = ""
|
copier = justcopy
|
||||||
elif zs == "md5":
|
halg = ""
|
||||||
hasher = hashlib.md5(**USED4SEC)
|
elif halg == "md5":
|
||||||
elif zs == "sha1":
|
hasher = hashlib.md5(**USED4SEC)
|
||||||
hasher = hashlib.sha1(**USED4SEC)
|
elif halg == "sha1":
|
||||||
elif zs == "sha256":
|
hasher = hashlib.sha1(**USED4SEC)
|
||||||
hasher = hashlib.sha256(**USED4SEC)
|
elif halg == "sha256":
|
||||||
elif zs in ("blake2", "b2"):
|
hasher = hashlib.sha256(**USED4SEC)
|
||||||
hasher = hashlib.blake2b(**USED4SEC)
|
elif halg in ("blake2", "b2"):
|
||||||
elif zs in ("blake2s", "b2s"):
|
hasher = hashlib.blake2b(**USED4SEC)
|
||||||
hasher = hashlib.blake2s(**USED4SEC)
|
elif halg in ("blake2s", "b2s"):
|
||||||
elif zs == "sha512":
|
hasher = hashlib.blake2s(**USED4SEC)
|
||||||
pass
|
else:
|
||||||
else:
|
raise Pebkac(500, "unknown hash alg")
|
||||||
raise Pebkac(500, "unknown hash alg")
|
|
||||||
|
|
||||||
f, fn = ren_open(fn, *open_a, **params)
|
f, fn = ren_open(fn, *open_a, **params)
|
||||||
try:
|
try:
|
||||||
@@ -2591,10 +2610,6 @@ class HttpCli(object):
|
|||||||
x = self.conn.hsrv.broker.ask("up2k.handle_json", body, self.u2fh.aps)
|
x = self.conn.hsrv.broker.ask("up2k.handle_json", body, self.u2fh.aps)
|
||||||
ret = x.get()
|
ret = x.get()
|
||||||
|
|
||||||
if self.is_vproxied:
|
|
||||||
if "purl" in ret:
|
|
||||||
ret["purl"] = self.args.SR + ret["purl"]
|
|
||||||
|
|
||||||
if self.args.shr and self.vpath.startswith(self.args.shr1):
|
if self.args.shr and self.vpath.startswith(self.args.shr1):
|
||||||
# strip common suffix (uploader's folder structure)
|
# strip common suffix (uploader's folder structure)
|
||||||
vp_req, vp_vfs = vroots(self.vpath, vjoin(dbv.vpath, vrem))
|
vp_req, vp_vfs = vroots(self.vpath, vjoin(dbv.vpath, vrem))
|
||||||
@@ -2604,6 +2619,10 @@ class HttpCli(object):
|
|||||||
raise Pebkac(500, t % zt)
|
raise Pebkac(500, t % zt)
|
||||||
ret["purl"] = vp_req + ret["purl"][len(vp_vfs) :]
|
ret["purl"] = vp_req + ret["purl"][len(vp_vfs) :]
|
||||||
|
|
||||||
|
if self.is_vproxied:
|
||||||
|
if "purl" in ret:
|
||||||
|
ret["purl"] = self.args.SR + ret["purl"]
|
||||||
|
|
||||||
ret = json.dumps(ret)
|
ret = json.dumps(ret)
|
||||||
self.log(ret)
|
self.log(ret)
|
||||||
self.reply(ret.encode("utf-8"), mime="application/json")
|
self.reply(ret.encode("utf-8"), mime="application/json")
|
||||||
@@ -2711,6 +2730,7 @@ class HttpCli(object):
|
|||||||
locked = chashes # remaining chunks to be received in this request
|
locked = chashes # remaining chunks to be received in this request
|
||||||
written = [] # chunks written to disk, but not yet released by up2k
|
written = [] # chunks written to disk, but not yet released by up2k
|
||||||
num_left = -1 # num chunks left according to most recent up2k release
|
num_left = -1 # num chunks left according to most recent up2k release
|
||||||
|
bail1 = False # used in sad path to avoid contradicting error-text
|
||||||
treport = time.time() # ratelimit up2k reporting to reduce overhead
|
treport = time.time() # ratelimit up2k reporting to reduce overhead
|
||||||
|
|
||||||
if "x-up2k-subc" in self.headers:
|
if "x-up2k-subc" in self.headers:
|
||||||
@@ -2849,7 +2869,6 @@ class HttpCli(object):
|
|||||||
except:
|
except:
|
||||||
# maybe busted handle (eg. disk went full)
|
# maybe busted handle (eg. disk went full)
|
||||||
f.close()
|
f.close()
|
||||||
chashes = [] # exception flag
|
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
if locked:
|
if locked:
|
||||||
@@ -2858,13 +2877,14 @@ class HttpCli(object):
|
|||||||
num_left, t = x.get()
|
num_left, t = x.get()
|
||||||
if num_left < 0:
|
if num_left < 0:
|
||||||
self.loud_reply(t, status=500)
|
self.loud_reply(t, status=500)
|
||||||
if chashes: # kills exception bubbling otherwise
|
bail1 = True
|
||||||
return False
|
|
||||||
else:
|
else:
|
||||||
t = "got %d more chunks, %d left"
|
t = "got %d more chunks, %d left"
|
||||||
self.log(t % (len(written), num_left), 6)
|
self.log(t % (len(written), num_left), 6)
|
||||||
|
|
||||||
if num_left < 0:
|
if num_left < 0:
|
||||||
|
if bail1:
|
||||||
|
return False
|
||||||
raise Pebkac(500, "unconfirmed; see serverlog")
|
raise Pebkac(500, "unconfirmed; see serverlog")
|
||||||
|
|
||||||
if not num_left and fpool:
|
if not num_left and fpool:
|
||||||
@@ -2931,7 +2951,8 @@ class HttpCli(object):
|
|||||||
self.parser.drop()
|
self.parser.drop()
|
||||||
|
|
||||||
self.log("logout " + self.uname)
|
self.log("logout " + self.uname)
|
||||||
self.asrv.forget_session(self.conn.hsrv.broker, self.uname)
|
if not self.uname.startswith("s_"):
|
||||||
|
self.asrv.forget_session(self.conn.hsrv.broker, self.uname)
|
||||||
self.get_pwd_cookie("x")
|
self.get_pwd_cookie("x")
|
||||||
|
|
||||||
dst = self.args.SRS + "?h"
|
dst = self.args.SRS + "?h"
|
||||||
@@ -3084,15 +3105,18 @@ class HttpCli(object):
|
|||||||
vfs, rem = self.asrv.vfs.get(self.vpath, self.uname, False, True)
|
vfs, rem = self.asrv.vfs.get(self.vpath, self.uname, False, True)
|
||||||
self._assert_safe_rem(rem)
|
self._assert_safe_rem(rem)
|
||||||
|
|
||||||
halg = "sha512"
|
|
||||||
hasher = None
|
hasher = None
|
||||||
copier = hashcopy
|
|
||||||
if nohash:
|
if nohash:
|
||||||
halg = ""
|
halg = ""
|
||||||
copier = justcopy
|
copier = justcopy
|
||||||
elif "ck" in self.ouparam or "ck" in self.headers:
|
else:
|
||||||
halg = self.ouparam.get("ck") or self.headers.get("ck") or ""
|
copier = hashcopy
|
||||||
if not halg or halg == "no":
|
halg = (
|
||||||
|
self.ouparam.get("ck") or self.headers.get("ck") or vfs.flags["bup_ck"]
|
||||||
|
)
|
||||||
|
if halg == "sha512":
|
||||||
|
pass
|
||||||
|
elif halg == "no":
|
||||||
copier = justcopy
|
copier = justcopy
|
||||||
halg = ""
|
halg = ""
|
||||||
elif halg == "md5":
|
elif halg == "md5":
|
||||||
@@ -3105,8 +3129,6 @@ class HttpCli(object):
|
|||||||
hasher = hashlib.blake2b(**USED4SEC)
|
hasher = hashlib.blake2b(**USED4SEC)
|
||||||
elif halg in ("blake2s", "b2s"):
|
elif halg in ("blake2s", "b2s"):
|
||||||
hasher = hashlib.blake2s(**USED4SEC)
|
hasher = hashlib.blake2s(**USED4SEC)
|
||||||
elif halg == "sha512":
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
raise Pebkac(500, "unknown hash alg")
|
raise Pebkac(500, "unknown hash alg")
|
||||||
|
|
||||||
@@ -3569,7 +3591,7 @@ class HttpCli(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if dp:
|
if dp:
|
||||||
wrename(self.log, fp, os.path.join(dp, mfile2), vfs.flags)
|
atomic_move(self.log, fp, os.path.join(dp, mfile2), vfs.flags)
|
||||||
|
|
||||||
assert self.parser.gen # !rm
|
assert self.parser.gen # !rm
|
||||||
p_field, _, p_data = next(self.parser.gen)
|
p_field, _, p_data = next(self.parser.gen)
|
||||||
@@ -3806,6 +3828,20 @@ class HttpCli(object):
|
|||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
def _can_tail(self, volflags: dict[str, Any]) -> bool:
|
||||||
|
zp = self.args.ua_nodoc
|
||||||
|
if zp and zp.search(self.ua):
|
||||||
|
t = "this URL contains no valuable information for bots/crawlers"
|
||||||
|
raise Pebkac(403, t)
|
||||||
|
lvl = volflags["tail_who"]
|
||||||
|
if "notail" in volflags or not lvl:
|
||||||
|
raise Pebkac(400, "tail is disabled in server config")
|
||||||
|
elif lvl <= 1 and not self.can_admin:
|
||||||
|
raise Pebkac(400, "tail is admin-only on this server")
|
||||||
|
elif lvl <= 2 and self.uname in ("", "*"):
|
||||||
|
raise Pebkac(400, "you must be authenticated to use ?tail on this server")
|
||||||
|
return True
|
||||||
|
|
||||||
def _can_zip(self, volflags: dict[str, Any]) -> str:
|
def _can_zip(self, volflags: dict[str, Any]) -> str:
|
||||||
lvl = volflags["zip_who"]
|
lvl = volflags["zip_who"]
|
||||||
if self.args.no_zip or not lvl:
|
if self.args.no_zip or not lvl:
|
||||||
@@ -3950,6 +3986,8 @@ class HttpCli(object):
|
|||||||
logmsg = "{:4} {} ".format("", self.req)
|
logmsg = "{:4} {} ".format("", self.req)
|
||||||
logtail = ""
|
logtail = ""
|
||||||
|
|
||||||
|
is_tail = "tail" in self.uparam and self._can_tail(self.vn.flags)
|
||||||
|
|
||||||
if ptop is not None:
|
if ptop is not None:
|
||||||
ap_data = "<%s>" % (req_path,)
|
ap_data = "<%s>" % (req_path,)
|
||||||
try:
|
try:
|
||||||
@@ -3980,7 +4018,7 @@ class HttpCli(object):
|
|||||||
if ptop is not None:
|
if ptop is not None:
|
||||||
assert job and ap_data # type: ignore # !rm
|
assert job and ap_data # type: ignore # !rm
|
||||||
sz = job["size"]
|
sz = job["size"]
|
||||||
file_ts = job["lmod"]
|
file_ts = max(0, job["lmod"])
|
||||||
editions["plain"] = (ap_data, sz)
|
editions["plain"] = (ap_data, sz)
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -4063,6 +4101,7 @@ class HttpCli(object):
|
|||||||
and can_range
|
and can_range
|
||||||
and file_sz
|
and file_sz
|
||||||
and "," not in hrange
|
and "," not in hrange
|
||||||
|
and not is_tail
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
if not hrange.lower().startswith("bytes"):
|
if not hrange.lower().startswith("bytes"):
|
||||||
@@ -4131,6 +4170,8 @@ class HttpCli(object):
|
|||||||
mime = "text/plain; charset={}".format(self.uparam["txt"] or "utf-8")
|
mime = "text/plain; charset={}".format(self.uparam["txt"] or "utf-8")
|
||||||
elif "mime" in self.uparam:
|
elif "mime" in self.uparam:
|
||||||
mime = str(self.uparam.get("mime"))
|
mime = str(self.uparam.get("mime"))
|
||||||
|
elif "rmagic" in self.vn.flags:
|
||||||
|
mime = guess_mime(req_path, fs_path)
|
||||||
else:
|
else:
|
||||||
mime = guess_mime(req_path)
|
mime = guess_mime(req_path)
|
||||||
|
|
||||||
@@ -4148,13 +4189,18 @@ class HttpCli(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
dls = self.conn.hsrv.dls
|
dls = self.conn.hsrv.dls
|
||||||
|
if is_tail:
|
||||||
|
upper = 1 << 30
|
||||||
|
if len(dls) > self.args.tail_cmax:
|
||||||
|
raise Pebkac(400, "too many active downloads to start a new tail")
|
||||||
|
|
||||||
if upper - lower > 0x400000: # 4m
|
if upper - lower > 0x400000: # 4m
|
||||||
now = time.time()
|
now = time.time()
|
||||||
self.dl_id = "%s:%s" % (self.ip, self.addr[1])
|
self.dl_id = "%s:%s" % (self.ip, self.addr[1])
|
||||||
dls[self.dl_id] = (now, 0)
|
dls[self.dl_id] = (now, 0)
|
||||||
self.conn.hsrv.dli[self.dl_id] = (
|
self.conn.hsrv.dli[self.dl_id] = (
|
||||||
now,
|
now,
|
||||||
upper - lower,
|
0 if is_tail else upper - lower,
|
||||||
self.vn,
|
self.vn,
|
||||||
self.vpath,
|
self.vpath,
|
||||||
self.uname,
|
self.uname,
|
||||||
@@ -4165,6 +4211,9 @@ class HttpCli(object):
|
|||||||
return self.tx_pipe(
|
return self.tx_pipe(
|
||||||
ptop, req_path, ap_data, job, lower, upper, status, mime, logmsg
|
ptop, req_path, ap_data, job, lower, upper, status, mime, logmsg
|
||||||
)
|
)
|
||||||
|
elif is_tail:
|
||||||
|
self.tx_tail(open_args, status, mime)
|
||||||
|
return False
|
||||||
|
|
||||||
ret = True
|
ret = True
|
||||||
with open_func(*open_args) as f:
|
with open_func(*open_args) as f:
|
||||||
@@ -4194,6 +4243,133 @@ class HttpCli(object):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def tx_tail(
|
||||||
|
self,
|
||||||
|
open_args: list[Any],
|
||||||
|
status: int,
|
||||||
|
mime: str,
|
||||||
|
) -> None:
|
||||||
|
vf = self.vn.flags
|
||||||
|
self.send_headers(length=None, status=status, mime=mime)
|
||||||
|
abspath: bytes = open_args[0]
|
||||||
|
sec_rate = vf["tail_rate"]
|
||||||
|
sec_max = vf["tail_tmax"]
|
||||||
|
sec_fd = vf["tail_fd"]
|
||||||
|
sec_ka = self.args.tail_ka
|
||||||
|
wr_slp = self.args.s_wr_slp
|
||||||
|
wr_sz = self.args.s_wr_sz
|
||||||
|
dls = self.conn.hsrv.dls
|
||||||
|
dl_id = self.dl_id
|
||||||
|
|
||||||
|
# non-numeric = full file from start
|
||||||
|
# positive = absolute offset from start
|
||||||
|
# negative = start that many bytes from eof
|
||||||
|
try:
|
||||||
|
ofs = int(self.uparam["tail"])
|
||||||
|
except:
|
||||||
|
ofs = 0
|
||||||
|
|
||||||
|
t0 = time.time()
|
||||||
|
ofs0 = ofs
|
||||||
|
f = None
|
||||||
|
try:
|
||||||
|
st = os.stat(abspath)
|
||||||
|
f = open(*open_args)
|
||||||
|
f.seek(0, os.SEEK_END)
|
||||||
|
eof = f.tell()
|
||||||
|
f.seek(0)
|
||||||
|
if ofs < 0:
|
||||||
|
ofs = max(0, ofs + eof)
|
||||||
|
|
||||||
|
self.log("tailing from byte %d: %r" % (ofs, abspath), 6)
|
||||||
|
|
||||||
|
# send initial data asap
|
||||||
|
remains = sendfile_py(
|
||||||
|
self.log, # d/c
|
||||||
|
ofs,
|
||||||
|
eof,
|
||||||
|
f,
|
||||||
|
self.s,
|
||||||
|
wr_sz,
|
||||||
|
wr_slp,
|
||||||
|
False, # d/c
|
||||||
|
dls,
|
||||||
|
dl_id,
|
||||||
|
)
|
||||||
|
sent = (eof - ofs) - remains
|
||||||
|
ofs = eof - remains
|
||||||
|
f.seek(ofs)
|
||||||
|
|
||||||
|
try:
|
||||||
|
st2 = os.stat(open_args[0])
|
||||||
|
if st.st_ino == st2.st_ino:
|
||||||
|
st = st2 # for filesize
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
gone = 0
|
||||||
|
t_fd = t_ka = time.time()
|
||||||
|
while True:
|
||||||
|
assert f # !rm
|
||||||
|
buf = f.read(4096)
|
||||||
|
now = time.time()
|
||||||
|
|
||||||
|
if sec_max and now - t0 >= sec_max:
|
||||||
|
self.log("max duration exceeded; kicking client", 6)
|
||||||
|
zb = b"\n\n*** max duration exceeded; disconnecting ***\n"
|
||||||
|
self.s.sendall(zb)
|
||||||
|
break
|
||||||
|
|
||||||
|
if buf:
|
||||||
|
t_fd = t_ka = now
|
||||||
|
self.s.sendall(buf)
|
||||||
|
sent += len(buf)
|
||||||
|
dls[dl_id] = (time.time(), sent)
|
||||||
|
continue
|
||||||
|
|
||||||
|
time.sleep(sec_rate)
|
||||||
|
if t_ka < now - sec_ka:
|
||||||
|
t_ka = now
|
||||||
|
self.s.send(b"\x00")
|
||||||
|
if t_fd < now - sec_fd:
|
||||||
|
try:
|
||||||
|
st2 = os.stat(open_args[0])
|
||||||
|
if (
|
||||||
|
st2.st_ino != st.st_ino
|
||||||
|
or st2.st_size < sent
|
||||||
|
or st2.st_size < st.st_size
|
||||||
|
):
|
||||||
|
assert f # !rm
|
||||||
|
# open new file before closing previous to avoid toctous (open may fail; cannot null f before)
|
||||||
|
f2 = open(*open_args)
|
||||||
|
f.close()
|
||||||
|
f = f2
|
||||||
|
f.seek(0, os.SEEK_END)
|
||||||
|
eof = f.tell()
|
||||||
|
if eof < sent:
|
||||||
|
ofs = sent = 0 # shrunk; send from start
|
||||||
|
zb = b"\n\n*** file size decreased -- rewinding to the start of the file ***\n\n"
|
||||||
|
self.s.sendall(zb)
|
||||||
|
if ofs0 < 0 and eof > -ofs0:
|
||||||
|
ofs = eof + ofs0
|
||||||
|
else:
|
||||||
|
ofs = sent # just new fd? resume from same ofs
|
||||||
|
f.seek(ofs)
|
||||||
|
self.log("reopened at byte %d: %r" % (ofs, abspath), 6)
|
||||||
|
gone = 0
|
||||||
|
st = st2
|
||||||
|
except:
|
||||||
|
gone += 1
|
||||||
|
if gone > 3:
|
||||||
|
self.log("file deleted; disconnecting")
|
||||||
|
break
|
||||||
|
except IOError as ex:
|
||||||
|
if ex.errno not in (errno.EPIPE, errno.ESHUTDOWN, errno.EBADFD):
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
if f:
|
||||||
|
f.close()
|
||||||
|
|
||||||
def tx_pipe(
|
def tx_pipe(
|
||||||
self,
|
self,
|
||||||
ptop: str,
|
ptop: str,
|
||||||
@@ -4754,7 +4930,6 @@ class HttpCli(object):
|
|||||||
if zi == 2 or (zi == 1 and self.avol):
|
if zi == 2 or (zi == 1 and self.avol):
|
||||||
dl_list = self.get_dls()
|
dl_list = self.get_dls()
|
||||||
for t0, t1, sent, sz, vp, dl_id, uname in dl_list:
|
for t0, t1, sent, sz, vp, dl_id, uname in dl_list:
|
||||||
rem = sz - sent
|
|
||||||
td = max(0.1, now - t0)
|
td = max(0.1, now - t0)
|
||||||
rd, fn = vsplit(vp)
|
rd, fn = vsplit(vp)
|
||||||
if not rd:
|
if not rd:
|
||||||
@@ -4774,6 +4949,11 @@ class HttpCli(object):
|
|||||||
fn = html_escape(fn) if fn else self.conn.hsrv.iiam
|
fn = html_escape(fn) if fn else self.conn.hsrv.iiam
|
||||||
dls.append((perc, hsent, spd, eta, idle, usr, erd, rds, fn))
|
dls.append((perc, hsent, spd, eta, idle, usr, erd, rds, fn))
|
||||||
|
|
||||||
|
if self.args.have_unlistc:
|
||||||
|
allvols = self.asrv.vfs.all_vols
|
||||||
|
rvol = [x for x in rvol if "unlistcr" not in allvols[x[1:-1]].flags]
|
||||||
|
wvol = [x for x in wvol if "unlistcw" not in allvols[x[1:-1]].flags]
|
||||||
|
|
||||||
fmt = self.uparam.get("ls", "")
|
fmt = self.uparam.get("ls", "")
|
||||||
if not fmt and (self.ua.startswith("curl/") or self.ua.startswith("fetch")):
|
if not fmt and (self.ua.startswith("curl/") or self.ua.startswith("fetch")):
|
||||||
fmt = "v"
|
fmt = "v"
|
||||||
@@ -4928,15 +5108,24 @@ class HttpCli(object):
|
|||||||
return "" # unhandled / fallthrough
|
return "" # unhandled / fallthrough
|
||||||
|
|
||||||
def scanvol(self) -> bool:
|
def scanvol(self) -> bool:
|
||||||
if not self.can_admin:
|
|
||||||
raise Pebkac(403, "'scanvol' not allowed for user " + self.uname)
|
|
||||||
|
|
||||||
if self.args.no_rescan:
|
if self.args.no_rescan:
|
||||||
raise Pebkac(403, "the rescan feature is disabled in server config")
|
raise Pebkac(403, "the rescan feature is disabled in server config")
|
||||||
|
|
||||||
vn, _ = self.asrv.vfs.get(self.vpath, self.uname, True, True)
|
vpaths = self.uparam["scan"].split(",/")
|
||||||
|
if vpaths == [""]:
|
||||||
|
vpaths = [self.vpath]
|
||||||
|
|
||||||
args = [self.asrv.vfs.all_vols, [vn.vpath], False, True]
|
vols = []
|
||||||
|
for vpath in vpaths:
|
||||||
|
vn, _ = self.asrv.vfs.get(vpath, self.uname, True, True)
|
||||||
|
vols.append(vn.vpath)
|
||||||
|
if self.uname not in vn.axs.uadmin:
|
||||||
|
self.log("rejected scanning [%s] => [%s];" % (vpath, vn.vpath), 3)
|
||||||
|
raise Pebkac(403, "'scanvol' not allowed for user " + self.uname)
|
||||||
|
|
||||||
|
self.log("trying to rescan %d volumes: %r" % (len(vols), vols))
|
||||||
|
|
||||||
|
args = [self.asrv.vfs.all_vols, vols, False, True]
|
||||||
|
|
||||||
x = self.conn.hsrv.broker.ask("up2k.rescan", *args)
|
x = self.conn.hsrv.broker.ask("up2k.rescan", *args)
|
||||||
err = x.get()
|
err = x.get()
|
||||||
@@ -5356,6 +5545,32 @@ class HttpCli(object):
|
|||||||
self.reply(html.encode("utf-8"), status=200)
|
self.reply(html.encode("utf-8"), status=200)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def tx_idp(self) -> bool:
|
||||||
|
if self.uname.lower() not in self.args.idp_adm_set:
|
||||||
|
raise Pebkac(403, "'idp' not allowed for user " + self.uname)
|
||||||
|
|
||||||
|
cmd = self.uparam["idp"]
|
||||||
|
if cmd.startswith("rm="):
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
db = sqlite3.connect(self.args.idp_db)
|
||||||
|
db.execute("delete from us where un=?", (cmd[3:],))
|
||||||
|
db.commit()
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
self.conn.hsrv.broker.ask("reload", False, False).get()
|
||||||
|
|
||||||
|
self.redirect("", "?idp")
|
||||||
|
return True
|
||||||
|
|
||||||
|
rows = [
|
||||||
|
[k, "[%s]" % ("], [".join(v))]
|
||||||
|
for k, v in sorted(self.asrv.idp_accs.items())
|
||||||
|
]
|
||||||
|
html = self.j2s("idp", this=self, rows=rows, now=int(time.time()))
|
||||||
|
self.reply(html.encode("utf-8"), status=200)
|
||||||
|
return True
|
||||||
|
|
||||||
def tx_shares(self) -> bool:
|
def tx_shares(self) -> bool:
|
||||||
if self.uname == "*":
|
if self.uname == "*":
|
||||||
self.loud_reply("you're not logged in")
|
self.loud_reply("you're not logged in")
|
||||||
@@ -5430,7 +5645,7 @@ class HttpCli(object):
|
|||||||
self.conn.hsrv.broker.ask("reload", False, False).get()
|
self.conn.hsrv.broker.ask("reload", False, False).get()
|
||||||
self.conn.hsrv.broker.ask("up2k.wake_rescanner").get()
|
self.conn.hsrv.broker.ask("up2k.wake_rescanner").get()
|
||||||
|
|
||||||
self.redirect(self.args.SRS + "?shares")
|
self.redirect("", "?shares")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def handle_share(self, req: dict[str, str]) -> bool:
|
def handle_share(self, req: dict[str, str]) -> bool:
|
||||||
@@ -5504,6 +5719,7 @@ class HttpCli(object):
|
|||||||
raise Pebkac(400, "selected file not found on disk: [%s]" % (fn,))
|
raise Pebkac(400, "selected file not found on disk: [%s]" % (fn,))
|
||||||
|
|
||||||
pw = req.get("pw") or ""
|
pw = req.get("pw") or ""
|
||||||
|
pw = self.asrv.ah.hash(pw)
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
sexp = req["exp"]
|
sexp = req["exp"]
|
||||||
exp = int(sexp) if sexp else 0
|
exp = int(sexp) if sexp else 0
|
||||||
@@ -6121,7 +6337,7 @@ class HttpCli(object):
|
|||||||
margin = "-"
|
margin = "-"
|
||||||
|
|
||||||
sz = inf.st_size
|
sz = inf.st_size
|
||||||
zd = datetime.fromtimestamp(linf.st_mtime, UTC)
|
zd = datetime.fromtimestamp(max(0, linf.st_mtime), UTC)
|
||||||
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
||||||
zd.year,
|
zd.year,
|
||||||
zd.month,
|
zd.month,
|
||||||
|
|||||||
@@ -224,3 +224,6 @@ class HttpConn(object):
|
|||||||
if self.u2idx:
|
if self.u2idx:
|
||||||
self.hsrv.put_u2idx(str(self.addr), self.u2idx)
|
self.hsrv.put_u2idx(str(self.addr), self.u2idx)
|
||||||
self.u2idx = None
|
self.u2idx = None
|
||||||
|
|
||||||
|
if self.rproxy:
|
||||||
|
self.set_rproxy()
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class HttpSrv(object):
|
|||||||
"browser",
|
"browser",
|
||||||
"browser2",
|
"browser2",
|
||||||
"cf",
|
"cf",
|
||||||
|
"idp",
|
||||||
"md",
|
"md",
|
||||||
"mde",
|
"mde",
|
||||||
"msg",
|
"msg",
|
||||||
@@ -313,6 +314,8 @@ class HttpSrv(object):
|
|||||||
|
|
||||||
Daemon(self.broker.say, "sig-hsrv-up1", ("cb_httpsrv_up",))
|
Daemon(self.broker.say, "sig-hsrv-up1", ("cb_httpsrv_up",))
|
||||||
|
|
||||||
|
saddr = ("", 0) # fwd-decl for `except TypeError as ex:`
|
||||||
|
|
||||||
while not self.stopping:
|
while not self.stopping:
|
||||||
if self.args.log_conn:
|
if self.args.log_conn:
|
||||||
self.log(self.name, "|%sC-ncli" % ("-" * 1,), c="90")
|
self.log(self.name, "|%sC-ncli" % ("-" * 1,), c="90")
|
||||||
@@ -394,6 +397,19 @@ class HttpSrv(object):
|
|||||||
self.log(self.name, "accept({}): {}".format(fno, ex), c=6)
|
self.log(self.name, "accept({}): {}".format(fno, ex), c=6)
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
continue
|
continue
|
||||||
|
except TypeError as ex:
|
||||||
|
# on macOS, accept() may return a None saddr if blocked by LittleSnitch;
|
||||||
|
# unicode(saddr[0]) ==> TypeError: 'NoneType' object is not subscriptable
|
||||||
|
if tcp and not saddr:
|
||||||
|
t = "accept(%s): failed to accept connection from client due to firewall or network issue"
|
||||||
|
self.log(self.name, t % (fno,), c=3)
|
||||||
|
try:
|
||||||
|
sck.close() # type: ignore
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
time.sleep(0.02)
|
||||||
|
continue
|
||||||
|
raise
|
||||||
|
|
||||||
if self.args.log_conn:
|
if self.args.log_conn:
|
||||||
t = "|{}C-acc2 \033[0;36m{} \033[3{}m{}".format(
|
t = "|{}C-acc2 \033[0;36m{} \033[3{}m{}".format(
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ if True: # pylint: disable=using-constant-test
|
|||||||
from .util import NamedLogger
|
from .util import NamedLogger
|
||||||
|
|
||||||
|
|
||||||
|
TAR_NO_OPUS = set("aac|m4a|mp3|oga|ogg|opus|wma".split("|"))
|
||||||
|
|
||||||
|
|
||||||
class StreamArc(object):
|
class StreamArc(object):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -82,9 +85,7 @@ def enthumb(
|
|||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
rem = f["vp"]
|
rem = f["vp"]
|
||||||
ext = rem.rsplit(".", 1)[-1].lower()
|
ext = rem.rsplit(".", 1)[-1].lower()
|
||||||
if (fmt == "mp3" and ext == "mp3") or (
|
if (fmt == "mp3" and ext == "mp3") or (fmt == "opus" and ext in TAR_NO_OPUS):
|
||||||
fmt == "opus" and ext in "aac|m4a|mp3|ogg|opus|wma".split("|")
|
|
||||||
):
|
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
vp = vjoin(vtop, rem.split("/", 1)[1])
|
vp = vjoin(vtop, rem.split("/", 1)[1])
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ if PY2:
|
|||||||
range = xrange # type: ignore
|
range = xrange # type: ignore
|
||||||
|
|
||||||
|
|
||||||
|
VER_IDP_DB = 1
|
||||||
VER_SESSION_DB = 1
|
VER_SESSION_DB = 1
|
||||||
VER_SHARES_DB = 2
|
VER_SHARES_DB = 2
|
||||||
|
|
||||||
@@ -253,8 +254,20 @@ class SvcHub(object):
|
|||||||
setattr(args, "ipu_iu", iu)
|
setattr(args, "ipu_iu", iu)
|
||||||
setattr(args, "ipu_nm", nm)
|
setattr(args, "ipu_nm", nm)
|
||||||
|
|
||||||
|
for zs in "ah_salt fk_salt dk_salt".split():
|
||||||
|
if getattr(args, "show_%s" % (zs,)):
|
||||||
|
self.log("root", "effective %s is %s" % (zs, getattr(args, zs)))
|
||||||
|
|
||||||
|
if args.ah_cli or args.ah_gen:
|
||||||
|
args.idp_store = 0
|
||||||
|
args.no_ses = True
|
||||||
|
args.shr = ""
|
||||||
|
|
||||||
|
if args.idp_store and args.idp_h_usr:
|
||||||
|
self.setup_db("idp")
|
||||||
|
|
||||||
if not self.args.no_ses:
|
if not self.args.no_ses:
|
||||||
self.setup_session_db()
|
self.setup_db("ses")
|
||||||
|
|
||||||
args.shr1 = ""
|
args.shr1 = ""
|
||||||
if args.shr:
|
if args.shr:
|
||||||
@@ -413,26 +426,58 @@ class SvcHub(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def setup_session_db(self) -> None:
|
def _db_onfail_ses(self) -> None:
|
||||||
|
self.args.no_ses = True
|
||||||
|
|
||||||
|
def _db_onfail_idp(self) -> None:
|
||||||
|
self.args.idp_store = 0
|
||||||
|
|
||||||
|
def setup_db(self, which: str) -> None:
|
||||||
|
"""
|
||||||
|
the "non-mission-critical" databases; if something looks broken then just nuke it
|
||||||
|
"""
|
||||||
|
if which == "ses":
|
||||||
|
native_ver = VER_SESSION_DB
|
||||||
|
db_path = self.args.ses_db
|
||||||
|
desc = "sessions-db"
|
||||||
|
pathopt = "ses-db"
|
||||||
|
sanchk_q = "select count(*) from us"
|
||||||
|
createfun = self._create_session_db
|
||||||
|
failfun = self._db_onfail_ses
|
||||||
|
elif which == "idp":
|
||||||
|
native_ver = VER_IDP_DB
|
||||||
|
db_path = self.args.idp_db
|
||||||
|
desc = "idp-db"
|
||||||
|
pathopt = "idp-db"
|
||||||
|
sanchk_q = "select count(*) from us"
|
||||||
|
createfun = self._create_idp_db
|
||||||
|
failfun = self._db_onfail_idp
|
||||||
|
else:
|
||||||
|
raise Exception("unknown cachetype")
|
||||||
|
|
||||||
|
if not db_path.endswith(".db"):
|
||||||
|
zs = "config option --%s (the %s) was configured to [%s] which is invalid; must be a filepath ending with .db"
|
||||||
|
self.log("root", zs % (pathopt, desc, db_path), 1)
|
||||||
|
raise Exception(BAD_CFG)
|
||||||
|
|
||||||
if not HAVE_SQLITE3:
|
if not HAVE_SQLITE3:
|
||||||
self.args.no_ses = True
|
failfun()
|
||||||
t = "WARNING: sqlite3 not available; disabling sessions, will use plaintext passwords in cookies"
|
if which == "ses":
|
||||||
self.log("root", t, 3)
|
zs = "disabling sessions, will use plaintext passwords in cookies"
|
||||||
|
elif which == "idp":
|
||||||
|
zs = "disabling idp-db, will be unable to remember IdP-volumes after a restart"
|
||||||
|
self.log("root", "WARNING: sqlite3 not available; %s" % (zs,), 3)
|
||||||
return
|
return
|
||||||
|
|
||||||
assert sqlite3 # type: ignore # !rm
|
assert sqlite3 # type: ignore # !rm
|
||||||
|
|
||||||
# policy:
|
|
||||||
# the sessions-db is whatever, if something looks broken then just nuke it
|
|
||||||
|
|
||||||
db_path = self.args.ses_db
|
|
||||||
db_lock = db_path + ".lock"
|
db_lock = db_path + ".lock"
|
||||||
try:
|
try:
|
||||||
create = not os.path.getsize(db_path)
|
create = not os.path.getsize(db_path)
|
||||||
except:
|
except:
|
||||||
create = True
|
create = True
|
||||||
zs = "creating new" if create else "opening"
|
zs = "creating new" if create else "opening"
|
||||||
self.log("root", "%s sessions-db %s" % (zs, db_path))
|
self.log("root", "%s %s %s" % (zs, desc, db_path))
|
||||||
|
|
||||||
for tries in range(2):
|
for tries in range(2):
|
||||||
sver = 0
|
sver = 0
|
||||||
@@ -442,17 +487,19 @@ class SvcHub(object):
|
|||||||
try:
|
try:
|
||||||
zs = "select v from kv where k='sver'"
|
zs = "select v from kv where k='sver'"
|
||||||
sver = cur.execute(zs).fetchall()[0][0]
|
sver = cur.execute(zs).fetchall()[0][0]
|
||||||
if sver > VER_SESSION_DB:
|
if sver > native_ver:
|
||||||
zs = "this version of copyparty only understands session-db v%d and older; the db is v%d"
|
zs = "this version of copyparty only understands %s v%d and older; the db is v%d"
|
||||||
raise Exception(zs % (VER_SESSION_DB, sver))
|
raise Exception(zs % (desc, native_ver, sver))
|
||||||
|
|
||||||
cur.execute("select count(*) from us").fetchone()
|
cur.execute(sanchk_q).fetchone()
|
||||||
except:
|
except:
|
||||||
if sver:
|
if sver:
|
||||||
raise
|
raise
|
||||||
sver = 1
|
sver = createfun(cur)
|
||||||
self._create_session_db(cur)
|
|
||||||
err = self._verify_session_db(cur, sver, db_path)
|
err = self._verify_db(
|
||||||
|
cur, which, pathopt, db_path, desc, sver, native_ver
|
||||||
|
)
|
||||||
if err:
|
if err:
|
||||||
tries = 99
|
tries = 99
|
||||||
self.args.no_ses = True
|
self.args.no_ses = True
|
||||||
@@ -460,10 +507,10 @@ class SvcHub(object):
|
|||||||
break
|
break
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if tries or sver > VER_SESSION_DB:
|
if tries or sver > native_ver:
|
||||||
raise
|
raise
|
||||||
t = "sessions-db is unusable; deleting and recreating: %r"
|
t = "%s is unusable; deleting and recreating: %r"
|
||||||
self.log("root", t % (ex,), 3)
|
self.log("root", t % (desc, ex), 3)
|
||||||
try:
|
try:
|
||||||
cur.close() # type: ignore
|
cur.close() # type: ignore
|
||||||
except:
|
except:
|
||||||
@@ -478,7 +525,7 @@ class SvcHub(object):
|
|||||||
pass
|
pass
|
||||||
os.unlink(db_path)
|
os.unlink(db_path)
|
||||||
|
|
||||||
def _create_session_db(self, cur: "sqlite3.Cursor") -> None:
|
def _create_session_db(self, cur: "sqlite3.Cursor") -> int:
|
||||||
sch = [
|
sch = [
|
||||||
r"create table kv (k text, v int)",
|
r"create table kv (k text, v int)",
|
||||||
r"create table us (un text, si text, t0 int)",
|
r"create table us (un text, si text, t0 int)",
|
||||||
@@ -491,8 +538,31 @@ class SvcHub(object):
|
|||||||
for cmd in sch:
|
for cmd in sch:
|
||||||
cur.execute(cmd)
|
cur.execute(cmd)
|
||||||
self.log("root", "created new sessions-db")
|
self.log("root", "created new sessions-db")
|
||||||
|
return 1
|
||||||
|
|
||||||
def _verify_session_db(self, cur: "sqlite3.Cursor", sver: int, db_path: str) -> str:
|
def _create_idp_db(self, cur: "sqlite3.Cursor") -> int:
|
||||||
|
sch = [
|
||||||
|
r"create table kv (k text, v int)",
|
||||||
|
r"create table us (un text, gs text)",
|
||||||
|
# username, groups
|
||||||
|
r"create index us_un on us(un)",
|
||||||
|
r"insert into kv values ('sver', 1)",
|
||||||
|
]
|
||||||
|
for cmd in sch:
|
||||||
|
cur.execute(cmd)
|
||||||
|
self.log("root", "created new idp-db")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def _verify_db(
|
||||||
|
self,
|
||||||
|
cur: "sqlite3.Cursor",
|
||||||
|
which: str,
|
||||||
|
pathopt: str,
|
||||||
|
db_path: str,
|
||||||
|
desc: str,
|
||||||
|
sver: int,
|
||||||
|
native_ver: int,
|
||||||
|
) -> str:
|
||||||
# ensure writable (maybe owned by other user)
|
# ensure writable (maybe owned by other user)
|
||||||
db = cur.connection
|
db = cur.connection
|
||||||
|
|
||||||
@@ -504,9 +574,16 @@ class SvcHub(object):
|
|||||||
except:
|
except:
|
||||||
owner = 0
|
owner = 0
|
||||||
|
|
||||||
|
if which == "ses":
|
||||||
|
cons = "Will now disable sessions and instead use plaintext passwords in cookies."
|
||||||
|
elif which == "idp":
|
||||||
|
cons = "Each IdP-volume will not become available until its associated user sends their first request."
|
||||||
|
else:
|
||||||
|
raise Exception()
|
||||||
|
|
||||||
if not lock_file(db_path + ".lock"):
|
if not lock_file(db_path + ".lock"):
|
||||||
t = "the sessions-db [%s] is already in use by another copyparty instance (pid:%d). This is not supported; please provide another database with --ses-db or give this copyparty-instance its entirely separate config-folder by setting another path in the XDG_CONFIG_HOME env-var. You can also disable this safeguard by setting env-var PRTY_NO_DB_LOCK=1. Will now disable sessions and instead use plaintext passwords in cookies."
|
t = "the %s [%s] is already in use by another copyparty instance (pid:%d). This is not supported; please provide another database with --%s or give this copyparty-instance its entirely separate config-folder by setting another path in the XDG_CONFIG_HOME env-var. You can also disable this safeguard by setting env-var PRTY_NO_DB_LOCK=1. %s"
|
||||||
return t % (db_path, owner)
|
return t % (desc, db_path, owner, pathopt, cons)
|
||||||
|
|
||||||
vars = (("pid", os.getpid()), ("ts", int(time.time() * 1000)))
|
vars = (("pid", os.getpid()), ("ts", int(time.time() * 1000)))
|
||||||
if owner:
|
if owner:
|
||||||
@@ -518,9 +595,9 @@ class SvcHub(object):
|
|||||||
for k, v in vars:
|
for k, v in vars:
|
||||||
cur.execute("insert into kv values(?, ?)", (k, v))
|
cur.execute("insert into kv values(?, ?)", (k, v))
|
||||||
|
|
||||||
if sver < VER_SESSION_DB:
|
if sver < native_ver:
|
||||||
cur.execute("delete from kv where k='sver'")
|
cur.execute("delete from kv where k='sver'")
|
||||||
cur.execute("insert into kv values('sver',?)", (VER_SESSION_DB,))
|
cur.execute("insert into kv values('sver',?)", (native_ver,))
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
@@ -872,6 +949,12 @@ class SvcHub(object):
|
|||||||
vs = os.path.expandvars(os.path.expanduser(vs))
|
vs = os.path.expandvars(os.path.expanduser(vs))
|
||||||
setattr(al, k, vs)
|
setattr(al, k, vs)
|
||||||
|
|
||||||
|
for k in "idp_adm".split(" "):
|
||||||
|
vs = getattr(al, k)
|
||||||
|
vsa = [x.strip() for x in vs.split(",")]
|
||||||
|
vsa = [x.lower() for x in vsa if x]
|
||||||
|
setattr(al, k + "_set", set(vsa))
|
||||||
|
|
||||||
zs = "dav_ua1 sus_urls nonsus_urls ua_nodoc ua_nozip"
|
zs = "dav_ua1 sus_urls nonsus_urls ua_nodoc ua_nozip"
|
||||||
for k in zs.split(" "):
|
for k in zs.split(" "):
|
||||||
vs = getattr(al, k)
|
vs = getattr(al, k)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ def gen_fdesc(sz: int, crc32: int, z64: bool) -> bytes:
|
|||||||
|
|
||||||
def gen_hdr(
|
def gen_hdr(
|
||||||
h_pos: Optional[int],
|
h_pos: Optional[int],
|
||||||
|
z64: bool,
|
||||||
fn: str,
|
fn: str,
|
||||||
sz: int,
|
sz: int,
|
||||||
lastmod: int,
|
lastmod: int,
|
||||||
@@ -70,7 +71,6 @@ def gen_hdr(
|
|||||||
# appnote 4.5 / zip 3.0 (2008) / unzip 6.0 (2009) says to add z64
|
# appnote 4.5 / zip 3.0 (2008) / unzip 6.0 (2009) says to add z64
|
||||||
# extinfo for values which exceed H, but that becomes an off-by-one
|
# extinfo for values which exceed H, but that becomes an off-by-one
|
||||||
# (can't tell if it was clamped or exactly maxval), make it obvious
|
# (can't tell if it was clamped or exactly maxval), make it obvious
|
||||||
z64 = sz >= 0xFFFFFFFF
|
|
||||||
z64v = [sz, sz] if z64 else []
|
z64v = [sz, sz] if z64 else []
|
||||||
if h_pos and h_pos >= 0xFFFFFFFF:
|
if h_pos and h_pos >= 0xFFFFFFFF:
|
||||||
# central, also consider ptr to original header
|
# central, also consider ptr to original header
|
||||||
@@ -244,6 +244,7 @@ class StreamZip(StreamArc):
|
|||||||
|
|
||||||
sz = st.st_size
|
sz = st.st_size
|
||||||
ts = st.st_mtime
|
ts = st.st_mtime
|
||||||
|
h_pos = self.pos
|
||||||
|
|
||||||
crc = 0
|
crc = 0
|
||||||
if self.pre_crc:
|
if self.pre_crc:
|
||||||
@@ -252,8 +253,12 @@ class StreamZip(StreamArc):
|
|||||||
|
|
||||||
crc &= 0xFFFFFFFF
|
crc &= 0xFFFFFFFF
|
||||||
|
|
||||||
h_pos = self.pos
|
# some unzip-programs expect a 64bit data-descriptor
|
||||||
buf = gen_hdr(None, name, sz, ts, self.utf8, crc, self.pre_crc)
|
# even if the only 32bit-exceeding value is the offset,
|
||||||
|
# so force that by placeholdering the filesize too
|
||||||
|
z64 = h_pos >= 0xFFFFFFFF or sz >= 0xFFFFFFFF
|
||||||
|
|
||||||
|
buf = gen_hdr(None, z64, name, sz, ts, self.utf8, crc, self.pre_crc)
|
||||||
yield self._ct(buf)
|
yield self._ct(buf)
|
||||||
|
|
||||||
for buf in yieldfile(src, self.args.iobuf):
|
for buf in yieldfile(src, self.args.iobuf):
|
||||||
@@ -266,8 +271,6 @@ class StreamZip(StreamArc):
|
|||||||
|
|
||||||
self.items.append((name, sz, ts, crc, h_pos))
|
self.items.append((name, sz, ts, crc, h_pos))
|
||||||
|
|
||||||
z64 = sz >= 4 * 1024 * 1024 * 1024
|
|
||||||
|
|
||||||
if z64 or not self.pre_crc:
|
if z64 or not self.pre_crc:
|
||||||
buf = gen_fdesc(sz, crc, z64)
|
buf = gen_fdesc(sz, crc, z64)
|
||||||
yield self._ct(buf)
|
yield self._ct(buf)
|
||||||
@@ -306,7 +309,8 @@ class StreamZip(StreamArc):
|
|||||||
|
|
||||||
cdir_pos = self.pos
|
cdir_pos = self.pos
|
||||||
for name, sz, ts, crc, h_pos in self.items:
|
for name, sz, ts, crc, h_pos in self.items:
|
||||||
buf = gen_hdr(h_pos, name, sz, ts, self.utf8, crc, self.pre_crc)
|
z64 = h_pos >= 0xFFFFFFFF or sz >= 0xFFFFFFFF
|
||||||
|
buf = gen_hdr(h_pos, z64, name, sz, ts, self.utf8, crc, self.pre_crc)
|
||||||
mbuf += self._ct(buf)
|
mbuf += self._ct(buf)
|
||||||
if len(mbuf) >= 16384:
|
if len(mbuf) >= 16384:
|
||||||
yield mbuf
|
yield mbuf
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ class Tftpd(object):
|
|||||||
if not ptn or not ptn.match(fn.lower()):
|
if not ptn or not ptn.match(fn.lower()):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
tsdt = datetime.fromtimestamp
|
||||||
vn, rem = self.asrv.vfs.get(vpath, "*", True, False)
|
vn, rem = self.asrv.vfs.get(vpath, "*", True, False)
|
||||||
fsroot, vfs_ls, vfs_virt = vn.ls(
|
fsroot, vfs_ls, vfs_virt = vn.ls(
|
||||||
rem,
|
rem,
|
||||||
@@ -296,7 +297,7 @@ class Tftpd(object):
|
|||||||
dirs1 = [(v.st_mtime, v.st_size, k + "/") for k, v in vfs_ls if k in dnames]
|
dirs1 = [(v.st_mtime, v.st_size, k + "/") for k, v in vfs_ls if k in dnames]
|
||||||
fils1 = [(v.st_mtime, v.st_size, k) for k, v in vfs_ls if k not in dnames]
|
fils1 = [(v.st_mtime, v.st_size, k) for k, v in vfs_ls if k not in dnames]
|
||||||
real1 = dirs1 + fils1
|
real1 = dirs1 + fils1
|
||||||
realt = [(datetime.fromtimestamp(mt, UTC), sz, fn) for mt, sz, fn in real1]
|
realt = [(tsdt(max(0, mt), UTC), sz, fn) for mt, sz, fn in real1]
|
||||||
reals = [
|
reals = [
|
||||||
(
|
(
|
||||||
"%04d-%02d-%02d %02d:%02d:%02d"
|
"%04d-%02d-%02d %02d:%02d:%02d"
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ from .util import (
|
|||||||
Cooldown,
|
Cooldown,
|
||||||
Daemon,
|
Daemon,
|
||||||
afsenc,
|
afsenc,
|
||||||
|
atomic_move,
|
||||||
fsenc,
|
fsenc,
|
||||||
min_ex,
|
min_ex,
|
||||||
runcmd,
|
runcmd,
|
||||||
statdir,
|
statdir,
|
||||||
ub64enc,
|
ub64enc,
|
||||||
vsplit,
|
vsplit,
|
||||||
wrename,
|
|
||||||
wunlink,
|
wunlink,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -96,6 +96,10 @@ try:
|
|||||||
if os.environ.get("PRTY_NO_PIL_AVIF"):
|
if os.environ.get("PRTY_NO_PIL_AVIF"):
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
|
if ".avif" in Image.registered_extensions():
|
||||||
|
HAVE_AVIF = True
|
||||||
|
raise Exception()
|
||||||
|
|
||||||
import pillow_avif # noqa: F401 # pylint: disable=unused-import
|
import pillow_avif # noqa: F401 # pylint: disable=unused-import
|
||||||
|
|
||||||
HAVE_AVIF = True
|
HAVE_AVIF = True
|
||||||
@@ -412,7 +416,7 @@ class ThumbSrv(object):
|
|||||||
wunlink(self.log, ap_unpk, vn.flags)
|
wunlink(self.log, ap_unpk, vn.flags)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wrename(self.log, ttpath, tpath, vn.flags)
|
atomic_move(self.log, ttpath, tpath, vn.flags)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if not os.path.exists(tpath):
|
if not os.path.exists(tpath):
|
||||||
t = "failed to move [%s] to [%s]: %r"
|
t = "failed to move [%s] to [%s]: %r"
|
||||||
@@ -677,7 +681,7 @@ class ThumbSrv(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
wrename(self.log, wtpath, tpath, vn.flags)
|
atomic_move(self.log, wtpath, tpath, vn.flags)
|
||||||
|
|
||||||
def conv_spec(self, abspath: str, tpath: str, fmt: str, vn: VFS) -> None:
|
def conv_spec(self, abspath: str, tpath: str, fmt: str, vn: VFS) -> None:
|
||||||
ret, _ = ffprobe(abspath, int(vn.flags["convt"] / 2))
|
ret, _ = ffprobe(abspath, int(vn.flags["convt"] / 2))
|
||||||
|
|||||||
@@ -1119,7 +1119,7 @@ class Up2k(object):
|
|||||||
ft = "\033[0;32m{}{:.0}"
|
ft = "\033[0;32m{}{:.0}"
|
||||||
ff = "\033[0;35m{}{:.0}"
|
ff = "\033[0;35m{}{:.0}"
|
||||||
fv = "\033[0;36m{}:\033[90m{}"
|
fv = "\033[0;36m{}:\033[90m{}"
|
||||||
zs = "ext_th_d html_head mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax zipmaxn_v zipmaxs_v"
|
zs = "ext_th_d html_head put_name2 mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax zipmaxn_v zipmaxs_v"
|
||||||
fx = set(zs.split())
|
fx = set(zs.split())
|
||||||
fd = vf_bmap()
|
fd = vf_bmap()
|
||||||
fd.update(vf_cmap())
|
fd.update(vf_cmap())
|
||||||
@@ -2120,11 +2120,12 @@ class Up2k(object):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
w = bw[:-1].decode("ascii")
|
w = bw[:-1].decode("ascii")
|
||||||
|
w16 = w[:16]
|
||||||
|
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
try:
|
try:
|
||||||
q = "select rd, fn, ip, at from up where substr(w,1,16)=? and +w=?"
|
q = "select rd, fn, ip, at from up where substr(w,1,16)=? and +w=?"
|
||||||
rd, fn, ip, at = cur.execute(q, (w[:16], w)).fetchone()
|
rd, fn, ip, at = cur.execute(q, (w16, w)).fetchone()
|
||||||
except:
|
except:
|
||||||
# file modified/deleted since spooling
|
# file modified/deleted since spooling
|
||||||
continue
|
continue
|
||||||
@@ -2133,8 +2134,12 @@ class Up2k(object):
|
|||||||
rd, fn = s3dec(rd, fn)
|
rd, fn = s3dec(rd, fn)
|
||||||
|
|
||||||
if "mtp" in flags:
|
if "mtp" in flags:
|
||||||
|
q = "select 1 from mt where w=? and +k='t:mtp' limit 1"
|
||||||
|
if cur.execute(q, (w16,)).fetchone():
|
||||||
|
continue
|
||||||
|
|
||||||
q = "insert into mt values (?,'t:mtp','a')"
|
q = "insert into mt values (?,'t:mtp','a')"
|
||||||
cur.execute(q, (w[:16],))
|
cur.execute(q, (w16,))
|
||||||
|
|
||||||
abspath = djoin(ptop, rd, fn)
|
abspath = djoin(ptop, rd, fn)
|
||||||
self.pp.msg = "c%d %s" % (nq, abspath)
|
self.pp.msg = "c%d %s" % (nq, abspath)
|
||||||
@@ -2190,7 +2195,7 @@ class Up2k(object):
|
|||||||
return tf, -1
|
return tf, -1
|
||||||
|
|
||||||
if flt == 1:
|
if flt == 1:
|
||||||
q = "select w from mt where w = ?"
|
q = "select 1 from mt where w=? and +k != 't:mtp'"
|
||||||
if c2.execute(q, (row[0][:16],)).fetchone():
|
if c2.execute(q, (row[0][:16],)).fetchone():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -3231,7 +3236,7 @@ class Up2k(object):
|
|||||||
if hr.get("reloc"):
|
if hr.get("reloc"):
|
||||||
x = pathmod(self.vfs, dst, vp, hr["reloc"])
|
x = pathmod(self.vfs, dst, vp, hr["reloc"])
|
||||||
if x:
|
if x:
|
||||||
zvfs = vfs
|
ud1 = (vfs.vpath, job["prel"], job["name"])
|
||||||
pdir, _, job["name"], (vfs, rem) = x
|
pdir, _, job["name"], (vfs, rem) = x
|
||||||
dst = os.path.join(pdir, job["name"])
|
dst = os.path.join(pdir, job["name"])
|
||||||
job["vcfg"] = vfs.flags
|
job["vcfg"] = vfs.flags
|
||||||
@@ -3239,7 +3244,8 @@ class Up2k(object):
|
|||||||
job["vtop"] = vfs.vpath
|
job["vtop"] = vfs.vpath
|
||||||
job["prel"] = rem
|
job["prel"] = rem
|
||||||
job["name"] = sanitize_fn(job["name"], "")
|
job["name"] = sanitize_fn(job["name"], "")
|
||||||
if zvfs.vpath != vfs.vpath:
|
ud2 = (vfs.vpath, job["prel"], job["name"])
|
||||||
|
if ud1 != ud2:
|
||||||
# print(json.dumps(job, sort_keys=True, indent=4))
|
# print(json.dumps(job, sort_keys=True, indent=4))
|
||||||
job["hash"] = cj["hash"]
|
job["hash"] = cj["hash"]
|
||||||
self.log("xbu reloc1:%d..." % (depth,), 6)
|
self.log("xbu reloc1:%d..." % (depth,), 6)
|
||||||
@@ -4994,14 +5000,15 @@ class Up2k(object):
|
|||||||
if hr.get("reloc"):
|
if hr.get("reloc"):
|
||||||
x = pathmod(self.vfs, ap_chk, vp_chk, hr["reloc"])
|
x = pathmod(self.vfs, ap_chk, vp_chk, hr["reloc"])
|
||||||
if x:
|
if x:
|
||||||
zvfs = vfs
|
ud1 = (vfs.vpath, job["prel"], job["name"])
|
||||||
pdir, _, job["name"], (vfs, rem) = x
|
pdir, _, job["name"], (vfs, rem) = x
|
||||||
job["vcfg"] = vf = vfs.flags
|
job["vcfg"] = vf = vfs.flags
|
||||||
job["ptop"] = vfs.realpath
|
job["ptop"] = vfs.realpath
|
||||||
job["vtop"] = vfs.vpath
|
job["vtop"] = vfs.vpath
|
||||||
job["prel"] = rem
|
job["prel"] = rem
|
||||||
job["name"] = sanitize_fn(job["name"], "")
|
job["name"] = sanitize_fn(job["name"], "")
|
||||||
if zvfs.vpath != vfs.vpath:
|
ud2 = (vfs.vpath, job["prel"], job["name"])
|
||||||
|
if ud1 != ud2:
|
||||||
self.log("xbu reloc2:%d..." % (depth,), 6)
|
self.log("xbu reloc2:%d..." % (depth,), 6)
|
||||||
return self._handle_json(job, depth + 1)
|
return self._handle_json(job, depth + 1)
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ try:
|
|||||||
except:
|
except:
|
||||||
HAVE_PSUTIL = False
|
HAVE_PSUTIL = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
if os.environ.get("PRTY_NO_MAGIC"):
|
||||||
|
raise Exception()
|
||||||
|
|
||||||
|
import magic
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if True: # pylint: disable=using-constant-test
|
if True: # pylint: disable=using-constant-test
|
||||||
import types
|
import types
|
||||||
from collections.abc import Callable, Iterable
|
from collections.abc import Callable, Iterable
|
||||||
@@ -175,8 +183,6 @@ if True: # pylint: disable=using-constant-test
|
|||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import magic
|
|
||||||
|
|
||||||
from .authsrv import VFS
|
from .authsrv import VFS
|
||||||
from .broker_util import BrokerCli
|
from .broker_util import BrokerCli
|
||||||
from .up2k import Up2k
|
from .up2k import Up2k
|
||||||
@@ -472,6 +478,8 @@ FN_EMB = set([".prologue.html", ".epilogue.html", "readme.md", "preadme.md"])
|
|||||||
|
|
||||||
|
|
||||||
def read_ram() -> tuple[float, float]:
|
def read_ram() -> tuple[float, float]:
|
||||||
|
# NOTE: apparently no need to consider /sys/fs/cgroup/memory.max
|
||||||
|
# (cgroups2) since the limit is synced to /proc/meminfo
|
||||||
a = b = 0
|
a = b = 0
|
||||||
try:
|
try:
|
||||||
with open("/proc/meminfo", "rb", 0x10000) as f:
|
with open("/proc/meminfo", "rb", 0x10000) as f:
|
||||||
@@ -1254,8 +1262,6 @@ class Magician(object):
|
|||||||
self.magic: Optional["magic.Magic"] = None
|
self.magic: Optional["magic.Magic"] = None
|
||||||
|
|
||||||
def ext(self, fpath: str) -> str:
|
def ext(self, fpath: str) -> str:
|
||||||
import magic
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.bad_magic:
|
if self.bad_magic:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
@@ -2581,6 +2587,11 @@ def _fs_mvrm(
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
if ex.errno == errno.ENOENT:
|
if ex.errno == errno.ENOENT:
|
||||||
return False
|
return False
|
||||||
|
if not attempt and ex.errno == errno.EXDEV:
|
||||||
|
t = "using copy+delete (%s)\n %s\n %s"
|
||||||
|
log(t % (ex.strerror, src, dst))
|
||||||
|
osfun = shutil.move
|
||||||
|
continue
|
||||||
if now - t0 > maxtime or attempt == 90209:
|
if now - t0 > maxtime or attempt == 90209:
|
||||||
raise
|
raise
|
||||||
if not attempt:
|
if not attempt:
|
||||||
@@ -2605,15 +2616,18 @@ def atomic_move(log: "NamedLogger", src: str, dst: str, flags: dict[str, Any]) -
|
|||||||
elif flags.get("mv_re_t"):
|
elif flags.get("mv_re_t"):
|
||||||
_fs_mvrm(log, src, dst, True, flags)
|
_fs_mvrm(log, src, dst, True, flags)
|
||||||
else:
|
else:
|
||||||
os.replace(bsrc, bdst)
|
try:
|
||||||
|
os.replace(bsrc, bdst)
|
||||||
|
except OSError as ex:
|
||||||
def wrename(log: "NamedLogger", src: str, dst: str, flags: dict[str, Any]) -> bool:
|
if ex.errno != errno.EXDEV:
|
||||||
if not flags.get("mv_re_t"):
|
raise
|
||||||
os.rename(fsenc(src), fsenc(dst))
|
t = "using copy+delete (%s);\n %s\n %s"
|
||||||
return True
|
log(t % (ex.strerror, src, dst))
|
||||||
|
try:
|
||||||
return _fs_mvrm(log, src, dst, False, flags)
|
os.unlink(bdst)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
shutil.move(bsrc, bdst)
|
||||||
|
|
||||||
|
|
||||||
def wunlink(log: "NamedLogger", abspath: str, flags: dict[str, Any]) -> bool:
|
def wunlink(log: "NamedLogger", abspath: str, flags: dict[str, Any]) -> bool:
|
||||||
@@ -3142,11 +3156,13 @@ def unescape_cookie(orig: str) -> str:
|
|||||||
return "".join(ret)
|
return "".join(ret)
|
||||||
|
|
||||||
|
|
||||||
def guess_mime(url: str, fallback: str = "application/octet-stream") -> str:
|
def guess_mime(
|
||||||
|
url: str, path: str = "", fallback: str = "application/octet-stream"
|
||||||
|
) -> str:
|
||||||
try:
|
try:
|
||||||
ext = url.rsplit(".", 1)[1].lower()
|
ext = url.rsplit(".", 1)[1].lower()
|
||||||
except:
|
except:
|
||||||
return fallback
|
ext = ""
|
||||||
|
|
||||||
ret = MIMES.get(ext)
|
ret = MIMES.get(ext)
|
||||||
|
|
||||||
@@ -3154,6 +3170,16 @@ def guess_mime(url: str, fallback: str = "application/octet-stream") -> str:
|
|||||||
x = mimetypes.guess_type(url)
|
x = mimetypes.guess_type(url)
|
||||||
ret = "application/{}".format(x[1]) if x[1] else x[0]
|
ret = "application/{}".format(x[1]) if x[1] else x[0]
|
||||||
|
|
||||||
|
if not ret and path:
|
||||||
|
try:
|
||||||
|
with open(fsenc(path), "rb", 0) as f:
|
||||||
|
ret = magic.from_buffer(f.read(4096), mime=True)
|
||||||
|
if ret.startswith("text/htm"):
|
||||||
|
# avoid serving up HTML content unless there was actually a .html extension
|
||||||
|
ret = "text/plain"
|
||||||
|
except Exception as ex:
|
||||||
|
pass
|
||||||
|
|
||||||
if not ret:
|
if not ret:
|
||||||
ret = fallback
|
ret = fallback
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
--grid-sz: 10em;
|
--grid-sz: 10em;
|
||||||
--grid-ln: 3;
|
--grid-ln: 3;
|
||||||
--nav-sz: 16em;
|
--nav-sz: 16em;
|
||||||
|
--sbw: 0.5em;
|
||||||
|
--sbh: 0.5em;
|
||||||
|
|
||||||
--fg: #ccc;
|
--fg: #ccc;
|
||||||
--fg-max: #fff;
|
--fg-max: #fff;
|
||||||
@@ -1151,17 +1153,17 @@ html.y #widget.open {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
background: var(--bg-u3);
|
background: var(--bg-u3);
|
||||||
}
|
}
|
||||||
#wfs, #wfm, #wzip, #wnp {
|
#wfs, #wfm, #wzip, #wnp, #wm3u {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#wfs, #wzip, #wnp {
|
#wfs, #wzip, #wnp, #wm3u {
|
||||||
margin-right: .2em;
|
margin-right: .2em;
|
||||||
padding-right: .2em;
|
padding-right: .2em;
|
||||||
border: 1px solid var(--bg-u5);
|
border: 1px solid var(--bg-u5);
|
||||||
border-width: 0 .1em 0 0;
|
border-width: 0 .1em 0 0;
|
||||||
}
|
}
|
||||||
#wfm.act+#wzip,
|
#wfm.act+#wzip1+#wzip,
|
||||||
#wfm.act+#wzip+#wnp {
|
#wfm.act+#wzip1+#wzip+#wnp {
|
||||||
margin-left: .2em;
|
margin-left: .2em;
|
||||||
padding-left: .2em;
|
padding-left: .2em;
|
||||||
border-left-width: .1em;
|
border-left-width: .1em;
|
||||||
@@ -1175,14 +1177,18 @@ html.y #widget.open {
|
|||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
}
|
}
|
||||||
#wtoggle.sel #wzip,
|
#wtoggle.sel #wzip,
|
||||||
|
#wtoggle.m3u #wm3u,
|
||||||
#wtoggle.np #wnp {
|
#wtoggle.np #wnp {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
#wtoggle.sel #wzip1,
|
||||||
#wtoggle.sel.np #wnp {
|
#wtoggle.sel.np #wnp {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#wfm a,
|
#wfm a,
|
||||||
#wnp a,
|
#wnp a,
|
||||||
|
#wm3u a,
|
||||||
|
#zip1,
|
||||||
#wzip a {
|
#wzip a {
|
||||||
font-size: .5em;
|
font-size: .5em;
|
||||||
padding: 0 .3em;
|
padding: 0 .3em;
|
||||||
@@ -1190,6 +1196,13 @@ html.y #widget.open {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
#zip1 {
|
||||||
|
font-size: .38em;
|
||||||
|
}
|
||||||
|
#wm3u a {
|
||||||
|
margin: -.2em .1em;
|
||||||
|
font-size: .45em;
|
||||||
|
}
|
||||||
#wfs {
|
#wfs {
|
||||||
font-size: .36em;
|
font-size: .36em;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -1198,13 +1211,22 @@ html.y #widget.open {
|
|||||||
border-width: 0 .25em 0 0;
|
border-width: 0 .25em 0 0;
|
||||||
}
|
}
|
||||||
#wfm span,
|
#wfm span,
|
||||||
|
#wm3u span,
|
||||||
|
#zip1 span,
|
||||||
#wnp span {
|
#wnp span {
|
||||||
font-size: .6em;
|
font-size: .6em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
#zip1 span {
|
||||||
|
font-size: .9em;
|
||||||
|
}
|
||||||
#wnp span {
|
#wnp span {
|
||||||
font-size: .7em;
|
font-size: .7em;
|
||||||
}
|
}
|
||||||
|
#wm3u span {
|
||||||
|
font-size: .77em;
|
||||||
|
padding-top: .2em;
|
||||||
|
}
|
||||||
#wfm a:not(.en) {
|
#wfm a:not(.en) {
|
||||||
opacity: .3;
|
opacity: .3;
|
||||||
color: var(--fm-off);
|
color: var(--fm-off);
|
||||||
@@ -1538,8 +1560,8 @@ html {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
background: var(--tree-bg);
|
background: var(--tree-bg);
|
||||||
left: -.98em;
|
left: -.96em;
|
||||||
width: calc(var(--nav-sz) - 0.5em);
|
width: calc(.3em + var(--nav-sz) - var(--sbw));
|
||||||
border-bottom: 1px solid var(--bg-u5);
|
border-bottom: 1px solid var(--bg-u5);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -1805,10 +1827,11 @@ html.y #tree.nowrap .ntree a+a:hover {
|
|||||||
line-height: 2.3em;
|
line-height: 2.3em;
|
||||||
margin-bottom: 1.5em;
|
margin-bottom: 1.5em;
|
||||||
}
|
}
|
||||||
|
#hdoc,
|
||||||
#ghead {
|
#ghead {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: -.3em;
|
top: -.3em;
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.ghead .btn {
|
.ghead .btn {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -1818,6 +1841,13 @@ html.y #tree.nowrap .ntree a+a:hover {
|
|||||||
white-space: pre;
|
white-space: pre;
|
||||||
padding-left: .3em;
|
padding-left: .3em;
|
||||||
}
|
}
|
||||||
|
#tailbtns {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#taildoc.on+#tailbtns {
|
||||||
|
display: inherit;
|
||||||
|
display: unset;
|
||||||
|
}
|
||||||
#op_unpost {
|
#op_unpost {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
@@ -1914,6 +1944,9 @@ html.y #tree.nowrap .ntree a+a:hover {
|
|||||||
padding: 1em 0 1em 0;
|
padding: 1em 0 1em 0;
|
||||||
border-radius: .3em;
|
border-radius: .3em;
|
||||||
}
|
}
|
||||||
|
#doc.wrap {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
html.y #doc {
|
html.y #doc {
|
||||||
box-shadow: 0 0 .3em var(--bg-u5);
|
box-shadow: 0 0 .3em var(--bg-u5);
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
@@ -3035,7 +3068,8 @@ html.b .ntree a {
|
|||||||
padding: .6em .2em;
|
padding: .6em .2em;
|
||||||
}
|
}
|
||||||
html.b #treepar {
|
html.b #treepar {
|
||||||
margin-left: .62em;
|
margin-left: .63em;
|
||||||
|
width: calc(.1em + var(--nav-sz) - var(--sbw));
|
||||||
border-bottom: .2em solid var(--f-h-b1);
|
border-bottom: .2em solid var(--f-h-b1);
|
||||||
}
|
}
|
||||||
html.b #wrap {
|
html.b #wrap {
|
||||||
@@ -3207,7 +3241,7 @@ html.d #treepar {
|
|||||||
|
|
||||||
#ggrid>a>span {
|
#ggrid>a>span {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 0.2em;
|
padding: .2em .2em .15em .2em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
55
copyparty/web/idp.html
Normal file
55
copyparty/web/idp.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{{ s_doctitle }}</title>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=0.8">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
<meta name="theme-color" content="#{{ tcolor }}">
|
||||||
|
<link rel="stylesheet" media="screen" href="{{ r }}/.cpr/shares.css?_={{ ts }}">
|
||||||
|
<link rel="stylesheet" media="screen" href="{{ r }}/.cpr/ui.css?_={{ ts }}">
|
||||||
|
{{ html_head }}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="wrap">
|
||||||
|
<a href="{{ r }}/?idp">refresh</a>
|
||||||
|
<a href="{{ r }}/?h">control-panel</a>
|
||||||
|
|
||||||
|
<table id="tab"><thead><tr>
|
||||||
|
<th>forget</th>
|
||||||
|
<th>user</th>
|
||||||
|
<th>groups</th>
|
||||||
|
</tr></thead><tbody>
|
||||||
|
{% for un, gn in rows %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{ r }}/?idp=rm={{ un|e }}">forget</a></td>
|
||||||
|
<td>{{ un|e }}</td>
|
||||||
|
<td>{{ gn|e }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody></table>
|
||||||
|
{% if not rows %}
|
||||||
|
(there are no IdP users in the cache)
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<a href="#" id="repl">π</a>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var SR="{{ r }}",
|
||||||
|
lang="{{ lang }}",
|
||||||
|
dfavico="{{ favico }}";
|
||||||
|
|
||||||
|
var STG = window.localStorage;
|
||||||
|
document.documentElement.className = (STG && STG.cpp_thm) || "{{ this.args.theme }}";
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script src="{{ r }}/.cpr/util.js?_={{ ts }}"></script>
|
||||||
|
{%- if js %}
|
||||||
|
<script src="{{ js }}_={{ ts }}"></script>
|
||||||
|
{%- endif %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -135,6 +135,10 @@
|
|||||||
|
|
||||||
<h1 id="cc">other stuff:</h1>
|
<h1 id="cc">other stuff:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
|
{%- if this.uname in this.args.idp_adm_set %}
|
||||||
|
<li><a id="ag" href="{{ r }}/?idp">view idp cache</a></li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if this.uname != '*' and this.args.shr %}
|
{%- if this.uname != '*' and this.args.shr %}
|
||||||
<li><a id="y" href="{{ r }}/?shares">edit shares</a></li>
|
<li><a id="y" href="{{ r }}/?shares">edit shares</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ var Ls = {
|
|||||||
"ad1": "no304 stopper all bruk av cache. Hvis ikke k304 var nok, prøv denne. Vil mangedoble dataforbruk!",
|
"ad1": "no304 stopper all bruk av cache. Hvis ikke k304 var nok, prøv denne. Vil mangedoble dataforbruk!",
|
||||||
"ae1": "utgående:",
|
"ae1": "utgående:",
|
||||||
"af1": "vis nylig opplastede filer",
|
"af1": "vis nylig opplastede filer",
|
||||||
|
"ag1": "vis kjente IdP-brukere",
|
||||||
},
|
},
|
||||||
"eng": {
|
"eng": {
|
||||||
"d2": "shows the state of all active threads",
|
"d2": "shows the state of all active threads",
|
||||||
@@ -90,6 +91,7 @@ var Ls = {
|
|||||||
"ad1": "启用 no304 将禁用所有缓存;如果 k304 不够,可以尝试此选项。这将消耗大量的网络流量!", //m
|
"ad1": "启用 no304 将禁用所有缓存;如果 k304 不够,可以尝试此选项。这将消耗大量的网络流量!", //m
|
||||||
"ae1": "正在下载:", //m
|
"ae1": "正在下载:", //m
|
||||||
"af1": "显示最近上传的文件", //m
|
"af1": "显示最近上传的文件", //m
|
||||||
|
"ag1": "查看已知 IdP 用户", //m
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
gio mount -a dav{{ s }}://{{ ep }}/{{ rvp }}
|
gio mount -a dav{{ s }}://{{ ep }}/{{ rvp }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>on KDE Dolphin, use <code>webdav{{ s }}://{{ ep }}/{{ rvp }}</code></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="os mac">
|
<div class="os mac">
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var x = sread('nosubtle');
|
||||||
|
if (x === '0' || x === '1')
|
||||||
|
nosubtle = parseInt(x);
|
||||||
|
if ((nosubtle > 1 && !CHROME && !FIREFOX) ||
|
||||||
|
(nosubtle > 2 && !CHROME) ||
|
||||||
|
(CHROME && nosubtle > VCHROME) ||
|
||||||
|
!WebAssembly)
|
||||||
|
nosubtle = 0;
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
function goto_up2k() {
|
function goto_up2k() {
|
||||||
if (up2k === false)
|
if (up2k === false)
|
||||||
return goto('bup');
|
return goto('bup');
|
||||||
@@ -23,7 +35,7 @@ var up2k = null,
|
|||||||
m = 'will use ' + sha_js + ' instead of native sha512 due to';
|
m = 'will use ' + sha_js + ' instead of native sha512 due to';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (sread('nosubtle') || window.nosubtle)
|
if (nosubtle)
|
||||||
throw 'chickenbit';
|
throw 'chickenbit';
|
||||||
var cf = crypto.subtle || crypto.webkitSubtle;
|
var cf = crypto.subtle || crypto.webkitSubtle;
|
||||||
cf.digest('SHA-512', new Uint8Array(1)).then(
|
cf.digest('SHA-512', new Uint8Array(1)).then(
|
||||||
@@ -825,7 +837,7 @@ function up2k_init(subtle) {
|
|||||||
}
|
}
|
||||||
qsr('#u2depmsg');
|
qsr('#u2depmsg');
|
||||||
var o = mknod('div', 'u2depmsg');
|
var o = mknod('div', 'u2depmsg');
|
||||||
o.innerHTML = m;
|
o.innerHTML = nosubtle ? '' : m;
|
||||||
ebi('u2foot').appendChild(o);
|
ebi('u2foot').appendChild(o);
|
||||||
}
|
}
|
||||||
loading_deps = true;
|
loading_deps = true;
|
||||||
@@ -881,7 +893,8 @@ function up2k_init(subtle) {
|
|||||||
bcfg_bind(uc, 'turbo', 'u2turbo', turbolvl > 1, draw_turbo);
|
bcfg_bind(uc, 'turbo', 'u2turbo', turbolvl > 1, draw_turbo);
|
||||||
bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null);
|
bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null);
|
||||||
bcfg_bind(uc, 'az', 'u2sort', u2sort.indexOf('n') + 1, set_u2sort);
|
bcfg_bind(uc, 'az', 'u2sort', u2sort.indexOf('n') + 1, set_u2sort);
|
||||||
bcfg_bind(uc, 'hashw', 'hashw', !!WebAssembly && !(CHROME && MOBILE) && (!subtle || !CHROME), set_hashw);
|
bcfg_bind(uc, 'hashw', 'hashw', !!WebAssembly && !(CHROME && MOBILE) && (!subtle || !CHROME || VCHROME > 136), set_hashw);
|
||||||
|
bcfg_bind(uc, 'hwasm', 'nosubtle', nosubtle, set_nosubtle);
|
||||||
bcfg_bind(uc, 'upnag', 'upnag', false, set_upnag);
|
bcfg_bind(uc, 'upnag', 'upnag', false, set_upnag);
|
||||||
bcfg_bind(uc, 'upsfx', 'upsfx', false, set_upsfx);
|
bcfg_bind(uc, 'upsfx', 'upsfx', false, set_upsfx);
|
||||||
|
|
||||||
@@ -1442,9 +1455,16 @@ function up2k_init(subtle) {
|
|||||||
if (CHROME) {
|
if (CHROME) {
|
||||||
// chrome-bug 383568268 // #124
|
// chrome-bug 383568268 // #124
|
||||||
nw = Math.max(1, (nw > 4 ? 4 : (nw - 1)));
|
nw = Math.max(1, (nw > 4 ? 4 : (nw - 1)));
|
||||||
|
if (VCHROME < 137)
|
||||||
nw = (subtle && !MOBILE && nw > 2) ? 2 : nw;
|
nw = (subtle && !MOBILE && nw > 2) ? 2 : nw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var x = sread('u2hashers') || window.u2hashers;
|
||||||
|
if (x) {
|
||||||
|
console.log('u2hashers is overriding default-value ' + nw);
|
||||||
|
nw = parseInt(x);
|
||||||
|
}
|
||||||
|
|
||||||
for (var a = 0; a < nw; a++)
|
for (var a = 0; a < nw; a++)
|
||||||
hws.push(new Worker(SR + '/.cpr/w.hash.js?_=' + TS));
|
hws.push(new Worker(SR + '/.cpr/w.hash.js?_=' + TS));
|
||||||
|
|
||||||
@@ -2213,6 +2233,7 @@ function up2k_init(subtle) {
|
|||||||
reading = 0,
|
reading = 0,
|
||||||
max_readers = 1,
|
max_readers = 1,
|
||||||
opt_readers = 2,
|
opt_readers = 2,
|
||||||
|
failed = false,
|
||||||
free = [],
|
free = [],
|
||||||
busy = {},
|
busy = {},
|
||||||
nbusy = 0,
|
nbusy = 0,
|
||||||
@@ -2262,6 +2283,14 @@ function up2k_init(subtle) {
|
|||||||
tasker();
|
tasker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function go_fail() {
|
||||||
|
failed = true;
|
||||||
|
if (nbusy)
|
||||||
|
return;
|
||||||
|
apop(st.busy.hash, t);
|
||||||
|
st.bytes.finished += t.size;
|
||||||
|
}
|
||||||
|
|
||||||
function onmsg(d) {
|
function onmsg(d) {
|
||||||
d = d.data;
|
d = d.data;
|
||||||
var k = d[0];
|
var k = d[0];
|
||||||
@@ -2276,6 +2305,12 @@ function up2k_init(subtle) {
|
|||||||
return vis_exh(d[1], 'up2k.js', '', '', d[1]);
|
return vis_exh(d[1], 'up2k.js', '', '', d[1]);
|
||||||
|
|
||||||
if (k == "fail") {
|
if (k == "fail") {
|
||||||
|
var nchunk = d[1];
|
||||||
|
free.push(busy[nchunk]);
|
||||||
|
delete busy[nchunk];
|
||||||
|
nbusy--;
|
||||||
|
reading--;
|
||||||
|
|
||||||
pvis.seth(t.n, 1, d[1]);
|
pvis.seth(t.n, 1, d[1]);
|
||||||
pvis.seth(t.n, 2, d[2]);
|
pvis.seth(t.n, 2, d[2]);
|
||||||
console.log(d[1], d[2]);
|
console.log(d[1], d[2]);
|
||||||
@@ -2283,9 +2318,7 @@ function up2k_init(subtle) {
|
|||||||
got_oserr();
|
got_oserr();
|
||||||
|
|
||||||
pvis.move(t.n, 'ng');
|
pvis.move(t.n, 'ng');
|
||||||
apop(st.busy.hash, t);
|
return go_fail();
|
||||||
st.bytes.finished += t.size;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k == "ferr")
|
if (k == "ferr")
|
||||||
@@ -2318,6 +2351,9 @@ function up2k_init(subtle) {
|
|||||||
t.hash.push(nchunk);
|
t.hash.push(nchunk);
|
||||||
pvis.hashed(t);
|
pvis.hashed(t);
|
||||||
|
|
||||||
|
if (failed)
|
||||||
|
return go_fail();
|
||||||
|
|
||||||
if (t.hash.length < nchunks)
|
if (t.hash.length < nchunks)
|
||||||
return nbusy < opt_readers && go_next();
|
return nbusy < opt_readers && go_next();
|
||||||
|
|
||||||
@@ -2395,8 +2431,8 @@ function up2k_init(subtle) {
|
|||||||
try { orz(e); } catch (ex) { vis_exh(ex + '', 'up2k.js', '', '', ex); }
|
try { orz(e); } catch (ex) { vis_exh(ex + '', 'up2k.js', '', '', ex); }
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.timeout = 34000;
|
|
||||||
xhr.open('HEAD', t.purl + uricom_enc(t.name), true);
|
xhr.open('HEAD', t.purl + uricom_enc(t.name), true);
|
||||||
|
xhr.timeout = 34000;
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2875,7 +2911,8 @@ function up2k_init(subtle) {
|
|||||||
|
|
||||||
st.bytes.inflight += db;
|
st.bytes.inflight += db;
|
||||||
xhr.bsent = nb;
|
xhr.bsent = nb;
|
||||||
xhr.timeout = 64000 + Date.now() - xhr.t0;
|
if (!IE)
|
||||||
|
xhr.timeout = 64000 + Date.now() - xhr.t0;
|
||||||
pvis.prog(t, pcar, nb);
|
pvis.prog(t, pcar, nb);
|
||||||
};
|
};
|
||||||
xhr.onload = function (xev) {
|
xhr.onload = function (xev) {
|
||||||
@@ -2923,7 +2960,7 @@ function up2k_init(subtle) {
|
|||||||
|
|
||||||
xhr.bsent = 0;
|
xhr.bsent = 0;
|
||||||
xhr.t0 = Date.now();
|
xhr.t0 = Date.now();
|
||||||
xhr.timeout = 42000;
|
xhr.timeout = 1000 * (IE ? 1234 : 42);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
xhr.send(t.fobj.slice(car, cdr));
|
xhr.send(t.fobj.slice(car, cdr));
|
||||||
}
|
}
|
||||||
@@ -3269,6 +3306,12 @@ function up2k_init(subtle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_nosubtle(v) {
|
||||||
|
if (!WebAssembly)
|
||||||
|
return toast.err(10, L.u_nowork);
|
||||||
|
modal.confirm(L.lang_set, location.reload.bind(location), null);
|
||||||
|
}
|
||||||
|
|
||||||
function set_upnag(en) {
|
function set_upnag(en) {
|
||||||
function nopenag() {
|
function nopenag() {
|
||||||
bcfg_set('upnag', uc.upnag = false);
|
bcfg_set('upnag', uc.upnag = false);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ var wah = '',
|
|||||||
CHROME = !!window.chrome, // safari=false
|
CHROME = !!window.chrome, // safari=false
|
||||||
VCHROME = CHROME ? 1 : 0,
|
VCHROME = CHROME ? 1 : 0,
|
||||||
UA = '' + navigator.userAgent,
|
UA = '' + navigator.userAgent,
|
||||||
IE = /Trident\//.test(UA),
|
IE = !!document.documentMode,
|
||||||
FIREFOX = ('netscape' in window) && / rv:/.test(UA),
|
FIREFOX = ('netscape' in window) && / rv:/.test(UA),
|
||||||
IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(UA),
|
IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(UA),
|
||||||
LINUX = /Linux/.test(UA),
|
LINUX = /Linux/.test(UA),
|
||||||
@@ -69,7 +69,7 @@ try {
|
|||||||
|
|
||||||
CHROME = navigator.userAgentData.brands.find(function (d) { return d.brand == 'Chromium' });
|
CHROME = navigator.userAgentData.brands.find(function (d) { return d.brand == 'Chromium' });
|
||||||
if (CHROME)
|
if (CHROME)
|
||||||
VCHROME = CHROME.version;
|
VCHROME = parseInt(CHROME.version);
|
||||||
else
|
else
|
||||||
VCHROME = 0;
|
VCHROME = 0;
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ function vis_exh(msg, url, lineNo, columnNo, error) {
|
|||||||
if (url.indexOf(' > eval') + 1 && !evalex_fatal)
|
if (url.indexOf(' > eval') + 1 && !evalex_fatal)
|
||||||
return; // md timer
|
return; // md timer
|
||||||
|
|
||||||
if (IE && url.indexOf('prism.js') + 1)
|
if (url.indexOf('prism.js') + 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (url.indexOf('easymde.js') + 1)
|
if (url.indexOf('easymde.js') + 1)
|
||||||
@@ -364,7 +364,8 @@ if (!Element.prototype.matches)
|
|||||||
Element.prototype.mozMatchesSelector ||
|
Element.prototype.mozMatchesSelector ||
|
||||||
Element.prototype.webkitMatchesSelector;
|
Element.prototype.webkitMatchesSelector;
|
||||||
|
|
||||||
if (!Element.prototype.closest)
|
var CLOSEST = !!Element.prototype.closest;
|
||||||
|
if (!CLOSEST)
|
||||||
Element.prototype.closest = function (s) {
|
Element.prototype.closest = function (s) {
|
||||||
var el = this;
|
var el = this;
|
||||||
do {
|
do {
|
||||||
@@ -1228,7 +1229,7 @@ function dl_file(url) {
|
|||||||
function cliptxt(txt, ok) {
|
function cliptxt(txt, ok) {
|
||||||
var fb = function () {
|
var fb = function () {
|
||||||
console.log('clip-fb');
|
console.log('clip-fb');
|
||||||
var o = mknod('input');
|
var o = mknod('textarea');
|
||||||
o.value = txt;
|
o.value = txt;
|
||||||
document.body.appendChild(o);
|
document.body.appendChild(o);
|
||||||
o.focus();
|
o.focus();
|
||||||
@@ -1238,6 +1239,8 @@ function cliptxt(txt, ok) {
|
|||||||
ok();
|
ok();
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
if (!window.isSecureContext)
|
||||||
|
throw 1;
|
||||||
navigator.clipboard.writeText(txt).then(ok, fb);
|
navigator.clipboard.writeText(txt).then(ok, fb);
|
||||||
}
|
}
|
||||||
catch (ex) { fb(); }
|
catch (ex) { fb(); }
|
||||||
|
|||||||
@@ -4,6 +4,16 @@
|
|||||||
function hex2u8(txt) {
|
function hex2u8(txt) {
|
||||||
return new Uint8Array(txt.match(/.{2}/g).map(function (b) { return parseInt(b, 16); }));
|
return new Uint8Array(txt.match(/.{2}/g).map(function (b) { return parseInt(b, 16); }));
|
||||||
}
|
}
|
||||||
|
function esc(txt) {
|
||||||
|
return txt.replace(/[&"<>]/g, function (c) {
|
||||||
|
return {
|
||||||
|
'&': '&',
|
||||||
|
'"': '"',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>'
|
||||||
|
}[c];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var subtle = null;
|
var subtle = null;
|
||||||
@@ -19,6 +29,8 @@ catch (ex) {
|
|||||||
}
|
}
|
||||||
function load_fb() {
|
function load_fb() {
|
||||||
subtle = null;
|
subtle = null;
|
||||||
|
if (self.hashwasm)
|
||||||
|
return;
|
||||||
importScripts('deps/sha512.hw.js');
|
importScripts('deps/sha512.hw.js');
|
||||||
console.log('using fallback hasher');
|
console.log('using fallback hasher');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,175 @@
|
|||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0622-0020 `v1.18.0` Logtail
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* textfile-viewer can now livestream logfiles (and other growing files) 17fa4906 77df17d1 a1c7a095 6ecf4fdc
|
||||||
|
* see [readme](https://github.com/9001/copyparty/#textfile-viewer) and the [live demo](https://a.ocv.me/pub/demo/logtail/)
|
||||||
|
* IdP-volumes: extend syntax for excluding certain users/groups 2e53f797
|
||||||
|
* the commit-message explains it well enough
|
||||||
|
* new option `--see-dots` to show dotfiles in the web-ui by default c599e2aa
|
||||||
|
* #171 automatic mimetype detection for files without extensions (thx @Morganamilo!) ec05f8cc 9dd5dec0
|
||||||
|
* default-disabled since it has a performance impact on webdav
|
||||||
|
* there are plans to fix this by using the db instead
|
||||||
|
* #170 improve custom filetype icons
|
||||||
|
* be less strict; if a thumbnail is set for `.gz` files, use it for `.tar.gz` too c75b0c25
|
||||||
|
* improve config docs fa5845ff
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* cosmetic: get rid of some noise along the bottom of some cards in the gridview 8cae7a71
|
||||||
|
* cosmetic: satisfy a new syntax warning in cpython-3.14 5ac38648
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* properly document how to [build from source](https://github.com/9001/copyparty/blob/hovudstraum/docs/devnotes.md#build-from-scratch) / build from scratch f61511d8
|
||||||
|
* update deps
|
||||||
|
* copyparty.exe: python 3.13 1eff87c3
|
||||||
|
* webdeps: dompurify 7eca90cc
|
||||||
|
|
||||||
|
## 🌠 fun facts
|
||||||
|
|
||||||
|
* this release was cooked up in a [swedish forest cabin](https://a.ocv.me/pub/g/nerd-stuff/forestparty.jpg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0527-1939 `v1.17.2` pushing chrome to the limits (and then some)
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* not this time
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* up2k: improve file-hashing speed on recent versions of google chrome e3e51fb8
|
||||||
|
* speed increased from 319 to 513 MiB/s by default (but older chrome versions did 748...)
|
||||||
|
* read the commit message for the full story, but basically chrome has gotten gradually slower over the past couple versions (starting from v133) and this makes it slightly less bad again
|
||||||
|
* hashing speed can be further improved from `0.5` to `1.1` GiB/s by enabling the `[wasm]` option in the `[⚙️] settings` tab
|
||||||
|
* this option can be made default-enabled with `--nosubtle 137` but beware that this increases the chances of running into browser-bugs (foreshadowing...)
|
||||||
|
* up2k: fix errorhandler for browser-bugs (oom and such) 49c71247
|
||||||
|
* because [chrome-bug 383568268](https://issues.chromium.org/issues/383568268) is about to make a [surprise return?!](https://issues.chromium.org/issues/383568268#comment14)
|
||||||
|
* #168 fix uploading into shares if path-based proxying is used 9cb93ae1
|
||||||
|
* #165 unconditionally heed `--rp-loc` 84f5f417
|
||||||
|
* the config-option for [path-based proxying](https://github.com/9001/copyparty/#reverse-proxy) was ignored if the reverse-proxy was untrusted; this was confusing and not strictly necessary
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* #166 the nixos module was improved once more (thx @msfjarvis!) 48470f6b 60fb1207
|
||||||
|
* added usage instructions to [minimal-up2k.js](https://github.com/9001/copyparty/tree/hovudstraum/contrib/plugins#example-browser-js), the up2k-ui [simplifier](https://user-images.githubusercontent.com/241032/118311195-dd6ca380-b4ef-11eb-86f3-75a3ff2e1332.png) 1d308eeb
|
||||||
|
* docker: improve feedback if config is bad or missing 28b63e58
|
||||||
|
|
||||||
|
## 🌠 fun facts
|
||||||
|
|
||||||
|
* this release was tested using an [unreliable rdp connection](https://a.ocv.me/pub/g/nerd-stuff/PXL_20250526_021207825.jpg) through two ssh-jumphosts to a qemu win10 vm back home from the bergen-oslo night train wifi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0518-2234 `v1.17.1` as seen on archlinux
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* new toolbar button to zip/tar the currently open folder 256dad8c
|
||||||
|
* new options to specify the default checksum algorithm for PUT/bup/WebDAV uploads 0de09860
|
||||||
|
* #164 new option `--put-name` to specify the filename of nameless uploads 5dcd88a6
|
||||||
|
* the default is still `put-TIMESTAMP-IPADDRESS.bin`
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* #162 password-protected shares was incompatible with password-hashing c3ef3fdc
|
||||||
|
* #161 m3u playlist creation was only possible over https 94352f27
|
||||||
|
* when relocating/redirecting an upload from an xbu hook (execute-before-upload), could miss an already existing file at the destination and create another copy 0a9a8077
|
||||||
|
* some edgecases when moving files between filesystems f425ff51
|
||||||
|
* improve tagscan-resume after a server restart (primarily for dupes) 41fa6b25
|
||||||
|
* support prehistoric timestamps in fat16 vhd-drives on windows 261236e3
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* #159 the nixos module was improved (thx @gabevenberg and @chinponya!) d1bca1f5
|
||||||
|
* an archlinux maintainer adopted the aur package; copyparty is now [officially in arch](https://archlinux.org/packages/extra/any/copyparty/) b9ba783c
|
||||||
|
* #162 add KDE Dolphin instructions to the conect-page d4a8071d
|
||||||
|
* audioplayer now knows that `.oga` means `.ogg`
|
||||||
|
|
||||||
|
## 🌠 fun facts
|
||||||
|
|
||||||
|
* this release contains code [pair-programmed during an anime rave](https://a.ocv.me/pub/g/nerd-stuff/PXL_20250503_222654610.jpg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0426-2149 `v1.17.0` mixtape.m3u
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* [m3u playlists](https://github.com/9001/copyparty/#playlists) 897f9d32 ad200f2b 4195762d fff45552
|
||||||
|
* create and play m3u / m3u8 files
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* improve support for ie11 (yes, internet explorer 11) 3090c748 95157d02
|
||||||
|
* now possible to launch the password-hasher cli while another instance is running dbfc899d
|
||||||
|
* in preparation of #157 / #159
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* make better decisions when running in a VM with less than 1 GiB RAM dc3b7a27
|
||||||
|
|
||||||
|
## 🌠 fun facts
|
||||||
|
|
||||||
|
* this release contains code written [less than 1masl](https://a.ocv.me/pub/g/nerd-stuff/PXL_20250425_170037812.jpg) and was gonna be named [hash again](https://www.youtube.com/watch?v=twUFbqyul_M) since it was originally just the password-hasher fix, but then kipun suggested adding playlist support (thx kipun)
|
||||||
|
* [donations](https://github.com/9001/) are now also possible through github -- good alternative to paypal (y)
|
||||||
|
* and thanks a lot for the support (and kind words therein) so far, appreciate it :>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0420-1836 `v1.16.21` unzip-compat
|
||||||
|
|
||||||
|
a couple guys have been asking if I accept donations -- thanks a lot!! added a few options on [my github page](https://github.com/9001/) :>
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* #156 add button to loop/repeat music 71c55659
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* #155 download-as-zip: increase compatibility with the unix `unzip` command db33d68d
|
||||||
|
* this unfortunately reduces support for huge zipfiles on old software (WinXP and such)
|
||||||
|
* and makes it less safe to stream zips into unzippers, so use tar.gz instead
|
||||||
|
* and is perhaps not even a copyparty bug; see commit-message for the full story
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* show warning on Ctrl-A in lazy-loaded folders 5b3a5fe7
|
||||||
|
* docker: hide keepalive pings from logs d5a9bd80
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
|
# 2025-0413-2151 `v1.16.20` all sorted
|
||||||
|
|
||||||
|
## 🧪 new features
|
||||||
|
|
||||||
|
* when enabled, natural-sort will now also apply to tags, not just filenames 7b2bd6da
|
||||||
|
|
||||||
|
## 🩹 bugfixes
|
||||||
|
|
||||||
|
* some sorting-related stuff 7b2bd6da
|
||||||
|
* folders with non-ascii names would sort incorrectly in the navpane/sidebar
|
||||||
|
* natural-sort didn't apply correctly after changing the sort order
|
||||||
|
* workaround [ffmpeg-bug 10797](https://trac.ffmpeg.org/ticket/10797) 98dcaee2
|
||||||
|
* reduces ram usage from 1534 to 230 MiB when generating spectrograms of s3xmodit songs (amiga chiptunes)
|
||||||
|
* disable mdns if only listening on uds (unix-sockets) ffc16109 361aebf8
|
||||||
|
|
||||||
|
## 🔧 other changes
|
||||||
|
|
||||||
|
* hotkey CTRL-A will now select all files in gridview 233075ae
|
||||||
|
* and it toggles (just like in list-view) so try pressing it again
|
||||||
|
* copyparty.exe: upgrade to pillow v11.2.1 c7aa1a35
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||||
# 2025-0408-2132 `v1.16.19` GHOST
|
# 2025-0408-2132 `v1.16.19` GHOST
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
* [dev env setup](#dev-env-setup)
|
* [dev env setup](#dev-env-setup)
|
||||||
* [just the sfx](#just-the-sfx)
|
* [just the sfx](#just-the-sfx)
|
||||||
* [build from release tarball](#build-from-release-tarball) - uses the included prebuilt webdeps
|
* [build from release tarball](#build-from-release-tarball) - uses the included prebuilt webdeps
|
||||||
|
* [build from scratch](#build-from-scratch) - how the sausage is made
|
||||||
* [complete release](#complete-release)
|
* [complete release](#complete-release)
|
||||||
* [debugging](#debugging)
|
* [debugging](#debugging)
|
||||||
* [music playback halting on phones](#music-playback-halting-on-phones) - mostly fine on android
|
* [music playback halting on phones](#music-playback-halting-on-phones) - mostly fine on android
|
||||||
@@ -190,6 +191,9 @@ authenticate using header `Cookie: cppwd=foo` or url param `&pw=foo`
|
|||||||
| GET | `?v` | open image/video/audio in mediaplayer |
|
| GET | `?v` | open image/video/audio in mediaplayer |
|
||||||
| GET | `?txt` | get file at URL as plaintext |
|
| GET | `?txt` | get file at URL as plaintext |
|
||||||
| GET | `?txt=iso-8859-1` | ...with specific charset |
|
| GET | `?txt=iso-8859-1` | ...with specific charset |
|
||||||
|
| GET | `?tail` | continuously stream a growing file |
|
||||||
|
| GET | `?tail=1024` | ...starting from byte 1024 |
|
||||||
|
| GET | `?tail=-128` | ...starting 128 bytes from the end |
|
||||||
| GET | `?th` | get image/video at URL as thumbnail |
|
| GET | `?th` | get image/video at URL as thumbnail |
|
||||||
| GET | `?th=opus` | convert audio file to 128kbps opus |
|
| GET | `?th=opus` | convert audio file to 128kbps opus |
|
||||||
| GET | `?th=caf` | ...in the iOS-proprietary container |
|
| GET | `?th=caf` | ...in the iOS-proprietary container |
|
||||||
@@ -257,6 +261,7 @@ upload modifiers:
|
|||||||
|--|--|--|
|
|--|--|--|
|
||||||
| GET | `?reload=cfg` | reload config files and rescan volumes |
|
| GET | `?reload=cfg` | reload config files and rescan volumes |
|
||||||
| GET | `?scan` | initiate a rescan of the volume which provides URL |
|
| GET | `?scan` | initiate a rescan of the volume which provides URL |
|
||||||
|
| GET | `?scan=/a,/b` | initiate a rescan of volumes `/a` and `/b` |
|
||||||
| GET | `?stack` | show a stacktrace of all threads |
|
| GET | `?stack` | show a stacktrace of all threads |
|
||||||
|
|
||||||
## general
|
## general
|
||||||
@@ -338,7 +343,7 @@ for the `re`pack to work, first run one of the sfx'es once to unpack it
|
|||||||
|
|
||||||
you need python 3.9 or newer due to type hints
|
you need python 3.9 or newer due to type hints
|
||||||
|
|
||||||
the rest is mostly optional; if you need a working env for vscode or similar
|
setting up a venv with the below packages is only necessary if you want it for vscode or similar
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
@@ -350,7 +355,7 @@ pip install mutagen # audio metadata
|
|||||||
pip install pyftpdlib # ftp server
|
pip install pyftpdlib # ftp server
|
||||||
pip install partftpy # tftp server
|
pip install partftpy # tftp server
|
||||||
pip install impacket # smb server -- disable Windows Defender if you REALLY need this on windows
|
pip install impacket # smb server -- disable Windows Defender if you REALLY need this on windows
|
||||||
pip install Pillow pyheif-pillow-opener pillow-avif-plugin # thumbnails
|
pip install Pillow pyheif-pillow-opener # thumbnails
|
||||||
pip install pyvips # faster thumbnails
|
pip install pyvips # faster thumbnails
|
||||||
pip install psutil # better cleanup of stuck metadata parsers on windows
|
pip install psutil # better cleanup of stuck metadata parsers on windows
|
||||||
pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscode tooling
|
pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscode tooling
|
||||||
@@ -392,6 +397,39 @@ python3 setup.py install --skip-build --prefix=/usr --root=$HOME/pe/copyparty
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## build from scratch
|
||||||
|
|
||||||
|
how the sausage is made:
|
||||||
|
|
||||||
|
to get started, first `cd` into the `scripts` folder
|
||||||
|
|
||||||
|
* the first step is the webdeps; they end up in `../copyparty/web/deps/` for example `../copyparty/web/deps/marked.js.gz` -- if you need to build the webdeps, run `make -C deps-docker`
|
||||||
|
* this needs rootless podman and the `podman-docker` compat-layer to pretend it's docker, although it *should* be possible to use rootful/rootless docker too
|
||||||
|
* if you don't have rootless podman/docker then `sudo make -C deps-docker` is fine too
|
||||||
|
* alternatively, you can entirely skip building the webdeps and instead extract the compiled webdeps from the latest github release with `./make-sfx.sh fast dl-wd`
|
||||||
|
|
||||||
|
* next, build `copyparty-sfx.py` by running `./make-sfx.sh gz fast`
|
||||||
|
* this is a dependency for most of the remaining steps, since they take the sfx as input
|
||||||
|
* removing `fast` makes it compress better
|
||||||
|
* removing `gz` too compresses even better, but startup gets slower
|
||||||
|
|
||||||
|
* if you want to build the `.pyz` standalone "binary", now run `./make-pyz.sh`
|
||||||
|
|
||||||
|
* if you want to build a pypi package, now run `./make-pypi-release.sh d`
|
||||||
|
|
||||||
|
* if you want to build a docker-image, you have two options:
|
||||||
|
* if you want to use podman to build all docker-images for all supported architectures, now run `(cd docker; ./make.sh hclean; ./make.sh hclean pull img)`
|
||||||
|
* if you want to use docker to build all docker-images for your native architecture, now run `sudo make -C docker`
|
||||||
|
* if you want to do something else, please take a look at `docker/make.sh` or `docker/Makefile` for inspiration
|
||||||
|
|
||||||
|
* if you want to build the windows exe, first grab some snacks and a beer, [you'll need it](https://github.com/9001/copyparty/tree/hovudstraum/scripts/pyinstaller)
|
||||||
|
|
||||||
|
the complete list of buildtime dependencies to do a build from scratch is as follows:
|
||||||
|
|
||||||
|
* on ubuntu-server, install podman or [docker](https://get.docker.com/), and then `sudo apt install make zip bzip2`
|
||||||
|
* because ubuntu is specifically what someone asked about :-p
|
||||||
|
|
||||||
|
|
||||||
## complete release
|
## complete release
|
||||||
|
|
||||||
also builds the sfx so skip the sfx section above
|
also builds the sfx so skip the sfx section above
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ services:
|
|||||||
|
|
||||||
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget --spider -q 127.0.0.1:3923/?reset"]
|
# hide it from logs with "/._" so it matches the default --lf-url filter
|
||||||
|
test: ["CMD-SHELL", "wget --spider -q 127.0.0.1:3923/?reset=/._"]
|
||||||
interval: 1m
|
interval: 1m
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
@@ -22,12 +22,6 @@ services:
|
|||||||
- 'traefik.http.routers.fs.rule=Host(`fs.example.com`)'
|
- 'traefik.http.routers.fs.rule=Host(`fs.example.com`)'
|
||||||
- 'traefik.http.routers.fs.entrypoints=http'
|
- 'traefik.http.routers.fs.entrypoints=http'
|
||||||
#- 'traefik.http.routers.fs.middlewares=authelia@docker' # TODO: ???
|
#- 'traefik.http.routers.fs.middlewares=authelia@docker' # TODO: ???
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "wget --spider -q 127.0.0.1:3923/?reset"]
|
|
||||||
interval: 1m
|
|
||||||
timeout: 2s
|
|
||||||
retries: 5
|
|
||||||
start_period: 15s
|
|
||||||
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
||||||
environment:
|
environment:
|
||||||
LD_PRELOAD: /usr/lib/libmimalloc-secure.so.NOPE
|
LD_PRELOAD: /usr/lib/libmimalloc-secure.so.NOPE
|
||||||
|
|||||||
@@ -106,3 +106,10 @@
|
|||||||
/w/tank1
|
/w/tank1
|
||||||
[/m8s]
|
[/m8s]
|
||||||
/w/tank2
|
/w/tank2
|
||||||
|
|
||||||
|
|
||||||
|
# some other things you can do:
|
||||||
|
# [/demo/${u%-su,%-fds}] # users which are NOT members of "su" or "fds"
|
||||||
|
# [/demo/${u%+su,%+fds}] # users which ARE members of BOTH "su" and "fds"
|
||||||
|
# [/demo/${g%-su}] # all groups except su
|
||||||
|
# [/demo/${g%-su,%-fds}] # all groups except su and fds
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ symbol legend,
|
|||||||
| upload a 999 TiB file | █ | | | | █ | █ | • | | █ | | █ | ╱ | ╱ |
|
| upload a 999 TiB file | █ | | | | █ | █ | • | | █ | | █ | ╱ | ╱ |
|
||||||
| CTRL-V from device | █ | | | █ | | | | | | | | | |
|
| CTRL-V from device | █ | | | █ | | | | | | | | | |
|
||||||
| race the beam ("p2p") | █ | | | | | | | | | | | | |
|
| race the beam ("p2p") | █ | | | | | | | | | | | | |
|
||||||
|
| "tail -f" streaming | █ | | | | | | | | | | | | |
|
||||||
| keep last-modified time | █ | | | █ | █ | █ | | | | | | █ | |
|
| keep last-modified time | █ | | | █ | █ | █ | | | | | | █ | |
|
||||||
| upload rules | ╱ | ╱ | ╱ | ╱ | ╱ | | | ╱ | ╱ | | ╱ | ╱ | ╱ |
|
| upload rules | ╱ | ╱ | ╱ | ╱ | ╱ | | | ╱ | ╱ | | ╱ | ╱ | ╱ |
|
||||||
| ┗ max disk usage | █ | █ | █ | | █ | | | | █ | | | █ | █ |
|
| ┗ max disk usage | █ | █ | █ | | █ | | | | █ | | | █ | █ |
|
||||||
@@ -193,6 +194,8 @@ symbol legend,
|
|||||||
|
|
||||||
* `race the beam` = files can be downloaded while they're still uploading; downloaders are slowed down such that the uploader is always ahead
|
* `race the beam` = files can be downloaded while they're still uploading; downloaders are slowed down such that the uploader is always ahead
|
||||||
|
|
||||||
|
* `tail -f` = when viewing or downloading a logfile, the connection can remain open to keep showing new lines as they are added in real time
|
||||||
|
|
||||||
* `upload routing` = depending on filetype / contents / uploader etc., the file can be redirected to another location or otherwise transformed; mitigates limitations such as [sharex#3992](https://github.com/ShareX/ShareX/issues/3992)
|
* `upload routing` = depending on filetype / contents / uploader etc., the file can be redirected to another location or otherwise transformed; mitigates limitations such as [sharex#3992](https://github.com/ShareX/ShareX/issues/3992)
|
||||||
* copyparty example: [reloc-by-ext](https://github.com/9001/copyparty/tree/hovudstraum/bin/hooks#before-upload)
|
* copyparty example: [reloc-by-ext](https://github.com/9001/copyparty/tree/hovudstraum/bin/hooks#before-upload)
|
||||||
|
|
||||||
|
|||||||
8
flake.lock
generated
8
flake.lock
generated
@@ -17,16 +17,16 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1680334310,
|
"lastModified": 1748162331,
|
||||||
"narHash": "sha256-ISWz16oGxBhF7wqAxefMPwFag6SlsA9up8muV79V9ck=",
|
"narHash": "sha256-rqc2RKYTxP3tbjA+PB3VMRQNnjesrT0pEofXQTrMsS8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "884e3b68be02ff9d61a042bc9bd9dd2a358f95da",
|
"rev": "7c43f080a7f28b2774f3b3f43234ca11661bf334",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-22.11",
|
"ref": "nixos-25.05",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-22.11";
|
nixpkgs.url = "nixpkgs/nixos-25.05";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
config = {
|
||||||
|
allowAliases = false;
|
||||||
|
};
|
||||||
overlays = [ self.overlays.default ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ WORKDIR /z
|
|||||||
ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \
|
ENV ver_asmcrypto=c72492f4a66e17a0e5dd8ad7874de354f3ccdaa5 \
|
||||||
ver_hashwasm=4.12.0 \
|
ver_hashwasm=4.12.0 \
|
||||||
ver_marked=4.3.0 \
|
ver_marked=4.3.0 \
|
||||||
ver_dompf=3.2.5 \
|
ver_dompf=3.2.6 \
|
||||||
ver_mde=2.18.0 \
|
ver_mde=2.18.0 \
|
||||||
ver_codemirror=5.65.18 \
|
ver_codemirror=5.65.18 \
|
||||||
ver_fontawesome=5.13.0 \
|
ver_fontawesome=5.13.0 \
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ RUN apk add -U !pyc \
|
|||||||
py3-jinja2 py3-argon2-cffi py3-pyzmq py3-pillow \
|
py3-jinja2 py3-argon2-cffi py3-pyzmq py3-pillow \
|
||||||
py3-pip py3-cffi \
|
py3-pip py3-cffi \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
py3-magic \
|
||||||
vips-jxl vips-heif vips-poppler vips-magick \
|
vips-jxl vips-heif vips-poppler vips-magick \
|
||||||
py3-numpy fftw libsndfile \
|
py3-numpy fftw libsndfile \
|
||||||
vamp-sdk vamp-sdk-libs \
|
vamp-sdk vamp-sdk-libs \
|
||||||
&& apk add -t .bd \
|
&& apk add -t .bd \
|
||||||
bash wget gcc g++ make cmake patchelf \
|
bash wget gcc g++ make cmake patchelf \
|
||||||
python3-dev ffmpeg-dev fftw-dev libsndfile-dev \
|
python3-dev ffmpeg-dev fftw-dev libsndfile-dev \
|
||||||
py3-wheel py3-numpy-dev \
|
py3-wheel py3-numpy-dev libffi-dev \
|
||||||
vamp-sdk-dev \
|
vamp-sdk-dev \
|
||||||
&& rm -f /usr/lib/python3*/EXTERNALLY-MANAGED \
|
&& rm -f /usr/lib/python3*/EXTERNALLY-MANAGED \
|
||||||
&& python3 -m pip install pyvips \
|
&& python3 -m pip install pyvips \
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
FROM debian:12-slim
|
FROM DO_NOT_USE_THIS_DOCKER_IMAGE
|
||||||
|
# this image is an unmaintained experiment to see whether alpine was the correct choice (it was)
|
||||||
|
|
||||||
|
#FROM debian:12-slim
|
||||||
WORKDIR /z
|
WORKDIR /z
|
||||||
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
||||||
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
FROM fedora:39
|
FROM DO_NOT_USE_THIS_DOCKER_IMAGE
|
||||||
|
# this image is an unmaintained experiment to see whether alpine was the correct choice (it was)
|
||||||
|
|
||||||
|
#FROM fedora:39
|
||||||
WORKDIR /z
|
WORKDIR /z
|
||||||
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
||||||
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
FROM fedora:38
|
FROM DO_NOT_USE_THIS_DOCKER_IMAGE
|
||||||
|
# this image is an unmaintained experiment to see whether alpine was the correct choice (it was)
|
||||||
|
|
||||||
|
#FROM fedora:38
|
||||||
WORKDIR /z
|
WORKDIR /z
|
||||||
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
||||||
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
FROM ubuntu:23.04
|
FROM DO_NOT_USE_THIS_DOCKER_IMAGE
|
||||||
|
# this image is an unmaintained experiment to see whether alpine was the correct choice (it was)
|
||||||
|
|
||||||
|
#FROM ubuntu:23.04
|
||||||
WORKDIR /z
|
WORKDIR /z
|
||||||
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
||||||
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ RUN apk add -U !pyc \
|
|||||||
py3-jinja2 py3-argon2-cffi py3-pyzmq py3-pillow \
|
py3-jinja2 py3-argon2-cffi py3-pyzmq py3-pillow \
|
||||||
py3-pip py3-cffi \
|
py3-pip py3-cffi \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
py3-magic \
|
||||||
vips-jxl vips-heif vips-poppler vips-magick \
|
vips-jxl vips-heif vips-poppler vips-magick \
|
||||||
&& apk add -t .bd \
|
&& apk add -t .bd \
|
||||||
bash wget gcc g++ make cmake patchelf \
|
bash wget gcc g++ make cmake patchelf \
|
||||||
python3-dev py3-wheel \
|
python3-dev py3-wheel libffi-dev \
|
||||||
&& rm -f /usr/lib/python3*/EXTERNALLY-MANAGED \
|
&& rm -f /usr/lib/python3*/EXTERNALLY-MANAGED \
|
||||||
&& python3 -m pip install pyvips \
|
&& python3 -m pip install pyvips \
|
||||||
&& apk del py3-pip .bd
|
&& apk del py3-pip .bd
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ all:
|
|||||||
|
|
||||||
docker image ls
|
docker image ls
|
||||||
|
|
||||||
|
min:
|
||||||
|
rm -rf i
|
||||||
|
mkdir i
|
||||||
|
tar -cC../.. dist/copyparty-sfx.py bin/mtag | tar -xvCi
|
||||||
|
|
||||||
|
podman build --squash --pull=always -t copyparty/min:latest -f Dockerfile.min .
|
||||||
|
echo 'scale=1;'`podman save copyparty/min:latest | pigz -c | wc -c`/1024/1024 | bc
|
||||||
|
|
||||||
push:
|
push:
|
||||||
docker push copyparty/min
|
docker push copyparty/min
|
||||||
docker push copyparty/im
|
docker push copyparty/im
|
||||||
|
|||||||
@@ -63,12 +63,13 @@ python3 -m copyparty \
|
|||||||
--ign-ebind -p$((1024+RANDOM)),$((1024+RANDOM)),$((1024+RANDOM)) \
|
--ign-ebind -p$((1024+RANDOM)),$((1024+RANDOM)),$((1024+RANDOM)) \
|
||||||
-v .::r --no-crt -qi127.1 --wr-h-eps $t & pid=$!
|
-v .::r --no-crt -qi127.1 --wr-h-eps $t & pid=$!
|
||||||
|
|
||||||
for n in $(seq 1 200); do sleep 0.2
|
for n in $(seq 1 900); do sleep 0.2
|
||||||
v=$(awk '/^127/{print;n=1;exit}END{exit n-1}' $t) && break
|
v=$(awk '/^127/{print;n=1;exit}END{exit n-1}' $t) && break
|
||||||
done
|
done
|
||||||
[ -z "$v" ] && echo SNAAAAAKE && exit 1
|
[ -z "$v" ] && echo SNAAAAAKE && exit 1
|
||||||
|
rm $t
|
||||||
|
|
||||||
for n in $(seq 1 200); do sleep 0.2
|
for n in $(seq 1 900); do sleep 0.2
|
||||||
wget -O- http://${v/ /:}/?tar=gz:1 >tf && break
|
wget -O- http://${v/ /:}/?tar=gz:1 >tf && break
|
||||||
done
|
done
|
||||||
tar -xzO top/innvikler.sh <tf | cmp innvikler.sh
|
tar -xzO top/innvikler.sh <tf | cmp innvikler.sh
|
||||||
@@ -79,7 +80,7 @@ kill $pid; wait $pid
|
|||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# output from -e2d
|
# output from -e2d
|
||||||
rm -rf .hist
|
rm -rf .hist /cfg/copyparty
|
||||||
|
|
||||||
# goodbye
|
# goodbye
|
||||||
exec rm innvikler.sh
|
exec rm innvikler.sh
|
||||||
|
|||||||
@@ -537,6 +537,7 @@ find | grep -E '\.(js|html)$' | while IFS= read -r f; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
gzres() {
|
gzres() {
|
||||||
|
local pk=
|
||||||
[ $zopf ] && command -v zopfli && pk="zopfli --i$zopf"
|
[ $zopf ] && command -v zopfli && pk="zopfli --i$zopf"
|
||||||
[ $zopf ] && command -v pigz && pk="pigz -11 -I $zopf"
|
[ $zopf ] && command -v pigz && pk="pigz -11 -I $zopf"
|
||||||
[ -z "$pk" ] && pk='gzip'
|
[ -z "$pk" ] && pk='gzip'
|
||||||
@@ -628,7 +629,6 @@ suf=
|
|||||||
[ $use_gz ] && {
|
[ $use_gz ] && {
|
||||||
sed -r 's/"r:bz2"/"r:gz"/' <$py >$py.t
|
sed -r 's/"r:bz2"/"r:gz"/' <$py >$py.t
|
||||||
py=$py.t
|
py=$py.t
|
||||||
suf=-gz
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"$pybin" $py --sfx-make tar.bz2 $ver $ts
|
"$pybin" $py --sfx-make tar.bz2 $ver $ts
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ clean=--clean
|
|||||||
|
|
||||||
uname -s | grep WOW64 && m=64 || m=32
|
uname -s | grep WOW64 && m=64 || m=32
|
||||||
uname -s | grep NT-10 && w10=1 || w7=1
|
uname -s | grep NT-10 && w10=1 || w7=1
|
||||||
|
[ $w7 ] && export PRTY_NO_MAGIC=1
|
||||||
[ $w7 ] && [ -e up2k.sh ] && [ ! "$1" ] && ./up2k.sh
|
[ $w7 ] && [ -e up2k.sh ] && [ ! "$1" ] && ./up2k.sh
|
||||||
|
|
||||||
[ $w7 ] && pyv=37 || pyv=312
|
[ $w7 ] && pyv=37 || pyv=313
|
||||||
esuf=
|
esuf=
|
||||||
[ $w7 ] && [ $m = 32 ] && esuf=32
|
[ $w7 ] && [ $m = 32 ] && esuf=32
|
||||||
[ $w7 ] && [ $m = 64 ] && esuf=-winpe64
|
[ $w7 ] && [ $m = 64 ] && esuf=-winpe64
|
||||||
@@ -89,14 +90,18 @@ excl=(
|
|||||||
urllib.request
|
urllib.request
|
||||||
urllib.response
|
urllib.response
|
||||||
urllib.robotparser
|
urllib.robotparser
|
||||||
zipfile
|
|
||||||
)
|
)
|
||||||
[ $w10 ] && excl+=(
|
[ $w10 ] && excl+=(
|
||||||
|
_pyrepl
|
||||||
|
distutils
|
||||||
|
setuptools
|
||||||
|
PIL._avif
|
||||||
PIL.ImageQt
|
PIL.ImageQt
|
||||||
PIL.ImageShow
|
PIL.ImageShow
|
||||||
PIL.ImageTk
|
PIL.ImageTk
|
||||||
PIL.ImageWin
|
PIL.ImageWin
|
||||||
PIL.PdfParser
|
PIL.PdfParser
|
||||||
|
zipimport
|
||||||
) || excl+=(
|
) || excl+=(
|
||||||
inspect
|
inspect
|
||||||
PIL
|
PIL
|
||||||
@@ -104,6 +109,7 @@ excl=(
|
|||||||
PIL.Image
|
PIL.Image
|
||||||
PIL.ImageDraw
|
PIL.ImageDraw
|
||||||
PIL.ImageOps
|
PIL.ImageOps
|
||||||
|
zipfile
|
||||||
)
|
)
|
||||||
excl=( "${excl[@]/#/--exclude-module }" )
|
excl=( "${excl[@]/#/--exclude-module }" )
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ f117016b1e6a7d7e745db30d3e67f1acf7957c443a0dd301b6c5e10b8368f2aa4db6be9782d2d3f8
|
|||||||
17ce52ba50692a9d964f57a23ac163fb74c77fdeb2ca988a6d439ae1fe91955ff43730c073af97a7b3223093ffea3479a996b9b50ee7fba0869247a56f74baa6 pefile-2023.2.7-py3-none-any.whl
|
17ce52ba50692a9d964f57a23ac163fb74c77fdeb2ca988a6d439ae1fe91955ff43730c073af97a7b3223093ffea3479a996b9b50ee7fba0869247a56f74baa6 pefile-2023.2.7-py3-none-any.whl
|
||||||
b297ff66ec50cf5a1abcf07d6ac949644c5150ba094ffac974c5d27c81574c3e97ed814a47547f4b03a4c83ea0fb8f026433fca06a3f08e32742dc5c024f3d07 pywin32_ctypes-0.2.3-py3-none-any.whl
|
b297ff66ec50cf5a1abcf07d6ac949644c5150ba094ffac974c5d27c81574c3e97ed814a47547f4b03a4c83ea0fb8f026433fca06a3f08e32742dc5c024f3d07 pywin32_ctypes-0.2.3-py3-none-any.whl
|
||||||
085d39ef4426aa5f097fbc484595becc16e61ca23fc7da4d2a8bba540a3b82e789e390b176c7151bdc67d01735cce22b1562cdb2e31273225a2d3e275851a4ad setuptools-70.3.0-py3-none-any.whl
|
085d39ef4426aa5f097fbc484595becc16e61ca23fc7da4d2a8bba540a3b82e789e390b176c7151bdc67d01735cce22b1562cdb2e31273225a2d3e275851a4ad setuptools-70.3.0-py3-none-any.whl
|
||||||
360a141928f4a7ec18a994602cbb28bbf8b5cc7c077a06ac76b54b12fa769ed95ca0333a5cf728923a8e0baeb5cc4d5e73e5b3de2666beb05eb477d8ae719093 upx-4.2.4-win32.zip
|
644931f8e1764e168c257c11c77b3d2ac5408397d97b0eef98168a058efe793d3ab6900dc2e9c54923a2bd906dd66bfbff8db6ff43418513e530a1bd501c6ccd upx-5.0.1-win32.zip
|
||||||
# win7
|
# win7
|
||||||
3253e86471e6f9fa85bfdb7684cd2f964ed6e35c6a4db87f81cca157c049bef43e66dfcae1e037b2fb904567b1e028aaeefe8983ba3255105df787406d2aa71e en_windows_7_professional_with_sp1_x86_dvd_u_677056.iso
|
3253e86471e6f9fa85bfdb7684cd2f964ed6e35c6a4db87f81cca157c049bef43e66dfcae1e037b2fb904567b1e028aaeefe8983ba3255105df787406d2aa71e en_windows_7_professional_with_sp1_x86_dvd_u_677056.iso
|
||||||
ab0db0283f61a5bbe44797d74546786bf41685175764a448d2e3bd629f292f1e7d829757b26be346b5044d78c9c1891736d93237cee4b1b6f5996a902c86d15f en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso
|
ab0db0283f61a5bbe44797d74546786bf41685175764a448d2e3bd629f292f1e7d829757b26be346b5044d78c9c1891736d93237cee4b1b6f5996a902c86d15f en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso
|
||||||
@@ -24,10 +24,11 @@ ac96786e5d35882e0c5b724794329c9125c2b86ae7847f17acfc49f0d294312c6afc1c3f248655de
|
|||||||
0a2cd4cadf0395f0374974cd2bc2407e5cc65c111275acdffb6ecc5a2026eee9e1bb3da528b35c7f0ff4b64563a74857d5c2149051e281cc09ebd0d1968be9aa en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
|
0a2cd4cadf0395f0374974cd2bc2407e5cc65c111275acdffb6ecc5a2026eee9e1bb3da528b35c7f0ff4b64563a74857d5c2149051e281cc09ebd0d1968be9aa en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
|
||||||
16cc0c58b5df6c7040893089f3eb29c074aed61d76dae6cd628d8a89a05f6223ac5d7f3f709a12417c147594a87a94cc808d1e04a6f1e407cc41f7c9f47790d1 virtio-win-0.1.248.iso
|
16cc0c58b5df6c7040893089f3eb29c074aed61d76dae6cd628d8a89a05f6223ac5d7f3f709a12417c147594a87a94cc808d1e04a6f1e407cc41f7c9f47790d1 virtio-win-0.1.248.iso
|
||||||
9a7f40edc6f9209a2acd23793f3cbd6213c94f36064048cb8bf6eb04f1bdb2c2fe991cb09f77fe8b13e5cd85c618ef23573e79813b2fef899ab2f290cd129779 jinja2-3.1.6-py3-none-any.whl
|
9a7f40edc6f9209a2acd23793f3cbd6213c94f36064048cb8bf6eb04f1bdb2c2fe991cb09f77fe8b13e5cd85c618ef23573e79813b2fef899ab2f290cd129779 jinja2-3.1.6-py3-none-any.whl
|
||||||
6df21f0da408a89f6504417c7cdf9aaafe4ed88cfa13e9b8fa8414f604c0401f885a04bbad0484dc51a29284af5d1548e33c6cc6bfb9896d9992c1b1074f332d MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl
|
00731cfdd9d5c12efef04a7161c90c1e5ed1dc4677aa88a1d4054aff836f3430df4da5262ed4289c21637358a9e10e5df16f76743cbf5a29bb3a44b146c19cf3 MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl
|
||||||
8a6e2b13a2ec4ef914a5d62aad3db6464d45e525a82e07f6051ed10474eae959069e165dba011aefb8207cdfd55391d73d6f06362c7eb247b08763106709526e mutagen-1.47.0-py3-none-any.whl
|
8a6e2b13a2ec4ef914a5d62aad3db6464d45e525a82e07f6051ed10474eae959069e165dba011aefb8207cdfd55391d73d6f06362c7eb247b08763106709526e mutagen-1.47.0-py3-none-any.whl
|
||||||
0203ec2551c4836696cfab0b2c9fff603352f03fa36e7476e2e1ca7ec57a3a0c24bd791fcd92f342bf817f0887854d9f072e0271c643de4b313d8c9569ba8813 packaging-24.1-py3-none-any.whl
|
a726fb46cce24f781fc8b55a3e6dea0a884ebc3b2b400ea74aa02333699f4955a5dc1e2ec5927ac72f35a624401f3f3b442882ba1cc4cadaf9c88558b5b8bdae packaging-25.0-py3-none-any.whl
|
||||||
c9051daaf34ec934962c743a5ac2dbe55a9b0cababb693a8cde0001d24d4a50b67bd534d714d935def6ca7b898ec0a352e58bd9ccdce01c54eaf2281b18e478d pillow-11.2.1-cp312-cp312-win_amd64.whl
|
3e39ea6e16b502d99a2e6544579095d0f7c6097761cd85135d5e929b9dec1b32e80669a846f94ee8c2cca9be2f5fe728625d09453988864c04e16bb8445c3f91 pillow-11.3.0-cp313-cp313-win_amd64.whl
|
||||||
f0463895e9aee97f31a2003323de235fed1b26289766dc0837261e3f4a594a31162b69e9adbb0e9a31e2e2d4b5f25c762ed1669553df7dc89a8ba4f85d297873 pyinstaller-6.11.1-py3-none-win_amd64.whl
|
59fbbcae044f4ee73d203ac74b553b27bfad3e6b2f3fb290fd3f8774753c6b545176b6b3399c240b092d131d152290ce732750accd962dc1e48e930be85f5e53 pyinstaller-6.14.1-py3-none-win_amd64.whl
|
||||||
d550a0a14428386945533de2220c4c2e37c0c890fc51a600f626c6ca90a32d39572c121ec04c157ba3a8d6601cb021f8433d871b5c562a3d342c804fffec90c1 pyinstaller_hooks_contrib-2024.11-py3-none-any.whl
|
fc6f3e144c5f5b662412de07cb8bf0c2eb3b3be21d19ec448aef3c4244d779b9ab8027fd67a4871e6e13823b248ea0f5a7a9241a53aef30f3b51a6d3cb5bdb3f pyinstaller_hooks_contrib-2025.5-py3-none-any.whl
|
||||||
4f9a4d9f65c93e2d851e2674057343a9599f30f5dc582ffca485522237d4fcf43653b3d393ed5eb11e518c4ba93714a07134bbb13a97d421cce211e1da34682e python-3.12.10-amd64.exe
|
2c7a52e223b8186c21009d3fa5ed6a856d8eb4ef3b98f5d24c378c6a1afbfa1378bd7a51d6addc500e263d7989efb544c862bf920055e740f137c702dfd9d18b python-3.13.5-amd64.exe
|
||||||
|
2a0420f7faaa33d2132b82895a8282688030e939db0225ad8abb95a47bdb87b45318f10985fc3cee271a9121441c1526caa363d7f2e4a4b18b1a674068766e87 setuptools-80.9.0-py3-none-any.whl
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ uname -s | grep NT-10 && w10=1 || {
|
|||||||
fns=(
|
fns=(
|
||||||
altgraph-0.17.4-py2.py3-none-any.whl
|
altgraph-0.17.4-py2.py3-none-any.whl
|
||||||
pefile-2023.2.7-py3-none-any.whl
|
pefile-2023.2.7-py3-none-any.whl
|
||||||
pywin32_ctypes-0.2.2-py3-none-any.whl
|
pywin32_ctypes-0.2.3-py3-none-any.whl
|
||||||
setuptools-70.3.0-py3-none-any.whl
|
upx-5.0.1-win32.zip
|
||||||
upx-4.2.4-win32.zip
|
|
||||||
)
|
)
|
||||||
[ $w10 ] && fns+=(
|
[ $w10 ] && fns+=(
|
||||||
jinja2-3.1.6-py3-none-any.whl
|
jinja2-3.1.6-py3-none-any.whl
|
||||||
MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl
|
MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl
|
||||||
mutagen-1.47.0-py3-none-any.whl
|
mutagen-1.47.0-py3-none-any.whl
|
||||||
packaging-24.1-py3-none-any.whl
|
packaging-25.0-py3-none-any.whl
|
||||||
pillow-11.2.1-cp312-cp312-win_amd64.whl
|
pillow-11.3.0-cp313-cp313-win_amd64.whl
|
||||||
pyinstaller-6.10.0-py3-none-win_amd64.whl
|
pyinstaller-6.14.1-py3-none-win_amd64.whl
|
||||||
pyinstaller_hooks_contrib-2024.8-py3-none-any.whl
|
pyinstaller_hooks_contrib-2025.5-py3-none-any.whl
|
||||||
python-3.12.10-amd64.exe
|
python-3.13.5-amd64.exe
|
||||||
|
setuptools-80.9.0-py3-none-any.whl
|
||||||
)
|
)
|
||||||
[ $w7 ] && fns+=(
|
[ $w7 ] && fns+=(
|
||||||
future-1.0.0-py3-none-any.whl
|
future-1.0.0-py3-none-any.whl
|
||||||
@@ -49,6 +49,7 @@ fns=(
|
|||||||
packaging-24.0-py3-none-any.whl
|
packaging-24.0-py3-none-any.whl
|
||||||
pip-24.0-py3-none-any.whl
|
pip-24.0-py3-none-any.whl
|
||||||
pyinstaller_hooks_contrib-2023.8-py2.py3-none-any.whl
|
pyinstaller_hooks_contrib-2023.8-py2.py3-none-any.whl
|
||||||
|
setuptools-70.3.0-py3-none-any.whl
|
||||||
typing_extensions-4.7.1-py3-none-any.whl
|
typing_extensions-4.7.1-py3-none-any.whl
|
||||||
zipp-3.15.0-py3-none-any.whl
|
zipp-3.15.0-py3-none-any.whl
|
||||||
)
|
)
|
||||||
@@ -80,7 +81,7 @@ close and reopen git-bash so python is in PATH
|
|||||||
|
|
||||||
===[ copy-paste into git-bash ]================================
|
===[ copy-paste into git-bash ]================================
|
||||||
uname -s | grep NT-10 && w10=1 || w7=1
|
uname -s | grep NT-10 && w10=1 || w7=1
|
||||||
[ $w7 ] && pyv=37 || pyv=312
|
[ $w7 ] && pyv=37 || pyv=313
|
||||||
appd=$(cygpath.exe "$APPDATA")
|
appd=$(cygpath.exe "$APPDATA")
|
||||||
cd ~/Downloads &&
|
cd ~/Downloads &&
|
||||||
yes | unzip upx-*-win32.zip &&
|
yes | unzip upx-*-win32.zip &&
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ shift
|
|||||||
./make-sfx.sh "$@"
|
./make-sfx.sh "$@"
|
||||||
f=../dist/copyparty-sfx
|
f=../dist/copyparty-sfx
|
||||||
[ -e $f.py ] && s= || s=-gz
|
[ -e $f.py ] && s= || s=-gz
|
||||||
|
# TODO: the -gz suffix is gone, can drop all the $s stuff probably
|
||||||
|
|
||||||
$f$s.py --version >/dev/null
|
$f$s.py --version >/dev/null
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ copyparty/web/deps/prismd.css,
|
|||||||
copyparty/web/deps/scp.woff2,
|
copyparty/web/deps/scp.woff2,
|
||||||
copyparty/web/deps/sha512.ac.js,
|
copyparty/web/deps/sha512.ac.js,
|
||||||
copyparty/web/deps/sha512.hw.js,
|
copyparty/web/deps/sha512.hw.js,
|
||||||
|
copyparty/web/idp.html,
|
||||||
copyparty/web/iiam.gif,
|
copyparty/web/iiam.gif,
|
||||||
copyparty/web/md.css,
|
copyparty/web/md.css,
|
||||||
copyparty/web/md.html,
|
copyparty/web/md.html,
|
||||||
|
|||||||
@@ -226,10 +226,13 @@ var tl_browser = {
|
|||||||
"wt_pst": "paste a previously cut / copied selection$NHotkey: ctrl-V",
|
"wt_pst": "paste a previously cut / copied selection$NHotkey: ctrl-V",
|
||||||
"wt_selall": "select all files$NHotkey: ctrl-A (when file focused)",
|
"wt_selall": "select all files$NHotkey: ctrl-A (when file focused)",
|
||||||
"wt_selinv": "invert selection",
|
"wt_selinv": "invert selection",
|
||||||
|
"wt_zip1": "download this folder as archive",
|
||||||
"wt_selzip": "download selection as archive",
|
"wt_selzip": "download selection as archive",
|
||||||
"wt_seldl": "download selection as separate files$NHotkey: Y",
|
"wt_seldl": "download selection as separate files$NHotkey: Y",
|
||||||
"wt_npirc": "copy irc-formatted track info",
|
"wt_npirc": "copy irc-formatted track info",
|
||||||
"wt_nptxt": "copy plaintext track info",
|
"wt_nptxt": "copy plaintext track info",
|
||||||
|
"wt_m3ua": "add to m3u playlist (click <code>📻copy</code> later)",
|
||||||
|
"wt_m3uc": "copy m3u playlist to clipboard",
|
||||||
"wt_grid": "toggle grid / list view$NHotkey: G",
|
"wt_grid": "toggle grid / list view$NHotkey: G",
|
||||||
"wt_prev": "previous track$NHotkey: J",
|
"wt_prev": "previous track$NHotkey: J",
|
||||||
"wt_play": "play / pause$NHotkey: P",
|
"wt_play": "play / pause$NHotkey: P",
|
||||||
@@ -332,6 +335,8 @@ var tl_browser = {
|
|||||||
|
|
||||||
"cut_mt": "use multithreading to accelerate file hashing$N$Nthis uses web-workers and requires$Nmore RAM (up to 512 MiB extra)$N$Nmakes https 30% faster, http 4.5x faster\">mt",
|
"cut_mt": "use multithreading to accelerate file hashing$N$Nthis uses web-workers and requires$Nmore RAM (up to 512 MiB extra)$N$Nmakes https 30% faster, http 4.5x faster\">mt",
|
||||||
|
|
||||||
|
"cut_wasm": "use wasm instead of the browser's built-in hasher; improves speed on chrome-based browsers but increases CPU load, and many older versions of chrome have bugs which makes the browser consume all RAM and crash if this is enabled\">wasm",
|
||||||
|
|
||||||
"cft_text": "favicon text (blank and refresh to disable)",
|
"cft_text": "favicon text (blank and refresh to disable)",
|
||||||
"cft_fg": "foreground color",
|
"cft_fg": "foreground color",
|
||||||
"cft_bg": "background color",
|
"cft_bg": "background color",
|
||||||
@@ -357,6 +362,7 @@ var tl_browser = {
|
|||||||
"ml_eq": "audio equalizer",
|
"ml_eq": "audio equalizer",
|
||||||
"ml_drc": "dynamic range compressor",
|
"ml_drc": "dynamic range compressor",
|
||||||
|
|
||||||
|
"mt_loop": "loop/repeat one song\">🔁",
|
||||||
"mt_shuf": "shuffle the songs in each folder\">🔀",
|
"mt_shuf": "shuffle the songs in each folder\">🔀",
|
||||||
"mt_aplay": "autoplay if there is a song-ID in the link you clicked to access the server$N$Ndisabling this will also stop the page URL from being updated with song-IDs when playing music, to prevent autoplay if these settings are lost but the URL remains\">a▶",
|
"mt_aplay": "autoplay if there is a song-ID in the link you clicked to access the server$N$Ndisabling this will also stop the page URL from being updated with song-IDs when playing music, to prevent autoplay if these settings are lost but the URL remains\">a▶",
|
||||||
"mt_preload": "start loading the next song near the end for gapless playback\">preload",
|
"mt_preload": "start loading the next song near the end for gapless playback\">preload",
|
||||||
@@ -365,6 +371,7 @@ var tl_browser = {
|
|||||||
"mt_fau": "on phones, prevent music from stopping if the next song doesn't preload fast enough (can make tags display glitchy)\">☕️",
|
"mt_fau": "on phones, prevent music from stopping if the next song doesn't preload fast enough (can make tags display glitchy)\">☕️",
|
||||||
"mt_waves": "waveform seekbar:$Nshow audio amplitude in the scrubber\">~s",
|
"mt_waves": "waveform seekbar:$Nshow audio amplitude in the scrubber\">~s",
|
||||||
"mt_npclip": "show buttons for clipboarding the currently playing song\">/np",
|
"mt_npclip": "show buttons for clipboarding the currently playing song\">/np",
|
||||||
|
"mt_m3u_c": "show buttons for clipboarding the$Nselected songs as m3u8 playlist entries\">📻",
|
||||||
"mt_octl": "os integration (media hotkeys / osd)\">os-ctl",
|
"mt_octl": "os integration (media hotkeys / osd)\">os-ctl",
|
||||||
"mt_oseek": "allow seeking through os integration$N$Nnote: on some devices (iPhones),$Nthis replaces the next-song button\">seek",
|
"mt_oseek": "allow seeking through os integration$N$Nnote: on some devices (iPhones),$Nthis replaces the next-song button\">seek",
|
||||||
"mt_oscv": "show album cover in osd\">art",
|
"mt_oscv": "show album cover in osd\">art",
|
||||||
@@ -390,6 +397,7 @@ var tl_browser = {
|
|||||||
|
|
||||||
"mb_play": "play",
|
"mb_play": "play",
|
||||||
"mm_hashplay": "play this audio file?",
|
"mm_hashplay": "play this audio file?",
|
||||||
|
"mm_m3u": "press <code>Enter/OK</code> to Play\npress <code>ESC/Cancel</code> to Edit",
|
||||||
"mp_breq": "need firefox 82+ or chrome 73+ or iOS 15+",
|
"mp_breq": "need firefox 82+ or chrome 73+ or iOS 15+",
|
||||||
"mm_bload": "now loading...",
|
"mm_bload": "now loading...",
|
||||||
"mm_bconv": "converting to {0}, please wait...",
|
"mm_bconv": "converting to {0}, please wait...",
|
||||||
@@ -402,6 +410,7 @@ var tl_browser = {
|
|||||||
"mm_eunk": "Unknown Errol",
|
"mm_eunk": "Unknown Errol",
|
||||||
"mm_e404": "Could not play audio; error 404: File not found.",
|
"mm_e404": "Could not play audio; error 404: File not found.",
|
||||||
"mm_e403": "Could not play audio; error 403: Access denied.\n\nTry pressing F5 to reload, maybe you got logged out",
|
"mm_e403": "Could not play audio; error 403: Access denied.\n\nTry pressing F5 to reload, maybe you got logged out",
|
||||||
|
"mm_e500": "Could not play audio; error 500: Check server logs.",
|
||||||
"mm_e5xx": "Could not play audio; server error ",
|
"mm_e5xx": "Could not play audio; server error ",
|
||||||
"mm_nof": "not finding any more audio files nearby",
|
"mm_nof": "not finding any more audio files nearby",
|
||||||
"mm_prescan": "Looking for music to play next...",
|
"mm_prescan": "Looking for music to play next...",
|
||||||
@@ -414,8 +423,10 @@ var tl_browser = {
|
|||||||
"f_empty": 'this folder is empty',
|
"f_empty": 'this folder is empty',
|
||||||
"f_chide": 'this will hide the column «{0}»\n\nyou can unhide columns in the settings tab',
|
"f_chide": 'this will hide the column «{0}»\n\nyou can unhide columns in the settings tab',
|
||||||
"f_bigtxt": "this file is {0} MiB large -- really view as text?",
|
"f_bigtxt": "this file is {0} MiB large -- really view as text?",
|
||||||
|
"f_bigtxt2": "view just the end of the file instead? this will also enable following/tailing, showing newly added lines of text in real time",
|
||||||
"fbd_more": '<div id="blazy">showing <code>{0}</code> of <code>{1}</code> files; <a href="#" id="bd_more">show {2}</a> or <a href="#" id="bd_all">show all</a></div>',
|
"fbd_more": '<div id="blazy">showing <code>{0}</code> of <code>{1}</code> files; <a href="#" id="bd_more">show {2}</a> or <a href="#" id="bd_all">show all</a></div>',
|
||||||
"fbd_all": '<div id="blazy">showing <code>{0}</code> of <code>{1}</code> files; <a href="#" id="bd_all">show all</a></div>',
|
"fbd_all": '<div id="blazy">showing <code>{0}</code> of <code>{1}</code> files; <a href="#" id="bd_all">show all</a></div>',
|
||||||
|
"f_anota": "only {0} of the {1} items were selected;\nto select the full folder, first scroll to the bottom",
|
||||||
|
|
||||||
"f_dls": 'the file links in the current folder have\nbeen changed into download links',
|
"f_dls": 'the file links in the current folder have\nbeen changed into download links',
|
||||||
|
|
||||||
@@ -517,6 +528,15 @@ var tl_browser = {
|
|||||||
"tvt_next": "show next document$NHotkey: K\">⬇ next",
|
"tvt_next": "show next document$NHotkey: K\">⬇ next",
|
||||||
"tvt_sel": "select file ( for cut / copy / delete / ... )$NHotkey: S\">sel",
|
"tvt_sel": "select file ( for cut / copy / delete / ... )$NHotkey: S\">sel",
|
||||||
"tvt_edit": "open file in text editor$NHotkey: E\">✏️ edit",
|
"tvt_edit": "open file in text editor$NHotkey: E\">✏️ edit",
|
||||||
|
"tvt_tail": "monitor file for changes; show new lines in real time\">📡 follow",
|
||||||
|
"tvt_wrap": "word-wrap\">↵",
|
||||||
|
"tvt_atail": "lock scroll to bottom of page\">⚓",
|
||||||
|
"tvt_ctail": "decode terminal colors (ansi escape codes)\">🌈",
|
||||||
|
"tvt_ntail": "scrollback limit (how many bytes of text to keep loaded)",
|
||||||
|
|
||||||
|
"m3u_add1": "song added to m3u playlist",
|
||||||
|
"m3u_addn": "{0} songs added to m3u playlist",
|
||||||
|
"m3u_clip": "m3u playlist now copied to clipboard\n\nyou should create a new textfile named something.m3u and paste the playlist in that document; this will make it playable",
|
||||||
|
|
||||||
"gt_vau": "don't show videos, just play the audio\">🎧",
|
"gt_vau": "don't show videos, just play the audio\">🎧",
|
||||||
"gt_msel": "enable file selection; ctrl-click a file to override$N$N<em>when active: doubleclick a file / folder to open it</em>$N$NHotkey: S\">multiselect",
|
"gt_msel": "enable file selection; ctrl-click a file to override$N$N<em>when active: doubleclick a file / folder to open it</em>$N$NHotkey: S\">multiselect",
|
||||||
@@ -612,6 +632,7 @@ var tl_browser = {
|
|||||||
"u_https3": "for better performance",
|
"u_https3": "for better performance",
|
||||||
"u_ancient": 'your browser is impressively ancient -- maybe you should <a href="#" onclick="goto(\'bup\')">use bup instead</a>',
|
"u_ancient": 'your browser is impressively ancient -- maybe you should <a href="#" onclick="goto(\'bup\')">use bup instead</a>',
|
||||||
"u_nowork": "need firefox 53+ or chrome 57+ or iOS 11+",
|
"u_nowork": "need firefox 53+ or chrome 57+ or iOS 11+",
|
||||||
|
"tail_2old": "need firefox 105+ or chrome 71+ or iOS 14.5+",
|
||||||
"u_nodrop": 'your browser is too old for drag-and-drop uploading',
|
"u_nodrop": 'your browser is too old for drag-and-drop uploading',
|
||||||
"u_notdir": "that's not a folder!\n\nyour browser is too old,\nplease try dragdrop instead",
|
"u_notdir": "that's not a folder!\n\nyour browser is too old,\nplease try dragdrop instead",
|
||||||
"u_uri": "to dragdrop images from other browser windows,\nplease drop it onto the big upload button",
|
"u_uri": "to dragdrop images from other browser windows,\nplease drop it onto the big upload button",
|
||||||
|
|||||||
46
tests/res/idp/7.conf
Normal file
46
tests/res/idp/7.conf
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# -*- mode: yaml -*-
|
||||||
|
# vim: ft=yaml:
|
||||||
|
|
||||||
|
[global]
|
||||||
|
idp-h-usr: x-idp-user
|
||||||
|
idp-h-grp: x-idp-group
|
||||||
|
|
||||||
|
[/u/${u}]
|
||||||
|
/u/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/uya/${u%+ga}]
|
||||||
|
/uya/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/uyab/${u%+ga,%+gb}]
|
||||||
|
/uyab/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/una/${u%-ga}]
|
||||||
|
/una/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/unab/${u%-ga,%-gb}]
|
||||||
|
/unab/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gya/${g%+ga}]
|
||||||
|
/gya/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gna/${g%-ga}]
|
||||||
|
/gna/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gnab/${g%-ga,%-gb}]
|
||||||
|
/gnab/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
47
tests/res/idp/8.conf
Normal file
47
tests/res/idp/8.conf
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# -*- mode: yaml -*-
|
||||||
|
# vim: ft=yaml:
|
||||||
|
|
||||||
|
[groups]
|
||||||
|
ga: iua, iuab, iuabc
|
||||||
|
gb: iuab, iuabc, iub, iubc
|
||||||
|
gc: iuabc, iubc, iuc
|
||||||
|
|
||||||
|
[/u/${u}]
|
||||||
|
/u/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/uya/${u%+ga}]
|
||||||
|
/uya/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/uyab/${u%+ga,%+gb}]
|
||||||
|
/uyab/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/una/${u%-ga}]
|
||||||
|
/una/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/unab/${u%-ga,%-gb}]
|
||||||
|
/unab/${u}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gya/${g%+ga}]
|
||||||
|
/gya/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gna/${g%-ga}]
|
||||||
|
/gna/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
|
|
||||||
|
[/gnab/${g%-ga,%-gb}]
|
||||||
|
/gnab/${g}
|
||||||
|
accs:
|
||||||
|
r: *
|
||||||
@@ -234,3 +234,74 @@ class TestVFS(unittest.TestCase):
|
|||||||
au.idp_checkin(None, "iud", "su")
|
au.idp_checkin(None, "iud", "su")
|
||||||
self.assertAxsAt(au, "team/su/iuc", [["iuc", "iud"]])
|
self.assertAxsAt(au, "team/su/iuc", [["iuc", "iud"]])
|
||||||
self.assertAxsAt(au, "team/su/iud", [["iuc", "iud"]])
|
self.assertAxsAt(au, "team/su/iud", [["iuc", "iud"]])
|
||||||
|
|
||||||
|
def test_7(self):
|
||||||
|
"""
|
||||||
|
conditional idp-vols
|
||||||
|
"""
|
||||||
|
_, cfgdir, xcfg = self.prep()
|
||||||
|
au = AuthSrv(Cfg(c=[cfgdir + "/7.conf"], **xcfg), self.log)
|
||||||
|
au.idp_checkin(None, "iua", "ga")
|
||||||
|
au.idp_checkin(None, "iuab", "ga,gb")
|
||||||
|
au.idp_checkin(None, "iuabc", "ga,gb,gc")
|
||||||
|
au.idp_checkin(None, "iub", "gb")
|
||||||
|
au.idp_checkin(None, "iubc", "gb,gc")
|
||||||
|
au.idp_checkin(None, "iuc", "gc")
|
||||||
|
zs = """
|
||||||
|
u/iua
|
||||||
|
u/iuab
|
||||||
|
u/iuabc
|
||||||
|
u/iub
|
||||||
|
u/iubc
|
||||||
|
u/iuc
|
||||||
|
uya/iua
|
||||||
|
uya/iuab
|
||||||
|
uya/iuabc
|
||||||
|
uyab/iuab
|
||||||
|
uyab/iuabc
|
||||||
|
una/iub
|
||||||
|
una/iubc
|
||||||
|
una/iuc
|
||||||
|
unab/iuc
|
||||||
|
gya/ga
|
||||||
|
gna/gb
|
||||||
|
gna/gc
|
||||||
|
gnab/gc
|
||||||
|
"""
|
||||||
|
zl1 = sorted(zs.strip().split("\n"))[:]
|
||||||
|
zl2 = sorted(list(au.vfs.all_vols))[:]
|
||||||
|
# print(" ".join(zl1))
|
||||||
|
# print(" ".join(zl2))
|
||||||
|
self.assertListEqual(zl1, zl2)
|
||||||
|
|
||||||
|
def test_8(self):
|
||||||
|
"""
|
||||||
|
conditional non-idp vols
|
||||||
|
"""
|
||||||
|
_, cfgdir, xcfg = self.prep()
|
||||||
|
xcfg = {"vc": True}
|
||||||
|
au = AuthSrv(Cfg(c=[cfgdir + "/8.conf"], **xcfg), self.log)
|
||||||
|
zs = """
|
||||||
|
u/iua
|
||||||
|
u/iuab
|
||||||
|
u/iuabc
|
||||||
|
u/iub
|
||||||
|
u/iubc
|
||||||
|
u/iuc
|
||||||
|
uya/iua
|
||||||
|
uya/iuab
|
||||||
|
uya/iuabc
|
||||||
|
uyab/iuab
|
||||||
|
uyab/iuabc
|
||||||
|
una/iub
|
||||||
|
una/iubc
|
||||||
|
una/iuc
|
||||||
|
unab/iuc
|
||||||
|
gya/ga
|
||||||
|
gna/gb
|
||||||
|
gna/gc
|
||||||
|
gnab/gc
|
||||||
|
"""
|
||||||
|
zl1 = sorted(zs.strip().split("\n"))[:]
|
||||||
|
zl2 = sorted(list(au.vfs.all_vols))[:]
|
||||||
|
self.assertListEqual(zl1, zl2)
|
||||||
|
|||||||
@@ -82,6 +82,19 @@ def get_ramdisk():
|
|||||||
return subdir(vol)
|
return subdir(vol)
|
||||||
|
|
||||||
if os.path.exists("/Volumes"):
|
if os.path.exists("/Volumes"):
|
||||||
|
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
sck.bind(("127.0.0.1", 2775))
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
print("waiting for 2775")
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
v = "/Volumes/cptd"
|
||||||
|
if os.path.exists(v):
|
||||||
|
return subdir(v)
|
||||||
|
|
||||||
# hdiutil eject /Volumes/cptd/
|
# hdiutil eject /Volumes/cptd/
|
||||||
devname, _ = chkcmd("hdiutil attach -nomount ram://131072".split())
|
devname, _ = chkcmd("hdiutil attach -nomount ram://131072".split())
|
||||||
devname = devname.strip()
|
devname = devname.strip()
|
||||||
@@ -97,6 +110,7 @@ def get_ramdisk():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
sck.close()
|
||||||
return subdir("/Volumes/cptd")
|
return subdir("/Volumes/cptd")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(repr(ex))
|
print(repr(ex))
|
||||||
@@ -129,22 +143,22 @@ class Cfg(Namespace):
|
|||||||
def __init__(self, a=None, v=None, c=None, **ka0):
|
def __init__(self, a=None, v=None, c=None, **ka0):
|
||||||
ka = {}
|
ka = {}
|
||||||
|
|
||||||
ex = "chpw daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink ih ihead magic hardlink_only nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tarcmp no_thumb no_vthumb no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz rss smb srch_dbg srch_excl stats uqe vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
|
ex = "chpw daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only ih ihead magic nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz rmagic rss smb srch_dbg srch_excl stats uqe vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
|
||||||
ka.update(**{k: False for k in ex.split()})
|
ka.update(**{k: False for k in ex.split()})
|
||||||
|
|
||||||
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump re_dhash plain_ip"
|
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump re_dhash see_dots plain_ip"
|
||||||
ka.update(**{k: True for k in ex.split()})
|
ka.update(**{k: True for k in ex.split()})
|
||||||
|
|
||||||
ex = "ah_cli ah_gen css_browser dbpath hist ipu js_browser js_other mime mimes no_forget no_hash no_idx nonsus_urls og_tpl og_ua ua_nodoc ua_nozip"
|
ex = "ah_cli ah_gen css_browser dbpath hist ipu js_browser js_other mime mimes no_forget no_hash no_idx nonsus_urls og_tpl og_ua ua_nodoc ua_nozip"
|
||||||
ka.update(**{k: None for k in ex.split()})
|
ka.update(**{k: None for k in ex.split()})
|
||||||
|
|
||||||
ex = "hash_mt hsortn safe_dedup srch_time u2abort u2j u2sz"
|
ex = "hash_mt hsortn safe_dedup srch_time tail_fd tail_rate u2abort u2j u2sz"
|
||||||
ka.update(**{k: 1 for k in ex.split()})
|
ka.update(**{k: 1 for k in ex.split()})
|
||||||
|
|
||||||
ex = "au_vol dl_list mtab_age reg_cap s_thead s_tbody th_convt ups_who zip_who"
|
ex = "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()})
|
ka.update(**{k: 9 for k in ex.split()})
|
||||||
|
|
||||||
ex = "db_act forget_ip k304 loris no304 re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs"
|
ex = "db_act forget_ip idp_store k304 loris no304 nosubtle 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()})
|
ka.update(**{k: 0 for k in ex.split()})
|
||||||
|
|
||||||
ex = "ah_alg bname chpw_db doctitle df exit favico idp_h_usr 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 unlist vname xff_src zipmaxt R RS SR"
|
ex = "ah_alg bname chpw_db doctitle df exit favico idp_h_usr 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 unlist vname xff_src zipmaxt R RS SR"
|
||||||
@@ -166,6 +180,7 @@ class Cfg(Namespace):
|
|||||||
v=v or [],
|
v=v or [],
|
||||||
c=c,
|
c=c,
|
||||||
E=E,
|
E=E,
|
||||||
|
bup_ck="sha512",
|
||||||
dbd="wal",
|
dbd="wal",
|
||||||
dk_salt="b" * 16,
|
dk_salt="b" * 16,
|
||||||
fk_salt="a" * 16,
|
fk_salt="a" * 16,
|
||||||
@@ -178,6 +193,8 @@ class Cfg(Namespace):
|
|||||||
mte={"a": True},
|
mte={"a": True},
|
||||||
mth={},
|
mth={},
|
||||||
mtp=[],
|
mtp=[],
|
||||||
|
put_ck="sha512",
|
||||||
|
put_name="put-{now.6f}-{cip}.bin",
|
||||||
mv_retry="0/0",
|
mv_retry="0/0",
|
||||||
rm_retry="0/0",
|
rm_retry="0/0",
|
||||||
s_rd_sz=256 * 1024,
|
s_rd_sz=256 * 1024,
|
||||||
|
|||||||
Reference in New Issue
Block a user