Skip to content

Commit 63a591f

Browse files
committed
feat: add Profile Webpage URL toggle in Subscription Settings
- Add Select input for enabling/disabling Profile Webpage URL - Update form validation to omit isProfileWebpageUrlEnabled - Upgrade @remnawave/backend-contract to version 0.3.13
1 parent 33656ce commit 63a591f

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@mantine/nprogress": "^7.17.1",
4646
"@monaco-editor/react": "^4.7.0",
4747
"@paralleldrive/cuid2": "2.2.2",
48-
"@remnawave/backend-contract": "0.3.11",
48+
"@remnawave/backend-contract": "0.3.13",
4949
"@stablelib/base64": "^2.0.1",
5050
"@stablelib/x25519": "^2.0.1",
5151
"@tabler/icons-react": "^3.31.0",

src/widgets/dashboard/subscription-settings/settings/subscription-settings.widget.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Group,
55
NumberInput,
66
Paper,
7+
Select,
78
Stack,
89
Text,
910
Textarea,
@@ -38,7 +39,11 @@ export const SubscriptionSettingsWidget = (props: IProps) => {
3839
const form = useForm<UpdateSubscriptionSettingsCommand.Request>({
3940
name: 'edit-subscription-settings-form',
4041
mode: 'uncontrolled',
41-
validate: zodResolver(UpdateSubscriptionSettingsCommand.RequestSchema)
42+
validate: zodResolver(
43+
UpdateSubscriptionSettingsCommand.RequestSchema.omit({
44+
isProfileWebpageUrlEnabled: true
45+
})
46+
)
4247
})
4348

4449
const updateExpiredRemarks = useCallback((newRemarks: string[]) => {
@@ -82,6 +87,12 @@ export const SubscriptionSettingsWidget = (props: IProps) => {
8287
profileUpdateInterval: subscriptionSettings.profileUpdateInterval,
8388
happAnnounce: subscriptionSettings.happAnnounce,
8489
happRouting: subscriptionSettings.happRouting,
90+
91+
// @ts-expect-error - TODO: fix this
92+
isProfileWebpageUrlEnabled: subscriptionSettings.isProfileWebpageUrlEnabled
93+
? 'true'
94+
: 'false',
95+
8596
expiredUsersRemarks: subscriptionSettings.expiredUsersRemarks,
8697
limitedUsersRemarks: subscriptionSettings.limitedUsersRemarks,
8798
disabledUsersRemarks: subscriptionSettings.disabledUsersRemarks
@@ -109,10 +120,15 @@ export const SubscriptionSettingsWidget = (props: IProps) => {
109120
})
110121
return
111122
}
123+
124+
const isProfileWebpageUrlEnabled =
125+
(values.isProfileWebpageUrlEnabled as unknown as string) === 'true'
126+
112127
updateSubscriptionSettings({
113128
variables: {
114129
...values,
115130
uuid: values.uuid,
131+
isProfileWebpageUrlEnabled,
116132
expiredUsersRemarks: expiredFiltered,
117133
limitedUsersRemarks: limitedFiltered,
118134
disabledUsersRemarks: disabledFiltered
@@ -168,6 +184,25 @@ export const SubscriptionSettingsWidget = (props: IProps) => {
168184
{...form.getInputProps('supportLink')}
169185
/>
170186
</Grid.Col>
187+
188+
<Grid.Col span={{ xs: 12, sm: 6 }}>
189+
<Select
190+
allowDeselect={false}
191+
comboboxProps={{
192+
transitionProps: { transition: 'pop', duration: 200 }
193+
}}
194+
data={[
195+
{ label: 'Enabled', value: 'true' },
196+
{ label: 'Disabled', value: 'false' }
197+
]}
198+
description={
199+
'Used by some clients. Enabled by default, domain resolved from SUB_PUBLIC_DOMAIN .env variable.'
200+
}
201+
key={form.key('isProfileWebpageUrlEnabled')}
202+
label={'Profile Webpage URL'}
203+
{...form.getInputProps('isProfileWebpageUrlEnabled')}
204+
/>
205+
</Grid.Col>
171206
</Grid>
172207
</Stack>
173208
</Paper>

0 commit comments

Comments
 (0)