refactor(auth): replace dashboard sessions with stateless tokens and session control (#6329)

* refactor(auth): replace dashboard sessions with stateless tokens

* feat(auth): harden session issuance and distributed enforcement

* fix(proxy): preserve trusted proxy compatibility defaults

* refactor: address dashboard auth review feedback

* refactor: remove classic frontend and flatten web app
This commit is contained in:
Calcium-Ion
2026-07-20 16:48:43 +08:00
committed by GitHub
parent 5a6c53d496
commit 31d70fca39
1605 changed files with 17511 additions and 147913 deletions
+15 -7
View File
@@ -16,7 +16,7 @@ cp ../new-api-macos ../new-api
**Option B: Build from source (requires Go)**
TODO
### 3. Electron Dependencies
### 2. Electron Dependencies
```bash
cd electron
npm install
@@ -24,13 +24,21 @@ npm install
## Development
Run the app in development mode:
Start the backend, the frontend, and Electron in separate terminals:
```bash
npm start
# Repository root
go run main.go
# Repository root
make dev-web
# electron/
npm run dev-app
```
This will:
- Start the Go backend on port 3000
- Use the Go backend on port 3000
- Use the Rsbuild frontend development server on port 5173
- Open an Electron window with DevTools enabled
- Create a system tray icon (menu bar on macOS)
- Store database in `../data/new-api.db`
@@ -39,10 +47,10 @@ This will:
### Quick Build
```bash
# Ensure Go binary exists in parent directory
ls ../new-api # Should exist
# From electron/, build the frontend, Go binary, and desktop package
./build.sh
# Build for current platform
# Or package an existing binary for the current platform
npm run build
# Platform-specific builds
+3 -2
View File
@@ -6,7 +6,8 @@ echo "Building New API Electron App..."
echo "Step 1: Building frontend..."
cd ../web
DISABLE_ESLINT_PLUGIN='true' bun run build
bun install --frozen-lockfile
DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(git describe --tags --always) bun run build
cd ../electron
echo "Step 2: Building Go backend..."
@@ -38,4 +39,4 @@ else
npm run build
fi
echo "Build complete! Check electron/dist/ for output."
echo "Build complete! Check electron/dist/ for output."
+4 -4
View File
@@ -9,7 +9,7 @@ let serverProcess;
let tray = null;
let serverErrorLogs = [];
const PORT = 3000;
const DEV_FRONTEND_PORT = 5173; // Vite dev server port
const DEV_FRONTEND_PORT = 5173; // Rsbuild dev server port
// 保存日志到文件并打开
function saveAndOpenErrorLog() {
@@ -235,7 +235,7 @@ function startServer() {
console.log('Development mode: skipping server startup');
console.log('Please make sure you have started:');
console.log(' 1. Go backend: go run main.go (port 3000)');
console.log(' 2. Frontend dev server: cd web && bun dev (port 5173)');
console.log(' 2. Frontend dev server: make dev-web (port 5173)');
console.log('');
console.log('Checking if servers are running...');
@@ -248,7 +248,7 @@ function startServer() {
.catch((err) => {
console.error(`✗ Cannot connect to frontend dev server on port ${DEV_FRONTEND_PORT}`);
console.error('Please make sure the frontend dev server is running:');
console.error(' cd web && bun dev');
console.error(' make dev-web');
reject(err);
});
return;
@@ -587,4 +587,4 @@ app.on('before-quit', (event) => {
app.exit();
});
}
});
});
-4
View File
@@ -60,10 +60,6 @@
"from": "../new-api",
"to": "bin/new-api"
},
{
"from": "../web/dist",
"to": "web/dist"
},
{
"from": "../LICENSE",
"to": "licenses/LICENSE"