Skip to content

Commit c532208

Browse files
chore: format code
1 parent 4b87265 commit c532208

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1790
-2158
lines changed

app/operation/node.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@
2323
from app.db.crud.user import get_user
2424
from app.db.models import Node, NodeStatus
2525
from app.models.admin import AdminDetails
26-
from app.models.node import NodeCreate, NodeModify, NodeNotification, NodeResponse, UsageTable, UserIPList, UserIPListAll
26+
from app.models.node import (
27+
NodeCreate,
28+
NodeModify,
29+
NodeNotification,
30+
NodeResponse,
31+
UsageTable,
32+
UserIPList,
33+
UserIPListAll,
34+
)
2735
from app.models.stats import NodeRealtimeStats, NodeStatsList, NodeUsageStatsList, Period
2836
from app.node import core_users, node_manager
2937
from app.operation import BaseOperation
@@ -414,9 +422,7 @@ async def get_user_online_stats_by_node(self, db: AsyncSession, node_id: Node, u
414422

415423
return {node_id: stats.value}
416424

417-
async def get_user_ip_list_by_node(
418-
self, db: AsyncSession, node_id: Node, username: str
419-
) -> UserIPList:
425+
async def get_user_ip_list_by_node(self, db: AsyncSession, node_id: Node, username: str) -> UserIPList:
420426
db_user = await get_user(db, username=username)
421427
if db_user is None:
422428
await self.raise_error(message="User not found", code=404)

dashboard/public/statics/locales/zh.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,13 @@
831831
"heartbeatPeriod": "心跳周期"
832832
},
833833
"fragment": {
834-
"title": "分片",
835-
"packets": "数据包",
834+
"title": "分片",
835+
"packets": "数据包",
836836
"packetsPlaceholder": "输入数据包",
837-
"length": "长度",
838-
"lengthPlaceholder": "输入长度",
839-
"interval": "间隔",
840-
"intervalPlaceholder": "输入间隔",
837+
"length": "长度",
838+
"lengthPlaceholder": "输入长度",
839+
"interval": "间隔",
840+
"intervalPlaceholder": "输入间隔",
841841
"allFieldsRequired": "如果填写一个字段,则必须填写所有字段",
842842
"info": "长度,间隔,数据包 (例如:10-100,100-200,tlshello)",
843843
"info.attention": "请注意: 当前特性仅支持 streisand >= 1.6.12 and v2rayNG >= 1.8.16 (自定义配置)",
@@ -847,16 +847,16 @@
847847
"recordFragment": "记录分片"
848848
},
849849
"noise": {
850-
"title": "噪声",
851-
"type": "类型",
852-
"addNoise": "添加噪声",
853-
"removeNoise": "删除噪声",
854-
"noNoiseSettings": "未配置噪声设置",
855-
"packet": "数据包",
850+
"title": "噪声",
851+
"type": "类型",
852+
"addNoise": "添加噪声",
853+
"removeNoise": "删除噪声",
854+
"noNoiseSettings": "未配置噪声设置",
855+
"packet": "数据包",
856856
"packetPlaceholder": "输入数据包值 (例如:rand:10-20)",
857-
"delay": "延迟",
858-
"delayPlaceholder": "输入延迟",
859-
"rand": "随机",
857+
"delay": "延迟",
858+
"delayPlaceholder": "输入延迟",
859+
"rand": "随机",
860860
"info": "数据包,延迟 (例如:rand:10-20,100-200)",
861861
"info.attention": "请注意: 当前特性仅支持 streisand >= 1.6.32 and v2rayNG >= 1.8.39 (自定义配置)",
862862
"info.examples": "示例:",

dashboard/src/components/ActionButtons.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,8 @@ const ActionButtons: FC<ActionButtonsProps> = ({ user }) => {
371371
</DropdownMenuTrigger>
372372
<DropdownMenuContent>
373373
{subscribeLinks.map(subLink => (
374-
<DropdownMenuItem
375-
className="justify-start p-0"
376-
key={subLink.link}
377-
onClick={() => handleCopyOrDownload(subLink)}
378-
>
379-
<span className="flex items-center gap-2 w-full px-2 py-1.5">
374+
<DropdownMenuItem className="justify-start p-0" key={subLink.link} onClick={() => handleCopyOrDownload(subLink)}>
375+
<span className="flex w-full items-center gap-2 px-2 py-1.5">
380376
<span className="text-sm">{subLink.icon}</span>
381377
<span>{subLink.protocol}</span>
382378
</span>

dashboard/src/components/AdminStatistics.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,7 @@ export default function AdminStatisticsSection({ data }: AdminsStatisticsProps)
8484
{React.createElement(stat.icon, { className: 'h-5 w-5' })}
8585
<span>{stat.label}</span>
8686
</div>
87-
<span
88-
className={cn(
89-
'mx-2 text-3xl transition-all duration-500',
90-
isIncreased[stat.key] ? 'animate-zoom-out' : ''
91-
)}
92-
style={{ animationDuration: '400ms' }}
93-
>
87+
<span className={cn('mx-2 text-3xl transition-all duration-500', isIncreased[stat.key] ? 'animate-zoom-out' : '')} style={{ animationDuration: '400ms' }}>
9488
<CountUp end={stat.value} />
9589
</span>
9690
</CardTitle>

dashboard/src/components/Language.tsx

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import { useTranslation } from 'react-i18next'
88

99
export const Language: React.FC = () => {
1010
const { i18n, t } = useTranslation()
11-
11+
1212
// Safely get sidebar state, defaulting to 'expanded' if not available
1313
const sidebarContext = useContext(SidebarContext)
1414
const sidebarState: 'expanded' | 'collapsed' = sidebarContext?.state ?? 'expanded'
1515
const isMobile = sidebarContext?.isMobile ?? false
1616

1717
const changeLanguage = async (lang: string) => {
18-
await i18n.changeLanguage(lang)
19-
document.documentElement.lang = lang
20-
document.documentElement.setAttribute('dir', i18n.dir())
18+
await i18n.changeLanguage(lang)
19+
document.documentElement.lang = lang
20+
document.documentElement.setAttribute('dir', i18n.dir())
2121
}
2222

2323
// Collapsed state (desktop only) - icon with popover
@@ -33,36 +33,16 @@ export const Language: React.FC = () => {
3333
<PopoverContent className="w-48 p-2" side="right" align="start">
3434
<div className="space-y-1">
3535
<div className="px-2 py-1.5 text-sm font-semibold">{t('language.title', { defaultValue: 'Language' })}</div>
36-
<Button
37-
variant="ghost"
38-
size="sm"
39-
className="w-full justify-start"
40-
onClick={() => changeLanguage('en')}
41-
>
36+
<Button variant="ghost" size="sm" className="w-full justify-start" onClick={() => changeLanguage('en')}>
4237
English
4338
</Button>
44-
<Button
45-
variant="ghost"
46-
size="sm"
47-
className="w-full justify-start"
48-
onClick={() => changeLanguage('fa')}
49-
>
39+
<Button variant="ghost" size="sm" className="w-full justify-start" onClick={() => changeLanguage('fa')}>
5040
فارسی
5141
</Button>
52-
<Button
53-
variant="ghost"
54-
size="sm"
55-
className="w-full justify-start"
56-
onClick={() => changeLanguage('zh')}
57-
>
42+
<Button variant="ghost" size="sm" className="w-full justify-start" onClick={() => changeLanguage('zh')}>
5843
简体中文
5944
</Button>
60-
<Button
61-
variant="ghost"
62-
size="sm"
63-
className="w-full justify-start"
64-
onClick={() => changeLanguage('ru')}
65-
>
45+
<Button variant="ghost" size="sm" className="w-full justify-start" onClick={() => changeLanguage('ru')}>
6646
Русский
6747
</Button>
6848
</div>

dashboard/src/components/TopLoadingBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ function TopLoadingBar({ height = 3, color, shadow = true, className = '' }: Top
136136
if (!shouldIgnoreRoute(pathname) && ref.current) {
137137
// Start loading bar on route change with continuous animation
138138
ref.current.continuousStart()
139-
139+
140140
// Set timeout to complete the loading bar after a longer delay
141141
// This gives time for the animation to progress and the page to render
142142
if (maxTimeoutRef.current) {
143143
clearTimeout(maxTimeoutRef.current)
144144
}
145-
145+
146146
maxTimeoutRef.current = setTimeout(() => {
147147
if (ref.current) {
148148
ref.current.complete()

dashboard/src/components/UsersStatistics.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const UsersStatistics = () => {
3030
setPrevData(data)
3131
}, [data])
3232

33-
3433
return (
3534
<div className="flex flex-col gap-y-4">
3635
<div className={cn('flex flex-col items-center justify-between gap-x-4 gap-y-4 lg:flex-row', dir === 'rtl' && 'lg:flex-row-reverse')}>

dashboard/src/components/admins/AdminsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export default function AdminsTable({ onEdit, onDelete, onToggleStatus, onResetU
227227

228228
const handleSort = (column: string) => {
229229
const currentSort = filters.sort
230-
230+
231231
if (currentSort === column) {
232232
// First click: ascending, make it descending
233233
setFilters(prev => ({ ...prev, sort: '-' + column }))

dashboard/src/components/admins/columns.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ const createSortButton = (
3131
console.log('Sorting by column:', column)
3232
handleSort(column)
3333
}
34-
34+
3535
return (
36-
<button
37-
onClick={handleClick}
38-
className="flex w-full items-center gap-1"
39-
>
36+
<button onClick={handleClick} className="flex w-full items-center gap-1">
4037
<div className="text-xs">{t(label)}</div>
4138
{filters.sort && (filters.sort === column || filters.sort === '-' + column) && (
4239
<ChevronDown size={16} className={`transition-transform duration-300 ${filters.sort === column ? 'rotate-180' : ''} ${filters.sort === '-' + column ? 'rotate-0' : ''} `} />
@@ -50,7 +47,7 @@ export const setupColumns = ({ t, handleSort, filters, onEdit, onDelete, toggleS
5047
accessorKey: 'username',
5148
header: () => createSortButton('username', 'username', t, handleSort, filters),
5249
cell: ({ row }) => (
53-
<div className="overflow-hidden text-ellipsis whitespace-nowrap font-medium py-1.5">
50+
<div className="overflow-hidden text-ellipsis whitespace-nowrap py-1.5 font-medium">
5451
<div className="flex items-center gap-x-3">
5552
<div>
5653
{row.original.is_disabled ? (
@@ -74,7 +71,9 @@ export const setupColumns = ({ t, handleSort, filters, onEdit, onDelete, toggleS
7471
return (
7572
<div className="flex items-center gap-2 whitespace-nowrap">
7673
<ChartPie className="hidden h-4 w-4 sm:block" />
77-
<span dir="ltr" className="text-xs">{traffic ? formatBytes(traffic) : '0 B'}</span>
74+
<span dir="ltr" className="text-xs">
75+
{traffic ? formatBytes(traffic) : '0 B'}
76+
</span>
7877
</div>
7978
)
8079
},
@@ -86,7 +85,9 @@ export const setupColumns = ({ t, handleSort, filters, onEdit, onDelete, toggleS
8685
const total = row.getValue('lifetime_used_traffic') as number | null
8786
return (
8887
<div className="flex items-center gap-2 whitespace-nowrap">
89-
<span dir="ltr" className="text-xs">{formatBytes(total || 0)}</span>
88+
<span dir="ltr" className="text-xs">
89+
{formatBytes(total || 0)}
90+
</span>
9091
</div>
9192
)
9293
},

0 commit comments

Comments
 (0)