Skip to content

feat(claim-node): implement node claiming functionality for publishers #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

snomiao
Copy link
Member

@snomiao snomiao commented May 28, 2025

  • Add a new route for GitHub OAuth device flow to facilitate node claiming.
  • Create ClaimNodePage for users to select a publisher and claim a node.
  • Implement ClaimMyNodePage for verifying GitHub repository ownership.
  • Introduce custom hooks for claiming nodes via API.
  • Enhance NodeDetails component to allow users to claim unclaimed nodes.
  • Ensure proper loading states and error handling during the claiming process.

this pr solves:
comfyanonymous/ComfyUI#821
Comfy-Org/ComfyUI-Manager#1820

providing a stage view
image

- Add a new route for GitHub OAuth device flow to facilitate node claiming.
- Create ClaimNodePage for users to select a publisher and claim a node.
- Implement ClaimMyNodePage for verifying GitHub repository ownership.
- Introduce custom hooks for claiming nodes via API.
- Enhance NodeDetails component to allow users to claim unclaimed nodes.
- Ensure proper loading states and error handling during the claiming process.
Copy link

vercel bot commented May 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
registry-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2025 2:49am

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

… by adjusting spacing and line breaks

feat(claim.tsx): wrap ClaimNodePage component with withAuth for authentication protection
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

snomiao added 4 commits June 16, 2025 15:12
…ties to Customer and Node interfaces to enhance API functionality

feat(generated.ts): add claimMyNode endpoint to allow publishers to claim unclaimed nodes they own, improving node management capabilities
…t support with Next.js

chore(tsconfig.json): update tsconfig structure and include next-env.d.ts for better type definitions in Next.js projects
…ith new endpoints and callback handling

refactor(claim): replace custom hook for claiming nodes with generated API hook for improved functionality
delete(api): remove outdated GitHub device flow endpoint and related custom hooks to streamline codebase
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@snomiao snomiao self-assigned this Jun 20, 2025
…GitHub OAuth integration

feat(github callback): update redirect logic to handle query parameters correctly for error and token
feat(github route): allow custom scope for GitHub OAuth and improve redirect URL construction
feat(CreatePublisherForm): add onSuccess and onCancel props for better handling of publisher creation
feat(CreatePublisherModal): create a modal component for publisher creation
feat(ClaimMyNodePage): implement GitHub verification process for claiming nodes
refactor(ClaimMyNodePage): streamline state management and error handling during the claiming process
chore(package): add octokit dependency for GitHub API interactions
delete(publishers claim-my-node page): remove old claim my node page in favor of the new implementation
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

…ts for displaying user, node, and publisher information with tooltips and click navigation

feat(claim-my-node): integrate new span components into ClaimMyNodePage for improved user experience and navigation to GitHub profiles and node/publisher details
Copy link

socket-security bot commented Jun 23, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​tsconfig/​next@​2.0.31001007678100

View full report

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

snomiao and others added 5 commits June 23, 2025 16:45
…n can edit nodes owned by them (#124)

fix(NodeDetails): update warningForAdminEdit logic to show warning if admin edits a node not owned by them
* refactor(app.tsx): remove dehydrateOptions for query persistence to simplify code and improve maintainability

* feat(_app.tsx): add build versioning using NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA to manage cache invalidation effectively

* feat(_app.tsx): add maxAge option to cache configuration to set cache duration to 1 day for improved performance and cache management

* chore(axios-instance.ts): remove Firebase authentication interceptor to simplify Axios instance configuration and reduce dependencies

* feat(NodeDetails): add useListPublishersForUser hook to check if admin can edit nodes owned by them

fix(NodeDetails): update warningForAdminEdit logic to show warning if admin edits a node not owned by them

* feat(AuthUI): integrate useAuthState to manage user authentication state and redirect users upon login
refactor(Logout): simplify logout process by clearing query cache and storage before signing out
refactor(Header): update login and signup button handlers to use router.push for better navigation
refactor(ProfileDropdown): enhance sign-out functionality to clear user data from cache and storage
fix(authAdmin): improve user redirection logic to handle authentication state more effectively
feat(getFromUrlSearchParam): add utility function to retrieve the current URL for redirection purposes
refactor(withAuth): streamline authentication check and loading state handling in HOC

* feat(_app.tsx): add Firebase JWT token interceptor to Axios instance for authenticated requests
refactor(_app.tsx): improve persistEffect function structure for better readability and maintainability

* docs(_app.tsx): add comments explaining the usage of NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA for cache busting and fallback behavior

* feat(AuthUI): replace div with Link component for logo navigation to improve accessibility and semantics

* feat(Logout.tsx): refactor logout functionality into a custom hook for better reusability and separation of concerns
fix(Logout.tsx): handle logout errors with toast notifications to improve user experience
refactor(ProfileDropdown.tsx): utilize the new useLogout hook for sign-out functionality to streamline code and enhance maintainability

* style(Header.tsx): change button color from light to dark for better visibility and consistency

* format: Apply prettier --fix changes

* fix(NodeDetails.tsx): refactor repository button to use onClick instead of anchor tag for better event handling
feat(NodeDetails.tsx): prevent default action and open repository link in a new tab for improved user experience

* style(NodeDetails.tsx): replace span with div for better semantic structure and accessibility in version changelog display

* Squashed commit of the following:

commit d75737c
Author: snomiao <[email protected]>
Date:   Tue Jun 3 13:12:21 2025 +0900

    Update OpenAPI (#102)

    * chore(api-gen): update cron schedule to run daily at midnight UTC for API type definitions
    chore(api-gen): refactor workflow steps to use bun for dependency management and API definition update
    chore(package): update orval dependency to version 7.9.0 for improved features and fixes
    refactor(orval.config.ts): adjust dotenv loading logic to be compatible with bun environment

    * chore: update lockfile

    * chore(package.json): update orval command to use bunx for better compatibility with package management

    * chore: generate backend API static type

    * Update orval.config.ts

    Co-authored-by: Copilot <[email protected]>

    ---------

    Co-authored-by: Copilot <[email protected]>

commit 6afd1f0
Author: snomiao <[email protected]>
Date:   Tue Jun 3 13:05:42 2025 +0900

    chore(ci): update CI workflow to use bunx for prettier and add sort-package-json step for better package.json formatting (#103)

    * chore(ci): update CI workflow to use bunx for prettier and add sort-package-json step for better package.json formatting

    * Update .github/workflows/react-ci.yml

    Co-authored-by: Copilot <[email protected]>

    ---------

    Co-authored-by: Copilot <[email protected]>

* chore(api-gen.yml): remove unnecessary blank line to improve workflow file readability

* chore(_app.tsx): remove commented-out code for user data persistence to clean up the codebase and improve readability

* docs(_app.tsx): update comment to clarify the purpose of query persistence in localStorage for better understanding

* format: Apply prettier --fix changes

* docs(_app.tsx): add comments to clarify the purpose of persistQueryClient and buster configuration for better understanding of the code

* format: Apply prettier --fix changes
…nd colors to streamline configuration and avoid unnecessary imports (#126)
* Fix: Remove legacyBehavior from Link components

* refactor(SearchHit.tsx): simplify JSX structure by removing unnecessary anchor tag and using React fragments for cleaner code

* format: Apply prettier --fix changes
* Add breadcrumb navigation to all admin pages

* Update components/common/Breadcrumb.tsx

Co-authored-by: Copilot <[email protected]>

* format: Apply prettier --fix changes

* Add breadcrumbs to all pages using Flowbite Breadcrumb component

* Fix import order and formatting in breadcrumb components

* Replace Button components with Link components in admin dashboard for better accessibility

* Fix build errors: update component naming convention and string template usage

* Update breadcrumbs: rename to 'Your Nodes', make 'Nodes' non-clickable in node detail page, simplify publisher breadcrumbs

* style(admin): add "dark" class to Breadcrumb.Item components for consistent styling across admin pages
style(pages): apply "dark" class to Breadcrumb.Item components for improved visual consistency in navigation elements

* format: Apply prettier --fix changes

---------

Co-authored-by: Copilot <[email protected]>
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

- Add useNextTranslation to all user-facing components
- Translate hardcoded strings in CreatePublisherModal
- Translate NodeClaimModal error messages and UI text
- Complete translation of claim-my-node page with step indicators
- Translate node claim selection page with publisher options
- Ensure all toast messages, form labels, and status text use t()
- Maintain translation key consistency with existing patterns
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@snomiao snomiao marked this pull request as ready for review June 30, 2025 05:18
@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 05:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the node-claiming feature via GitHub OAuth, allowing publishers to verify repo ownership and claim unclaimed nodes. Key changes include:

  • New API types, hooks, and mutation (claimMyNode, useClaimMyNode) for claiming nodes.
  • Two new pages (ClaimNodePage, ClaimMyNodePage) guiding users through publisher selection and OAuth verification.
  • UI updates across NodeDetails, modals, and translation files to support claim flow.

Reviewed Changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/api/generated.ts Generated API types & hooks for node-claiming endpoints
public/locales/zh/common.json Added Chinese translations for claim flow
public/locales/ja/common.json Added Japanese translations for claim flow
public/locales/en/common.json Added English translations for claim flow
pages/publishers/[publisherId]/claim-my-node.tsx Multi-stage page for GitHub OAuth verification & node claiming
pages/nodes/[nodeId]/claim.tsx Publisher selection page before OAuth flow
pages/admin/search-ranking.tsx Swapped next/router default import to useRouter
pages/admin/preempted-comfy-node-names.tsx Swapped next/router default import to useRouter
package.json Added @tsconfig/next and octokit dependencies
docs/github-app.md Documentation for setting up GitHub OAuth App
README.md Linked to GitHub OAuth docs in README
.env Added GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET placeholders
components/publisher/CreatePublisherModal.tsx New modal wrapper for creating publishers
components/publisher/CreatePublisherForm.tsx Form updates: onCancel/onSuccess props, layout adjustments
components/nodes/NodeDetails.tsx Added "Claim this node" button and handler in node details view
components/nodes/NodeClaimModal.tsx Updated modal to use translation keys and improved error msgs
components/common/Spans/index.tsx Central export of span components
components/common/Spans/GithubUserSpan.tsx Added span for linking GitHub usernames
components/common/Spans/NodeSpan.tsx Added span for linking node details
components/common/Spans/PublisherSpan.tsx Added span for linking publisher details
app/api/auth/github/route.ts Endpoint to initiate GitHub OAuth flow
app/api/auth/github/callback/route.ts Callback handler to exchange code for token and redirect
Comments suppressed due to low confidence (7)

src/api/generated.ts:543

  • [nitpick] Property has_fund uses snake_case, while other fields follow camelCase (e.g., createdAt). Consider renaming to hasFund for consistency in TypeScript models.
  has_fund?: boolean;

components/common/Spans/GithubUserSpan.tsx:3

  • A code snippet mistakenly appears inside the JSDoc comment; remove the stray <span line to clean up the component documentation.
            <span 

components/publisher/CreatePublisherForm.tsx:20

  • Missing import for useRouter from 'next/router'; without it, router will be undefined and calls like router.back() will fail.
    const router = useRouter()

app/api/auth/github/route.ts:56

  • Avoid hardcoding the host in OAuth redirects; derive the origin dynamically from request headers or an environment variable to support multiple deployments.
        const host = '3000.stukivx.snomiao.dev'

pages/publishers/[publisherId]/claim-my-node.tsx:65

  • The UseMutationResult from React Query does not include an isPending property; use isLoading to reflect the mutation in progress.
    const { mutate: claimNode, isPending: isClaimingNode } = useClaimMyNode({

public/locales/en/common.json:124

  • Inconsistent casing: use GitHub (capital H) instead of Github to match official branding.
  "Github": "Github",

components/publisher/CreatePublisherForm.tsx:50

  • Use the translation function t(...) for user-facing messages instead of a hardcoded English string to support localization.
                    toast.success('Publisher created successfully!')

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