mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 11:23:49 +08:00
allow uploads
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user