Compare commits

..

3 Commits

Author SHA1 Message Date
d6e7acf45f
👷 fix by ruff 2024-12-17 11:17:49 +08:00
9dec89a317
🐛 fix type hint 2024-12-17 11:14:51 +08:00
4cf3a82562
B站 cookie选择策略优化 2024-12-17 11:13:30 +08:00
6 changed files with 10 additions and 12 deletions

View File

@ -9,7 +9,6 @@
### Bug 修复
- :bug: 修复新版 httpx 中 proxy 不起效的问题 [@suyiiyii](https://github.com/suyiiyii) ([#669](https://github.com/MountainDash/nonebot-bison/pull/669))
- :bug: 修复 cookie 模块 type hint [@suyiiyii](https://github.com/suyiiyii) ([#658](https://github.com/MountainDash/nonebot-bison/pull/658))
- :bug: B站转发动态补充 DeletedItem 类型解析 [@AzideCupric](https://github.com/AzideCupric) ([#659](https://github.com/MountainDash/nonebot-bison/pull/659))
- :bug: 小刻食堂cdn使用https [@phidiaLam](https://github.com/phidiaLam) ([#650](https://github.com/MountainDash/nonebot-bison/pull/650))

View File

@ -1,4 +1,4 @@
FROM node:22.11.0 AS frontend
FROM node:22.11.0 as frontend
ADD . /app
WORKDIR /app/admin-frontend
RUN npm install -g pnpm

View File

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.10
FROM python:3.11-slim-bullseye AS base
FROM python:3.11-slim-bullseye as base
FROM base AS builder
FROM base as builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
@ -12,6 +12,7 @@ ENV PYTHONFAULTHANDLER=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
PATH="$PATH:/runtime/bin" \
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.10/site-packages" \
# Versions:
POETRY_VERSION=1.7.1
RUN apt-get update && apt-get install -y build-essential unzip wget python-dev git
@ -24,7 +25,7 @@ COPY README.md pyproject.toml poetry.lock /src/
RUN poetry export --only=main,docker --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
FROM base AS runtime
FROM base as runtime
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt \

View File

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.10
FROM python:3.11-slim-bullseye AS base
FROM python:3.11-slim-bullseye as base
FROM base AS builder
FROM base as builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
@ -12,6 +12,7 @@ ENV PYTHONFAULTHANDLER=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
PATH="$PATH:/runtime/bin" \
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.10/site-packages" \
# Versions:
POETRY_VERSION=1.7.1
RUN apt-get update && apt-get install -y build-essential unzip wget python3-dev git
@ -24,7 +25,7 @@ COPY pyproject.toml poetry.lock /src/
RUN poetry export --only=main,docker --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
FROM base AS runtime
FROM base as runtime
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt \

View File

@ -91,12 +91,9 @@ class BilibiliClientManager(CookieClientManager):
async def _choose_cookie(self, target: Target | None) -> CookieModel:
"""选择 cookie 的具体算法"""
if self._current_user_cookie is None:
# 若当前没有选定用户 cookie 则尝试获取
self._current_user_cookie = await self._get_next_user_cookie()
if self._current_user_cookie:
# 如果当前有选定的用户 cookie 则直接返回
return self._current_user_cookie
# 否则返回匿名 cookie
return (await config.get_cookie(self._site_name, is_anonymous=True))[0]
@override

View File

@ -3,7 +3,7 @@ import httpx
from nonebot_bison.plugin_config import plugin_config
http_args = {
"proxy": plugin_config.bison_proxy or None,
"proxies": plugin_config.bison_proxy or None,
}
http_headers = {"user-agent": plugin_config.bison_ua}