test(subscription): suspend client access checks

This commit is contained in:
chengma
2026-07-22 15:55:46 +08:00
parent 953d98314b
commit 9163f6b371
6 changed files with 35 additions and 4 deletions
-1
View File
@@ -189,7 +189,6 @@ def main() -> int:
if runtime_lease is not None:
app.aboutToQuit.connect(runtime_lease.release)
window.show()
QTimer.singleShot(0, window.begin_subscription_check)
QTimer.singleShot(
0,
lambda: update_health.write_health(health_context, "main_window_ready"),
+14 -2
View File
@@ -20,6 +20,8 @@ from .workers import SubscriptionCheckWorker
PREFERRED_WINDOW_SIZE = (1180, 760)
MIN_WINDOW_SIZE = (960, 640)
WINDOW_SCREEN_MARGIN = 40
# 订阅服务仍在联调期,暂不让客户端检查或限制本地工作流。
SUBSCRIPTION_CHECK_ENABLED = False
def _screen_available_geometry():
@@ -132,7 +134,12 @@ class MainWindow(QMainWindow):
self._header_title_label.setStyleSheet(
"font-size: 15px; font-weight: 600; color: #24292f;"
)
self._subscription_label = QLabel("会员:正在验证")
subscription_label_text = (
"会员:正在验证"
if SUBSCRIPTION_CHECK_ENABLED
else "会员:订阅检测已暂停"
)
self._subscription_label = QLabel(subscription_label_text)
self._subscription_label.setObjectName("subscriptionStatusLabel")
self._subscription_label.setAccessibleName("会员状态")
self._subscription_label.setStyleSheet("color: #0969da;")
@@ -232,7 +239,6 @@ class MainWindow(QMainWindow):
widget.refresh_gateway_state()
label = "自定义网关" if str(backend) == "direct" else "默认网关"
self.show_status("设置已保存,当前使用%s" % label, level="success")
self.begin_subscription_check()
@property
def subscription_status(self):
@@ -241,6 +247,10 @@ class MainWindow(QMainWindow):
def begin_subscription_check(self):
"""Refresh membership state without blocking the Qt GUI thread."""
if not SUBSCRIPTION_CHECK_ENABLED:
self._set_product_access(True)
self._set_subscription_label("会员:订阅检测已暂停", "muted")
return
self._subscription_request_token += 1
token = self._subscription_request_token
if self._subscription_worker is not None:
@@ -272,6 +282,8 @@ class MainWindow(QMainWindow):
def ensure_subscription_for_new_submit(self, action_name="生成"):
"""Return whether a new product request may start from the current UI."""
if not SUBSCRIPTION_CHECK_ENABLED:
return True
status = self._subscription_status
if status.allows_product_workflows:
return True