Skip to content

Commit

Permalink
latest pull
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh4517 committed Sep 21, 2024
1 parent 8be5383 commit e4ba1d2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/paste/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pygments.util import ClassNotFound
from typing import List, Optional
from . import __version__, __author__, __contact__, __url__
from .schema import PasteCreate, PasteResponse, PasteDetails
from .schema import PasteCreate, PasteDetails, PasteResponse

description: str = "paste.py 🐍 - A pastebin written in python."

Expand Down Expand Up @@ -145,7 +145,7 @@ async def get_paste_data(uuid: str, user_agent: Optional[str] = Header(None)) ->
-ms-user-select: none;
user-select: none;
}
span {
font-size: 1.1em !important;
}
Expand Down Expand Up @@ -235,6 +235,7 @@ async def get_paste_data(uuid: str, user_agent: Optional[str] = Header(None)) ->


@app.get("/", response_class=HTMLResponse)
@limiter.limit("100/minute")
async def indexpage(request: Request) -> Response:
return templates.TemplateResponse("index.html", {"request": request})

Expand All @@ -254,13 +255,15 @@ async def delete_paste(uuid: str) -> PlainTextResponse:


@app.get("/web", response_class=HTMLResponse)
@limiter.limit("100/minute")
async def web(request: Request) -> Response:
return templates.TemplateResponse("web.html", {"request": request})


@app.post("/web", response_class=PlainTextResponse)
@limiter.limit("100/minute")
async def web_post(request: Request, content: str = Form(...), extension: Optional[str] = Form(None)) -> RedirectResponse:
async def web_post(request: Request, content: str = Form(...),
extension: Optional[str] = Form(None)) -> RedirectResponse:
try:
file_content: bytes = content.encode()
uuid: str = generate_uuid()
Expand Down

0 comments on commit e4ba1d2

Please sign in to comment.