update backend logic

This commit is contained in:
2025-11-14 17:21:42 +01:00
parent 8939c6ffb5
commit 5b337e3168
4 changed files with 24 additions and 6 deletions

View File

@ -7,7 +7,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent / "webui"
def main():
parser = argparse.ArgumentParser(description="Serve Multiplayer Crossword Frontend")
parser.add_argument("--host", type=str, default="localhost")
parser.add_argument("--host", type=str, default="0.0.0.0")
parser.add_argument("--port", type=int, default=8000)
parser.add_argument("--no-file-list", action="store_true", help="Disable directory listing")

View File

@ -335,7 +335,7 @@ export class ClueArea extends LitElement {
// Show across clues
if (this._showAllCluesAcross) {
return html`
<div class="clue-area">
<div class="clue-area expanded">
<div class="clue-header">
<h3>Across Clues</h3>
<button class="clue-toggle" @click="${this._toggleShowAllCluesAcross}">
@ -360,7 +360,7 @@ export class ClueArea extends LitElement {
// Show down clues
if (this._showAllCluesDown) {
return html`
<div class="clue-area">
<div class="clue-area expanded">
<div class="clue-header">
<h3>Down Clues</h3>
<button class="clue-toggle" @click="${this._toggleShowAllCluesDown}">

View File

@ -60,8 +60,16 @@ export class CrosswordMenu extends LitElement {
_getWebsocketUrl() {
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
const host = window.location.hostname;
const port = 8765;
return `${protocol}://${host}:${port}`;
// If host is localhost, use port 8765. Otherwise, use default port (443 for wss, 80 for ws)
const isLocalhost = host === 'localhost' || host === '127.0.0.1';
const port = isLocalhost ? 8765 : '';
const portStr = port ? `:${port}` : '';
// If host is localhost, use it as is. Otherwise, add crosswords_backend/ to the path
const path = isLocalhost ? '' : 'crosswords_backend/';
return `${protocol}://${host}${portStr}/${path}`;
}
_requestSessionProperties() {
@ -193,8 +201,13 @@ export class CrosswordMenu extends LitElement {
<li><strong>Session Lifetime:</strong> Sessions are automatically deleted after 48 hours of inactivity.</li>
<li><strong>No Tracking:</strong> No personal data is collected or stored beyond the session duration.</li>
</ul>
</div>
</div>
<p style="margin-top: 12px; font-size: 0.9em;">
<a href="https://the-cake-is-a-lie.net/gitea/jonas/multiplayer_crosswords" target="_blank" rel="noopener noreferrer">🔗 View source code on Gitea</a>
</p>
</div>
</div>
`;

View File

@ -1159,10 +1159,15 @@ crossword-grid {
z-index: 1000;
padding: 1rem;
box-sizing: border-box;
max-height: 50vh;
max-height: 20vh;
overflow-y: auto;
}
/* Expanded clue area - show all clues */
.clue-area.expanded {
max-height: 50vh;
}
.clue-header {
display: flex;
justify-content: space-between;