@@ -12,7 +12,6 @@ import CopyButton from '@/components/common/CopyButton.vue'
1212import UIIcon from ' @/components/ui/icons/UIIcon.vue'
1313import * as accountAdminApis from ' @/apis/admin/account'
1414import {
15- accountAppAllowedOriginsTip ,
1615 accountAppClientTypeLabels ,
1716 accountAppRedirectURIPatternsTip ,
1817 accountAppRedirectURIsTip ,
@@ -52,11 +51,9 @@ usePageTitle(() =>
5251const displayName = ref (' ' )
5352const status = ref <accountAdminApis .AccountApp [' status' ]>(' active' )
5453const redirectURIs = ref (' ' )
55- const allowedOrigins = ref (' ' )
5654const savedDisplayName = ref (' ' )
5755const savedStatus = ref <accountAdminApis .AccountApp [' status' ]>(' active' )
5856const savedRedirectURIs = ref <string []>([])
59- const savedAllowedOrigins = ref <string []>([])
6057const appUpdatedAt = ref (' ' )
6158const appFallbackText = computed (() => displayName .value .trim ().charAt (0 ).toUpperCase () || ' ?' )
6259const trimmedDisplayName = computed (() => displayName .value .trim ())
@@ -68,28 +65,22 @@ watch(
6865 displayName .value = value .displayName
6966 status .value = value .status
7067 redirectURIs .value = value .redirectURIs .join (' \n ' )
71- allowedOrigins .value = value .allowedOrigins .join (' \n ' )
7268 savedDisplayName .value = value .displayName
7369 savedStatus .value = value .status
7470 savedRedirectURIs .value = value .redirectURIs
75- savedAllowedOrigins .value = value .allowedOrigins
7671 appUpdatedAt .value = value .updatedAt
7772 },
7873 { immediate: true }
7974)
8075
8176const parsedRedirectURIs = computed (() => parseLines (redirectURIs .value ))
82- const parsedAllowedOrigins = computed (() => parseLines (allowedOrigins .value ))
8377const isActive = computed (() => status .value === ' active' )
8478const isIdentityChanged = computed (
8579 () => trimmedDisplayName .value !== ' ' && trimmedDisplayName .value !== savedDisplayName .value
8680)
8781const isStatusChanged = computed (() => status .value !== savedStatus .value )
88- const areEndpointsChanged = computed (
89- () =>
90- parsedRedirectURIs .value .length > 0 &&
91- (! areStringListsEqual (parsedRedirectURIs .value , savedRedirectURIs .value ) ||
92- ! areStringListsEqual (parsedAllowedOrigins .value , savedAllowedOrigins .value ))
82+ const areRedirectURIsChanged = computed (
83+ () => parsedRedirectURIs .value .length > 0 && ! areStringListsEqual (parsedRedirectURIs .value , savedRedirectURIs .value )
9384)
9485
9586function areStringListsEqual(a : string [], b : string []) {
@@ -123,14 +114,12 @@ const handleUpdateIdentity = useMessageHandle(
123114 { en: ' App identity updated' , zh: ' 应用信息已更新' }
124115)
125116
126- const handleUpdateEndpoints = useMessageHandle (
117+ const handleUpdateRedirectURIs = useMessageHandle (
127118 async () => {
128119 const updated = await accountAdminApis .updateAccountApp (props .appID , {
129- redirectURIs: parsedRedirectURIs .value ,
130- allowedOrigins: parsedAllowedOrigins .value
120+ redirectURIs: parsedRedirectURIs .value
131121 })
132122 savedRedirectURIs .value = updated .redirectURIs
133- savedAllowedOrigins .value = updated .allowedOrigins
134123 appUpdatedAt .value = updated .updatedAt
135124 },
136125 { en: ' Failed to update OAuth endpoints' , zh: ' 更新 OAuth 地址配置失败' },
@@ -339,13 +328,13 @@ function deleteSecret(secretID: string) {
339328 <p class =" m-0 mt-1 text-sm text-grey-800" >
340329 {{
341330 $t({
342- en: 'Exact destinations and browser origins trusted by this app.',
343- zh: '此应用信任的精确回调地址和浏览器来源 。'
331+ en: 'Exact callback destinations trusted by this app.',
332+ zh: '此应用信任的精确回调地址 。'
344333 })
345334 }}
346335 </p >
347336 </div >
348- <form class =" flex flex-col gap-5" @submit.prevent =" handleUpdateEndpoints .fn" >
337+ <form class =" flex flex-col gap-5" @submit.prevent =" handleUpdateRedirectURIs .fn" >
349338 <label class =" flex flex-col gap-1 text-sm text-grey-900" >
350339 {{ $t({ en: 'Redirect URIs', zh: '回调 URI' }) }}
351340 <UITextInput v-model :value =" redirectURIs " type="textarea" :rows =" 5 " />
@@ -364,17 +353,12 @@ function deleteSecret(secretID: string) {
364353 </div >
365354 <span class =" text-xs text-grey-700" >{{ $t(accountAppRedirectURIPatternsTip) }}</span >
366355 </div >
367- <label class =" flex flex-col gap-1 text-sm text-grey-900" >
368- {{ $t({ en: 'Allowed origins', zh: '允许的 Origin' }) }}
369- <UITextInput v-model :value =" allowedOrigins " type="textarea" :rows =" 4 " />
370- <span class =" text-xs text-grey-700" >{{ $t(accountAppAllowedOriginsTip) }}</span >
371- </label >
372356 <div class =" flex justify-end" >
373357 <UIButton
374358 html-type="submit"
375359 type="primary"
376- :disabled =" ! areEndpointsChanged "
377- :loading =" handleUpdateEndpoints .isLoading .value "
360+ :disabled =" ! areRedirectURIsChanged "
361+ :loading =" handleUpdateRedirectURIs .isLoading .value "
378362 >
379363 {{ $t({ en: 'Save endpoint settings', zh: '保存地址配置' }) }}
380364 </UIButton >
0 commit comments