Skip to content

Commit 2662e45

Browse files
committed
perf: remove fetch ip for faster startup
1 parent 880aa12 commit 2662e45

11 files changed

Lines changed: 12 additions & 96 deletions

File tree

app/db/crud/admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
AdminSimpleSortOption,
2121
AdminSortField,
2222
AdminSortOption,
23-
SortDirection,
2423
hash_password,
2524
)
2625
from app.models.stats import Period, UserUsageStat, UserUsageStatsList

app/db/crud/client_template.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
ClientTemplateSimpleSortField,
1414
ClientTemplateSimpleSortOption,
1515
ClientTemplateType,
16-
SortDirection,
1716
)
1817

1918
TEMPLATE_TYPE_TO_LEGACY_KEY: dict[ClientTemplateType, str] = {

app/db/crud/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
CoreSimpleListQuery,
99
CoreSimpleSortField,
1010
CoreSimpleSortOption,
11-
SortDirection,
1211
)
1312

1413

app/db/crud/group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
GroupSimpleListQuery,
1717
GroupSimpleSortField,
1818
GroupSimpleSortOption,
19-
SortDirection,
2019
)
2120

2221
from .host import upsert_inbounds

app/db/crud/node.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
NodeSimpleListQuery,
2424
NodeSimpleSortField,
2525
NodeSimpleSortOption,
26-
SortDirection,
2726
UsageTable,
2827
)
2928
from app.models.stats import NodeStats, NodeStatsList, NodeUsageStat, NodeUsageStatsList, Period

app/db/crud/user.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
)
3636
from app.models.user import (
3737
ExpiredUsersQuery,
38-
SortDirection,
3938
UserCreate,
4039
UserListQuery,
4140
UserModify,

app/db/crud/user_template.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from app.db.models import NextPlan, UserTemplate, template_group_association
77
from app.models.user_template import (
8-
SortDirection,
98
UserTemplateCreate,
109
UserTemplateListQuery,
1110
UserTemplateModify,

app/models/status_emojis.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
STATUS_EMOJIS = {
2+
"active": "✅",
3+
"expired": "⌛️",
4+
"limited": "🪫",
5+
"disabled": "❌",
6+
"on_hold": "🔌",
7+
}

app/subscription/share.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
from app.core.hosts import host_manager
1111
from app.db.models import UserStatus
12+
from app.models.status_emojis import STATUS_EMOJIS
1213
from app.models.subscription import SubscriptionInboundData
1314
from app.models.user import UsersResponseWithInbounds
1415
from app.subscription.client_templates import subscription_client_templates, subscription_xray_templates
15-
from app.utils.system import get_public_ip, get_public_ipv6, readable_size
16+
from app.utils.system import readable_size
1617
from config import wireguard_settings
1718

1819
from . import (
@@ -25,16 +26,8 @@
2526
XrayConfiguration,
2627
)
2728

28-
SERVER_IP = get_public_ip()
29-
SERVER_IPV6 = get_public_ipv6()
30-
31-
STATUS_EMOJIS = {
32-
"active": "✅",
33-
"expired": "⌛️",
34-
"limited": "🪫",
35-
"disabled": "❌",
36-
"on_hold": "🔌",
37-
}
29+
SERVER_IP = "127.0.0.1"
30+
SERVER_IPV6 = "[::1]"
3831

3932

4033
def _build_subscription_config(

app/telegram/utils/texts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from aiogram.utils.formatting import html_decoration
55

66
from app.models.group import Group
7+
from app.models.status_emojis import STATUS_EMOJIS
78
from app.models.system import SystemStats
89
from app.models.user import UserResponse, UserStatus
9-
from app.subscription.share import STATUS_EMOJIS
1010
from app.telegram.utils.shared import readable_size
1111

1212
b = html_decoration.bold

0 commit comments

Comments
 (0)