Skip to content

Commit

Permalink
option to restrict recent-uploads visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Jan 25, 2025
1 parent cdd3b67 commit b8b5214
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,8 @@ will show uploader IP and upload-time if the visitor has the admin permission
* global-option `--ups-when` makes upload-time visible to all users, and not just admins
* global-option `--ups-who` (volflag `ups_who`) specifies who gets access (0=nobody, 1=admins, 2=everyone), default=2
note that the [🧯 unpost](#unpost) feature is better suited for viewing *your own* recent uploads, as it includes the option to undo/delete them
Expand Down
1 change: 1 addition & 0 deletions copyparty/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,7 @@ def add_admin(ap):
ap2.add_argument("--no-ups-page", action="store_true", help="disable ?ru (list of recent uploads)")
ap2.add_argument("--no-up-list", action="store_true", help="don't show list of incoming files in controlpanel")
ap2.add_argument("--dl-list", metavar="LVL", type=int, default=2, help="who can see active downloads in the controlpanel? [\033[32m0\033[0m]=nobody, [\033[32m1\033[0m]=admins, [\033[32m2\033[0m]=everyone")
ap2.add_argument("--ups-who", metavar="LVL", type=int, default=2, help="who can see recent uploads on the ?ru page? [\033[32m0\033[0m]=nobody, [\033[32m1\033[0m]=admins, [\033[32m2\033[0m]=everyone (volflag=ups_who)")
ap2.add_argument("--ups-when", action="store_true", help="let everyone see upload timestamps on the ?ru page, not just admins")


Expand Down
1 change: 1 addition & 0 deletions copyparty/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def vf_vmap() -> dict[str, str]:
"unlist",
"u2abort",
"u2ts",
"ups_who",
):
ret[k] = k
return ret
Expand Down
6 changes: 6 additions & 0 deletions copyparty/httpcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5152,6 +5152,12 @@ def tx_rups(self) -> bool:
adm = "*" in vol.axs.uadmin or self.uname in vol.axs.uadmin
dots = "*" in vol.axs.udot or self.uname in vol.axs.udot

lvl = int(vol.flags["ups_who"])
if not lvl:
continue
elif lvl == 1 and not adm:
continue

n = 1000
q = "select sz, rd, fn, ip, at from up where at>0 order by at desc"
for sz, rd, fn, ip, at in cur.execute(q):
Expand Down

0 comments on commit b8b5214

Please sign in to comment.