chore: update packages and python
This commit is contained in:
parent
8547834c2a
commit
50971eeb0e
4
.github/workflows/portable.yml
vendored
4
.github/workflows/portable.yml
vendored
@ -8,7 +8,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
FFMPEG_ARCHIVE_URL: https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-lgpl-shared.zip
|
FFMPEG_ARCHIVE_URL: https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-lgpl-shared.zip
|
||||||
FFMPEG_ARCHIVE_NAME: ffmpeg-master-latest-win64-lgpl-shared.zip
|
FFMPEG_ARCHIVE_NAME: ffmpeg-master-latest-win64-lgpl-shared.zip
|
||||||
PYTHON_ARCHIVE_URL: https://www.python.org/ftp/python/3.10.4/python-3.10.4-embed-amd64.zip
|
PYTHON_ARCHIVE_URL: https://www.python.org/ftp/python/3.11.1/python-3.11.1-embed-amd64.zip
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.11.1"
|
||||||
|
|
||||||
- name: Download ffmpeg archive
|
- name: Download ffmpeg archive
|
||||||
run: Invoke-WebRequest -Uri $($env:FFMPEG_ARCHIVE_URL) -OutFile ffmpeg.zip
|
run: Invoke-WebRequest -Uri $($env:FFMPEG_ARCHIVE_URL) -OutFile ffmpeg.zip
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM python:3.10-slim-buster
|
FROM python:3.11-slim-buster
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
VOLUME ["/cfg", "/log", "/rec"]
|
VOLUME ["/cfg", "/log", "/rec"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM python:3.10-slim-buster
|
FROM python:3.11-slim-buster
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
VOLUME ["/cfg", "/log", "/rec"]
|
VOLUME ["/cfg", "/log", "/rec"]
|
||||||
|
10
setup.cfg
10
setup.cfg
@ -38,13 +38,13 @@ install_requires =
|
|||||||
python-liquid >= 1.2.1, < 2.0.0
|
python-liquid >= 1.2.1, < 2.0.0
|
||||||
typing-extensions >= 3.10.0.0
|
typing-extensions >= 3.10.0.0
|
||||||
ordered-set >= 4.1.0, < 5.0.0
|
ordered-set >= 4.1.0, < 5.0.0
|
||||||
fastapi >= 0.70.0, < 0.71.0
|
fastapi >= 0.88.0, < 0.89.0
|
||||||
email_validator >= 1.1.3, < 2.0.0
|
email_validator >= 1.1.3, < 2.0.0
|
||||||
click < 8.1.0
|
click < 8.1.0
|
||||||
typer >= 0.4.1, < 0.5.0
|
typer >= 0.7.0, < 0.8.0
|
||||||
aiohttp >= 3.8.1, < 4.0.0
|
aiohttp >= 3.8.1, < 4.0.0
|
||||||
requests >= 2.24.0, < 3.0.0
|
requests >= 2.24.0, < 3.0.0
|
||||||
aiofiles >= 0.8.0, < 0.9.0
|
aiofiles >= 22.1.0, < 23.0.0
|
||||||
tenacity >= 8.0.1, < 9.0.0
|
tenacity >= 8.0.1, < 9.0.0
|
||||||
colorama >= 0.4.4, < 0.5.0
|
colorama >= 0.4.4, < 0.5.0
|
||||||
humanize >= 3.13.1, < 4.0.0
|
humanize >= 3.13.1, < 4.0.0
|
||||||
@ -52,14 +52,14 @@ install_requires =
|
|||||||
attrs >= 21.2.0, < 22.0.0
|
attrs >= 21.2.0, < 22.0.0
|
||||||
lxml >= 4.6.4, < 5.0.0
|
lxml >= 4.6.4, < 5.0.0
|
||||||
toml >= 0.10.2, < 0.11.0
|
toml >= 0.10.2, < 0.11.0
|
||||||
m3u8 >= 1.0.0, < 2.0.0
|
m3u8 >= 3.3.0, < 4.0.0
|
||||||
av >= 10.0.0, < 11.0.0
|
av >= 10.0.0, < 11.0.0
|
||||||
jsonpath == 0.82
|
jsonpath == 0.82
|
||||||
psutil >= 5.8.0, < 6.0.0
|
psutil >= 5.8.0, < 6.0.0
|
||||||
reactivex >= 4.0.0, < 5.0.0
|
reactivex >= 4.0.0, < 5.0.0
|
||||||
bitarray >= 2.2.5, < 3.0.0
|
bitarray >= 2.2.5, < 3.0.0
|
||||||
brotli >= 1.0.9, < 2.0.0
|
brotli >= 1.0.9, < 2.0.0
|
||||||
uvicorn[standard] >= 0.15.0, < 0.16.0
|
uvicorn[standard] >= 0.20.0, < 0.21.0
|
||||||
|
|
||||||
[options.extras_require]
|
[options.extras_require]
|
||||||
dev =
|
dev =
|
||||||
|
@ -137,12 +137,12 @@ api.include_router(update.router)
|
|||||||
|
|
||||||
|
|
||||||
class WebAppFiles(StaticFiles):
|
class WebAppFiles(StaticFiles):
|
||||||
async def lookup_path(
|
def lookup_path(
|
||||||
self, path: str
|
self, path: str
|
||||||
) -> Tuple[str, Optional[os.stat_result]]:
|
) -> Tuple[str, Optional[os.stat_result]]:
|
||||||
if path == '404.html':
|
if path == '404.html':
|
||||||
path = 'index.html'
|
path = 'index.html'
|
||||||
return await super().lookup_path(path)
|
return super().lookup_path(path)
|
||||||
|
|
||||||
def file_response(self, full_path: str, *args, **kwargs) -> Response: # type: ignore # noqa
|
def file_response(self, full_path: str, *args, **kwargs) -> Response: # type: ignore # noqa
|
||||||
# ignore MIME types from Windows registry
|
# ignore MIME types from Windows registry
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
import secrets
|
import secrets
|
||||||
from typing import Optional, Set, Dict
|
from typing import Dict, Optional, Set
|
||||||
|
|
||||||
from fastapi import status, Request, Header
|
from fastapi import Header, Request, status
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -21,34 +20,26 @@ attempting_clients: Dict[str, int] = {}
|
|||||||
|
|
||||||
|
|
||||||
async def authenticate(
|
async def authenticate(
|
||||||
request: Request,
|
request: Request, x_api_key: Optional[str] = Header(None)
|
||||||
x_api_key: Optional[str] = Header(None),
|
|
||||||
) -> None:
|
) -> None:
|
||||||
assert api_key, 'api_key is required'
|
assert api_key, 'api_key is required'
|
||||||
|
|
||||||
if not x_api_key:
|
if not x_api_key:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED, detail='No api key'
|
||||||
detail='No api key',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert request.client is not None, 'client should not be None'
|
||||||
client_ip = request.client.host
|
client_ip = request.client.host
|
||||||
assert client_ip, 'client_ip is required'
|
assert client_ip, 'client_ip is required'
|
||||||
|
|
||||||
if client_ip in blacklist:
|
if client_ip in blacklist:
|
||||||
raise HTTPException(
|
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail='Blacklisted')
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
|
||||||
detail='Blacklisted',
|
|
||||||
)
|
|
||||||
if client_ip not in whitelist:
|
if client_ip not in whitelist:
|
||||||
if (
|
if len(whitelist) >= MAX_WHITELIST or len(blacklist) >= MAX_BLACKLIST:
|
||||||
len(whitelist) >= MAX_WHITELIST or
|
|
||||||
len(blacklist) >= MAX_BLACKLIST
|
|
||||||
):
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail='Max clients allowed in whitelist or blacklist '
|
detail='Max clients allowed in whitelist or blacklist ' 'will exceeded',
|
||||||
'will exceeded',
|
|
||||||
)
|
)
|
||||||
if len(attempting_clients) >= MAX_ATTEMPTING_CLIENTS:
|
if len(attempting_clients) >= MAX_ATTEMPTING_CLIENTS:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@ -71,8 +62,7 @@ async def authenticate(
|
|||||||
if client_ip in whitelist:
|
if client_ip in whitelist:
|
||||||
whitelist.remove(client_ip)
|
whitelist.remove(client_ip)
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED, detail='API key is invalid'
|
||||||
detail='API key is invalid',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if client_ip in attempting_clients:
|
if client_ip in attempting_clients:
|
||||||
|
Loading…
Reference in New Issue
Block a user