From ac40dccc8fc858ae3de293c4afed89512c157c8a Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 15 Oct 2023 20:06:46 +0000 Subject: [PATCH] v1.9.12 --- README.md | 3 ++- copyparty/__version__.py | 4 ++-- copyparty/cfg.py | 1 + copyparty/ico.py | 16 +++++++++++----- copyparty/web/browser.js | 7 ++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 35b17015..e7fd65c2 100644 --- a/README.md +++ b/README.md @@ -580,7 +580,8 @@ the up2k UI is the epitome of polished inutitive experiences: * "parallel uploads" specifies how many chunks to upload at the same time * `[🏃]` analysis of other files should continue while one is uploading * `[🥔]` shows a simpler UI for faster uploads from slow devices -* `[💭]` ask for confirmation before files are added to the queue +* `[🎲]` generate random filenames during upload +* `[📅]` preserve last-modified timestamps; server times will match yours * `[🔎]` switch between upload and [file-search](#file-search) mode * ignore `[🔎]` if you add files by dragging them into the browser diff --git a/copyparty/__version__.py b/copyparty/__version__.py index 2ec8e228..4ddaa4ea 100644 --- a/copyparty/__version__.py +++ b/copyparty/__version__.py @@ -1,8 +1,8 @@ # coding: utf-8 -VERSION = (1, 9, 11) +VERSION = (1, 9, 12) CODENAME = "prometheable" -BUILD_DT = (2023, 10, 9) +BUILD_DT = (2023, 10, 15) S_VERSION = ".".join(map(str, VERSION)) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) diff --git a/copyparty/cfg.py b/copyparty/cfg.py index b44a6626..cc982bf6 100644 --- a/copyparty/cfg.py +++ b/copyparty/cfg.py @@ -86,6 +86,7 @@ flagcats = { "vmaxn=4k": "max 4096 files in volume (suffixes: b, k, m, g, t)", "rand": "force randomized filenames, 9 chars long by default", "nrand=N": "randomized filenames are N chars long", + "u2ts=fc": "[f]orce [c]lient-last-modified or [u]pload-time", "sz=1k-3m": "allow filesizes between 1 KiB and 3MiB", "df=1g": "ensure 1 GiB free disk space", }, diff --git a/copyparty/ico.py b/copyparty/ico.py index 81211dc3..a2ba0b0e 100644 --- a/copyparty/ico.py +++ b/copyparty/ico.py @@ -4,6 +4,7 @@ from __future__ import print_function, unicode_literals import argparse # typechk import colorsys import hashlib +import re from .__init__ import PY2 from .th_srv import HAVE_PIL, HAVE_PILF @@ -24,7 +25,7 @@ class Ico(object): zb = [ord(x) for x in zb] c1 = colorsys.hsv_to_rgb(zb[0] / 256.0, 1, 0.3) - c2 = colorsys.hsv_to_rgb(zb[0] / 256.0, 1, 1) + c2 = colorsys.hsv_to_rgb(zb[0] / 256.0, 0.8 if HAVE_PILF else 1, 1) ci = [int(x * 255) for x in list(c1) + list(c2)] c = "".join(["{:02x}".format(x) for x in ci]) @@ -38,16 +39,21 @@ class Ico(object): if chrome: # cannot handle more than ~2000 unique SVGs if HAVE_PILF: + # pillow 10.1 made this the default font; + # svg: 3.7s, this: 36s try: from PIL import Image, ImageDraw - h = int(96 * h / w) - w = 96 + # [.lt] are hard to see lowercase / unspaced + ext2 = re.sub("(.)", "\\1 ", ext).upper() + + h = int(128 * h / w) + w = 128 img = Image.new("RGB", (w, h), "#" + c[:6]) pb = ImageDraw.Draw(img) - _, _, tw, th = pb.textbbox((0, 0), ext, font_size=16) + _, _, tw, th = pb.textbbox((0, 0), ext2, font_size=16) xy = ((w - tw) // 2, (h - th) // 2) - pb.text(xy, ext, fill="#" + c[6:], font_size=16) + pb.text(xy, ext2, fill="#" + c[6:], font_size=16) img = img.resize((w * 2, h * 2), Image.NEAREST) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 7881be37..c36c6f39 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1050,7 +1050,7 @@ ebi('op_up2k').innerHTML = ( ' \n' + ' \n' + ' \n' + - '