Skip to content

fix(1point3acres): detect login via current Discuz X user-panel markup#2145

Open
jiancui-research wants to merge 1 commit into
jackwener:mainfrom
jiancui-research:fix/1point3acres-login-whoami-selector
Open

fix(1point3acres): detect login via current Discuz X user-panel markup#2145
jiancui-research wants to merge 1 commit into
jackwener:mainfrom
jiancui-research:fix/1point3acres-login-whoami-selector

Conversation

@jiancui-research

@jiancui-research jiancui-research commented Jul 17, 2026

Copy link
Copy Markdown

Problem

opencli 1point3acres whoami (and login-gated commands) report
AUTH_REQUIRED for users who are logged in. The site updated its header
markup, so the identity probe's username selector no longer matches:

document.querySelector('#um .vwmy h4 a, a.username, .vwmy a')

The logged-in user's own link is now:

<a href="space-uid-<uid>.html" title="访问我的空间">username</a>

Fix

  • Match the current username link, keeping the legacy selectors as fallback:

    - document.querySelector('#um .vwmy h4 a, a.username, .vwmy a')
    + document.querySelector('a[title="访问我的空间"], #um .vwmy h4 a, a.username, .vwmy a')

    a[title="访问我的空间"] matches only the current user's own space link, and
    the existing uid[=-](\d+) regex already handles the space-uid-<uid>.html
    href.

  • Also treat the logged-in header menu ids (#g_upmine, #extcreditmenu) as
    a login signal, so a future wording/markup change of the username link does
    not reintroduce a false AUTH_REQUIRED.

Verification

whoami returns the correct user_id / username for a logged-in session.
Behavior is unchanged for the current site and for legacy markup — the new
selector and guard only add fallbacks, never remove existing ones.

🤖 Generated with Claude Code

whoami and login-gated commands reported AUTH_REQUIRED for logged-in users
because the identity probe only matched the legacy Discuz member panel
(`#um .vwmy h4 a`), which the site no longer renders.

- Match the current header username link (`a[title="访问我的空间"]`) while
  keeping the legacy selectors as fallbacks; the existing uid regex already
  handles the `space-uid-<uid>.html` href.
- Also accept the logged-in header menu ids (`#g_upmine`, `#extcreditmenu`)
  as a login signal, so a future wording/markup change of the username link
  does not reintroduce a false AUTH_REQUIRED.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jiancui-research
jiancui-research force-pushed the fix/1point3acres-login-whoami-selector branch from ac66a13 to 486e015 Compare July 17, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant