Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2a726020
authored
Nov 16, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: linuxdo oauth endpoint -> environment
parent
9009a572
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
.env.example
+3
-0
controller/linuxdo.go
+2
-2
No files found.
.env.example
View file @
2a726020
...
@@ -67,6 +67,9 @@
...
@@ -67,6 +67,9 @@
# 设置 Dify 渠道是否输出工作流和节点信息到客户端
# 设置 Dify 渠道是否输出工作流和节点信息到客户端
# DIFY_DEBUG=true
# DIFY_DEBUG=true
# LinuxDo相关配置
LINUX_DO_TOKEN_ENDPOINT=https://connect.linux.do/oauth2/token
LINUX_DO_USER_ENDPOINT=https://connect.linux.do/api/user
# 节点类型
# 节点类型
# 如果是主节点则为master
# 如果是主节点则为master
...
...
controller/linuxdo.go
View file @
2a726020
...
@@ -84,7 +84,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
...
@@ -84,7 +84,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
}
}
// Get access token using Basic auth
// Get access token using Basic auth
tokenEndpoint
:=
"https://connect.linux.do/oauth2/token"
tokenEndpoint
:=
common
.
GetEnvOrDefaultString
(
"LINUX_DO_TOKEN_ENDPOINT"
,
"https://connect.linux.do/oauth2/token"
)
credentials
:=
common
.
LinuxDOClientId
+
":"
+
common
.
LinuxDOClientSecret
credentials
:=
common
.
LinuxDOClientId
+
":"
+
common
.
LinuxDOClientSecret
basicAuth
:=
"Basic "
+
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
credentials
))
basicAuth
:=
"Basic "
+
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
credentials
))
...
@@ -129,7 +129,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
...
@@ -129,7 +129,7 @@ func getLinuxdoUserInfoByCode(code string, c *gin.Context) (*LinuxdoUser, error)
}
}
// Get user info
// Get user info
userEndpoint
:=
"https://connect.linux.do/api/user"
userEndpoint
:=
common
.
GetEnvOrDefaultString
(
"LINUX_DO_USER_ENDPOINT"
,
"https://connect.linux.do/api/user"
)
req
,
err
=
http
.
NewRequest
(
"GET"
,
userEndpoint
,
nil
)
req
,
err
=
http
.
NewRequest
(
"GET"
,
userEndpoint
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment