update backend logic
This commit is contained in:
@ -7,7 +7,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent / "webui"
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Serve Multiplayer Crossword Frontend")
|
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("--port", type=int, default=8000)
|
||||||
parser.add_argument("--no-file-list", action="store_true", help="Disable directory listing")
|
parser.add_argument("--no-file-list", action="store_true", help="Disable directory listing")
|
||||||
|
|
||||||
|
|||||||
@ -335,7 +335,7 @@ export class ClueArea extends LitElement {
|
|||||||
// Show across clues
|
// Show across clues
|
||||||
if (this._showAllCluesAcross) {
|
if (this._showAllCluesAcross) {
|
||||||
return html`
|
return html`
|
||||||
<div class="clue-area">
|
<div class="clue-area expanded">
|
||||||
<div class="clue-header">
|
<div class="clue-header">
|
||||||
<h3>Across Clues</h3>
|
<h3>Across Clues</h3>
|
||||||
<button class="clue-toggle" @click="${this._toggleShowAllCluesAcross}">
|
<button class="clue-toggle" @click="${this._toggleShowAllCluesAcross}">
|
||||||
@ -360,7 +360,7 @@ export class ClueArea extends LitElement {
|
|||||||
// Show down clues
|
// Show down clues
|
||||||
if (this._showAllCluesDown) {
|
if (this._showAllCluesDown) {
|
||||||
return html`
|
return html`
|
||||||
<div class="clue-area">
|
<div class="clue-area expanded">
|
||||||
<div class="clue-header">
|
<div class="clue-header">
|
||||||
<h3>Down Clues</h3>
|
<h3>Down Clues</h3>
|
||||||
<button class="clue-toggle" @click="${this._toggleShowAllCluesDown}">
|
<button class="clue-toggle" @click="${this._toggleShowAllCluesDown}">
|
||||||
|
|||||||
@ -60,8 +60,16 @@ export class CrosswordMenu extends LitElement {
|
|||||||
_getWebsocketUrl() {
|
_getWebsocketUrl() {
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
const host = window.location.hostname;
|
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() {
|
_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>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>
|
<li><strong>No Tracking:</strong> No personal data is collected or stored beyond the session duration.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1159,10 +1159,15 @@ crossword-grid {
|
|||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-height: 50vh;
|
max-height: 20vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Expanded clue area - show all clues */
|
||||||
|
.clue-area.expanded {
|
||||||
|
max-height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
.clue-header {
|
.clue-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
Reference in New Issue
Block a user