mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-13 02:26:36 +08:00
chore: format
This commit is contained in:
@@ -67,10 +67,7 @@ export function getProxyRouteConfigSection(
|
||||
: 'domains';
|
||||
}
|
||||
|
||||
export function validateDomain(
|
||||
domain: string,
|
||||
t: TranslateFn,
|
||||
): string | null {
|
||||
export function validateDomain(domain: string, t: TranslateFn): string | null {
|
||||
const normalized = domain.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return t('validation.enterDomain');
|
||||
|
||||
@@ -269,8 +269,7 @@ export function ProxyRouteCreateSheet({
|
||||
onCreated(route);
|
||||
} catch (error) {
|
||||
form.setError('root', {
|
||||
message:
|
||||
error instanceof Error ? error.message : t('createFailed'),
|
||||
message: error instanceof Error ? error.message : t('createFailed'),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -400,7 +399,9 @@ export function ProxyRouteCreateSheet({
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value='none'>{t('pleaseSelect')}</SelectItem>
|
||||
<SelectItem value='none'>
|
||||
{t('pleaseSelect')}
|
||||
</SelectItem>
|
||||
{tunnelClients.map((tunnel) => (
|
||||
<SelectItem
|
||||
key={tunnel.id}
|
||||
@@ -415,7 +416,9 @@ export function ProxyRouteCreateSheet({
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormDescription>{t('tunnelForwardHint')}</FormDescription>
|
||||
<FormDescription>
|
||||
{t('tunnelForwardHint')}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
@@ -455,7 +458,9 @@ export function ProxyRouteCreateSheet({
|
||||
<FormControl>
|
||||
<Input placeholder='127.0.0.1:8080' {...field} />
|
||||
</FormControl>
|
||||
<FormDescription>{t('tunnelAddressHint')}</FormDescription>
|
||||
<FormDescription>
|
||||
{t('tunnelAddressHint')}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
@@ -483,7 +488,9 @@ export function ProxyRouteCreateSheet({
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value='none'>{t('pleaseSelect')}</SelectItem>
|
||||
<SelectItem value='none'>
|
||||
{t('pleaseSelect')}
|
||||
</SelectItem>
|
||||
{pagesProjects.map((project) => (
|
||||
<SelectItem
|
||||
key={project.id}
|
||||
|
||||
@@ -119,22 +119,20 @@ export function ZoneDomainSelector({
|
||||
|
||||
{filtered.length === 0 ? (
|
||||
<div className='rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground'>
|
||||
{domains.length === 0 ? (
|
||||
t.rich('noZoneDomains', {
|
||||
websites: (chunks) => (
|
||||
<Link
|
||||
href='/websites'
|
||||
className='text-primary underline-offset-4 hover:underline'
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
})
|
||||
) : availableDomains.length === 0 ? (
|
||||
t('noBindableDomains')
|
||||
) : (
|
||||
t('noMatchingDomains')
|
||||
)}
|
||||
{domains.length === 0
|
||||
? t.rich('noZoneDomains', {
|
||||
websites: (chunks) => (
|
||||
<Link
|
||||
href='/websites'
|
||||
className='text-primary underline-offset-4 hover:underline'
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
})
|
||||
: availableDomains.length === 0
|
||||
? t('noBindableDomains')
|
||||
: t('noMatchingDomains')}
|
||||
</div>
|
||||
) : (
|
||||
<div className='max-h-72 space-y-1 overflow-y-auto rounded-lg border p-2'>
|
||||
|
||||
@@ -162,9 +162,7 @@ export function AuthSection({
|
||||
<SelectItem value='basic'>Basic Auth</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormDescription>
|
||||
{t('powHint')}
|
||||
</FormDescription>
|
||||
<FormDescription>{t('powHint')}</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
|
||||
@@ -286,7 +286,9 @@ export function CacheSection({
|
||||
<SelectItem value='path_prefix'>
|
||||
{t('policyPrefix')}
|
||||
</SelectItem>
|
||||
<SelectItem value='path_exact'>{t('policyExact')}</SelectItem>
|
||||
<SelectItem value='path_exact'>
|
||||
{t('policyExact')}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
|
||||
@@ -349,7 +349,9 @@ export function ProxySection({
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value='none'>{t('pleaseSelect')}</SelectItem>
|
||||
<SelectItem value='none'>
|
||||
{t('pleaseSelect')}
|
||||
</SelectItem>
|
||||
{tunnelClients.map((tunnel) => (
|
||||
<SelectItem key={tunnel.id} value={String(tunnel.id)}>
|
||||
{tunnel.name} (
|
||||
@@ -426,7 +428,9 @@ export function ProxySection({
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value='none'>{t('pleaseSelect')}</SelectItem>
|
||||
<SelectItem value='none'>
|
||||
{t('pleaseSelect')}
|
||||
</SelectItem>
|
||||
{pagesProjects.map((project) => (
|
||||
<SelectItem
|
||||
key={project.id}
|
||||
@@ -454,9 +458,7 @@ export function ProxySection({
|
||||
<FormControl>
|
||||
<Input placeholder='origin.example.internal' {...field} />
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
{t('originHostHint')}
|
||||
</FormDescription>
|
||||
<FormDescription>{t('originHostHint')}</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
|
||||
@@ -153,7 +153,9 @@ export function RouteHeader({ route }: RouteHeaderProps) {
|
||||
<AlertDialogDescription>{t('publishDesc')}</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel disabled={publishing}>{tc('cancel')}</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={publishing}>
|
||||
{tc('cancel')}
|
||||
</AlertDialogCancel>
|
||||
<Button onClick={() => void handlePublish()} disabled={publishing}>
|
||||
{publishing ? (
|
||||
<Loader2 className='size-4 animate-spin' />
|
||||
|
||||
@@ -116,7 +116,9 @@ export function ProxyRoutesPageClient() {
|
||||
<div className='flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Route className='size-5 text-primary' />
|
||||
<h1 className='text-2xl font-semibold tracking-tight'>{t('title')}</h1>
|
||||
<h1 className='text-2xl font-semibold tracking-tight'>
|
||||
{t('title')}
|
||||
</h1>
|
||||
</div>
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
<Button
|
||||
@@ -143,7 +145,9 @@ export function ProxyRoutesPageClient() {
|
||||
<Card className='border-border/40 shadow-sm'>
|
||||
<CardHeader className='pb-3'>
|
||||
<div className='flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between'>
|
||||
<CardTitle className='text-sm font-semibold'>{t('listTitle')}</CardTitle>
|
||||
<CardTitle className='text-sm font-semibold'>
|
||||
{t('listTitle')}
|
||||
</CardTitle>
|
||||
<Input
|
||||
value={keyword}
|
||||
onChange={(event) => setKeyword(event.target.value)}
|
||||
@@ -261,7 +265,9 @@ export function ProxyRoutesPageClient() {
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel disabled={deleting}>{tc('cancel')}</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={deleting}>
|
||||
{tc('cancel')}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
className='bg-destructive text-white hover:bg-destructive/90'
|
||||
disabled={deleting}
|
||||
|
||||
Reference in New Issue
Block a user