-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
add nodeloc oauth2 login #1783
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
base: main
Are you sure you want to change the base?
add nodeloc oauth2 login #1783
Changes from all commits
bcca071
a77601f
32ac1fa
0169ddf
fcf9ef6
da50b23
d3e3fda
6590b51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ 'v*' ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
REGISTRY: docker.io | ||
IMAGE_NAME: nodeloc/new-api | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,46 @@ | ||||||||||||||||||||||
# NodeLoc New-API Docker部署 | ||||||||||||||||||||||
|
||||||||||||||||||||||
这是NodeLoc版本的New-API,支持NodeLoc OAuth2登录。 | ||||||||||||||||||||||
|
||||||||||||||||||||||
## 快速开始 | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. 下载docker-compose.yml文件: | ||||||||||||||||||||||
```bash | ||||||||||||||||||||||
curl -O https://raw.githubusercontent.com/nodeloc/new-api/main/docker-compose.yml | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainRepository link likely incorrect. The curl URL points to nodeloc/new-api, but this PR lives under QuantumNous/new-api. Use the current repository path or reference a release asset instead to avoid fetching the wrong compose. Proposed fix: -curl -O https://raw.githubusercontent.com/nodeloc/new-api/main/docker-compose.yml
+curl -O https://raw.githubusercontent.com/QuantumNous/new-api/main/docker-compose.yml 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
if command -v rg >/dev/null 2>&1; then
SEARCH_TOOL="rg"
else
SEARCH_TOOL=""
fi
echo "---- searching for literal 'nodeloc/new-api' ----"
if [ -n "$SEARCH_TOOL" ]; then
rg -n --hidden -S 'nodeloc/new-api' || true
else
grep -nR --exclude-dir=.git -e 'nodeloc/new-api' . || true
fi
echo "---- locating DOCKER_README.md files ----"
if command -v fd >/dev/null 2>&1; then
fd -HI --hidden --type f 'DOCKER_README.md' || true
else
find . -type f -iname 'DOCKER_README.md' -print || true
fi
echo "---- printing DOCKER_README.md contents (first 200 lines) if found ----"
while IFS= read -r file; do
echo "---- FILE: $file ----"
nl -ba "$file" | sed -n '1,200p' || true
done < <(find . -type f -iname 'DOCKER_README.md' -print)
echo "---- searching for any raw.githubusercontent.com occurrences ----"
if [ -n "$SEARCH_TOOL" ]; then
rg -n --hidden -S 'raw.githubusercontent.com' || true
else
grep -nR --exclude-dir=.git -e 'raw.githubusercontent.com' . || true
fi Length of output: 621 Replace nodeloc/new-api references with QuantumNous/new-api or a tagged release asset
🤖 Prompt for AI Agents
|
||||||||||||||||||||||
|
||||||||||||||||||||||
2. 启动服务: | ||||||||||||||||||||||
```bash | ||||||||||||||||||||||
docker-compose up -d | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
3. 访问 http://localhost:3000 | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
### 其他配置 | ||||||||||||||||||||||
```yaml | ||||||||||||||||||||||
environment: | ||||||||||||||||||||||
- SQL_DSN=root:123456@tcp(mysql:3306)/new-api | ||||||||||||||||||||||
- REDIS_CONN_STRING=redis://redis | ||||||||||||||||||||||
- TZ=Asia/Shanghai | ||||||||||||||||||||||
- ERROR_LOG_ENABLED=true | ||||||||||||||||||||||
- SESSION_SECRET=your_random_secret_key | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
Comment on lines
+20
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document NodeLoc OAuth env vars alongside core settings. Readers will miss how to wire OAuth unless the variables appear in the example block. - ERROR_LOG_ENABLED=true
- SESSION_SECRET=your_random_secret_key
+ # NodeLoc OAuth2
+ - NODELOC_OAUTH_ENABLED=true
+ - NODELOC_CLIENT_ID=${NODELOC_CLIENT_ID}
+ - NODELOC_CLIENT_SECRET=${NODELOC_CLIENT_SECRET}
+ # optional
+ # - NODELOC_MINIMUM_TRUST_LEVEL=2 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||
|
||||||||||||||||||||||
## NodeLoc OAuth2设置 | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. 访问 https://conn.nodeloc.cc/apps | ||||||||||||||||||||||
2. 创建新应用 | ||||||||||||||||||||||
3. 设置回调URL: `https://your-domain.com/api/oauth/nodeloc` | ||||||||||||||||||||||
4. 获取Client ID和Client Secret | ||||||||||||||||||||||
5. 在环境变量中配置 | ||||||||||||||||||||||
|
||||||||||||||||||||||
## 版本 | ||||||||||||||||||||||
|
||||||||||||||||||||||
- `latest`: 最新版本 | ||||||||||||||||||||||
- `v1.x.x`: 具体版本号 | ||||||||||||||||||||||
|
||||||||||||||||||||||
## 支持 | ||||||||||||||||||||||
|
||||||||||||||||||||||
- 项目地址: https://github.com/nodeloc/new-api | ||||||||||||||||||||||
- 问题反馈: https://github.com/nodeloc/new-api/issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enable QEMU for multi-arch emulation.
Without QEMU, arm64 builds may fail on x86 runners.
📝 Committable suggestion
🤖 Prompt for AI Agents