mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-08 04:56:00 +08:00
🎨 优化网页控制台
This commit is contained in:
parent
4dde8f912d
commit
b326deb42e
@ -2,18 +2,248 @@ import fastapi_amis_admin
|
||||
|
||||
from gsuid_core.version import __version__ as gscore_version
|
||||
|
||||
bots = 'HoshinoBot · NoneBot2 · Koishi · Yunzai · ZeroBot · AstrBot'
|
||||
sup = f'✨支持连接{bots}的多功能Bot插件核心✨'
|
||||
style = '''
|
||||
div {
|
||||
background: rgba(255, 255, 255, 0.6) url('/webstatic/bg.jpg');
|
||||
background-blend-mode: screen;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
html, body,
|
||||
.app-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:root {
|
||||
--Page-main-bg: #ffffff;
|
||||
--colors-brand-main: #ce5050;
|
||||
--colors-brand-5: #ce5050;
|
||||
--colors-brand-4: #b84343;
|
||||
--colors-brand-6: #de5b5b;
|
||||
--Layout-asideLink-color: #ce5050;
|
||||
--colors-brand-10: rgba(206, 80, 80, 0.08)
|
||||
--Layout-nav-height: 2.8rem;
|
||||
--borders-radius-3: 10px;
|
||||
--Layout-aside-bg: rgba(0, 0, 0, 0);
|
||||
--sizes-size-7: 1rem;
|
||||
}
|
||||
|
||||
.amis-scope {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: hidden; /* 防止滚动条 */
|
||||
}
|
||||
|
||||
.amis-scope .a-Panel {
|
||||
/* margin: 1.5rem 3rem 1.5rem -1.5rem; */
|
||||
padding: 1.5rem 3rem 1.5rem 0rem;
|
||||
border-radius: 10px;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
width: 150%;
|
||||
margin: 0 auto;
|
||||
margin-left: -25%;
|
||||
}
|
||||
|
||||
|
||||
rect {
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.amis-scope .a-TextControl .InputText-invisible {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.amis-scope .a-TextControl-icon-view svg {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.amis-scope .a-AppBcn {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.amis-scope .a-ButtonToolbar {
|
||||
border-radius: 10px;
|
||||
/* background-color: #ce5050; */
|
||||
}
|
||||
|
||||
/*
|
||||
.amis-scope .a-Layout--asideFixed .a-Layout-asideWrap {
|
||||
box-shadow: 1px 8px 3px 2px rgba(26, 25, 23, 0.3);
|
||||
}
|
||||
*/
|
||||
|
||||
.amis-scope .a-Layout-brand, .amis-scope .a-Layout-brandBar, .amis-scope .a-Layout-aside {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-list {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 8px; /* 圆角矩形,可根据需要调整数值 */
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
border: 1px solid #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 8px; /* 圆角矩形,可根据需要调整数值 */
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item:hover {
|
||||
background-color: #cfcfcf;
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemLabel {
|
||||
/* background-color: #cfcfcf; */
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item:hover > a > .a-AsideNav-itemLabel {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active > a {
|
||||
border-radius: 8px;
|
||||
background-color: #ce5050;
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active .a-AsideNav-item .a-AsideNav-itemLabel{
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-open > .a-AsideNav-item:hover > .a-AsideNav-itemLabel{
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item:hover > a > .a-AsideNav-itemLabel {
|
||||
color: unset;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active .a-AsideNav-itemLabel {
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item a {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
.a-AsideNav-item.is-open:has(.a-AsideNav-item.is-open.is-active) {
|
||||
background-color: transparent;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
a-AsideNav-item.is-open > a > i {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
a-AsideNav-item.is-open > a > a-AsideNav-itemLabel {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item a:hover {
|
||||
background-color: #ce5050;
|
||||
border-radius: 8px;
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active > a:hover {
|
||||
background: #ce5050;
|
||||
border-radius: 8px;
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-Layout-brand, .amis-scope .a-Layout-brandBar, .amis-scope .a-Layout-aside {
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: #cfcfcf;
|
||||
|
||||
}
|
||||
|
||||
.amis-scope a {
|
||||
color: #ce5050; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-Switch.is-checked {
|
||||
background: #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .m-l-sm {
|
||||
color: #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-subList {
|
||||
background: #FFFFFF;
|
||||
border-radius: 8px!important; /* 圆角矩形,可根据需要调整数值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow svg {
|
||||
fill : #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow::after {
|
||||
color : #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow::before {
|
||||
color : #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow:empty {
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
background: none !important; /* 移除原有背景 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item a:hover .a-AsideNav-itemArrow:empty:before {
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow:empty:before {
|
||||
content: "";
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ce5050' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-open > a > .a-AsideNav-itemArrow:empty:before {
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
}
|
||||
''' # noqa: E501
|
||||
|
||||
web_url = 'https://docs.sayu-bot.com'
|
||||
login_html = f'''
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
div {{
|
||||
background: rgba(255, 255, 255, 0.6) url('/webstatic/bg.jpg');
|
||||
background-blend-mode: screen;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
}}
|
||||
{style}
|
||||
</style>
|
||||
</head>
|
||||
<p>
|
||||
@ -32,10 +262,10 @@ login_html = f'''
|
||||
<a href='{web_url}/FAQ/'>常见问题</a>
|
||||
</div>
|
||||
<h5 align='center'>
|
||||
✨支持连接HoshinoBot · NoneBot2 · Koishi · Yunzai · ZeroBot的多功能Bot插件核心✨
|
||||
{sup}
|
||||
</h5>
|
||||
<h5 align='center'>
|
||||
✨支持平台: QQ群/频道 · Onebot v11/v12 · WeChat · 飞书 · Tg · Kook/dodo · Dc · 米游社✨
|
||||
✨支持平台: QQ群/频道 · Onebot v11/v12 · WeChat · 飞书 · Tg · Kook/dodo · Dc · 钉钉✨
|
||||
</h5>
|
||||
</p>
|
||||
</html>
|
||||
@ -44,8 +274,8 @@ login_html = f'''
|
||||
footer_html = f'''
|
||||
<p align='right'>
|
||||
<div class='p-2 text-center bg-light'>Copyright © 2021 - 2024
|
||||
<a href='https://github.com/KimigaiiWuyi/GenshinUID' target='_blank'
|
||||
class='link-secondary'>GenshinUID {gscore_version}
|
||||
<a href='https://github.com/Genshin-bots/gsuid_core' target='_blank'
|
||||
class='link-secondary'>早柚核心 {gscore_version}
|
||||
</a>
|
||||
X
|
||||
<a target='_blank'
|
||||
|
@ -35,7 +35,7 @@ async def _get_page_as_app(self, request: Request) -> App:
|
||||
tpl='''
|
||||
<div class='flex justify-between'>
|
||||
<div>
|
||||
<a href='https://github.com/KimigaiiWuyi/GenshinUID'
|
||||
<a href='https://github.com/Genshin-bots/gsuid_core'
|
||||
target='_blank' title='Copyright'>
|
||||
<i class='fa fa-github fa-2x'></i>
|
||||
</a>
|
||||
|
@ -231,96 +231,6 @@ class GsNormalForm(admin.FormAdmin):
|
||||
return True
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class AmisPageAdmin(admin.PageAdmin):
|
||||
page_schema = '入门使用'
|
||||
|
||||
async def get_page(self, request: Request) -> Page:
|
||||
return Page.parse_obj(
|
||||
{
|
||||
'type': 'page',
|
||||
'body': {
|
||||
'type': 'markdown',
|
||||
'value': f'{gsuid_webconsole_help}',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class UserBindFormAdmin(GsNormalForm):
|
||||
page_schema = PageSchema(label='绑定CK或SK', icon='fa fa-link') # type: ignore
|
||||
|
||||
async def get_form(self, request: Request) -> Form:
|
||||
form = await super().get_form(request)
|
||||
form.body.sort(key=lambda form_item: form_item.type, reverse=True) # type: ignore
|
||||
form.update_from_kwargs(
|
||||
title='',
|
||||
mode=DisplayModeEnum.horizontal,
|
||||
submitText='绑定',
|
||||
actionsClassName='no-border m-none p-none',
|
||||
panelClassName='',
|
||||
wrapWithPanel=True,
|
||||
horizontal=Horizontal(left=3, right=9),
|
||||
actions=[
|
||||
ButtonToolbar(
|
||||
buttons=[
|
||||
Action(
|
||||
actionType='submit',
|
||||
label='绑定',
|
||||
level=LevelEnum.primary,
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
)
|
||||
return form
|
||||
|
||||
async def get_page(self, request: Request) -> Page:
|
||||
page = await super().get_page(request)
|
||||
page.body = [
|
||||
Alert(
|
||||
level='warning',
|
||||
body='CK获取可查看左侧栏 [入门使用] 相关细则!',
|
||||
),
|
||||
amis.Divider(),
|
||||
Grid(
|
||||
columns=[
|
||||
{
|
||||
'body': [page.body],
|
||||
'lg': 10,
|
||||
'md': 10,
|
||||
'valign': 'middle',
|
||||
}
|
||||
],
|
||||
align='center',
|
||||
valign='middle',
|
||||
),
|
||||
]
|
||||
return page
|
||||
|
||||
# 创建表单数据模型
|
||||
class schema(BaseModel):
|
||||
bot_id: str = Field(..., title='平台ID') # type: ignore
|
||||
user_id: str = Field(..., title='用户ID', min_length=3, max_length=30) # type: ignore
|
||||
cookie: str = Field(..., title='Cookie或者Login_ticket') # type: ignore
|
||||
|
||||
# 处理表单提交数据
|
||||
async def handle(
|
||||
self, request: Request, data: schema, **kwargs
|
||||
) -> BaseApiOut[Any]:
|
||||
try:
|
||||
im = await _deal_ck(data.bot_id, data.cookie, data.user_id)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
return BaseApiOut(status=-1, msg='你输入的CK可能已经失效/或者该用户ID未绑定UID') # type: ignore
|
||||
ok_num = im.count('成功')
|
||||
if ok_num < 1:
|
||||
return BaseApiOut(status=-1, msg=im) # type: ignore
|
||||
else:
|
||||
return BaseApiOut(msg=im) # type: ignore
|
||||
|
||||
|
||||
class GsAdminModel(admin.ModelAdmin):
|
||||
async def has_page_permission(
|
||||
self,
|
||||
@ -366,51 +276,6 @@ class GsAdminPage(admin.PageAdmin):
|
||||
)
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class CKAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='CK管理', icon='fa fa-database') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsUser
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class PushAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='推送管理', icon='fa fa-bullhorn') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsPush
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class CacheAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='缓存管理', icon='fa fa-recycle') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsCache
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class BindAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='绑定管理', icon='fa fa-users') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsBind
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class SubscribeAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='订阅管理', icon='fa fa-rss') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = Subscribe
|
||||
|
||||
|
||||
# 注册自定义首页
|
||||
@site.register_admin
|
||||
class MyHomeAdmin(admin.HomeAdmin):
|
||||
@ -486,7 +351,6 @@ class CoreManagePage(GsAdminPage):
|
||||
return Page.parse_obj(get_core_config_page())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class SVManagePage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('功能服务配置'),
|
||||
@ -501,7 +365,6 @@ class SVManagePage(GsAdminPage):
|
||||
return Page.parse_obj(get_sv_page())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class ConfigManagePage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('修改插件设定'),
|
||||
@ -516,7 +379,6 @@ class ConfigManagePage(GsAdminPage):
|
||||
return Page.parse_obj(get_config_page())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class PluginsManagePage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('插件管理'),
|
||||
@ -532,6 +394,18 @@ class PluginsManagePage(GsAdminPage):
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class PluginsConfig(admin.AdminApp):
|
||||
page_schema = PageSchema(label="插件管理", icon="fa fa-cogs") # type: ignore
|
||||
|
||||
def __init__(self, app: "admin.AdminApp"):
|
||||
super().__init__(app)
|
||||
self.register_admin(
|
||||
SVManagePage,
|
||||
ConfigManagePage,
|
||||
PluginsManagePage,
|
||||
)
|
||||
|
||||
|
||||
class LogsPage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('实时日志'),
|
||||
@ -546,7 +420,6 @@ class LogsPage(GsAdminPage):
|
||||
return Page.parse_obj(create_log_page())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class HistoryLogsPage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('历史日志'),
|
||||
@ -561,7 +434,6 @@ class HistoryLogsPage(GsAdminPage):
|
||||
return Page.parse_obj(get_history_logs_page())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class PushPage(GsAdminPage):
|
||||
page_schema = PageSchema(
|
||||
label=('批量推送消息'),
|
||||
@ -576,5 +448,173 @@ class PushPage(GsAdminPage):
|
||||
return Page.parse_obj(await get_batch_push_panel())
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class LogAndMessage(admin.AdminApp):
|
||||
page_schema = PageSchema(label="日志和消息", icon="fa fa-comments-o") # type: ignore
|
||||
|
||||
def __init__(self, app: "admin.AdminApp"):
|
||||
super().__init__(app)
|
||||
self.register_admin(
|
||||
LogsPage,
|
||||
HistoryLogsPage,
|
||||
PushPage,
|
||||
)
|
||||
|
||||
|
||||
class CKAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='CK管理', icon='fa fa-database') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsUser
|
||||
|
||||
|
||||
class PushAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='推送管理', icon='fa fa-bullhorn') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsPush
|
||||
|
||||
|
||||
class CacheAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='缓存管理', icon='fa fa-recycle') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsCache
|
||||
|
||||
|
||||
class BindAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='绑定管理', icon='fa fa-users') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = GsBind
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class MiHoYoDatabase(admin.AdminApp):
|
||||
page_schema = PageSchema(label="米游数据库", icon="fa fa-database") # type: ignore
|
||||
|
||||
def __init__(self, app: "admin.AdminApp"):
|
||||
super().__init__(app)
|
||||
self.register_admin(
|
||||
CKAdmin,
|
||||
PushAdmin,
|
||||
CacheAdmin,
|
||||
BindAdmin,
|
||||
)
|
||||
|
||||
|
||||
class AmisPageAdmin(admin.PageAdmin):
|
||||
page_schema = '入门使用'
|
||||
|
||||
async def get_page(self, request: Request) -> Page:
|
||||
return Page.parse_obj(
|
||||
{
|
||||
'type': 'page',
|
||||
'body': {
|
||||
'type': 'markdown',
|
||||
'value': f'{gsuid_webconsole_help}',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class UserBindFormAdmin(GsNormalForm):
|
||||
page_schema = PageSchema(label='绑定CK或SK', icon='fa fa-link') # type: ignore
|
||||
|
||||
async def get_form(self, request: Request) -> Form:
|
||||
form = await super().get_form(request)
|
||||
form.body.sort(key=lambda form_item: form_item.type, reverse=True) # type: ignore
|
||||
form.update_from_kwargs(
|
||||
title='',
|
||||
mode=DisplayModeEnum.horizontal,
|
||||
submitText='绑定',
|
||||
actionsClassName='no-border m-none p-none',
|
||||
panelClassName='',
|
||||
wrapWithPanel=True,
|
||||
horizontal=Horizontal(left=3, right=9),
|
||||
actions=[
|
||||
ButtonToolbar(
|
||||
buttons=[
|
||||
Action(
|
||||
actionType='submit',
|
||||
label='绑定',
|
||||
level=LevelEnum.primary,
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
)
|
||||
return form
|
||||
|
||||
async def get_page(self, request: Request) -> Page:
|
||||
page = await super().get_page(request)
|
||||
page.body = [
|
||||
Alert(
|
||||
level='warning',
|
||||
body='CK获取可查看左侧栏 [入门使用] 相关细则!',
|
||||
),
|
||||
amis.Divider(),
|
||||
Grid(
|
||||
columns=[
|
||||
{
|
||||
'body': [page.body],
|
||||
'lg': 10,
|
||||
'md': 10,
|
||||
'valign': 'middle',
|
||||
}
|
||||
],
|
||||
align='center',
|
||||
valign='middle',
|
||||
),
|
||||
]
|
||||
return page
|
||||
|
||||
# 创建表单数据模型
|
||||
class schema(BaseModel):
|
||||
bot_id: str = Field(..., title='平台ID') # type: ignore
|
||||
user_id: str = Field(..., title='用户ID', min_length=3, max_length=30) # type: ignore
|
||||
cookie: str = Field(..., title='Cookie或者Login_ticket') # type: ignore
|
||||
|
||||
# 处理表单提交数据
|
||||
async def handle(
|
||||
self, request: Request, data: schema, **kwargs
|
||||
) -> BaseApiOut[Any]:
|
||||
try:
|
||||
im = await _deal_ck(data.bot_id, data.cookie, data.user_id)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
return BaseApiOut(status=-1, msg='你输入的CK可能已经失效/或者该用户ID未绑定UID') # type: ignore
|
||||
ok_num = im.count('成功')
|
||||
if ok_num < 1:
|
||||
return BaseApiOut(status=-1, msg=im) # type: ignore
|
||||
else:
|
||||
return BaseApiOut(msg=im) # type: ignore
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class MiHoYoBind(admin.AdminApp):
|
||||
page_schema = PageSchema(label="米游账户绑定", icon="fa fa-link") # type: ignore
|
||||
|
||||
def __init__(self, app: "admin.AdminApp"):
|
||||
super().__init__(app)
|
||||
self.register_admin(
|
||||
UserBindFormAdmin,
|
||||
AmisPageAdmin,
|
||||
)
|
||||
|
||||
|
||||
@site.register_admin
|
||||
class SubscribeAdmin(GsAdminModel):
|
||||
pk_name = 'id'
|
||||
page_schema = PageSchema(label='订阅管理', icon='fa fa-rss') # type: ignore
|
||||
|
||||
# 配置管理模型
|
||||
model = Subscribe
|
||||
|
||||
|
||||
# 取消注册默认管理类
|
||||
site.unregister_admin(admin.HomeAdmin, APIDocsApp, FileAdmin)
|
||||
|
@ -25,20 +25,28 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--Page-main-bg: #e389890d;
|
||||
--Page-main-bg: #ffffff;
|
||||
--colors-brand-main: #ce5050;
|
||||
--colors-brand-5: #ce5050;
|
||||
--colors-brand-4: #b84343;
|
||||
--colors-brand-6: #de5b5b;
|
||||
--Layout-asideLink-color: #ce5050;
|
||||
--colors-brand-10: rgba(206, 80, 80, 0.08)
|
||||
--Layout-nav-height: 2.8rem;
|
||||
--borders-radius-3: 10px;
|
||||
--Layout-aside-bg: rgba(0, 0, 0, 0);
|
||||
--sizes-size-7: 1rem;
|
||||
}
|
||||
|
||||
.amis-scope .a-AppBcn {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
/*
|
||||
.amis-scope .a-Layout--asideFixed .a-Layout-asideWrap {
|
||||
box-shadow: 1px 8px 3px 2px rgba(26, 25, 23, 0.3);
|
||||
}
|
||||
*/
|
||||
|
||||
.amis-scope .a-Layout-brand, .amis-scope .a-Layout-brandBar, .amis-scope .a-Layout-aside {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
@ -48,6 +56,7 @@
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 8px; /* 圆角矩形,可根据需要调整数值 */
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
border: 1px solid #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item {
|
||||
@ -66,7 +75,7 @@
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item:hover .a-AsideNav-itemLabel {
|
||||
.amis-scope .a-AsideNav-item:hover > a > .a-AsideNav-itemLabel {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
@ -76,14 +85,23 @@
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-ButtonToolbar {
|
||||
border-radius: 10px;
|
||||
background-color: #ce5050;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active .a-AsideNav-item .a-AsideNav-itemLabel{
|
||||
color: #1a1917; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active .a-AsideNav-item:hover .a-AsideNav-itemLabel{
|
||||
.amis-scope .a-AsideNav-item.is-open > .a-AsideNav-item:hover > .a-AsideNav-itemLabel{
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item:hover > a > .a-AsideNav-itemLabel {
|
||||
color: unset;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item.is-active .a-AsideNav-itemLabel {
|
||||
color: #FFFFFF; /* 修改文字颜色,可根据需要调整颜色值 */
|
||||
}
|
||||
@ -92,6 +110,21 @@
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
.a-AsideNav-item.is-open:has(.a-AsideNav-item.is-open.is-active) {
|
||||
background-color: transparent;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
a-AsideNav-item.is-open > a > i {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
a-AsideNav-item.is-open > a > a-AsideNav-itemLabel {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item a:hover {
|
||||
background-color: #ce5050;
|
||||
border-radius: 8px;
|
||||
@ -140,6 +173,25 @@
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow:empty {
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
background: none !important; /* 移除原有背景 */
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-item a:hover .a-AsideNav-itemArrow:empty:before {
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
background-position: center center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow:empty:before {
|
||||
content: "";
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ce5050' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
@ -149,7 +201,7 @@
|
||||
}
|
||||
|
||||
|
||||
.amis-scope .a-AsideNav-itemArrow:empty:before {
|
||||
.amis-scope .a-AsideNav-item.is-open > a > .a-AsideNav-itemArrow:empty:before {
|
||||
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
background-repeat: no-repeat;
|
||||
width: 0.625rem;
|
||||
@ -158,6 +210,16 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.amis-scope .a-Panel {
|
||||
margin: 1.5rem 1.5rem 1.5rem 1.5rem;
|
||||
}
|
||||
|
||||
.amis-scope .a-Property > table {
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
BIN
gsuid_core/webstatic/_bg.jpg
Normal file
BIN
gsuid_core/webstatic/_bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
Binary file not shown.
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 346 KiB |
Loading…
x
Reference in New Issue
Block a user