Compare commits
No commits in common. "94fed6db51a60b72ec4baebd953a2fe0b24109b2" and "4c786fbce9072670f6a68204e0b35075b05286d5" have entirely different histories.
94fed6db51
...
4c786fbce9
@ -38,18 +38,6 @@
|
|||||||
.chevron:hover { color: rgba(255, 255, 255, 0.9); }
|
.chevron:hover { color: rgba(255, 255, 255, 0.9); }
|
||||||
.chevron.left { left: 10px; }
|
.chevron.left { left: 10px; }
|
||||||
.chevron.right { right: 10px; }
|
.chevron.right { right: 10px; }
|
||||||
.play-btn {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 20px;
|
|
||||||
right: 20px;
|
|
||||||
font-size: 48px;
|
|
||||||
color: rgba(255, 255, 255, 0.7);
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: color 0.2s, transform 0.2s;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
.play-btn:hover { color: rgba(255, 255, 255, 1); transform: scale(1.1); }
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -57,7 +45,6 @@
|
|||||||
<a href="$image_click_url"><img id="img" src="$img_url" title="$filename"></a>
|
<a href="$image_click_url"><img id="img" src="$img_url" title="$filename"></a>
|
||||||
<a href="$prev_url" class="chevron left" id="prev-btn">‹</a>
|
<a href="$prev_url" class="chevron left" id="prev-btn">‹</a>
|
||||||
<a href="$next_url" class="chevron right" id="next-btn">›</a>
|
<a href="$next_url" class="chevron right" id="next-btn">›</a>
|
||||||
$play_button
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
function getRefreshParams() {
|
function getRefreshParams() {
|
||||||
|
|||||||
15
main.py
15
main.py
@ -187,7 +187,7 @@ def _get_navigation_data(file_hash: str):
|
|||||||
|
|
||||||
|
|
||||||
def _render_page(
|
def _render_page(
|
||||||
navigation_data: dict, extra_meta: str = "", image_click_url: str = "", play_button: str = ""
|
navigation_data: dict, extra_meta: str = "", image_click_url: str = ""
|
||||||
) -> HTMLResponse:
|
) -> HTMLResponse:
|
||||||
"""Render the frontend page with navigation data"""
|
"""Render the frontend page with navigation data"""
|
||||||
with open("frontend.html", "r") as f:
|
with open("frontend.html", "r") as f:
|
||||||
@ -202,7 +202,6 @@ def _render_page(
|
|||||||
prev_url="/{prev_hash}".format(prev_hash=navigation_data["prev_hash"]),
|
prev_url="/{prev_hash}".format(prev_hash=navigation_data["prev_hash"]),
|
||||||
filename=navigation_data["filename"],
|
filename=navigation_data["filename"],
|
||||||
extra_meta=extra_meta,
|
extra_meta=extra_meta,
|
||||||
play_button=play_button,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return HTMLResponse(content=content)
|
return HTMLResponse(content=content)
|
||||||
@ -215,10 +214,7 @@ async def hash_page(file_hash: str):
|
|||||||
raise HTTPException(status_code=404, detail="File not found")
|
raise HTTPException(status_code=404, detail="File not found")
|
||||||
|
|
||||||
navigation_data = _get_navigation_data(file_hash)
|
navigation_data = _get_navigation_data(file_hash)
|
||||||
play_button = '<a href="/next/5/{file_hash}" class="play-btn" title="Play next 5">⏵</a>'.format(
|
return _render_page(navigation_data)
|
||||||
file_hash=file_hash
|
|
||||||
)
|
|
||||||
return _render_page(navigation_data, play_button=play_button)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/{order}/{delay}/{file_hash}")
|
@app.get("/{order}/{delay}/{file_hash}")
|
||||||
@ -244,12 +240,7 @@ async def hash_page_with_refresh(order: str, delay: int, file_hash: str):
|
|||||||
refresh_meta = f'<meta http-equiv="refresh" content="{delay};url={refresh_url}">'
|
refresh_meta = f'<meta http-equiv="refresh" content="{delay};url={refresh_url}">'
|
||||||
image_click_url = "/{file_hash}".format(file_hash=file_hash)
|
image_click_url = "/{file_hash}".format(file_hash=file_hash)
|
||||||
|
|
||||||
# Create pause button to stop auto-refresh
|
return _render_page(navigation_data, refresh_meta, image_click_url)
|
||||||
pause_button = '<a href="/{file_hash}" class="play-btn" title="Pause">⏸</a>'.format(
|
|
||||||
file_hash=file_hash
|
|
||||||
)
|
|
||||||
|
|
||||||
return _render_page(navigation_data, refresh_meta, image_click_url, play_button=pause_button)
|
|
||||||
|
|
||||||
|
|
||||||
def _find_indexer_for_hash(file_hash: str):
|
def _find_indexer_for_hash(file_hash: str):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user