This commit is contained in:
parent
8b925f852d
commit
b772ce8b7e
BIN
dist/rupload-1.3.37-py3-none-any.whl
vendored
BIN
dist/rupload-1.3.37-py3-none-any.whl
vendored
Binary file not shown.
BIN
dist/rupload-1.3.37.tar.gz
vendored
BIN
dist/rupload-1.3.37.tar.gz
vendored
Binary file not shown.
@ -2,14 +2,19 @@ import pathlib
|
|||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
|
MAX_FILE_SIZE = 1024 * 1024 * 50 # 50Mb
|
||||||
|
UPLOAD_FOLDER_QUOTA = 10 * 1024 * 1024 * 1024 # 10Gb
|
||||||
|
UPLOAD_URL = "/"
|
||||||
|
UPLOAD_PATH = "uploads"
|
||||||
|
|
||||||
|
|
||||||
class Rupload(web.Application):
|
class Rupload(web.Application):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
upload_url: str = "/uploads/",
|
upload_url: str = UPLOAD_URL,
|
||||||
upload_path: str = "uploads",
|
upload_path: str = UPLOAD_PATH,
|
||||||
max_file_size: int = 1024 * 1024 * 50,
|
max_file_size: int = MAX_FILE_SIZE,
|
||||||
upload_folder_quota: int = 10 * 1024 * 1024 * 1024,
|
upload_folder_quota: int = UPLOAD_FOLDER_QUOTA,
|
||||||
):
|
):
|
||||||
self.upload_path = upload_path.rstrip("/")
|
self.upload_path = upload_path.rstrip("/")
|
||||||
self.max_file_size = max_file_size
|
self.max_file_size = max_file_size
|
||||||
@ -175,6 +180,8 @@ def get_images(path):
|
|||||||
".gif",
|
".gif",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
".webp",
|
||||||
|
".svg",
|
||||||
]:
|
]:
|
||||||
images.append(image)
|
images.append(image)
|
||||||
return images
|
return images
|
||||||
@ -288,10 +295,10 @@ async def handle_index(request: web.Request):
|
|||||||
|
|
||||||
|
|
||||||
def create_app(
|
def create_app(
|
||||||
upload_url: str = "/",
|
upload_url: str = UPLOAD_URL,
|
||||||
upload_path: str = "upload",
|
upload_path: str = UPLOAD_PATH,
|
||||||
max_file_size: int = 1024 * 1024 * 50,
|
max_file_size: int = MAX_FILE_SIZE,
|
||||||
upload_folder_quota: int = 10 * 1024 * 1024 * 1024,
|
upload_folder_quota: int = UPLOAD_FOLDER_QUOTA,
|
||||||
):
|
):
|
||||||
app = Rupload(
|
app = Rupload(
|
||||||
upload_url=upload_url,
|
upload_url=upload_url,
|
||||||
|
Loading…
Reference in New Issue
Block a user