feat: initial commit - Go + CGO captcha recognition service
Build and Deploy / build-frontend (push) Failing after 2s
Build and Deploy / build-backend (push) Has been skipped
Build and Deploy / build-docker (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped

Features:
- Go + CGO ONNX/OpenCV wrapper for high performance
- SQLite (default) / MySQL database support
- Optional Redis caching
- JWT authentication system
- Multiple captcha recognition APIs:
  - OCR text recognition
  - Slider captcha matching
  - Image similarity comparison
  - Rotation captcha detection
  - Object detection
- React frontend with install wizard
- Docker and docker-compose support
- Gitea CI/CD pipeline

Project structure:
- cmd/server: Main entry point
- internal/: Core business logic
- pkg/onnx: ONNX Runtime CGO wrapper
- pkg/opencv: OpenCV CGO wrapper
- web/: React frontend
- deploy/: Deployment configs
- scripts/: Utility scripts
This commit is contained in:
2026-07-16 08:56:38 +00:00
commit 524c404194
32 changed files with 2971 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
import { useState } from 'react'
export default function RegisterPage() {
const [username, setUsername] = useState('')
const [password, setPassword] = useState('')
const [code, setCode] = useState('')
const [error, setError] = useState('')
const [success, setSuccess] = useState('')
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setError('')
setSuccess('')
setLoading(true)
try {
const res = await fetch('/api/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password, registration_code: code }),
})
const data = await res.json()
if (!res.ok) {
setError(data.error || '注册失败')
return
}
setSuccess('注册成功,请登录')
setTimeout(() => window.location.href = '/login', 2000)
} catch {
setError('网络错误')
} finally {
setLoading(false)
}
}
return (
<div className="container" style={{ maxWidth: '400px', marginTop: '100px' }}>
<div className="card">
<h1 style={{ marginBottom: '24px', textAlign: 'center' }}></h1>
<form onSubmit={handleSubmit}>
<div className="form-group">
<label className="label"></label>
<input
type="text"
className="input"
value={username}
onChange={e => setUsername(e.target.value)}
placeholder="请输入用户名"
required
/>
</div>
<div className="form-group">
<label className="label"></label>
<input
type="password"
className="input"
value={password}
onChange={e => setPassword(e.target.value)}
placeholder="请输入密码"
required
/>
</div>
<div className="form-group">
<label className="label"></label>
<input
type="text"
className="input"
value={code}
onChange={e => setCode(e.target.value)}
placeholder="请输入注册码"
required
/>
</div>
{error && <div className="error">{error}</div>}
{success && <div className="success">{success}</div>}
<button type="submit" className="button" style={{ width: '100%' }} disabled={loading}>
{loading ? '注册中...' : '注册'}
</button>
</form>
<div className="text-center mt-4">
<a href="/login" style={{ color: 'var(--primary)' }}></a>
</div>
</div>
</div>
)
}