Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: get username from dom#193

Merged
timerring merged 1 commit intomainfrom
dev
Feb 17, 2026
Merged

refactor: get username from dom#193
timerring merged 1 commit intomainfrom
dev

Conversation

@timerring
Copy link
Member

Summary

Fixed the avatar and username display issue for Huawei Developer platform. Changed username retrieval from API (which returned a masked phone number) to DOM-based extraction to get the actual community nickname.

Changes Made

huaweidev.js

  • Changed username retrieval from API (GOpen.User.getInfo returns masked phone number) to DOM extraction (.user_name selector) to get the actual community nickname
  • Avatar continues to be fetched from API's headPictureURL field
  • Enhanced cache validation by adding cachedUser.username non-empty check to prevent reusing old cache entries with empty usernames
  • Fixed CSRF token field name: now checks both udJson.csrf and udJson.csrftoken for compatibility

content.js

  • Synchronized Huawei Developer page user information caching logic: username is extracted from DOM .user_name, avatar from API
  • Ensures consistency with the executeScript logic in huaweidev.js

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (code changes that neither fix a bug nor add a feature)
  • Enhancement (improvement to existing functionality)

@timerring timerring self-assigned this Feb 17, 2026
@timerring timerring added the enhancement New feature or request label Feb 17, 2026
@timerring timerring merged commit 3562175 into main Feb 17, 2026
@timerring timerring deleted the dev branch February 17, 2026 02:21
Copy link
Member Author

@timerring timerring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant