Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remnawave/subscription-page",
"version": "7.0.4",
"version": "7.0.5",
"description": "Remnawave Subscription Page",
"private": false,
"type": "commonjs",
Expand Down
19 changes: 13 additions & 6 deletions backend/src/common/axios/axios.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ export class AxiosService implements OnModuleInit {
error?: unknown;
}> {
try {
await this.axiosInstance.request<GetStatusCommand.Response>({
const response = await this.axiosInstance.request<GetStatusCommand.Response>({
method: GetStatusCommand.endpointDetails.REQUEST_METHOD,
url: GetStatusCommand.TSQ_url,
});

await GetStatusCommand.ResponseSchema.parseAsync(response.data);

return {
isOk: true,
};
Expand Down Expand Up @@ -190,9 +192,12 @@ export class AxiosService implements OnModuleInit {
url: GetSubscriptionPageConfigsCommand.url,
});

const validationResult =
await GetSubscriptionPageConfigsCommand.ResponseSchema.parseAsync(response.data);

return {
isOk: true,
response: response.data.response,
response: validationResult.response,
};
} catch (error) {
if (error instanceof AxiosError) {
Expand All @@ -203,11 +208,13 @@ export class AxiosService implements OnModuleInit {
);
return { isOk: false };
}
}

this.logger.error('Error in GetSubscriptionPageConfigList Request:', error);

return { isOk: false };
this.logger.error(`Subpage Config List Request failed: ${error.message}`);
return { isOk: false };
} else {
this.logger.error(`Subpage Config List Request failed: ${error}`);
return { isOk: false };
}
}
}

Expand Down
1 change: 1 addition & 0 deletions backend/src/common/config/app-config/config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const configSchema = z
.transform((val) => val === 'true'),
MARZBAN_LEGACY_SECRET_KEY: z.optional(z.string()),
MARZBAN_LEGACY_SUBSCRIPTION_VALID_FROM: z.optional(z.string()),
INTERNAL_JWT_SECRET: z.string(),
})
.superRefine((data, ctx) => {
if (
Expand Down
31 changes: 19 additions & 12 deletions backend/src/modules/root/subpage-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,17 @@ export class SubpageConfigService implements OnApplicationBootstrap {
}

public getEncryptedSubpageConfigUuid(subpageConfigUuidFromRemnawave: string | null): string {
let uuidToEncrypt: string;

const isDefaultUuid = this.subpageConfigUuid === SUBPAGE_DEFAULT_CONFIG_UUID;

if (isDefaultUuid && subpageConfigUuidFromRemnawave) {
uuidToEncrypt = subpageConfigUuidFromRemnawave;
} else {
uuidToEncrypt = this.subpageConfigUuid;
}

return encryptUuid(uuidToEncrypt, this.internalJwtSecret);
return encryptUuid(
this.getFinalSubpageConfigUuid(subpageConfigUuidFromRemnawave),
this.internalJwtSecret,
);
}

public getBaseSettings(
subpageConfigUuid: string | null,
): TSubscriptionPageRawConfig['baseSettings'] {
const subpageConfig = this.subpageConfigMap.get(
subpageConfigUuid || SUBPAGE_DEFAULT_CONFIG_UUID,
this.getFinalSubpageConfigUuid(subpageConfigUuid),
);

if (!subpageConfig) {
Expand All @@ -140,4 +133,18 @@ export class SubpageConfigService implements OnApplicationBootstrap {
showConnectionKeys: subpageConfig.baseSettings.showConnectionKeys,
};
}

private getFinalSubpageConfigUuid(subpageConfigUuid: string | null): string {
let finalSubpageConfigUuid: string;

const isDefaultUuid = this.subpageConfigUuid === SUBPAGE_DEFAULT_CONFIG_UUID;

if (isDefaultUuid && subpageConfigUuid) {
finalSubpageConfigUuid = subpageConfigUuid;
} else {
finalSubpageConfigUuid = this.subpageConfigUuid;
}

return finalSubpageConfigUuid;
}
}
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@remnawave/subscription-page",
"private": false,
"type": "module",
"version": "7.0.4",
"version": "7.0.5",
"license": "AGPL-3.0-only",
"author": "REMNAWAVE <github.com/remnawave>",
"homepage": "https://github.com/remnawave",
Expand Down
28 changes: 13 additions & 15 deletions frontend/src/pages/main/ui/components/main.page.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Center, Container, Group, Image, Stack, Text, Title } from '@mantine/core'
import { Box, Center, Container, Group, Image, Stack, Title } from '@mantine/core'
import { TSubscriptionPagePlatformKey } from '@remnawave/subscription-page-types'

import {
Expand Down Expand Up @@ -69,35 +69,33 @@ export const MainPageComponent = ({ isMobile, platform }: IMainPageComponentProp
<Page>
<Box className="header-wrapper" py="md">
<Container maw={1200} px={{ base: 'md', sm: 'lg', md: 'xl' }}>
<Group justify="space-between" wrap="nowrap">
<Group justify="space-between">
<Group gap="sm" style={{ userSelect: 'none' }} wrap="nowrap">
{hasCustomLogo ? (
<Image
alt="logo"
fit="contain"
src={config.brandingSettings.logoUrl}
style={{
maxWidth: '32px',
maxHeight: '32px',
width: 'auto',
height: 'auto'
width: '32px',
height: '32px',
flexShrink: 0
}}
/>
) : (
<RemnawaveLogo c="cyan" size={32} />
)}
<Title fw={700} order={4} size="lg">
<Text c={hasCustomLogo ? 'white' : 'cyan'} component="span" inherit>
{brandName}
</Text>
<Title
c={hasCustomLogo ? 'white' : 'cyan'}
fw={700}
order={4}
size="lg"
>
{brandName}
</Title>
</Group>

<Group gap="xs">
<SubscriptionLinkWidget
supportUrl={config.brandingSettings.supportUrl}
/>
</Group>
<SubscriptionLinkWidget supportUrl={config.brandingSettings.supportUrl} />
</Group>
</Container>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ import {
TSubscriptionPageButtonConfig,
TSubscriptionPagePlatformKey
} from '@remnawave/subscription-page-types'
import { Box, Button, ButtonVariant, Card, Group, NativeSelect, Stack, Title } from '@mantine/core'
import {
Box,
Button,
ButtonVariant,
Card,
Group,
NativeSelect,
Stack,
Title,
UnstyledButton
} from '@mantine/core'
import { notifications } from '@mantine/notifications'
import { IconStar } from '@tabler/icons-react'
import { useClipboard } from '@mantine/hooks'
import { useState } from 'react'
import clsx from 'clsx'

import { constructSubscriptionUrl } from '@shared/utils/construct-subscription-url'
import { useSubscription } from '@entities/subscription-info-store'
Expand Down Expand Up @@ -186,34 +196,44 @@ export const InstallationGuideConnector = (props: IProps) => {

{platformApps.length > 0 && (
<Box>
<Group gap="xs" mb="md">
<div className={classes.appsGrid}>
{platformApps.map((app: TSubscriptionPageAppConfig, index: number) => {
const isActive = index === selectedAppIndex
const hasIcon = Boolean(app.svgIconKey)

return (
<Button
className={
isActive ? classes.appButtonActive : classes.appButton
}
color={isActive ? 'cyan' : 'gray'}
<UnstyledButton
className={clsx(
classes.appButton,
isActive && classes.appButtonActive,
app.featured && classes.appButtonFeatured
)}
key={app.name}
leftSection={
app.featured ? (
<IconStar color="gold" size={16} />
) : undefined
}
onClick={() => {
vibrate('toggle')
setSelectedAppIndex(index)
}}
radius="md"
size="sm"
variant={isActive ? 'outline' : 'subtle'}
>
{app.name}
</Button>
{app.featured && <span className={classes.featuredBadge} />}
{hasIcon && (
<span
className={clsx(
classes.bgIcon,
isActive && classes.bgIconActive
)}
dangerouslySetInnerHTML={{
__html: getIconFromLibrary(
app.svgIconKey!,
svgLibrary
)
}}
/>
)}
<span className={classes.appName}>{app.name}</span>
</UnstyledButton>
)
})}
</Group>
</div>

{selectedApp && (
<BlockRenderer
Expand Down
Loading