mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
"upload only" icon on write-only folders
This commit is contained in:
parent
14af136fcd
commit
89c6c2e0d9
|
@ -3141,10 +3141,13 @@ class HttpCli(object):
|
|||
if len(ext) > 11:
|
||||
ext = "~" + ext[-9:]
|
||||
|
||||
return self.tx_svg(ext, exact)
|
||||
|
||||
def tx_svg(self, txt: str, small: bool = False) -> bool:
|
||||
# chrome cannot handle more than ~2000 unique SVGs
|
||||
# so url-param "raster" returns a png/webp instead
|
||||
# (useragent-sniffing kinshi due to caching proxies)
|
||||
mime, ico = self.ico.get(ext, not exact, "raster" in self.uparam)
|
||||
mime, ico = self.ico.get(txt, not small, "raster" in self.uparam)
|
||||
|
||||
lm = formatdate(self.E.t0, usegmt=True)
|
||||
self.reply(ico, mime=mime, headers={"Last-Modified": lm})
|
||||
|
@ -3409,7 +3412,7 @@ class HttpCli(object):
|
|||
return True
|
||||
|
||||
if "th" in self.ouparam:
|
||||
return self.tx_ico("a.e" + pt[:3])
|
||||
return self.tx_svg("e" + pt[:3])
|
||||
|
||||
t = t.format(self.args.SR)
|
||||
qv = quotep(self.vpaths) + self.ourlq()
|
||||
|
@ -3791,8 +3794,8 @@ class HttpCli(object):
|
|||
if idx and hasattr(idx, "p_end"):
|
||||
icur = idx.get_cur(dbv.realpath)
|
||||
|
||||
th_fmt = self.uparam.get("th")
|
||||
if self.can_read:
|
||||
th_fmt = self.uparam.get("th")
|
||||
if th_fmt is not None:
|
||||
nothumb = "dthumb" in dbv.flags
|
||||
if is_dir:
|
||||
|
@ -3822,7 +3825,7 @@ class HttpCli(object):
|
|||
break
|
||||
|
||||
if is_dir:
|
||||
return self.tx_ico("a.folder")
|
||||
return self.tx_svg("folder")
|
||||
|
||||
thp = None
|
||||
if self.thumbcli and not nothumb:
|
||||
|
@ -3836,6 +3839,9 @@ class HttpCli(object):
|
|||
|
||||
return self.tx_ico(rem)
|
||||
|
||||
elif self.can_write and th_fmt is not None:
|
||||
return self.tx_svg("upload\nonly")
|
||||
|
||||
elif self.can_get and self.avn:
|
||||
axs = self.avn.axs
|
||||
if self.uname not in axs.uhtml:
|
||||
|
|
|
@ -8,7 +8,7 @@ import re
|
|||
|
||||
from .__init__ import PY2
|
||||
from .th_srv import HAVE_PIL, HAVE_PILF
|
||||
from .util import BytesIO # type: ignore
|
||||
from .util import BytesIO, html_escape # type: ignore
|
||||
|
||||
|
||||
class Ico(object):
|
||||
|
@ -98,6 +98,6 @@ class Ico(object):
|
|||
fill="#{}" font-family="monospace" font-size="14px" style="letter-spacing:.5px">{}</text>
|
||||
</g></svg>
|
||||
"""
|
||||
svg = svg.format(h, c[:6], c[6:], ext)
|
||||
svg = svg.format(h, c[:6], c[6:], html_escape(ext, True))
|
||||
|
||||
return "image/svg+xml", svg.encode("utf-8")
|
||||
|
|
Loading…
Reference in a new issue