Skip to content

usera3/sub2-oidc-console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sub2 OIDC Console

Local tools and a lightweight web console for managing NodeLoc OIDC ChatGPT accounts and importing them into Sub2 / Sub2API.

This project wraps three operational flows:

  1. Manage OIDC-backed @fuckoai.oooooooooo.bond accounts
  2. Warm up a fresh account by logging it into ChatGPT in an incognito Chrome context
  3. Finalize Sub2 OpenAI OAuth by capturing the localhost:1455 callback and creating the corresponding OpenAI OAuth account inside Sub2

It also ships with a browser-based local control panel for:

  • viewing OIDC accounts
  • deleting/recreating a single test account
  • running the full single-account end-to-end flow
  • running only the third-step Sub2 finalization
  • editing local machine-specific configuration in the UI
  • checking environment health

Repository Layout

outputs/
  sub2_console/                    local web console
  start_sub2_console.ps1           stable console launcher
  stop_sub2_console.ps1            stable console stopper
  sub2_single_account_e2e.mjs      full single-account E2E runner
  run_sub2_single_account_e2e.ps1  PowerShell wrapper for full E2E runner
  sub2_finalize_openai_oauth.mjs   third-step-only finalizer
  finalize_sub2_openai_oauth.ps1   PowerShell wrapper for third-step-only flow
  nodeloc_api.py                   OIDC account CRUD wrapper
  sub2_console.config.example.json machine-specific config template
  sub2_portable/                   portable distributable directory

Requirements

  • Windows
  • Node.js 22+
  • Python 3.10+
  • Google Chrome
  • A valid NODELOC_NL_SESSION in the workspace .env
  • A reachable Sub2 instance

Quick Start

  1. Install dependencies:
npm install
  1. Create a workspace .env file containing at least:
NODELOC_NL_SESSION=your_real_nl_session_value
  1. Copy the config template:
Copy-Item .\outputs\sub2_console.config.example.json .\outputs\sub2_console.config.json
  1. Edit:
outputs/sub2_console.config.json

Set these values for your machine:

  • sub2ApiBaseUrl
  • oidcBaseUrl
  • deployEnvPath
  • chromePath
  • defaultE2EPort
  • defaultFinalizePort
  • defaultRunCount
  • defaultIntervalMinutes
  • connectionName
  • chatgptUrl
  1. Start the local console:
.\outputs\start_sub2_console.ps1
  1. Open:
http://127.0.0.1:8788/

Main Flows

1. Replace with one OIDC account

In the web console, click:

删光并只建 1 个账号

This deletes all current OIDC accounts and creates exactly one fresh account.

2. Full single-account E2E flow

Use:

.\outputs\run_sub2_single_account_e2e.ps1

Or click:

运行完整单账号闭环

The E2E runner will:

  1. delete all current OIDC accounts
  2. create exactly one new OIDC account
  3. open a fresh incognito Chrome with remote debugging
  4. warm up that account inside official ChatGPT
  5. generate a fresh Sub2 OpenAI OAuth link
  6. capture http://localhost:1455/auth/callback?...
  7. exchange the callback with Sub2
  8. create the OpenAI OAuth account in Sub2

3. Finalize only the third step

Use this only after the first two steps were already completed in the same incognito Chrome context.

PowerShell:

.\outputs\finalize_sub2_openai_oauth.ps1 -Port 9251

Or click:

只跑第三步补授权

Run Count and Interval Semantics

The UI now exposes two related fields:

  • 每批连续次数
  • 批次间隔分钟

Their meaning is:

  • 每批连续次数 = N: one batch contains N back-to-back runs
  • 批次间隔分钟 = M: after that whole batch finishes, wait M minutes, then start the next batch

Example:

  • 每批连续次数 = 3
  • 批次间隔分钟 = 5

Behavior:

  1. run 3 times in a row
  2. wait 5 minutes
  3. run 3 times again
  4. wait 5 minutes
  5. continue repeating

This is not "wait 5 minutes between each individual run".

If 批次间隔分钟 = 0, only one batch is executed.

Environment Health

The web console includes an environment self-check panel for:

  • Node.js
  • Python
  • Chrome path
  • workspace .env
  • NODELOC_NL_SESSION
  • Sub2 deploy/.env
  • local Sub2 /health
  • OIDC site reachability

Security Notes

  • Do not commit your real .env
  • Do not commit NODELOC_NL_SESSION
  • Do not share .nodeloc_managed_account.json / .nodeloc_managed_accounts.json
  • Do not share generated Chrome test profiles

The .gitignore already excludes these local/sensitive files.

Portable Bundle

There is also a prepared portable directory and zip:

  • outputs/sub2_portable/
  • outputs/sub2_portable_bundle.zip

This is intended for handoff to another Windows machine.

Troubleshooting

Control panel says Failed to fetch

Usually the console service is not running.

Start it:

.\outputs\start_sub2_console.ps1

Stop it:

.\outputs\stop_sub2_console.ps1

Full flow gets stuck on ChatGPT public homepage

The project now guards against falsely treating the public homepage as a logged-in session. If this still happens, rerun the flow and inspect the task log panel.

No Sub2 account appears after OAuth exchange

The latest E2E flow already performs both:

  1. /admin/openai/exchange-code
  2. /admin/accounts create

If the UI still does not show the new account, inspect the run result table and the raw task log.

Local Development

Minimal local commands:

npm install
npm run console

And for syntax checks:

node --check .\outputs\sub2_single_account_e2e.mjs
node --check .\outputs\sub2_console\server.mjs

License / Ownership

This project contains operational automation tailored for a specific NodeLoc OIDC + Sub2 workflow. Review every environment-specific path and endpoint before sharing it publicly.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors