Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
40f7e832
Commit
40f7e832
authored
Apr 21, 2026
by
IanShaw027
Browse files
fix: restore wechat settings compatibility after rebase
parent
b22d00e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/setting_service_wechat_config_test.go
View file @
40f7e832
...
...
@@ -70,8 +70,8 @@ func TestSettingService_GetWeChatConnectOAuthConfig_UsesDatabaseOverrides(t *tes
got
,
err
:=
svc
.
GetWeChatConnectOAuthConfig
(
context
.
Background
())
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
got
.
Enabled
)
require
.
Equal
(
t
,
"wx-db-app"
,
got
.
AppID
)
require
.
Equal
(
t
,
"wx-db-secret"
,
got
.
AppSecret
)
require
.
Equal
(
t
,
"wx-db-app"
,
got
.
AppID
ForMode
(
"mp"
)
)
require
.
Equal
(
t
,
"wx-db-secret"
,
got
.
AppSecret
ForMode
(
"mp"
)
)
require
.
True
(
t
,
got
.
OpenEnabled
)
require
.
True
(
t
,
got
.
MPEnabled
)
require
.
Equal
(
t
,
"mp"
,
got
.
Mode
)
...
...
frontend/src/components/auth/WechatOAuthSection.vue
View file @
40f7e832
...
...
@@ -43,9 +43,13 @@ const props = withDefaults(defineProps<{
const
appStore
=
useAppStore
()
const
route
=
useRoute
()
const
{
t
}
=
useI18n
()
const
{
t
,
locale
}
=
useI18n
()
const
providerName
=
computed
(()
=>
t
(
'
auth.wechatProviderName
'
))
function
localizeWeChatHint
(
zh
:
string
,
en
:
string
):
string
{
return
locale
.
value
.
startsWith
(
'
zh
'
)
?
zh
:
en
}
const
resolvedStart
=
computed
(()
=>
resolveWeChatOAuthStart
(
appStore
.
cachedPublicSettings
))
const
buttonDisabled
=
computed
(()
=>
props
.
disabled
||
resolvedStart
.
value
.
mode
===
null
)
const
disabledHint
=
computed
(()
=>
{
...
...
frontend/src/views/admin/SettingsView.vue
View file @
40f7e832
...
...
@@ -1434,6 +1434,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_open_app_id
"
data
-
testid
=
"
wechat-connect-open-app-id
"
type
=
"
text
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -1452,6 +1453,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_open_app_secret
"
data
-
testid
=
"
wechat-connect-open-app-secret
"
type
=
"
password
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -1505,6 +1507,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_mp_app_id
"
data
-
testid
=
"
wechat-connect-mp-app-id
"
type
=
"
text
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -1528,6 +1531,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_mp_app_secret
"
data
-
testid
=
"
wechat-connect-mp-app-secret
"
type
=
"
password
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -1581,6 +1585,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_mobile_app_id
"
data
-
testid
=
"
wechat-connect-mobile-app-id
"
type
=
"
text
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -1599,6 +1604,7 @@
<
/label
>
<
input
v
-
model
=
"
form.wechat_connect_mobile_app_secret
"
data
-
testid
=
"
wechat-connect-mobile-app-secret
"
type
=
"
password
"
class
=
"
input font-mono text-sm
"
:
placeholder
=
"
...
...
@@ -4719,6 +4725,10 @@ const { t, locale } = useI18n();
const
appStore
=
useAppStore
();
const
adminSettingsStore
=
useAdminSettingsStore
();
function
localText
(
zh
:
string
,
en
:
string
):
string
{
return
locale
.
value
.
startsWith
(
"
zh
"
)
?
zh
:
en
;
}
type
SettingsTab
=
|
"
general
"
|
"
security
"
...
...
@@ -5532,6 +5542,39 @@ async function loadSettings() {
wechatCapabilities
.
mobileEnabled
,
settings
.
wechat_connect_mode
,
);
const
legacyWeChatAppID
=
String
(
settings
.
wechat_connect_app_id
||
""
).
trim
();
const
legacyWeChatSecretConfigured
=
Boolean
(
settings
.
wechat_connect_app_secret_configured
,
);
if
(
!
form
.
wechat_connect_open_app_id
&&
wechatCapabilities
.
openEnabled
)
{
form
.
wechat_connect_open_app_id
=
legacyWeChatAppID
;
}
if
(
!
form
.
wechat_connect_mp_app_id
&&
wechatCapabilities
.
mpEnabled
)
{
form
.
wechat_connect_mp_app_id
=
legacyWeChatAppID
;
}
if
(
!
form
.
wechat_connect_mobile_app_id
&&
wechatCapabilities
.
mobileEnabled
)
{
form
.
wechat_connect_mobile_app_id
=
legacyWeChatAppID
;
}
if
(
!
form
.
wechat_connect_open_app_secret_configured
&&
wechatCapabilities
.
openEnabled
)
{
form
.
wechat_connect_open_app_secret_configured
=
legacyWeChatSecretConfigured
;
}
if
(
!
form
.
wechat_connect_mp_app_secret_configured
&&
wechatCapabilities
.
mpEnabled
)
{
form
.
wechat_connect_mp_app_secret_configured
=
legacyWeChatSecretConfigured
;
}
if
(
!
form
.
wechat_connect_mobile_app_secret_configured
&&
wechatCapabilities
.
mobileEnabled
)
{
form
.
wechat_connect_mobile_app_secret_configured
=
legacyWeChatSecretConfigured
;
}
form
.
wechat_connect_scopes
=
defaultWeChatConnectScopesForMode
(
form
.
wechat_connect_mode
,
);
...
...
@@ -5689,10 +5732,6 @@ async function saveSettings() {
}
}
if
(
!
validatePaymentVisibleMethodSelections
())
{
return
;
}
if
(
form
.
wechat_connect_mp_enabled
&&
form
.
wechat_connect_mobile_enabled
)
{
appStore
.
showError
(
localText
(
...
...
frontend/src/views/admin/__tests__/SettingsView.spec.ts
View file @
40f7e832
...
...
@@ -664,7 +664,7 @@ describe("admin SettingsView wechat connect controls", () => {
expect
(
(
wrapper
.
get
(
'
[data-testid="wechat-connect-app-id"]
'
)
wrapper
.
get
(
'
[data-testid="wechat-connect-
mp-
app-id"]
'
)
.
element
as
HTMLInputElement
).
value
,
).
toBe
(
"
wx-app-id-123
"
);
...
...
@@ -685,7 +685,7 @@ describe("admin SettingsView wechat connect controls", () => {
);
expect
(
wrapper
.
get
(
'
[data-testid="wechat-connect-app-secret"]
'
)
.
get
(
'
[data-testid="wechat-connect-
mp-
app-secret"]
'
)
.
attributes
(
"
placeholder
"
),
).
toContain
(
"
密钥已配置
"
);
expect
(
...
...
@@ -703,10 +703,10 @@ describe("admin SettingsView wechat connect controls", () => {
await
openSecurityTab
(
wrapper
);
await
wrapper
.
get
(
'
[data-testid="wechat-connect-app-id"]
'
)
.
get
(
'
[data-testid="wechat-connect-
mp-
app-id"]
'
)
.
setValue
(
"
wx-app-id-updated
"
);
await
wrapper
.
get
(
'
[data-testid="wechat-connect-app-secret"]
'
)
.
get
(
'
[data-testid="wechat-connect-
mp-
app-secret"]
'
)
.
setValue
(
"
new-secret
"
);
await
wrapper
.
get
(
'
[data-testid="wechat-connect-open-enabled"]
'
)
...
...
@@ -728,9 +728,10 @@ describe("admin SettingsView wechat connect controls", () => {
expect
.
objectContaining
({
wechat_connect_enabled
:
true
,
wechat_connect_app_id
:
"
wx-app-id-updated
"
,
wechat_connect_app_secret
:
"
new-secret
"
,
wechat_connect_open_enabled
:
true
,
wechat_connect_mp_enabled
:
true
,
wechat_connect_mp_app_id
:
"
wx-app-id-updated
"
,
wechat_connect_mp_app_secret
:
"
new-secret
"
,
wechat_connect_redirect_url
:
"
https://admin.example.com/api/v1/auth/oauth/wechat/callback
"
,
wechat_connect_frontend_redirect_url
:
"
/auth/wechat/callback
"
,
...
...
@@ -738,13 +739,13 @@ describe("admin SettingsView wechat connect controls", () => {
);
expect
(
(
wrapper
.
get
(
'
[data-testid="wechat-connect-app-secret"]
'
)
wrapper
.
get
(
'
[data-testid="wechat-connect-
mp-
app-secret"]
'
)
.
element
as
HTMLInputElement
).
value
,
).
toBe
(
""
);
expect
(
wrapper
.
get
(
'
[data-testid="wechat-connect-app-secret"]
'
)
.
get
(
'
[data-testid="wechat-connect-
mp-
app-secret"]
'
)
.
attributes
(
"
placeholder
"
),
).
toContain
(
"
密钥已配置
"
);
});
...
...
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