Skip to content

Commit dbf926e

Browse files
committed
Set samesite to strict for cookies
Set title to filename instead of filepath in the UI Bump version
1 parent 75bf3d8 commit dbf926e

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

pystream/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from .main import start # noqa: F401
33
from .models import config, images, secure # noqa: F401
44

5-
version = "2.0"
5+
version = "2.1"

pystream/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def redirect_exception_handler(request: Request,
3737
else:
3838
response = RedirectResponse(url=exception.location)
3939
if exception.detail:
40-
response.set_cookie("detail", exception.detail.upper())
40+
response.set_cookie("detail", exception.detail.upper(), httponly=True, samesite="strict")
4141
return response
4242

4343

pystream/routers/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ async def login(request: Request) -> JSONResponse:
7171
value=config.static.cipher_suite.encrypt(str(auth_payload).encode("utf-8")).decode(),
7272
max_age=config.env.session_duration,
7373
expires=expiration,
74-
httponly=True)
74+
httponly=True,
75+
samesite="strict")
7576
if config.env.secure_session:
7677
cookie_kwargs["secure"] = True
7778
response.set_cookie(**cookie_kwargs)

pystream/routers/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def stream_video(request: Request,
9595
)
9696
if pure_path.exists():
9797
attrs = {
98-
"request": request, "video_title": video_path,
98+
"request": request, "video_title": pure_path.name,
9999
"home": config.static.home_endpoint, "logout": config.static.logout_endpoint,
100100
"path": f"{config.static.streaming_endpoint}?{config.static.query_param}={urlparse.quote(str(pure_path))}"
101101
}

pystream/templates/land.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html lang="en">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6-
<title>FastAPI video streaming</title>
6+
<title>{{ video_title }}</title>
77
<meta property="og:type" content="VideoStreaming">
88
<meta name="keywords" content="Python, streaming, fastapi, JavaScript, HTML, CSS">
99
<meta name="author" content="Vignesh Rao">

0 commit comments

Comments
 (0)