mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-02 09:26:12 +08:00
✨ WebUI 中,允许查看 Cookie 的 content
This commit is contained in:
parent
8d32145ea8
commit
ff1c3c3159
@ -76,11 +76,17 @@ function CookieEditModal({ visible, setVisible, cookie }: CookieEditModalProps)
|
||||
<Input disabled value={cookie.id.toString()} />
|
||||
</FormItem>
|
||||
<FormItem label="Cookie 名称">
|
||||
<Input value={cookie.friendly_name} disabled />
|
||||
<Input value={cookie.cookie_name} disabled />
|
||||
</FormItem>
|
||||
<FormItem label="所属站点">
|
||||
<Input value={cookie.site_name} disabled />
|
||||
</FormItem>
|
||||
<FormItem label="内容">
|
||||
<Input.TextArea
|
||||
value={cookie.content}
|
||||
disabled
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="标签">
|
||||
<Input.TextArea
|
||||
|
@ -37,19 +37,7 @@ export default function CookieManager() {
|
||||
setShowEditModal(true);
|
||||
};
|
||||
|
||||
let data = [
|
||||
{
|
||||
id: 3,
|
||||
site_name: 'rss',
|
||||
friendly_name: 'rss [{"ewqe":"e]',
|
||||
last_usage: '1970-01-01T00:00:00',
|
||||
status: '',
|
||||
cd_milliseconds: 10000,
|
||||
is_universal: false,
|
||||
is_anonymous: false,
|
||||
tags: {},
|
||||
},
|
||||
];
|
||||
let data = [];
|
||||
if (siteName) {
|
||||
data = cookiesList.filter((tSite) => tSite.site_name === siteName);
|
||||
}
|
||||
@ -61,7 +49,7 @@ export default function CookieManager() {
|
||||
},
|
||||
{
|
||||
title: 'Cookie 名称',
|
||||
dataIndex: 'friendly_name',
|
||||
dataIndex: 'cookie_name',
|
||||
},
|
||||
{
|
||||
title: '所属站点',
|
||||
@ -84,7 +72,7 @@ export default function CookieManager() {
|
||||
render: (_: null, record: Cookie) => (
|
||||
<Space size="small">
|
||||
<Popconfirm
|
||||
title={`确定删除 Cookie ${record.friendly_name} ?`}
|
||||
title={`确定删除 Cookie ${record.cookie_name} ?`}
|
||||
onOk={handleDelCookie(record.id.toString())}
|
||||
>
|
||||
<span className="list-actions-icon">
|
||||
|
@ -91,7 +91,8 @@ export interface Target {
|
||||
export interface Cookie {
|
||||
id: number;
|
||||
site_name: string;
|
||||
friendly_name: string;
|
||||
content: string;
|
||||
cookie_name: string;
|
||||
last_usage: Date;
|
||||
status: string;
|
||||
cd_milliseconds: number;
|
||||
|
@ -3,7 +3,7 @@ prev: /usage/
|
||||
next: /usage/install
|
||||
---
|
||||
|
||||
# 🍪 Bison 的自行车电助力装置
|
||||
# :cookie: Bison 的自行车电助力装置
|
||||
|
||||
Bison 支持 Cookie 啦,你可以将 Cookie 关联到订阅以获得更好的体验。
|
||||
|
||||
@ -26,7 +26,7 @@ nonebot-bison 开发者及 MountainDash 社区不对因使用 Cookie 导致的
|
||||
::: warning 使用须知
|
||||
Cookie 全局生效,这意味着,通过你的 Cookie 获取到的内容,可能会被共享给其他用户。
|
||||
|
||||
当然,Bison 不会将你的 Cookie 透露给其他用户,包括管理员。
|
||||
当然,Bison 不会将你的 Cookie 透露给其他用户。但是,管理员或其他可以接触的数据库的人员可以看到**所有 Cookie**的内容。所以,在上传 Cookie 之前,请确保管理人员可信。
|
||||
:::
|
||||
|
||||
## :wheelchair: 我该怎么使用 Cookie?
|
||||
|
@ -211,12 +211,12 @@ async def update_weigth_config(platformName: str, target: str, weight_config: We
|
||||
|
||||
@router.get("/cookie", dependencies=[Depends(check_is_superuser)])
|
||||
async def get_cookie(site_name: str = None, target: str = None) -> list[Cookie]:
|
||||
# todo: 调用 client_mgr 来添加cookie,以校验和获取cookie_name
|
||||
cookies_in_db = await config.get_cookie(site_name, is_anonymous=False)
|
||||
return [
|
||||
Cookie(
|
||||
id=cookies_in_db[i].id,
|
||||
friendly_name=cookies_in_db[i].cookie_name,
|
||||
content=cookies_in_db[i].content,
|
||||
cookie_name=cookies_in_db[i].cookie_name,
|
||||
site_name=cookies_in_db[i].site_name,
|
||||
last_usage=cookies_in_db[i].last_usage,
|
||||
status=cookies_in_db[i].status,
|
||||
|
@ -75,7 +75,8 @@ class Target(BaseModel):
|
||||
class Cookie(BaseModel):
|
||||
id: int
|
||||
site_name: str
|
||||
friendly_name: str
|
||||
content: str
|
||||
cookie_name: str
|
||||
last_usage: datetime
|
||||
status: str
|
||||
cd_milliseconds: int
|
||||
|
Loading…
x
Reference in New Issue
Block a user