Remove hardcodes and implement WebClient

This commit is contained in:
tyuXX 2026-10-10 17:53:31 +00:00
parent f25ba8adcd
commit c316ef0092
11 changed files with 2062 additions and 75 deletions

View file

@ -0,0 +1,169 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>GsDChat - Web Client</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
<!-- App Container -->
<div id="app" class="app-layout">
<!-- Header / Navigation Bar -->
<header class="app-header">
<div class="header-left">
<span class="status-indicator" id="connIndicator" title="Connection Status"></span>
<h1 class="server-title" id="serverTitle">GsDChat</h1>
</div>
<nav class="nav-tabs" id="navTabs">
<button class="nav-tab active" data-tab="chat">💬 Chat</button>
<button class="nav-tab" data-tab="channels">📁 Channels</button>
<button class="nav-tab" data-tab="users">👥 Users</button>
<button class="nav-tab" data-tab="files">📎 Files</button>
</nav>
<div class="header-right">
<div class="user-badge" id="userBadge">
<span class="user-name" id="currentUsername"></span>
<span class="user-role" id="currentUserRole"></span>
</div>
<button class="btn btn-outline-danger btn-sm" id="logoutBtn" title="Logout">Disconnect</button>
</div>
</header>
<!-- Main Views Container -->
<main class="app-main">
<!-- View 1: Chat View -->
<section id="view-chat" class="tab-view active">
<div class="chat-header">
<div class="channel-info">
<span class="channel-hash">#</span>
<span class="channel-name" id="activeChannelName">general</span>
<span class="channel-topic" id="activeChannelTopic"></span>
</div>
</div>
<div class="chat-messages" id="chatMessages">
<div class="welcome-message">
<h3 id="welcomeMotd">Welcome to GsDChat!</h3>
<p>Select a channel or start chatting below.</p>
</div>
</div>
<div class="chat-input-bar">
<label class="btn-icon upload-btn" title="Upload File">
📎
<input type="file" id="fileInput" style="display:none;">
</label>
<input type="text" id="messageInput" placeholder="Message #general... (or /help)" autocomplete="off">
<button class="btn btn-primary send-btn" id="sendBtn">Send</button>
</div>
</section>
<!-- View 2: Channels View -->
<section id="view-channels" class="tab-view">
<div class="view-header">
<h2>Server Channels</h2>
<button class="btn btn-primary" id="openCreateChannelBtn" style="display:none;">+ Create Channel</button>
</div>
<div class="channel-list" id="channelList">
<!-- Populated by JS -->
</div>
<!-- Channel Creation Form -->
<div class="card channel-create-card" id="createChannelCard" style="display:none;">
<h3>Create New Channel</h3>
<div class="form-group">
<label for="newChannelName">Channel Name</label>
<input type="text" id="newChannelName" placeholder="e.g. gaming, music">
</div>
<div class="form-group">
<label for="newChannelTopic">Topic (Optional)</label>
<input type="text" id="newChannelTopic" placeholder="Channel description...">
</div>
<div class="form-actions">
<button class="btn btn-primary" id="submitCreateChannelBtn">Create</button>
<button class="btn btn-secondary" id="cancelCreateChannelBtn">Cancel</button>
</div>
</div>
</section>
<!-- View 3: Users View -->
<section id="view-users" class="tab-view">
<div class="view-header">
<h2>Community Members</h2>
<span class="user-count-badge" id="userCountBadge">0 Online</span>
</div>
<div class="user-list" id="userList">
<!-- Populated by JS -->
</div>
</section>
<!-- View 4: Files View -->
<section id="view-files" class="tab-view">
<div class="view-header">
<h2>Shared Files</h2>
<label class="btn btn-primary">
+ Upload File
<input type="file" id="filesViewUploadInput" style="display:none;">
</label>
</div>
<div class="files-list" id="filesList">
<!-- Populated by JS -->
</div>
</section>
</main>
<!-- Toast Notification Overlay -->
<div id="toastContainer" class="toast-container"></div>
<!-- Auth Modal (Login / Register) -->
<div id="authModal" class="modal-backdrop">
<div class="modal-card">
<div class="modal-header">
<h2 id="modalServerName">GsDChat Community</h2>
<p class="modal-motd" id="modalMotd">Secure & Private Messaging</p>
</div>
<div class="auth-tabs">
<button class="auth-tab active" id="tabLogin">Login</button>
<button class="auth-tab" id="tabRegister">Register</button>
</div>
<form id="authForm" class="auth-form" onsubmit="return false;">
<div class="form-group" id="groupServerPassword" style="display:none;">
<label for="authServerPassword">Server Password</label>
<input type="password" id="authServerPassword" placeholder="Required for this server">
</div>
<div class="form-group">
<label for="authUsername">Username</label>
<input type="text" id="authUsername" placeholder="Enter username" required autocomplete="username">
</div>
<div class="form-group">
<label for="authPassword">Password</label>
<input type="password" id="authPassword" placeholder="Enter password" required autocomplete="current-password">
</div>
<div class="form-group" id="groupInviteToken" style="display:none;">
<label for="authInviteToken">Invite Token (Optional)</label>
<input type="text" id="authInviteToken" placeholder="Required if invite-only">
</div>
<div class="auth-error" id="authError"></div>
<button type="submit" class="btn btn-primary btn-block" id="authSubmitBtn">Login</button>
</form>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>