allow uploads

This commit is contained in:
firestar5683
2026-03-08 20:45:59 -05:00
parent 5ca3f503ee
commit c8f18d1497
28 changed files with 185 additions and 39 deletions
+7 -2
View File
@@ -103,6 +103,7 @@ log_recv_queue: Queue[str] = queue.Queue()
cancelled_uploads: set[str] = set()
cur_upload_items: dict[int, UploadItem | None] = {}
params_store = Params()
def strip_bz2_extension(fn: str) -> str:
@@ -115,6 +116,10 @@ class AbortTransferException(Exception):
pass
def always_allow_uploads() -> bool:
return params_store.get_bool("AlwaysAllowUploads")
class UploadQueueCache:
@staticmethod
@@ -214,7 +219,7 @@ def cb(sm, item, tid, end_event: threading.Event, sz: int, cur: int) -> None:
# or if athenad is shutting down to re-connect the websocket
sm.update(0)
metered = sm['deviceState'].networkMetered
if metered and (not item.allow_cellular):
if metered and (not item.allow_cellular) and not always_allow_uploads():
raise AbortTransferException
if end_event.is_set():
@@ -247,7 +252,7 @@ def upload_handler(end_event: threading.Event) -> None:
sm.update(0)
metered = sm['deviceState'].networkMetered
network_type = sm['deviceState'].networkType.raw
if metered and (not item.allow_cellular):
if metered and (not item.allow_cellular) and not always_allow_uploads():
retry_upload(tid, end_event, False)
continue