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
9e17df3f
authored
Sep 13, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update references from setting to system_setting for ServerAddress
parent
ad092838
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
26 additions
and
22 deletions
+26
-22
controller/midjourney.go
+3
-2
controller/misc.go
+2
-2
controller/oidc.go
+1
-2
controller/topup.go
+2
-1
controller/topup_stripe.go
+3
-2
model/option.go
+8
-7
relay/mjproxy_handler.go
+2
-1
service/epay.go
+2
-2
service/quota.go
+2
-2
setting/system_setting/system_setting_old.go
+1
-1
No files found.
controller/midjourney.go
View file @
9e17df3f
...
...
@@ -13,6 +13,7 @@ import (
"one-api/model"
"one-api/service"
"one-api/setting"
"one-api/setting/system_setting"
"time"
"github.com/gin-gonic/gin"
...
...
@@ -259,7 +260,7 @@ func GetAllMidjourney(c *gin.Context) {
if
setting
.
MjForwardUrlEnabled
{
for
i
,
midjourney
:=
range
items
{
midjourney
.
ImageUrl
=
setting
.
ServerAddress
+
"/mj/image/"
+
midjourney
.
MjId
midjourney
.
ImageUrl
=
s
ystem_s
etting
.
ServerAddress
+
"/mj/image/"
+
midjourney
.
MjId
items
[
i
]
=
midjourney
}
}
...
...
@@ -284,7 +285,7 @@ func GetUserMidjourney(c *gin.Context) {
if
setting
.
MjForwardUrlEnabled
{
for
i
,
midjourney
:=
range
items
{
midjourney
.
ImageUrl
=
setting
.
ServerAddress
+
"/mj/image/"
+
midjourney
.
MjId
midjourney
.
ImageUrl
=
s
ystem_s
etting
.
ServerAddress
+
"/mj/image/"
+
midjourney
.
MjId
items
[
i
]
=
midjourney
}
}
...
...
controller/misc.go
View file @
9e17df3f
...
...
@@ -58,7 +58,7 @@ func GetStatus(c *gin.Context) {
"footer_html"
:
common
.
Footer
,
"wechat_qrcode"
:
common
.
WeChatAccountQRCodeImageURL
,
"wechat_login"
:
common
.
WeChatAuthEnabled
,
"server_address"
:
setting
.
ServerAddress
,
"server_address"
:
s
ystem_s
etting
.
ServerAddress
,
"turnstile_check"
:
common
.
TurnstileCheckEnabled
,
"turnstile_site_key"
:
common
.
TurnstileSiteKey
,
"top_up_link"
:
common
.
TopUpLink
,
...
...
@@ -249,7 +249,7 @@ func SendPasswordResetEmail(c *gin.Context) {
}
code
:=
common
.
GenerateVerificationCode
(
0
)
common
.
RegisterVerificationCodeWithKey
(
email
,
code
,
common
.
PasswordResetPurpose
)
link
:=
fmt
.
Sprintf
(
"%s/user/reset?email=%s&token=%s"
,
setting
.
ServerAddress
,
email
,
code
)
link
:=
fmt
.
Sprintf
(
"%s/user/reset?email=%s&token=%s"
,
s
ystem_s
etting
.
ServerAddress
,
email
,
code
)
subject
:=
fmt
.
Sprintf
(
"%s密码重置"
,
common
.
SystemName
)
content
:=
fmt
.
Sprintf
(
"<p>您好,你正在进行%s密码重置。</p>"
+
"<p>点击 <a href='%s'>此处</a> 进行密码重置。</p>"
+
...
...
controller/oidc.go
View file @
9e17df3f
...
...
@@ -8,7 +8,6 @@ import (
"net/url"
"one-api/common"
"one-api/model"
"one-api/setting"
"one-api/setting/system_setting"
"strconv"
"strings"
...
...
@@ -45,7 +44,7 @@ func getOidcUserInfoByCode(code string) (*OidcUser, error) {
values
.
Set
(
"client_secret"
,
system_setting
.
GetOIDCSettings
()
.
ClientSecret
)
values
.
Set
(
"code"
,
code
)
values
.
Set
(
"grant_type"
,
"authorization_code"
)
values
.
Set
(
"redirect_uri"
,
fmt
.
Sprintf
(
"%s/oauth/oidc"
,
setting
.
ServerAddress
))
values
.
Set
(
"redirect_uri"
,
fmt
.
Sprintf
(
"%s/oauth/oidc"
,
s
ystem_s
etting
.
ServerAddress
))
formData
:=
values
.
Encode
()
req
,
err
:=
http
.
NewRequest
(
"POST"
,
system_setting
.
GetOIDCSettings
()
.
TokenEndpoint
,
strings
.
NewReader
(
formData
))
if
err
!=
nil
{
...
...
controller/topup.go
View file @
9e17df3f
...
...
@@ -10,6 +10,7 @@ import (
"one-api/service"
"one-api/setting"
"one-api/setting/operation_setting"
"one-api/setting/system_setting"
"strconv"
"sync"
"time"
...
...
@@ -152,7 +153,7 @@ func RequestEpay(c *gin.Context) {
}
callBackAddress
:=
service
.
GetCallbackAddress
()
returnUrl
,
_
:=
url
.
Parse
(
setting
.
ServerAddress
+
"/console/log"
)
returnUrl
,
_
:=
url
.
Parse
(
s
ystem_s
etting
.
ServerAddress
+
"/console/log"
)
notifyUrl
,
_
:=
url
.
Parse
(
callBackAddress
+
"/api/user/epay/notify"
)
tradeNo
:=
fmt
.
Sprintf
(
"%s%d"
,
common
.
GetRandomString
(
6
),
time
.
Now
()
.
Unix
())
tradeNo
=
fmt
.
Sprintf
(
"USR%dNO%s"
,
id
,
tradeNo
)
...
...
controller/topup_stripe.go
View file @
9e17df3f
...
...
@@ -9,6 +9,7 @@ import (
"one-api/model"
"one-api/setting"
"one-api/setting/operation_setting"
"one-api/setting/system_setting"
"strconv"
"strings"
"time"
...
...
@@ -216,8 +217,8 @@ func genStripeLink(referenceId string, customerId string, email string, amount i
params
:=
&
stripe
.
CheckoutSessionParams
{
ClientReferenceID
:
stripe
.
String
(
referenceId
),
SuccessURL
:
stripe
.
String
(
setting
.
ServerAddress
+
"/log"
),
CancelURL
:
stripe
.
String
(
setting
.
ServerAddress
+
"/topup"
),
SuccessURL
:
stripe
.
String
(
s
ystem_s
etting
.
ServerAddress
+
"/log"
),
CancelURL
:
stripe
.
String
(
s
ystem_s
etting
.
ServerAddress
+
"/topup"
),
LineItems
:
[]
*
stripe
.
CheckoutSessionLineItemParams
{
{
Price
:
stripe
.
String
(
setting
.
StripePriceId
),
...
...
model/option.go
View file @
9e17df3f
...
...
@@ -6,6 +6,7 @@ import (
"one-api/setting/config"
"one-api/setting/operation_setting"
"one-api/setting/ratio_setting"
"one-api/setting/system_setting"
"strconv"
"strings"
"time"
...
...
@@ -66,9 +67,9 @@ func InitOptionMap() {
common
.
OptionMap
[
"SystemName"
]
=
common
.
SystemName
common
.
OptionMap
[
"Logo"
]
=
common
.
Logo
common
.
OptionMap
[
"ServerAddress"
]
=
""
common
.
OptionMap
[
"WorkerUrl"
]
=
setting
.
WorkerUrl
common
.
OptionMap
[
"WorkerValidKey"
]
=
setting
.
WorkerValidKey
common
.
OptionMap
[
"WorkerAllowHttpImageRequestEnabled"
]
=
strconv
.
FormatBool
(
setting
.
WorkerAllowHttpImageRequestEnabled
)
common
.
OptionMap
[
"WorkerUrl"
]
=
s
ystem_s
etting
.
WorkerUrl
common
.
OptionMap
[
"WorkerValidKey"
]
=
s
ystem_s
etting
.
WorkerValidKey
common
.
OptionMap
[
"WorkerAllowHttpImageRequestEnabled"
]
=
strconv
.
FormatBool
(
s
ystem_s
etting
.
WorkerAllowHttpImageRequestEnabled
)
common
.
OptionMap
[
"PayAddress"
]
=
""
common
.
OptionMap
[
"CustomCallbackAddress"
]
=
""
common
.
OptionMap
[
"EpayId"
]
=
""
...
...
@@ -271,7 +272,7 @@ func updateOptionMap(key string, value string) (err error) {
case
"SMTPSSLEnabled"
:
common
.
SMTPSSLEnabled
=
boolValue
case
"WorkerAllowHttpImageRequestEnabled"
:
setting
.
WorkerAllowHttpImageRequestEnabled
=
boolValue
s
ystem_s
etting
.
WorkerAllowHttpImageRequestEnabled
=
boolValue
case
"DefaultUseAutoGroup"
:
setting
.
DefaultUseAutoGroup
=
boolValue
case
"ExposeRatioEnabled"
:
...
...
@@ -293,11 +294,11 @@ func updateOptionMap(key string, value string) (err error) {
case
"SMTPToken"
:
common
.
SMTPToken
=
value
case
"ServerAddress"
:
setting
.
ServerAddress
=
value
s
ystem_s
etting
.
ServerAddress
=
value
case
"WorkerUrl"
:
setting
.
WorkerUrl
=
value
s
ystem_s
etting
.
WorkerUrl
=
value
case
"WorkerValidKey"
:
setting
.
WorkerValidKey
=
value
s
ystem_s
etting
.
WorkerValidKey
=
value
case
"PayAddress"
:
operation_setting
.
PayAddress
=
value
case
"Chats"
:
...
...
relay/mjproxy_handler.go
View file @
9e17df3f
...
...
@@ -16,6 +16,7 @@ import (
"one-api/relay/helper"
"one-api/service"
"one-api/setting"
"one-api/setting/system_setting"
"strconv"
"strings"
"time"
...
...
@@ -131,7 +132,7 @@ func coverMidjourneyTaskDto(c *gin.Context, originTask *model.Midjourney) (midjo
midjourneyTask
.
FinishTime
=
originTask
.
FinishTime
midjourneyTask
.
ImageUrl
=
""
if
originTask
.
ImageUrl
!=
""
&&
setting
.
MjForwardUrlEnabled
{
midjourneyTask
.
ImageUrl
=
setting
.
ServerAddress
+
"/mj/image/"
+
originTask
.
MjId
midjourneyTask
.
ImageUrl
=
s
ystem_s
etting
.
ServerAddress
+
"/mj/image/"
+
originTask
.
MjId
if
originTask
.
Status
!=
"SUCCESS"
{
midjourneyTask
.
ImageUrl
+=
"?rand="
+
strconv
.
FormatInt
(
time
.
Now
()
.
UnixNano
(),
10
)
}
...
...
service/epay.go
View file @
9e17df3f
package
service
import
(
"one-api/setting"
"one-api/setting/operation_setting"
"one-api/setting/system_setting"
)
func
GetCallbackAddress
()
string
{
if
operation_setting
.
CustomCallbackAddress
==
""
{
return
setting
.
ServerAddress
return
s
ystem_s
etting
.
ServerAddress
}
return
operation_setting
.
CustomCallbackAddress
}
service/quota.go
View file @
9e17df3f
...
...
@@ -11,8 +11,8 @@ import (
"one-api/logger"
"one-api/model"
relaycommon
"one-api/relay/common"
"one-api/setting"
"one-api/setting/ratio_setting"
"one-api/setting/system_setting"
"one-api/types"
"strings"
"time"
...
...
@@ -534,7 +534,7 @@ func checkAndSendQuotaNotify(relayInfo *relaycommon.RelayInfo, quota int, preCon
}
if
quotaTooLow
{
prompt
:=
"您的额度即将用尽"
topUpLink
:=
fmt
.
Sprintf
(
"%s/topup"
,
setting
.
ServerAddress
)
topUpLink
:=
fmt
.
Sprintf
(
"%s/topup"
,
s
ystem_s
etting
.
ServerAddress
)
// 根据通知方式生成不同的内容格式
var
content
string
...
...
setting/system_setting.go
→
setting/system_setting
/system_setting_old
.go
View file @
9e17df3f
package
setting
package
s
ystem_s
etting
var
ServerAddress
=
"http://localhost:3000"
var
WorkerUrl
=
""
...
...
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