From 380e25c4f71afc8f0a1b6859446f16109df238e3 Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 23 Dec 2025 21:24:26 +0800 Subject: [PATCH] update PRESS - JCLOUDE --- .github/workflows/main.yaml | 8 ++++---- dashboard/tests-e2e/tests/dashboard/auth.setup.ts | 4 ++-- press/api/client.py | 2 +- press/auth.py | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b4024034..a957c5cb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -90,8 +90,8 @@ jobs: name: Client runs-on: ubuntu-latest env: - PRESS_ADMIN_USER_EMAIL: playwright@example.com - PRESS_ADMIN_USER_PASSWORD: playwright + JCLOUDE _ADMIN_USER_EMAIL: playwright@example.com + JCLOUDE _ADMIN_USER_PASSWORD: playwright BASE_URL: http://test_site:8000 services: @@ -169,8 +169,8 @@ jobs: working-directory: /home/runner/jingrow-bench/apps/jcloude/dashboard run: | bench --site test_site execute jcloude.jcloude.doctype.team.test_team.create_test_jcloude_admin_team \ - --kwargs "{\"email\": \"${PRESS_ADMIN_USER_EMAIL}\", \"free_account\": True, \"skip_onboarding\": True}" - bench --site test_site set-password "$PRESS_ADMIN_USER_EMAIL" "$PRESS_ADMIN_USER_PASSWORD" + --kwargs "{\"email\": \"${JCLOUDE _ADMIN_USER_EMAIL}\", \"free_account\": True, \"skip_onboarding\": True}" + bench --site test_site set-password "$JCLOUDE _ADMIN_USER_EMAIL" "$JCLOUDE _ADMIN_USER_PASSWORD" - name: Run Playwright Tests working-directory: /home/runner/jingrow-bench/apps/jcloude/dashboard diff --git a/dashboard/tests-e2e/tests/dashboard/auth.setup.ts b/dashboard/tests-e2e/tests/dashboard/auth.setup.ts index 518d7295..707c8a8d 100644 --- a/dashboard/tests-e2e/tests/dashboard/auth.setup.ts +++ b/dashboard/tests-e2e/tests/dashboard/auth.setup.ts @@ -4,8 +4,8 @@ import { fileURLToPath } from 'url'; import { test as setup } from "./coverage.fixture"; const localCloudBaseUrl = process.env.BASE_URL!; -const userEmail = process.env.PRESS_ADMIN_USER_EMAIL!; -const userPassword = process.env.PRESS_ADMIN_USER_PASSWORD!; +const userEmail = process.env.JCLOUDE _ADMIN_USER_EMAIL!; +const userPassword = process.env.JCLOUDE _ADMIN_USER_PASSWORD!; const sessionStoragePath = process.env.PLAYWRIGHT_SESSION_STORAGE_PATH || '../../.auth/session.json'; function getSessionStorageStatePath() { diff --git a/press/api/client.py b/press/api/client.py index f0644ea1..a40bce4a 100644 --- a/press/api/client.py +++ b/press/api/client.py @@ -488,7 +488,7 @@ def check_permissions(doctype): if not hasattr(jingrow.local, "team") or not jingrow.local.team(): jingrow.throw( - "current_team is not set. Use X-PRESS-TEAM header in the request to set it.", + "current_team is not set. Use X-JCLOUDE -TEAM header in the request to set it.", TeamHeaderNotInRequestError, ) diff --git a/press/auth.py b/press/auth.py index 098f22e2..422bf04c 100644 --- a/press/auth.py +++ b/press/auth.py @@ -7,8 +7,8 @@ import traceback import jingrow -PRESS_AUTH_KEY = "jcloude-auth-logs" -PRESS_AUTH_MAX_ENTRIES = 1000000 +JCLOUDE _AUTH_KEY = "jcloude-auth-logs" +JCLOUDE _AUTH_MAX_ENTRIES = 1000000 ALLOWED_PATHS = [ @@ -110,23 +110,23 @@ def log(path, user_type): "referer": jingrow.request.headers.get("Referer", ""), } - if jingrow.cache().llen(PRESS_AUTH_KEY) > PRESS_AUTH_MAX_ENTRIES: - jingrow.cache().ltrim(PRESS_AUTH_KEY, 1, -1) + if jingrow.cache().llen(JCLOUDE _AUTH_KEY) > JCLOUDE _AUTH_MAX_ENTRIES: + jingrow.cache().ltrim(JCLOUDE _AUTH_KEY, 1, -1) serialized = json.dumps(data, sort_keys=True, default=str) - jingrow.cache().rpush(PRESS_AUTH_KEY, serialized) + jingrow.cache().rpush(JCLOUDE _AUTH_KEY, serialized) def flush(): log_file = os.path.join(jingrow.utils.get_bench_path(), "logs", "jcloude.auth.json.log") try: # Fetch all entries without removing from cache - logs = jingrow.cache().lrange(PRESS_AUTH_KEY, 0, -1) + logs = jingrow.cache().lrange(JCLOUDE _AUTH_KEY, 0, -1) if logs: logs = list(map(jingrow.safe_decode, logs)) with open(log_file, "a", os.O_NONBLOCK) as f: f.write("\n".join(logs)) f.write("\n") # Remove fetched entries from cache - jingrow.cache().ltrim(PRESS_AUTH_KEY, len(logs) - 1, -1) + jingrow.cache().ltrim(JCLOUDE _AUTH_KEY, len(logs) - 1, -1) except Exception: traceback.print_exc()