Spaces:
Running
Running
Update index.html
Browse files- index.html +775 -311
index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Client:Less Matrix Web Client</title>
|
| 7 |
<style>
|
| 8 |
:root {
|
| 9 |
--tg-blue: #5682a3;
|
|
@@ -21,6 +21,11 @@
|
|
| 21 |
--tg-msg-out-border: #d2e7b6;
|
| 22 |
--tg-online: #42b740;
|
| 23 |
--tg-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
* {
|
|
@@ -133,7 +138,7 @@
|
|
| 133 |
}
|
| 134 |
|
| 135 |
.content-card {
|
| 136 |
-
max-width:
|
| 137 |
margin: 0 auto 24px auto;
|
| 138 |
background: var(--tg-card-bg);
|
| 139 |
border-radius: 4px;
|
|
@@ -160,14 +165,15 @@
|
|
| 160 |
display: inline-block;
|
| 161 |
background-color: var(--tg-blue);
|
| 162 |
color: #ffffff;
|
| 163 |
-
padding:
|
| 164 |
border-radius: 3px;
|
| 165 |
text-decoration: none;
|
| 166 |
font-weight: 600;
|
| 167 |
border: none;
|
| 168 |
cursor: pointer;
|
| 169 |
transition: background-color 0.15s;
|
| 170 |
-
font-size:
|
|
|
|
| 171 |
}
|
| 172 |
|
| 173 |
.btn:hover {
|
|
@@ -178,6 +184,11 @@
|
|
| 178 |
background-color: var(--tg-blue-active);
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
.btn-outline {
|
| 182 |
background-color: transparent;
|
| 183 |
color: var(--tg-blue);
|
|
@@ -188,43 +199,9 @@
|
|
| 188 |
background-color: rgba(86, 130, 162, 0.08);
|
| 189 |
}
|
| 190 |
|
| 191 |
-
.news-item {
|
| 192 |
-
border-bottom: 1px solid var(--tg-border);
|
| 193 |
-
padding-bottom: 20px;
|
| 194 |
-
margin-bottom: 20px;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.news-item:last-child {
|
| 198 |
-
border-bottom: none;
|
| 199 |
-
margin-bottom: 0;
|
| 200 |
-
padding-bottom: 0;
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
.news-date {
|
| 204 |
-
display: inline-block;
|
| 205 |
-
background: #f0f4f7;
|
| 206 |
-
color: var(--tg-blue-dark);
|
| 207 |
-
font-size: 12px;
|
| 208 |
-
font-weight: 700;
|
| 209 |
-
padding: 3px 8px;
|
| 210 |
-
border-radius: 3px;
|
| 211 |
-
margin-bottom: 8px;
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
.news-heading {
|
| 215 |
-
font-size: 18px;
|
| 216 |
-
color: #111;
|
| 217 |
-
margin-bottom: 8px;
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
.news-body {
|
| 221 |
-
line-height: 1.6;
|
| 222 |
-
color: #444;
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
.login-box {
|
| 226 |
-
max-width:
|
| 227 |
-
margin:
|
| 228 |
background: #fff;
|
| 229 |
padding: 32px;
|
| 230 |
border-radius: 4px;
|
|
@@ -264,6 +241,88 @@
|
|
| 264 |
margin-top: 4px;
|
| 265 |
}
|
| 266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
.client-layout {
|
| 268 |
display: flex;
|
| 269 |
height: 100%;
|
|
@@ -271,16 +330,53 @@
|
|
| 271 |
background-color: var(--tg-card-bg);
|
| 272 |
}
|
| 273 |
|
| 274 |
-
/* Column 1: Room List */
|
| 275 |
.rooms-sidebar {
|
| 276 |
-
width:
|
| 277 |
-
min-width:
|
| 278 |
border-right: 1px solid var(--tg-border);
|
| 279 |
display: flex;
|
| 280 |
flex-direction: column;
|
| 281 |
background-color: #ffffff;
|
| 282 |
}
|
| 283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
.search-box {
|
| 285 |
padding: 10px;
|
| 286 |
border-bottom: 1px solid #f0f0f0;
|
|
@@ -341,6 +437,14 @@
|
|
| 341 |
margin-right: 12px;
|
| 342 |
flex-shrink: 0;
|
| 343 |
user-select: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
.room-details {
|
|
@@ -377,7 +481,6 @@
|
|
| 377 |
text-overflow: ellipsis;
|
| 378 |
}
|
| 379 |
|
| 380 |
-
/* Column 2: Chat Main Area */
|
| 381 |
.chat-main {
|
| 382 |
flex: 1;
|
| 383 |
display: flex;
|
|
@@ -394,17 +497,19 @@
|
|
| 394 |
height: 100%;
|
| 395 |
color: #8393a3;
|
| 396 |
user-select: none;
|
|
|
|
| 397 |
}
|
| 398 |
|
| 399 |
.chat-placeholder-badge {
|
| 400 |
-
background: rgba(0, 0, 0, 0.
|
| 401 |
-
padding: 8px
|
| 402 |
-
border-radius:
|
| 403 |
font-size: 13px;
|
|
|
|
| 404 |
}
|
| 405 |
|
| 406 |
.chat-header {
|
| 407 |
-
height:
|
| 408 |
background: #ffffff;
|
| 409 |
border-bottom: 1px solid var(--tg-border);
|
| 410 |
display: flex;
|
|
@@ -497,24 +602,9 @@
|
|
| 497 |
border-color: var(--tg-blue);
|
| 498 |
}
|
| 499 |
|
| 500 |
-
.send-btn {
|
| 501 |
-
background: var(--tg-blue);
|
| 502 |
-
color: white;
|
| 503 |
-
border: none;
|
| 504 |
-
padding: 10px 18px;
|
| 505 |
-
border-radius: 3px;
|
| 506 |
-
font-weight: 600;
|
| 507 |
-
cursor: pointer;
|
| 508 |
-
}
|
| 509 |
-
|
| 510 |
-
.send-btn:hover {
|
| 511 |
-
background: var(--tg-blue-hover);
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
/* Column 3: Group / User Info Sidebar */
|
| 515 |
.info-sidebar {
|
| 516 |
-
width:
|
| 517 |
-
min-width:
|
| 518 |
border-left: 1px solid var(--tg-border);
|
| 519 |
background: #ffffff;
|
| 520 |
display: flex;
|
|
@@ -532,17 +622,24 @@
|
|
| 532 |
}
|
| 533 |
|
| 534 |
.info-avatar {
|
| 535 |
-
width:
|
| 536 |
-
height:
|
| 537 |
border-radius: 50%;
|
| 538 |
background: #5682a3;
|
| 539 |
color: #fff;
|
| 540 |
-
font-size:
|
| 541 |
font-weight: bold;
|
| 542 |
display: flex;
|
| 543 |
align-items: center;
|
| 544 |
justify-content: center;
|
| 545 |
margin-bottom: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
}
|
| 547 |
|
| 548 |
.info-name {
|
|
@@ -550,6 +647,7 @@
|
|
| 550 |
font-weight: 600;
|
| 551 |
color: #111;
|
| 552 |
margin-bottom: 4px;
|
|
|
|
| 553 |
}
|
| 554 |
|
| 555 |
.info-members-count {
|
|
@@ -593,11 +691,20 @@
|
|
| 593 |
justify-content: center;
|
| 594 |
font-size: 12px;
|
| 595 |
font-weight: bold;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
}
|
| 597 |
|
| 598 |
.member-name {
|
| 599 |
font-size: 13px;
|
| 600 |
font-weight: 500;
|
|
|
|
| 601 |
}
|
| 602 |
|
| 603 |
.member-status {
|
|
@@ -605,33 +712,6 @@
|
|
| 605 |
color: var(--tg-online);
|
| 606 |
}
|
| 607 |
|
| 608 |
-
.doc-section {
|
| 609 |
-
margin-bottom: 24px;
|
| 610 |
-
}
|
| 611 |
-
|
| 612 |
-
.doc-section h3 {
|
| 613 |
-
font-size: 16px;
|
| 614 |
-
color: var(--tg-blue-dark);
|
| 615 |
-
margin-bottom: 8px;
|
| 616 |
-
}
|
| 617 |
-
|
| 618 |
-
.doc-section p {
|
| 619 |
-
line-height: 1.6;
|
| 620 |
-
color: #333;
|
| 621 |
-
margin-bottom: 8px;
|
| 622 |
-
}
|
| 623 |
-
|
| 624 |
-
.code-block {
|
| 625 |
-
background: #272822;
|
| 626 |
-
color: #f8f8f2;
|
| 627 |
-
padding: 12px;
|
| 628 |
-
border-radius: 4px;
|
| 629 |
-
font-family: monospace;
|
| 630 |
-
font-size: 13px;
|
| 631 |
-
overflow-x: auto;
|
| 632 |
-
margin: 10px 0;
|
| 633 |
-
}
|
| 634 |
-
|
| 635 |
.download-box {
|
| 636 |
display: flex;
|
| 637 |
gap: 20px;
|
|
@@ -641,31 +721,41 @@
|
|
| 641 |
|
| 642 |
.download-card {
|
| 643 |
flex: 1;
|
| 644 |
-
min-width:
|
| 645 |
border: 1px solid var(--tg-border);
|
| 646 |
-
padding:
|
| 647 |
border-radius: 4px;
|
| 648 |
text-align: center;
|
| 649 |
background: #fafbfc;
|
| 650 |
}
|
| 651 |
|
| 652 |
-
.download-card h4 {
|
| 653 |
-
font-size: 16px;
|
| 654 |
-
margin-bottom: 8px;
|
| 655 |
-
color: var(--tg-blue-dark);
|
| 656 |
-
}
|
| 657 |
-
|
| 658 |
.toast {
|
| 659 |
position: fixed;
|
| 660 |
bottom: 20px;
|
| 661 |
right: 20px;
|
| 662 |
-
background: rgba(0, 0, 0, 0.
|
| 663 |
color: #fff;
|
| 664 |
padding: 12px 20px;
|
| 665 |
border-radius: 4px;
|
| 666 |
font-size: 13px;
|
| 667 |
z-index: 9999;
|
| 668 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
}
|
| 670 |
</style>
|
| 671 |
</head>
|
|
@@ -678,82 +768,124 @@
|
|
| 678 |
<ul class="nav-menu">
|
| 679 |
<li class="nav-item"><a class="nav-link active" id="nav-home" onclick="switchTab('home')">Главная</a></li>
|
| 680 |
<li class="nav-item"><a class="nav-link" id="nav-login" onclick="switchTab('login')">Войти</a></li>
|
|
|
|
| 681 |
<li class="nav-item"><a class="nav-link" id="nav-download" onclick="switchTab('download')">Скачать приложение</a></li>
|
| 682 |
-
<li class="nav-item"><a class="nav-link" id="nav-news" onclick="switchTab('news')">Новости</a></li>
|
| 683 |
-
<li class="nav-item"><a class="nav-link" id="nav-docs" onclick="switchTab('docs')">Docs</a></li>
|
| 684 |
</ul>
|
| 685 |
</header>
|
| 686 |
|
| 687 |
<div class="page-container">
|
| 688 |
|
|
|
|
| 689 |
<div id="page-home" class="page active">
|
| 690 |
<div class="content-card">
|
| 691 |
<h1 class="content-title">Добро пожаловать в Client:Less</h1>
|
| 692 |
<p class="content-subtitle">
|
| 693 |
-
|
| 694 |
</p>
|
| 695 |
-
<div style="margin-bottom: 20px;">
|
| 696 |
<button class="btn" onclick="switchTab('login')">Открыть веб-клиент</button>
|
| 697 |
-
<button class="btn btn-outline" onclick="switchTab('
|
| 698 |
</div>
|
| 699 |
</div>
|
| 700 |
|
| 701 |
<div class="content-card">
|
| 702 |
-
<h2 style="font-size: 18px; color: var(--tg-blue-dark); margin-bottom: 12px;">
|
| 703 |
<p style="line-height: 1.6; color: #444; margin-bottom: 12px;">
|
| 704 |
-
|
| 705 |
</p>
|
| 706 |
<ul style="padding-left: 20px; line-height: 1.8; color: #444;">
|
| 707 |
-
<li><strong>
|
| 708 |
-
<li><strong>Telegram 2015
|
| 709 |
-
<li><strong>
|
| 710 |
</ul>
|
| 711 |
</div>
|
| 712 |
</div>
|
| 713 |
|
|
|
|
| 714 |
<div id="page-login" class="page">
|
| 715 |
<div class="login-box">
|
| 716 |
<h2 style="font-size: 20px; color: var(--tg-blue-dark); margin-bottom: 8px; text-align: center;">Вход в Matrix</h2>
|
| 717 |
<p style="font-size: 13px; color: var(--tg-subtext); margin-bottom: 20px; text-align: center;">
|
| 718 |
-
Введите
|
| 719 |
</p>
|
| 720 |
|
| 721 |
<div class="form-group">
|
| 722 |
-
<label for="input-homeserver">Домашний сервер (Homeserver)</label>
|
| 723 |
<input type="text" id="input-homeserver" class="form-input" value="https://matrix.org" placeholder="https://matrix.org">
|
| 724 |
-
<div class="form-hint">Например: https://matrix.org или
|
| 725 |
</div>
|
| 726 |
|
| 727 |
<div class="form-group">
|
| 728 |
-
<label for="input-username">Имя пользователя
|
| 729 |
-
<input type="text" id="input-username" class="form-input" placeholder="alice">
|
| 730 |
</div>
|
| 731 |
|
| 732 |
<div class="form-group">
|
| 733 |
-
<label for="input-password">Пароль
|
| 734 |
<input type="password" id="input-password" class="form-input" placeholder="••••••••">
|
| 735 |
</div>
|
| 736 |
|
| 737 |
-
<button class="btn" style="width: 100%; text-align: center;" onclick="
|
| 738 |
-
|
| 739 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
</div>
|
| 741 |
</div>
|
| 742 |
</div>
|
| 743 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 744 |
<div id="page-client" class="page page-client-container">
|
| 745 |
<div class="client-layout">
|
| 746 |
-
<!-- Column 1: Rooms -->
|
| 747 |
<div class="rooms-sidebar">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 748 |
<div class="search-box">
|
| 749 |
<input type="text" class="search-input" placeholder="Поиск чатов..." id="room-search-input" onkeyup="filterRooms()">
|
| 750 |
</div>
|
|
|
|
| 751 |
<ul class="rooms-list" id="rooms-list-container">
|
| 752 |
<!-- Populated dynamically -->
|
| 753 |
</ul>
|
| 754 |
</div>
|
| 755 |
|
| 756 |
-
<!-- Column 2: Chat
|
| 757 |
<div class="chat-main" id="chat-main-container">
|
| 758 |
<div class="chat-placeholder" id="chat-empty-state">
|
| 759 |
<div class="chat-placeholder-badge">Выберите чат из списка слева</div>
|
|
@@ -765,6 +897,9 @@
|
|
| 765 |
<div class="chat-header-title" id="active-chat-title">Название чата</div>
|
| 766 |
<div class="chat-header-status" id="active-chat-status">0 участников</div>
|
| 767 |
</div>
|
|
|
|
|
|
|
|
|
|
| 768 |
</div>
|
| 769 |
|
| 770 |
<div class="messages-container" id="messages-container">
|
|
@@ -773,21 +908,21 @@
|
|
| 773 |
|
| 774 |
<div class="chat-input-bar">
|
| 775 |
<input type="text" class="chat-input" id="message-input" placeholder="Напишите сообщение..." onkeydown="handleKeyPress(event)">
|
| 776 |
-
<button class="
|
| 777 |
</div>
|
| 778 |
</div>
|
| 779 |
</div>
|
| 780 |
|
| 781 |
-
<!-- Column 3: Info Sidebar -->
|
| 782 |
<div class="info-sidebar" id="info-sidebar-container">
|
| 783 |
<div class="info-header">
|
| 784 |
<div class="info-avatar" id="info-avatar-box">?</div>
|
| 785 |
-
<div class="info-name" id="info-name-box">
|
| 786 |
<div class="info-members-count" id="info-count-box">Информационная панель</div>
|
| 787 |
</div>
|
| 788 |
|
| 789 |
<div class="info-section">
|
| 790 |
-
<div class="info-section-title">О комнате</div>
|
| 791 |
<p style="font-size: 13px; color: #444; line-height: 1.4;" id="info-description-box">
|
| 792 |
Здесь отображается описание выбронного чата и список участников.
|
| 793 |
</p>
|
|
@@ -803,26 +938,27 @@
|
|
| 803 |
</div>
|
| 804 |
</div>
|
| 805 |
|
|
|
|
| 806 |
<div id="page-download" class="page">
|
| 807 |
<div class="content-card">
|
| 808 |
<h1 class="content-title">Скачать Client:Less</h1>
|
| 809 |
<p class="content-subtitle">
|
| 810 |
-
|
| 811 |
</p>
|
| 812 |
|
| 813 |
<div class="download-box">
|
| 814 |
<div class="download-card">
|
| 815 |
-
<h4>Windows</h4>
|
| 816 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">x64 / ARM64 (Portable .exe)</p>
|
| 817 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для Windows...')">Скачать .EXE</button>
|
| 818 |
</div>
|
| 819 |
<div class="download-card">
|
| 820 |
-
<h4>macOS</h4>
|
| 821 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">Apple Silicon / Intel (.dmg)</p>
|
| 822 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для macOS...')">Скачать .DMG</button>
|
| 823 |
</div>
|
| 824 |
<div class="download-card">
|
| 825 |
-
<h4>Linux</h4>
|
| 826 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">AppImage / .tar.gz</p>
|
| 827 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для Linux...')">Скачать .AppImage</button>
|
| 828 |
</div>
|
|
@@ -830,123 +966,122 @@
|
|
| 830 |
</div>
|
| 831 |
</div>
|
| 832 |
|
| 833 |
-
<div id="page-news" class="page">
|
| 834 |
-
<div class="content-card">
|
| 835 |
-
<h1 class="content-title">Новости проекта</h1>
|
| 836 |
-
<p class="content-subtitle">Все официальные релизы и обновления Client:Less начиная с 25.08.2026.</p>
|
| 837 |
-
|
| 838 |
-
<div class="news-item">
|
| 839 |
-
<div class="news-date">25.08.2026</div>
|
| 840 |
-
<h3 class="news-heading">Релиз Client:Less v1.0 Alpha!</h3>
|
| 841 |
-
<div class="news-body">
|
| 842 |
-
Сегодня состоялся официальный запуск веб-клиента <strong>Client:Less</strong>. Проект спроектирован без использования сторонних тяжелых библиотек и CDN, обеспечивая моментальный отклик интерфейса в классическом стиле Telegram 2015 года. В этой версии реализована прямая работа с Matrix REST CS API v3, подгрузка комнат, отправка сообщений и инфо-панель участников.
|
| 843 |
-
</div>
|
| 844 |
-
</div>
|
| 845 |
-
|
| 846 |
-
<div class="news-item">
|
| 847 |
-
<div class="news-date">25.08.2026</div>
|
| 848 |
-
<h3 class="news-heading">Дорожная карта разработки</h3>
|
| 849 |
-
<div class="news-body">
|
| 850 |
-
В ближайших обновлениях планируется внедрение локального шифрования Olm/Megolm (E2EE), кастомных стилей оформления и поддержки голосовых сообщений.
|
| 851 |
-
</div>
|
| 852 |
-
</div>
|
| 853 |
-
</div>
|
| 854 |
-
</div>
|
| 855 |
-
|
| 856 |
-
<div id="page-docs" class="page">
|
| 857 |
-
<div class="content-card">
|
| 858 |
-
<h1 class="content-title">Документация и справка</h1>
|
| 859 |
-
|
| 860 |
-
<div class="doc-section">
|
| 861 |
-
<h3>1. Что такое Matrix?</h3>
|
| 862 |
-
<p>
|
| 863 |
-
<strong>Matrix</strong> — это открытый стандарт децентрализованной защищенной коммуникации в реальном времени. Он позволяет пользователям с разных серверов (Homeservers) бесшовно общаться друг с другом, аналог электронной почты, но для мгновенных сообщений и чатов.
|
| 864 |
-
</p>
|
| 865 |
-
</div>
|
| 866 |
-
|
| 867 |
-
<div class="doc-section">
|
| 868 |
-
<h3>2. Как работает Client:Less?</h3>
|
| 869 |
-
<p>
|
| 870 |
-
Client:Less отправляет стандартные HTTP/REST запросы к выбранному Matrix-серверу:
|
| 871 |
-
</p>
|
| 872 |
-
<div class="code-block">
|
| 873 |
-
POST /_matrix/client/v3/login
|
| 874 |
-
GET /_matrix/client/v3/joined_rooms
|
| 875 |
-
GET /_matrix/client/v3/rooms/{roomId}/messages
|
| 876 |
-
PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
| 877 |
-
</div>
|
| 878 |
-
</div>
|
| 879 |
-
|
| 880 |
-
<div class="doc-section">
|
| 881 |
-
<h3>3. Безопасность и автономность</h3>
|
| 882 |
-
<p>
|
| 883 |
-
Клиент не отправляет ваши учетные данные никуда, кроме указанного вами адреса Домашнего сервера Matrix. Вся работа происходит локально в вашем браузере.
|
| 884 |
-
</p>
|
| 885 |
-
</div>
|
| 886 |
-
</div>
|
| 887 |
-
</div>
|
| 888 |
-
|
| 889 |
</div>
|
| 890 |
|
| 891 |
<div class="toast" id="toast-message">Уведомление</div>
|
| 892 |
|
| 893 |
<script>
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 903 |
{
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
description: 'Главный общественный чат протокола Matrix.',
|
| 909 |
-
members: [
|
| 910 |
-
{ name: 'Alice (Matrix Admin)', status: 'online' },
|
| 911 |
-
{ name: 'Bob (Core Dev)', status: 'online' },
|
| 912 |
-
{ name: 'Charlie', status: 'offline' }
|
| 913 |
-
],
|
| 914 |
-
messages: [
|
| 915 |
-
{ sender: 'Alice (Matrix Admin)', text: 'Добро пожаловать в децентрализованную сеть Matrix!', time: '12:30', incoming: true },
|
| 916 |
-
{ sender: 'Bob (Core Dev)', text: 'Client:Less работает невероятно быстро.', time: '12:31', incoming: true },
|
| 917 |
-
{ sender: 'Вы', text: 'Интерфейс Telegram 2015 года вызывает приятную ностальгию!', time: '12:35', incoming: false }
|
| 918 |
-
]
|
| 919 |
},
|
| 920 |
{
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
description: 'Официальный канал обсуждения разработки веб-клиента Client:Less.',
|
| 926 |
-
members: [
|
| 927 |
-
{ name: 'Lead Developer', status: 'online' },
|
| 928 |
-
{ name: 'UI Designer 2015', status: 'online' }
|
| 929 |
-
],
|
| 930 |
-
messages: [
|
| 931 |
-
{ sender: 'Lead Developer', text: 'Релиз v1.0 Alpha официально состоялся 25.08.2026!', time: '10:00', incoming: true },
|
| 932 |
-
{ sender: 'UI Designer 2015', text: 'Все цвета #5682a3 выверены с точностью.', time: '10:15', incoming: true }
|
| 933 |
-
]
|
| 934 |
},
|
| 935 |
{
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
description: 'Канал новостей сети.',
|
| 941 |
-
members: [
|
| 942 |
-
{ name: 'News Bot', status: 'online' }
|
| 943 |
-
],
|
| 944 |
-
messages: [
|
| 945 |
-
{ sender: 'News Bot', text: 'Запущена система синхронизации без CDN библиотек.', time: '09:00', incoming: true }
|
| 946 |
-
]
|
| 947 |
}
|
| 948 |
];
|
| 949 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 950 |
function switchTab(tabName) {
|
| 951 |
document.querySelectorAll('.nav-link').forEach(el => el.classList.remove('active'));
|
| 952 |
document.querySelectorAll('.page').forEach(el => el.classList.remove('active'));
|
|
@@ -968,23 +1103,36 @@ PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
|
| 968 |
toast.style.display = 'block';
|
| 969 |
setTimeout(() => {
|
| 970 |
toast.style.display = 'none';
|
| 971 |
-
},
|
| 972 |
}
|
| 973 |
|
| 974 |
-
async function
|
| 975 |
-
|
| 976 |
const user = document.getElementById('input-username').value.trim();
|
| 977 |
const pass = document.getElementById('input-password').value.trim();
|
| 978 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 979 |
if (!user || !pass) {
|
| 980 |
showToast('Пожалуйста, введите имя пользователя и пароль.');
|
| 981 |
return;
|
| 982 |
}
|
| 983 |
|
| 984 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 985 |
|
| 986 |
try {
|
| 987 |
-
// Real Matrix CS API login request
|
| 988 |
const response = await fetch(`${server}/_matrix/client/v3/login`, {
|
| 989 |
method: 'POST',
|
| 990 |
headers: { 'Content-Type': 'application/json' },
|
|
@@ -997,48 +1145,312 @@ PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
|
| 997 |
|
| 998 |
const data = await response.json();
|
| 999 |
|
| 1000 |
-
if (response.ok) {
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1006 |
switchTab('client');
|
|
|
|
|
|
|
|
|
|
| 1007 |
} else {
|
| 1008 |
-
|
| 1009 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1010 |
}
|
| 1011 |
} catch (err) {
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
}
|
| 1015 |
}
|
| 1016 |
|
| 1017 |
function startDemoMode() {
|
| 1018 |
-
|
| 1019 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1020 |
switchTab('client');
|
| 1021 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
}
|
| 1023 |
|
| 1024 |
function renderRoomsList() {
|
| 1025 |
const container = document.getElementById('rooms-list-container');
|
| 1026 |
container.innerHTML = '';
|
| 1027 |
|
| 1028 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
const lastMsg = room.messages[room.messages.length - 1];
|
| 1030 |
const li = document.createElement('li');
|
| 1031 |
-
li.className = `room-item ${
|
| 1032 |
li.onclick = () => selectRoom(room.id);
|
| 1033 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1034 |
li.innerHTML = `
|
| 1035 |
-
|
| 1036 |
<div class="room-details">
|
| 1037 |
<div class="room-header-row">
|
| 1038 |
-
<span class="room-title">${room.name}</span>
|
| 1039 |
<span class="room-time">${lastMsg ? lastMsg.time : ''}</span>
|
| 1040 |
</div>
|
| 1041 |
-
<div class="room-last-msg">${lastMsg ? `${lastMsg.sender
|
| 1042 |
</div>
|
| 1043 |
`;
|
| 1044 |
container.appendChild(li);
|
|
@@ -1047,67 +1459,138 @@ PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
|
| 1047 |
|
| 1048 |
function filterRooms() {
|
| 1049 |
const query = document.getElementById('room-search-input').value.toLowerCase();
|
|
|
|
| 1050 |
const items = document.querySelectorAll('.room-item');
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
-
if (
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
|
|
|
|
|
|
|
| 1057 |
}
|
| 1058 |
});
|
| 1059 |
}
|
| 1060 |
|
| 1061 |
function selectRoom(roomId) {
|
| 1062 |
-
|
| 1063 |
-
const room =
|
| 1064 |
|
| 1065 |
if (!room) return;
|
| 1066 |
|
| 1067 |
document.getElementById('chat-empty-state').style.display = 'none';
|
| 1068 |
document.getElementById('chat-active-state').style.display = 'flex';
|
| 1069 |
|
| 1070 |
-
//
|
| 1071 |
document.getElementById('active-chat-title').innerText = room.name;
|
| 1072 |
-
document.getElementById('active-chat-status').innerText =
|
| 1073 |
|
| 1074 |
// Info panel
|
| 1075 |
-
|
| 1076 |
-
document.getElementById('info-avatar-box')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1077 |
document.getElementById('info-name-box').innerText = room.name;
|
| 1078 |
-
document.getElementById('info-count-box').innerText =
|
| 1079 |
-
document.getElementById('info-description-box').innerText = room.
|
| 1080 |
|
| 1081 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1082 |
const memberList = document.getElementById('info-member-list');
|
| 1083 |
memberList.innerHTML = '';
|
| 1084 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1085 |
const item = document.createElement('li');
|
| 1086 |
item.className = 'member-item';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1087 |
item.innerHTML = `
|
| 1088 |
-
<div class="member-avatar">${
|
| 1089 |
-
<div>
|
| 1090 |
-
<div class="member-name">${m.name}</div>
|
| 1091 |
-
<div class="member-status">
|
| 1092 |
</div>
|
| 1093 |
`;
|
| 1094 |
memberList.appendChild(item);
|
| 1095 |
});
|
| 1096 |
-
|
| 1097 |
-
renderMessages(room);
|
| 1098 |
-
renderRoomsList();
|
| 1099 |
}
|
| 1100 |
|
| 1101 |
function renderMessages(room) {
|
| 1102 |
const container = document.getElementById('messages-container');
|
| 1103 |
container.innerHTML = '';
|
| 1104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
room.messages.forEach(msg => {
|
| 1106 |
const bubble = document.createElement('div');
|
| 1107 |
bubble.className = `message-bubble ${msg.incoming ? 'incoming' : 'outgoing'}`;
|
| 1108 |
|
| 1109 |
bubble.innerHTML = `
|
| 1110 |
-
${msg.incoming ? `<div class="msg-sender">${msg.sender}</div>` : ''}
|
| 1111 |
<div>${escapeHtml(msg.text)}</div>
|
| 1112 |
<div class="msg-time">${msg.time}</div>
|
| 1113 |
`;
|
|
@@ -1118,30 +1601,6 @@ PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
|
| 1118 |
container.scrollTop = container.scrollHeight;
|
| 1119 |
}
|
| 1120 |
|
| 1121 |
-
function sendMessage() {
|
| 1122 |
-
const input = document.getElementById('message-input');
|
| 1123 |
-
const text = input.value.trim();
|
| 1124 |
-
|
| 1125 |
-
if (!text || !currentState.activeRoomId) return;
|
| 1126 |
-
|
| 1127 |
-
const room = mockRooms.find(r => r.id === currentState.activeRoomId);
|
| 1128 |
-
if (room) {
|
| 1129 |
-
const now = new Date();
|
| 1130 |
-
const timeStr = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
| 1131 |
-
|
| 1132 |
-
room.messages.push({
|
| 1133 |
-
sender: 'Вы',
|
| 1134 |
-
text: text,
|
| 1135 |
-
time: timeStr,
|
| 1136 |
-
incoming: false
|
| 1137 |
-
});
|
| 1138 |
-
|
| 1139 |
-
input.value = '';
|
| 1140 |
-
renderMessages(room);
|
| 1141 |
-
renderRoomsList();
|
| 1142 |
-
}
|
| 1143 |
-
}
|
| 1144 |
-
|
| 1145 |
function handleKeyPress(e) {
|
| 1146 |
if (e.key === 'Enter') {
|
| 1147 |
sendMessage();
|
|
@@ -1149,12 +1608,17 @@ PUT /_matrix/client/v3/rooms/{roomId}/send/m.room.message/{txnId}
|
|
| 1149 |
}
|
| 1150 |
|
| 1151 |
function escapeHtml(text) {
|
| 1152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1153 |
}
|
| 1154 |
|
| 1155 |
window.onload = function() {
|
| 1156 |
-
|
| 1157 |
-
selectRoom(mockRooms[0].id);
|
| 1158 |
};
|
| 1159 |
</script>
|
| 1160 |
</body>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Client:Less — Lightweight Matrix Web Client</title>
|
| 7 |
<style>
|
| 8 |
:root {
|
| 9 |
--tg-blue: #5682a3;
|
|
|
|
| 21 |
--tg-msg-out-border: #d2e7b6;
|
| 22 |
--tg-online: #42b740;
|
| 23 |
--tg-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
| 24 |
+
--dark-bg: #181a1b;
|
| 25 |
+
--dark-card: #202326;
|
| 26 |
+
--dark-border: #31363c;
|
| 27 |
+
--dark-text: #e8e8e8;
|
| 28 |
+
--accent-link: #539edb;
|
| 29 |
}
|
| 30 |
|
| 31 |
* {
|
|
|
|
| 138 |
}
|
| 139 |
|
| 140 |
.content-card {
|
| 141 |
+
max-width: 960px;
|
| 142 |
margin: 0 auto 24px auto;
|
| 143 |
background: var(--tg-card-bg);
|
| 144 |
border-radius: 4px;
|
|
|
|
| 165 |
display: inline-block;
|
| 166 |
background-color: var(--tg-blue);
|
| 167 |
color: #ffffff;
|
| 168 |
+
padding: 9px 18px;
|
| 169 |
border-radius: 3px;
|
| 170 |
text-decoration: none;
|
| 171 |
font-weight: 600;
|
| 172 |
border: none;
|
| 173 |
cursor: pointer;
|
| 174 |
transition: background-color 0.15s;
|
| 175 |
+
font-size: 13px;
|
| 176 |
+
text-align: center;
|
| 177 |
}
|
| 178 |
|
| 179 |
.btn:hover {
|
|
|
|
| 184 |
background-color: var(--tg-blue-active);
|
| 185 |
}
|
| 186 |
|
| 187 |
+
.btn-sm {
|
| 188 |
+
padding: 5px 12px;
|
| 189 |
+
font-size: 12px;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
.btn-outline {
|
| 193 |
background-color: transparent;
|
| 194 |
color: var(--tg-blue);
|
|
|
|
| 199 |
background-color: rgba(86, 130, 162, 0.08);
|
| 200 |
}
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
.login-box {
|
| 203 |
+
max-width: 440px;
|
| 204 |
+
margin: 30px auto;
|
| 205 |
background: #fff;
|
| 206 |
padding: 32px;
|
| 207 |
border-radius: 4px;
|
|
|
|
| 241 |
margin-top: 4px;
|
| 242 |
}
|
| 243 |
|
| 244 |
+
.servers-card {
|
| 245 |
+
background-color: var(--dark-bg);
|
| 246 |
+
color: var(--dark-text);
|
| 247 |
+
border-color: var(--dark-border);
|
| 248 |
+
border-radius: 6px;
|
| 249 |
+
padding: 24px;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.servers-title {
|
| 253 |
+
color: #ffffff;
|
| 254 |
+
font-size: 22px;
|
| 255 |
+
margin-bottom: 8px;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.servers-subtitle {
|
| 259 |
+
color: #a0a6b0;
|
| 260 |
+
font-size: 14px;
|
| 261 |
+
margin-bottom: 20px;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.servers-table-wrapper {
|
| 265 |
+
width: 100%;
|
| 266 |
+
overflow-x: auto;
|
| 267 |
+
border-radius: 4px;
|
| 268 |
+
border: 1px solid var(--dark-border);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
.servers-table {
|
| 272 |
+
width: 100%;
|
| 273 |
+
border-collapse: collapse;
|
| 274 |
+
text-align: left;
|
| 275 |
+
font-size: 13.5px;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.servers-table th {
|
| 279 |
+
background-color: var(--dark-card);
|
| 280 |
+
color: #ffffff;
|
| 281 |
+
padding: 14px 16px;
|
| 282 |
+
font-weight: 600;
|
| 283 |
+
border-bottom: 2px solid var(--dark-border);
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
.servers-table td {
|
| 287 |
+
padding: 12px 16px;
|
| 288 |
+
border-bottom: 1px solid var(--dark-border);
|
| 289 |
+
vertical-align: middle;
|
| 290 |
+
color: #d1d5db;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.servers-table tr:last-child td {
|
| 294 |
+
border-bottom: none;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
.servers-table tr:hover td {
|
| 298 |
+
background-color: rgba(255, 255, 255, 0.03);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.server-name-cell {
|
| 302 |
+
font-weight: 600;
|
| 303 |
+
color: var(--accent-link);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
.server-url-link {
|
| 307 |
+
color: var(--accent-link);
|
| 308 |
+
text-decoration: none;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
.server-url-link:hover {
|
| 312 |
+
text-decoration: underline;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
.ref-badge {
|
| 316 |
+
display: inline-block;
|
| 317 |
+
background: #2b323b;
|
| 318 |
+
color: #8b9bb4;
|
| 319 |
+
font-size: 10px;
|
| 320 |
+
font-weight: bold;
|
| 321 |
+
padding: 1px 5px;
|
| 322 |
+
border-radius: 10px;
|
| 323 |
+
margin-left: 3px;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
.client-layout {
|
| 327 |
display: flex;
|
| 328 |
height: 100%;
|
|
|
|
| 330 |
background-color: var(--tg-card-bg);
|
| 331 |
}
|
| 332 |
|
|
|
|
| 333 |
.rooms-sidebar {
|
| 334 |
+
width: 300px;
|
| 335 |
+
min-width: 300px;
|
| 336 |
border-right: 1px solid var(--tg-border);
|
| 337 |
display: flex;
|
| 338 |
flex-direction: column;
|
| 339 |
background-color: #ffffff;
|
| 340 |
}
|
| 341 |
|
| 342 |
+
.user-profile-header {
|
| 343 |
+
padding: 10px 14px;
|
| 344 |
+
background: var(--tg-blue-dark);
|
| 345 |
+
color: #ffffff;
|
| 346 |
+
display: flex;
|
| 347 |
+
align-items: center;
|
| 348 |
+
justify-content: space-between;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
.user-profile-info {
|
| 352 |
+
display: flex;
|
| 353 |
+
align-items: center;
|
| 354 |
+
gap: 10px;
|
| 355 |
+
overflow: hidden;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.user-avatar-sm {
|
| 359 |
+
width: 32px;
|
| 360 |
+
height: 32px;
|
| 361 |
+
border-radius: 50%;
|
| 362 |
+
background: #ffffff;
|
| 363 |
+
color: var(--tg-blue-dark);
|
| 364 |
+
display: flex;
|
| 365 |
+
align-items: center;
|
| 366 |
+
justify-content: center;
|
| 367 |
+
font-weight: bold;
|
| 368 |
+
font-size: 14px;
|
| 369 |
+
flex-shrink: 0;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
.user-display-name {
|
| 373 |
+
font-weight: 600;
|
| 374 |
+
font-size: 13px;
|
| 375 |
+
white-space: nowrap;
|
| 376 |
+
overflow: hidden;
|
| 377 |
+
text-overflow: ellipsis;
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
.search-box {
|
| 381 |
padding: 10px;
|
| 382 |
border-bottom: 1px solid #f0f0f0;
|
|
|
|
| 437 |
margin-right: 12px;
|
| 438 |
flex-shrink: 0;
|
| 439 |
user-select: none;
|
| 440 |
+
overflow: hidden;
|
| 441 |
+
object-fit: cover;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
.avatar img {
|
| 445 |
+
width: 100%;
|
| 446 |
+
height: 100%;
|
| 447 |
+
object-fit: cover;
|
| 448 |
}
|
| 449 |
|
| 450 |
.room-details {
|
|
|
|
| 481 |
text-overflow: ellipsis;
|
| 482 |
}
|
| 483 |
|
|
|
|
| 484 |
.chat-main {
|
| 485 |
flex: 1;
|
| 486 |
display: flex;
|
|
|
|
| 497 |
height: 100%;
|
| 498 |
color: #8393a3;
|
| 499 |
user-select: none;
|
| 500 |
+
gap: 12px;
|
| 501 |
}
|
| 502 |
|
| 503 |
.chat-placeholder-badge {
|
| 504 |
+
background: rgba(0, 0, 0, 0.07);
|
| 505 |
+
padding: 8px 18px;
|
| 506 |
+
border-radius: 16px;
|
| 507 |
font-size: 13px;
|
| 508 |
+
font-weight: 500;
|
| 509 |
}
|
| 510 |
|
| 511 |
.chat-header {
|
| 512 |
+
height: 50px;
|
| 513 |
background: #ffffff;
|
| 514 |
border-bottom: 1px solid var(--tg-border);
|
| 515 |
display: flex;
|
|
|
|
| 602 |
border-color: var(--tg-blue);
|
| 603 |
}
|
| 604 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
.info-sidebar {
|
| 606 |
+
width: 270px;
|
| 607 |
+
min-width: 270px;
|
| 608 |
border-left: 1px solid var(--tg-border);
|
| 609 |
background: #ffffff;
|
| 610 |
display: flex;
|
|
|
|
| 622 |
}
|
| 623 |
|
| 624 |
.info-avatar {
|
| 625 |
+
width: 76px;
|
| 626 |
+
height: 76px;
|
| 627 |
border-radius: 50%;
|
| 628 |
background: #5682a3;
|
| 629 |
color: #fff;
|
| 630 |
+
font-size: 28px;
|
| 631 |
font-weight: bold;
|
| 632 |
display: flex;
|
| 633 |
align-items: center;
|
| 634 |
justify-content: center;
|
| 635 |
margin-bottom: 12px;
|
| 636 |
+
overflow: hidden;
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
.info-avatar img {
|
| 640 |
+
width: 100%;
|
| 641 |
+
height: 100%;
|
| 642 |
+
object-fit: cover;
|
| 643 |
}
|
| 644 |
|
| 645 |
.info-name {
|
|
|
|
| 647 |
font-weight: 600;
|
| 648 |
color: #111;
|
| 649 |
margin-bottom: 4px;
|
| 650 |
+
word-break: break-word;
|
| 651 |
}
|
| 652 |
|
| 653 |
.info-members-count {
|
|
|
|
| 691 |
justify-content: center;
|
| 692 |
font-size: 12px;
|
| 693 |
font-weight: bold;
|
| 694 |
+
overflow: hidden;
|
| 695 |
+
flex-shrink: 0;
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
.member-avatar img {
|
| 699 |
+
width: 100%;
|
| 700 |
+
height: 100%;
|
| 701 |
+
object-fit: cover;
|
| 702 |
}
|
| 703 |
|
| 704 |
.member-name {
|
| 705 |
font-size: 13px;
|
| 706 |
font-weight: 500;
|
| 707 |
+
word-break: break-all;
|
| 708 |
}
|
| 709 |
|
| 710 |
.member-status {
|
|
|
|
| 712 |
color: var(--tg-online);
|
| 713 |
}
|
| 714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 715 |
.download-box {
|
| 716 |
display: flex;
|
| 717 |
gap: 20px;
|
|
|
|
| 721 |
|
| 722 |
.download-card {
|
| 723 |
flex: 1;
|
| 724 |
+
min-width: 220px;
|
| 725 |
border: 1px solid var(--tg-border);
|
| 726 |
+
padding: 24px;
|
| 727 |
border-radius: 4px;
|
| 728 |
text-align: center;
|
| 729 |
background: #fafbfc;
|
| 730 |
}
|
| 731 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 732 |
.toast {
|
| 733 |
position: fixed;
|
| 734 |
bottom: 20px;
|
| 735 |
right: 20px;
|
| 736 |
+
background: rgba(0, 0, 0, 0.88);
|
| 737 |
color: #fff;
|
| 738 |
padding: 12px 20px;
|
| 739 |
border-radius: 4px;
|
| 740 |
font-size: 13px;
|
| 741 |
z-index: 9999;
|
| 742 |
display: none;
|
| 743 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
.sync-loader {
|
| 747 |
+
display: inline-block;
|
| 748 |
+
width: 12px;
|
| 749 |
+
height: 12px;
|
| 750 |
+
border: 2px solid rgba(255,255,255,0.3);
|
| 751 |
+
border-radius: 50%;
|
| 752 |
+
border-top-color: #fff;
|
| 753 |
+
animation: spin 0.8s linear infinite;
|
| 754 |
+
margin-right: 6px;
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
@keyframes spin {
|
| 758 |
+
to { transform: rotate(360deg); }
|
| 759 |
}
|
| 760 |
</style>
|
| 761 |
</head>
|
|
|
|
| 768 |
<ul class="nav-menu">
|
| 769 |
<li class="nav-item"><a class="nav-link active" id="nav-home" onclick="switchTab('home')">Главная</a></li>
|
| 770 |
<li class="nav-item"><a class="nav-link" id="nav-login" onclick="switchTab('login')">Войти</a></li>
|
| 771 |
+
<li class="nav-item"><a class="nav-link" id="nav-servers" onclick="switchTab('servers')">Популярные серверы</a></li>
|
| 772 |
<li class="nav-item"><a class="nav-link" id="nav-download" onclick="switchTab('download')">Скачать приложение</a></li>
|
|
|
|
|
|
|
| 773 |
</ul>
|
| 774 |
</header>
|
| 775 |
|
| 776 |
<div class="page-container">
|
| 777 |
|
| 778 |
+
<!-- Page 1: Home -->
|
| 779 |
<div id="page-home" class="page active">
|
| 780 |
<div class="content-card">
|
| 781 |
<h1 class="content-title">Добро пожаловать в Client:Less</h1>
|
| 782 |
<p class="content-subtitle">
|
| 783 |
+
Автономный веб-клиент для децентрализованной сети Matrix в классическом стиле Telegram Desktop 2015 года. Без сторонних фреймворков, тяжелых скриптов и CDN.
|
| 784 |
</p>
|
| 785 |
+
<div style="margin-bottom: 20px; display: flex; gap: 10px;">
|
| 786 |
<button class="btn" onclick="switchTab('login')">Открыть веб-клиент</button>
|
| 787 |
+
<button class="btn btn-outline" onclick="switchTab('servers')">Список известных серверов</button>
|
| 788 |
</div>
|
| 789 |
</div>
|
| 790 |
|
| 791 |
<div class="content-card">
|
| 792 |
+
<h2 style="font-size: 18px; color: var(--tg-blue-dark); margin-bottom: 12px;">Прямой доступ к вашим чатам Matrix</h2>
|
| 793 |
<p style="line-height: 1.6; color: #444; margin-bottom: 12px;">
|
| 794 |
+
Client:Less выполняет реальную синхронизацию данных прямо через стандартный Matrix Client-Server REST API (v3). В�� получаете доступ к вашим настоящим чатам, истории сообщений и списку участников без промежуточных прокси.
|
| 795 |
</p>
|
| 796 |
<ul style="padding-left: 20px; line-height: 1.8; color: #444;">
|
| 797 |
+
<li><strong>Настоящий Matrix Sync:</strong> Подгружает реальные комнаты пользователя с вашего домашнего сервера.</li>
|
| 798 |
+
<li><strong>Telegram 2015 UI:</strong> 3-колоночный рабочий стол с выбором чата, диалоговым окном и правой панелью информации.</li>
|
| 799 |
+
<li><strong>Чистый JS и CSS:</strong> Загружается мгновенно, не требует тяжелого Node.js окружения.</li>
|
| 800 |
</ul>
|
| 801 |
</div>
|
| 802 |
</div>
|
| 803 |
|
| 804 |
+
<!-- Page 2: Login -->
|
| 805 |
<div id="page-login" class="page">
|
| 806 |
<div class="login-box">
|
| 807 |
<h2 style="font-size: 20px; color: var(--tg-blue-dark); margin-bottom: 8px; text-align: center;">Вход в Matrix</h2>
|
| 808 |
<p style="font-size: 13px; color: var(--tg-subtext); margin-bottom: 20px; text-align: center;">
|
| 809 |
+
Введите адрес вашего сервера Matrix и учётные данные
|
| 810 |
</p>
|
| 811 |
|
| 812 |
<div class="form-group">
|
| 813 |
+
<label for="input-homeserver">Домашний сервер (Homeserver URL)</label>
|
| 814 |
<input type="text" id="input-homeserver" class="form-input" value="https://matrix.org" placeholder="https://matrix.org">
|
| 815 |
+
<div class="form-hint">Например: https://matrix.org или выберите из списка серверов</div>
|
| 816 |
</div>
|
| 817 |
|
| 818 |
<div class="form-group">
|
| 819 |
+
<label for="input-username">Имя пользователя или Matrix ID</label>
|
| 820 |
+
<input type="text" id="input-username" class="form-input" placeholder="alice или @alice:matrix.org">
|
| 821 |
</div>
|
| 822 |
|
| 823 |
<div class="form-group">
|
| 824 |
+
<label for="input-password">Пароль</label>
|
| 825 |
<input type="password" id="input-password" class="form-input" placeholder="••••••••">
|
| 826 |
</div>
|
| 827 |
|
| 828 |
+
<button class="btn" id="login-btn-submit" style="width: 100%; text-align: center;" onclick="handleRealLogin()">
|
| 829 |
+
Подключиться и открыть веб-клиент
|
| 830 |
+
</button>
|
| 831 |
+
|
| 832 |
+
<div style="text-align: center; margin-top: 18px; border-top: 1px solid #eee; padding-top: 14px;">
|
| 833 |
+
<a style="color: var(--tg-blue); font-size: 12px; cursor: pointer; text-decoration: underline;" onclick="startDemoMode()">
|
| 834 |
+
Запустить демо-интерфейс без авторизации
|
| 835 |
+
</a>
|
| 836 |
</div>
|
| 837 |
</div>
|
| 838 |
</div>
|
| 839 |
|
| 840 |
+
<!-- Page 3: Popular Servers (Exact match from screenshot) -->
|
| 841 |
+
<div id="page-servers" class="page">
|
| 842 |
+
<div class="content-card servers-card">
|
| 843 |
+
<h1 class="servers-title">Список самых популярных серверов Matrix</h1>
|
| 844 |
+
<p class="servers-subtitle">
|
| 845 |
+
Выберите публичный домашний сервер Matrix для регистрации или входа. Нажмите «Войти» для подстановки адреса.
|
| 846 |
+
</p>
|
| 847 |
+
|
| 848 |
+
<div class="servers-table-wrapper">
|
| 849 |
+
<table class="servers-table">
|
| 850 |
+
<thead>
|
| 851 |
+
<tr>
|
| 852 |
+
<th>Название</th>
|
| 853 |
+
<th>URL</th>
|
| 854 |
+
<th>Примечания</th>
|
| 855 |
+
<th style="text-align: center; width: 100px;">Действие</th>
|
| 856 |
+
</tr>
|
| 857 |
+
</thead>
|
| 858 |
+
<tbody id="servers-table-body">
|
| 859 |
+
<!-- Populated dynamically via script with exact table from screenshot -->
|
| 860 |
+
</tbody>
|
| 861 |
+
</table>
|
| 862 |
+
</div>
|
| 863 |
+
</div>
|
| 864 |
+
</div>
|
| 865 |
+
|
| 866 |
+
<!-- Page 4: Telegram 2015 Desktop Web Client -->
|
| 867 |
<div id="page-client" class="page page-client-container">
|
| 868 |
<div class="client-layout">
|
| 869 |
+
<!-- Column 1: Rooms list & User header -->
|
| 870 |
<div class="rooms-sidebar">
|
| 871 |
+
<div class="user-profile-header">
|
| 872 |
+
<div class="user-profile-info">
|
| 873 |
+
<div class="user-avatar-sm" id="client-user-avatar">U</div>
|
| 874 |
+
<div class="user-display-name" id="client-user-name">Пользователь</div>
|
| 875 |
+
</div>
|
| 876 |
+
<button class="btn btn-sm btn-outline" style="color:#fff; border-color:rgba(255,255,255,0.4);" onclick="handleLogout()">Выйти</button>
|
| 877 |
+
</div>
|
| 878 |
+
|
| 879 |
<div class="search-box">
|
| 880 |
<input type="text" class="search-input" placeholder="Поиск чатов..." id="room-search-input" onkeyup="filterRooms()">
|
| 881 |
</div>
|
| 882 |
+
|
| 883 |
<ul class="rooms-list" id="rooms-list-container">
|
| 884 |
<!-- Populated dynamically -->
|
| 885 |
</ul>
|
| 886 |
</div>
|
| 887 |
|
| 888 |
+
<!-- Column 2: Active Chat Area -->
|
| 889 |
<div class="chat-main" id="chat-main-container">
|
| 890 |
<div class="chat-placeholder" id="chat-empty-state">
|
| 891 |
<div class="chat-placeholder-badge">Выберите чат из списка слева</div>
|
|
|
|
| 897 |
<div class="chat-header-title" id="active-chat-title">Название чата</div>
|
| 898 |
<div class="chat-header-status" id="active-chat-status">0 участников</div>
|
| 899 |
</div>
|
| 900 |
+
<div id="sync-status-indicator" style="font-size: 11px; color: var(--tg-subtext);">
|
| 901 |
+
Live Sync
|
| 902 |
+
</div>
|
| 903 |
</div>
|
| 904 |
|
| 905 |
<div class="messages-container" id="messages-container">
|
|
|
|
| 908 |
|
| 909 |
<div class="chat-input-bar">
|
| 910 |
<input type="text" class="chat-input" id="message-input" placeholder="Напишите сообщение..." onkeydown="handleKeyPress(event)">
|
| 911 |
+
<button class="btn" style="height: 40px;" onclick="sendMessage()">Отправить</button>
|
| 912 |
</div>
|
| 913 |
</div>
|
| 914 |
</div>
|
| 915 |
|
| 916 |
+
<!-- Column 3: Group & User Info Sidebar -->
|
| 917 |
<div class="info-sidebar" id="info-sidebar-container">
|
| 918 |
<div class="info-header">
|
| 919 |
<div class="info-avatar" id="info-avatar-box">?</div>
|
| 920 |
+
<div class="info-name" id="info-name-box">Чат не выбран</div>
|
| 921 |
<div class="info-members-count" id="info-count-box">Информационная панель</div>
|
| 922 |
</div>
|
| 923 |
|
| 924 |
<div class="info-section">
|
| 925 |
+
<div class="info-section-title">О комнате / Тема</div>
|
| 926 |
<p style="font-size: 13px; color: #444; line-height: 1.4;" id="info-description-box">
|
| 927 |
Здесь отображается описание выбронного чата и список участников.
|
| 928 |
</p>
|
|
|
|
| 938 |
</div>
|
| 939 |
</div>
|
| 940 |
|
| 941 |
+
<!-- Page 5: Download App -->
|
| 942 |
<div id="page-download" class="page">
|
| 943 |
<div class="content-card">
|
| 944 |
<h1 class="content-title">Скачать Client:Less</h1>
|
| 945 |
<p class="content-subtitle">
|
| 946 |
+
Автономный десктопный клиент для Windows, macOS и Linux.
|
| 947 |
</p>
|
| 948 |
|
| 949 |
<div class="download-box">
|
| 950 |
<div class="download-card">
|
| 951 |
+
<h4 style="font-size:16px; margin-bottom:8px; color:var(--tg-blue-dark);">Windows</h4>
|
| 952 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">x64 / ARM64 (Portable .exe)</p>
|
| 953 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для Windows...')">Скачать .EXE</button>
|
| 954 |
</div>
|
| 955 |
<div class="download-card">
|
| 956 |
+
<h4 style="font-size:16px; margin-bottom:8px; color:var(--tg-blue-dark);">macOS</h4>
|
| 957 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">Apple Silicon / Intel (.dmg)</p>
|
| 958 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для macOS...')">Скачать .DMG</button>
|
| 959 |
</div>
|
| 960 |
<div class="download-card">
|
| 961 |
+
<h4 style="font-size:16px; margin-bottom:8px; color:var(--tg-blue-dark);">Linux</h4>
|
| 962 |
<p style="font-size: 12px; color: var(--tg-subtext); margin-bottom: 15px;">AppImage / .tar.gz</p>
|
| 963 |
<button class="btn" onclick="showToast('Загрузка Client:Less v1.0 для Linux...')">Скачать .AppImage</button>
|
| 964 |
</div>
|
|
|
|
| 966 |
</div>
|
| 967 |
</div>
|
| 968 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 969 |
</div>
|
| 970 |
|
| 971 |
<div class="toast" id="toast-message">Уведомление</div>
|
| 972 |
|
| 973 |
<script>
|
| 974 |
+
// Exact popular servers dataset matching the user screenshot
|
| 975 |
+
const popularServers = [
|
| 976 |
+
{
|
| 977 |
+
name: "matrix.org",
|
| 978 |
+
url: "https://matrix.org",
|
| 979 |
+
notes: "Крупнейший сервер, управляется фондом Matrix.org",
|
| 980 |
+
refs: ["3"]
|
| 981 |
+
},
|
| 982 |
+
{
|
| 983 |
+
name: "envs.net",
|
| 984 |
+
url: "https://element.envs.net",
|
| 985 |
+
notes: "Ориентирован на приватность, не требует номера телефона",
|
| 986 |
+
refs: ["3", "4"]
|
| 987 |
+
},
|
| 988 |
+
{
|
| 989 |
+
name: "tchncs.de",
|
| 990 |
+
url: "https://tchncs.de/matrix",
|
| 991 |
+
notes: "Немецкий сервер, уважающий приватность",
|
| 992 |
+
refs: ["3", "8", "4"]
|
| 993 |
+
},
|
| 994 |
+
{
|
| 995 |
+
name: "nitro.chat",
|
| 996 |
+
url: "https://nitro.chat",
|
| 997 |
+
notes: "Быстрый сервер, базируется в США",
|
| 998 |
+
refs: ["3"]
|
| 999 |
+
},
|
| 1000 |
+
{
|
| 1001 |
+
name: "matrix.im",
|
| 1002 |
+
url: "https://matrix.im",
|
| 1003 |
+
notes: "Сервер для сообщества",
|
| 1004 |
+
refs: ["3"]
|
| 1005 |
+
},
|
| 1006 |
+
{
|
| 1007 |
+
name: "unredacted.org",
|
| 1008 |
+
url: "https://unredacted.org",
|
| 1009 |
+
notes: "Рекомендуется в нескольких списках",
|
| 1010 |
+
refs: ["8", "4"]
|
| 1011 |
+
},
|
| 1012 |
+
{
|
| 1013 |
+
name: "aria-net.org",
|
| 1014 |
+
url: "https://aria-net.org",
|
| 1015 |
+
notes: "Рекомендуемый сервер",
|
| 1016 |
+
refs: ["4"]
|
| 1017 |
+
},
|
| 1018 |
+
{
|
| 1019 |
+
name: "nope.chat",
|
| 1020 |
+
url: "https://nope.chat",
|
| 1021 |
+
notes: "Рекомендуемый сервер",
|
| 1022 |
+
refs: ["4"]
|
| 1023 |
+
},
|
| 1024 |
{
|
| 1025 |
+
name: "converser.eu",
|
| 1026 |
+
url: "https://converser.eu",
|
| 1027 |
+
notes: "Упоминается в списке клиента Cinny",
|
| 1028 |
+
refs: ["8"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
},
|
| 1030 |
{
|
| 1031 |
+
name: "mozilla.org",
|
| 1032 |
+
url: "https://mozilla.org",
|
| 1033 |
+
notes: "Сервер от Mozilla",
|
| 1034 |
+
refs: ["8"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1035 |
},
|
| 1036 |
{
|
| 1037 |
+
name: "xmr.se",
|
| 1038 |
+
url: "https://xmr.se",
|
| 1039 |
+
notes: "Упоминается в списке клиента Cinny",
|
| 1040 |
+
refs: ["8"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1041 |
}
|
| 1042 |
];
|
| 1043 |
|
| 1044 |
+
// Global State
|
| 1045 |
+
let matrixSession = {
|
| 1046 |
+
homeserver: '',
|
| 1047 |
+
accessToken: '',
|
| 1048 |
+
userId: '',
|
| 1049 |
+
displayName: '',
|
| 1050 |
+
avatarUrl: '',
|
| 1051 |
+
nextBatch: '',
|
| 1052 |
+
rooms: {}, // roomId -> { id, name, topic, avatar, messages: [], members: [] }
|
| 1053 |
+
activeRoomId: null,
|
| 1054 |
+
isDemo: false,
|
| 1055 |
+
syncTimeoutId: null
|
| 1056 |
+
};
|
| 1057 |
+
|
| 1058 |
+
function renderPopularServersTable() {
|
| 1059 |
+
const tbody = document.getElementById('servers-table-body');
|
| 1060 |
+
tbody.innerHTML = '';
|
| 1061 |
+
|
| 1062 |
+
popularServers.forEach(server => {
|
| 1063 |
+
const tr = document.createElement('tr');
|
| 1064 |
+
|
| 1065 |
+
const refsHtml = server.refs.map(r => `<span class="ref-badge">${r}</span>`).join('');
|
| 1066 |
+
|
| 1067 |
+
tr.innerHTML = `
|
| 1068 |
+
<td class="server-name-cell">${server.name}</td>
|
| 1069 |
+
<td><a href="${server.url}" target="_blank" class="server-url-link">${server.url}</a></td>
|
| 1070 |
+
<td>${server.notes} ${refsHtml}</td>
|
| 1071 |
+
<td style="text-align: center;">
|
| 1072 |
+
<button class="btn btn-sm" onclick="selectServerForLogin('${server.url}')">Войти</button>
|
| 1073 |
+
</td>
|
| 1074 |
+
`;
|
| 1075 |
+
tbody.appendChild(tr);
|
| 1076 |
+
});
|
| 1077 |
+
}
|
| 1078 |
+
|
| 1079 |
+
function selectServerForLogin(url) {
|
| 1080 |
+
document.getElementById('input-homeserver').value = url;
|
| 1081 |
+
switchTab('login');
|
| 1082 |
+
showToast(`Сервер ${url} выбран. Введите ваш логин и пароль.`);
|
| 1083 |
+
}
|
| 1084 |
+
|
| 1085 |
function switchTab(tabName) {
|
| 1086 |
document.querySelectorAll('.nav-link').forEach(el => el.classList.remove('active'));
|
| 1087 |
document.querySelectorAll('.page').forEach(el => el.classList.remove('active'));
|
|
|
|
| 1103 |
toast.style.display = 'block';
|
| 1104 |
setTimeout(() => {
|
| 1105 |
toast.style.display = 'none';
|
| 1106 |
+
}, 3500);
|
| 1107 |
}
|
| 1108 |
|
| 1109 |
+
async function handleRealLogin() {
|
| 1110 |
+
let server = document.getElementById('input-homeserver').value.trim();
|
| 1111 |
const user = document.getElementById('input-username').value.trim();
|
| 1112 |
const pass = document.getElementById('input-password').value.trim();
|
| 1113 |
|
| 1114 |
+
if (!server) {
|
| 1115 |
+
showToast('Пожалуйста, укажите адрес домашнего сервера Matrix.');
|
| 1116 |
+
return;
|
| 1117 |
+
}
|
| 1118 |
if (!user || !pass) {
|
| 1119 |
showToast('Пожалуйста, введите имя пользователя и пароль.');
|
| 1120 |
return;
|
| 1121 |
}
|
| 1122 |
|
| 1123 |
+
// Normalize homeserver URL
|
| 1124 |
+
if (!server.startsWith('http://') && !server.startsWith('https://')) {
|
| 1125 |
+
server = 'https://' + server;
|
| 1126 |
+
}
|
| 1127 |
+
server = server.replace(/\/+$/, '');
|
| 1128 |
+
|
| 1129 |
+
const loginBtn = document.getElementById('login-btn-submit');
|
| 1130 |
+
loginBtn.innerHTML = `<span class="sync-loader"></span> Авторизация...`;
|
| 1131 |
+
loginBtn.disabled = true;
|
| 1132 |
+
|
| 1133 |
+
showToast(`Подключение к ${server}...`);
|
| 1134 |
|
| 1135 |
try {
|
|
|
|
| 1136 |
const response = await fetch(`${server}/_matrix/client/v3/login`, {
|
| 1137 |
method: 'POST',
|
| 1138 |
headers: { 'Content-Type': 'application/json' },
|
|
|
|
| 1145 |
|
| 1146 |
const data = await response.json();
|
| 1147 |
|
| 1148 |
+
if (response.ok && data.access_token) {
|
| 1149 |
+
matrixSession.homeserver = server;
|
| 1150 |
+
matrixSession.accessToken = data.access_token;
|
| 1151 |
+
matrixSession.userId = data.user_id;
|
| 1152 |
+
matrixSession.displayName = user;
|
| 1153 |
+
matrixSession.isDemo = false;
|
| 1154 |
+
matrixSession.rooms = {};
|
| 1155 |
+
|
| 1156 |
+
updateUserProfileUI();
|
| 1157 |
+
showToast('Авторизация успешна! Подгружаем ваши реальные чаты...');
|
| 1158 |
+
|
| 1159 |
+
// Switch to client UI
|
| 1160 |
switchTab('client');
|
| 1161 |
+
|
| 1162 |
+
// Start initial Matrix Sync loop
|
| 1163 |
+
startMatrixSync();
|
| 1164 |
} else {
|
| 1165 |
+
const errText = data.error || 'Неверный логин или пароль';
|
| 1166 |
+
showToast(`Ошибка входа (${response.status}): ${errText}`);
|
| 1167 |
+
}
|
| 1168 |
+
} catch (err) {
|
| 1169 |
+
console.error('Matrix login error:', err);
|
| 1170 |
+
showToast(`Не удалось связаться с ${server}. Проверьте CORS или подключение.`);
|
| 1171 |
+
} finally {
|
| 1172 |
+
loginBtn.innerHTML = `Подключиться и открыть веб-клиент`;
|
| 1173 |
+
loginBtn.disabled = false;
|
| 1174 |
+
}
|
| 1175 |
+
}
|
| 1176 |
+
|
| 1177 |
+
async function startMatrixSync() {
|
| 1178 |
+
if (matrixSession.isDemo || !matrixSession.accessToken) return;
|
| 1179 |
+
|
| 1180 |
+
const syncStatus = document.getElementById('sync-status-indicator');
|
| 1181 |
+
if (syncStatus) syncStatus.innerText = 'Синхронизация...';
|
| 1182 |
+
|
| 1183 |
+
let url = `${matrixSession.homeserver}/_matrix/client/v3/sync?timeout=30000`;
|
| 1184 |
+
if (matrixSession.nextBatch) {
|
| 1185 |
+
url += `&since=${encodeURIComponent(matrixSession.nextBatch)}`;
|
| 1186 |
+
} else {
|
| 1187 |
+
url += `&filter={"room":{"timeline":{"limit":30}}}`;
|
| 1188 |
+
}
|
| 1189 |
+
|
| 1190 |
+
try {
|
| 1191 |
+
const res = await fetch(url, {
|
| 1192 |
+
headers: { 'Authorization': `Bearer ${matrixSession.accessToken}` }
|
| 1193 |
+
});
|
| 1194 |
+
|
| 1195 |
+
if (res.status === 401) {
|
| 1196 |
+
showToast('Сессия истекла. Пожалуйста, войдите снова.');
|
| 1197 |
+
handleLogout();
|
| 1198 |
+
return;
|
| 1199 |
+
}
|
| 1200 |
+
|
| 1201 |
+
if (res.ok) {
|
| 1202 |
+
const data = await res.json();
|
| 1203 |
+
matrixSession.nextBatch = data.next_batch;
|
| 1204 |
+
|
| 1205 |
+
if (data.rooms && data.rooms.join) {
|
| 1206 |
+
processSyncRooms(data.rooms.join);
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
if (syncStatus) syncStatus.innerText = 'Онлайн (Matrix REST)';
|
| 1210 |
+
}
|
| 1211 |
+
} catch (e) {
|
| 1212 |
+
console.warn('Sync iteration error:', e);
|
| 1213 |
+
if (syncStatus) syncStatus.innerText = 'Ошибка соединения';
|
| 1214 |
+
}
|
| 1215 |
+
|
| 1216 |
+
// Schedule next long-poll sync
|
| 1217 |
+
matrixSession.syncTimeoutId = setTimeout(startMatrixSync, 1000);
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
function processSyncRooms(joinedRooms) {
|
| 1221 |
+
let updated = false;
|
| 1222 |
+
|
| 1223 |
+
for (const [roomId, roomData] of Object.entries(joinedRooms)) {
|
| 1224 |
+
if (!matrixSession.rooms[roomId]) {
|
| 1225 |
+
matrixSession.rooms[roomId] = {
|
| 1226 |
+
id: roomId,
|
| 1227 |
+
name: roomId,
|
| 1228 |
+
topic: '',
|
| 1229 |
+
avatar: '',
|
| 1230 |
+
messages: [],
|
| 1231 |
+
members: []
|
| 1232 |
+
};
|
| 1233 |
+
updated = true;
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
const room = matrixSession.rooms[roomId];
|
| 1237 |
+
|
| 1238 |
+
// Process state events (Room Name, Topic, Avatar)
|
| 1239 |
+
if (roomData.state && roomData.state.events) {
|
| 1240 |
+
parseStateEvents(room, roomData.state.events);
|
| 1241 |
+
}
|
| 1242 |
+
|
| 1243 |
+
// Process timeline messages
|
| 1244 |
+
if (roomData.timeline && roomData.timeline.events) {
|
| 1245 |
+
roomData.timeline.events.forEach(ev => {
|
| 1246 |
+
if (ev.type === 'm.room.name' && ev.content.name) {
|
| 1247 |
+
room.name = ev.content.name;
|
| 1248 |
+
}
|
| 1249 |
+
if (ev.type === 'm.room.avatar' && ev.content.url) {
|
| 1250 |
+
room.avatar = mxcToHttp(ev.content.url);
|
| 1251 |
+
}
|
| 1252 |
+
if (ev.type === 'm.room.topic' && ev.content.topic) {
|
| 1253 |
+
room.topic = ev.content.topic;
|
| 1254 |
+
}
|
| 1255 |
+
|
| 1256 |
+
if (ev.type === 'm.room.message' && ev.content && ev.content.body) {
|
| 1257 |
+
const isExisting = room.messages.some(m => m.id === ev.event_id);
|
| 1258 |
+
if (!isExisting) {
|
| 1259 |
+
const senderName = ev.sender.split(':')[0].replace('@', '');
|
| 1260 |
+
const isSelf = ev.sender === matrixSession.userId;
|
| 1261 |
+
const timeStr = formatEventTime(ev.origin_server_ts);
|
| 1262 |
+
|
| 1263 |
+
room.messages.push({
|
| 1264 |
+
id: ev.event_id,
|
| 1265 |
+
sender: isSelf ? 'Вы' : senderName,
|
| 1266 |
+
rawSender: ev.sender,
|
| 1267 |
+
text: ev.content.body,
|
| 1268 |
+
time: timeStr,
|
| 1269 |
+
incoming: !isSelf,
|
| 1270 |
+
ts: ev.origin_server_ts || Date.now()
|
| 1271 |
+
});
|
| 1272 |
+
updated = true;
|
| 1273 |
+
}
|
| 1274 |
+
}
|
| 1275 |
+
});
|
| 1276 |
+
|
| 1277 |
+
// Sort messages by timestamp
|
| 1278 |
+
room.messages.sort((a, b) => a.ts - b.ts);
|
| 1279 |
+
}
|
| 1280 |
+
}
|
| 1281 |
+
|
| 1282 |
+
if (updated) {
|
| 1283 |
+
renderRoomsList();
|
| 1284 |
+
if (matrixSession.activeRoomId && matrixSession.rooms[matrixSession.activeRoomId]) {
|
| 1285 |
+
const activeRoom = matrixSession.rooms[matrixSession.activeRoomId];
|
| 1286 |
+
renderMessages(activeRoom);
|
| 1287 |
+
}
|
| 1288 |
+
}
|
| 1289 |
+
}
|
| 1290 |
+
|
| 1291 |
+
function parseStateEvents(room, events) {
|
| 1292 |
+
events.forEach(ev => {
|
| 1293 |
+
if (ev.type === 'm.room.name' && ev.content.name) room.name = ev.content.name;
|
| 1294 |
+
if (ev.type === 'm.room.topic' && ev.content.topic) room.topic = ev.content.topic;
|
| 1295 |
+
if (ev.type === 'm.room.avatar' && ev.content.url) room.avatar = mxcToHttp(ev.content.url);
|
| 1296 |
+
});
|
| 1297 |
+
}
|
| 1298 |
+
|
| 1299 |
+
function mxcToHttp(mxc) {
|
| 1300 |
+
if (!mxc || !mxc.startsWith('mxc://')) return '';
|
| 1301 |
+
const parts = mxc.substring(6).split('/');
|
| 1302 |
+
if (parts.length < 2) return '';
|
| 1303 |
+
return `${matrixSession.homeserver}/_matrix/media/v3/download/${parts[0]}/${parts[1]}`;
|
| 1304 |
+
}
|
| 1305 |
+
|
| 1306 |
+
function formatEventTime(ts) {
|
| 1307 |
+
if (!ts) return '';
|
| 1308 |
+
const d = new Date(ts);
|
| 1309 |
+
return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
|
| 1310 |
+
}
|
| 1311 |
+
|
| 1312 |
+
async function sendMessage() {
|
| 1313 |
+
const input = document.getElementById('message-input');
|
| 1314 |
+
const text = input.value.trim();
|
| 1315 |
+
|
| 1316 |
+
if (!text || !matrixSession.activeRoomId) return;
|
| 1317 |
+
|
| 1318 |
+
const roomId = matrixSession.activeRoomId;
|
| 1319 |
+
const room = matrixSession.rooms[roomId];
|
| 1320 |
+
|
| 1321 |
+
if (matrixSession.isDemo) {
|
| 1322 |
+
const now = new Date();
|
| 1323 |
+
const timeStr = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
| 1324 |
+
room.messages.push({
|
| 1325 |
+
id: 'demo_' + Date.now(),
|
| 1326 |
+
sender: 'Вы',
|
| 1327 |
+
text: text,
|
| 1328 |
+
time: timeStr,
|
| 1329 |
+
incoming: false,
|
| 1330 |
+
ts: Date.now()
|
| 1331 |
+
});
|
| 1332 |
+
input.value = '';
|
| 1333 |
+
renderMessages(room);
|
| 1334 |
+
renderRoomsList();
|
| 1335 |
+
return;
|
| 1336 |
+
}
|
| 1337 |
+
|
| 1338 |
+
// Real Matrix message send
|
| 1339 |
+
const txnId = 'm' + Date.now() + '_' + Math.random().toString(36).substring(2, 6);
|
| 1340 |
+
const sendUrl = `${matrixSession.homeserver}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/send/m.room.message/${txnId}`;
|
| 1341 |
+
|
| 1342 |
+
input.value = '';
|
| 1343 |
+
|
| 1344 |
+
try {
|
| 1345 |
+
const res = await fetch(sendUrl, {
|
| 1346 |
+
method: 'PUT',
|
| 1347 |
+
headers: {
|
| 1348 |
+
'Authorization': `Bearer ${matrixSession.accessToken}`,
|
| 1349 |
+
'Content-Type': 'application/json'
|
| 1350 |
+
},
|
| 1351 |
+
body: JSON.stringify({
|
| 1352 |
+
msgtype: 'm.text',
|
| 1353 |
+
body: text
|
| 1354 |
+
})
|
| 1355 |
+
});
|
| 1356 |
+
|
| 1357 |
+
if (!res.ok) {
|
| 1358 |
+
showToast('Ошибка при отправке сообщения.');
|
| 1359 |
}
|
| 1360 |
} catch (err) {
|
| 1361 |
+
console.error('Send error:', err);
|
| 1362 |
+
showToast('Не удалось отправить сообщение.');
|
| 1363 |
}
|
| 1364 |
}
|
| 1365 |
|
| 1366 |
function startDemoMode() {
|
| 1367 |
+
matrixSession.isDemo = true;
|
| 1368 |
+
matrixSession.userId = '@demo_user:matrix.org';
|
| 1369 |
+
matrixSession.displayName = 'Demo User';
|
| 1370 |
+
matrixSession.homeserver = 'https://matrix.org';
|
| 1371 |
+
|
| 1372 |
+
matrixSession.rooms = {
|
| 1373 |
+
'!matrix_gen:matrix.org': {
|
| 1374 |
+
id: '!matrix_gen:matrix.org',
|
| 1375 |
+
name: 'Matrix General HQ',
|
| 1376 |
+
topic: 'Главный общественный чат децентрализованной сети Matrix.',
|
| 1377 |
+
avatar: '',
|
| 1378 |
+
messages: [
|
| 1379 |
+
{ id: '1', sender: 'Alice', text: 'Добро пожаловать в Client:Less Matrix!', time: '12:30', incoming: true, ts: 1000 },
|
| 1380 |
+
{ id: '2', sender: 'Bob', text: 'Интерфейс в стиле Telegram 2015 года работает шустро.', time: '12:31', incoming: true, ts: 2000 },
|
| 1381 |
+
{ id: '3', sender: 'Вы', text: 'Проверяем реальный веб-клиент!', time: '12:35', incoming: false, ts: 3000 }
|
| 1382 |
+
],
|
| 1383 |
+
members: [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Demo User' }]
|
| 1384 |
+
},
|
| 1385 |
+
'!dev_room:matrix.org': {
|
| 1386 |
+
id: '!dev_room:matrix.org',
|
| 1387 |
+
name: 'Разработка Client:Less',
|
| 1388 |
+
topic: 'Обсуждение релизов и интеграции REST API.',
|
| 1389 |
+
avatar: '',
|
| 1390 |
+
messages: [
|
| 1391 |
+
{ id: '4', sender: 'Lead Dev', text: 'Полностью удалены мок-новости, подгружаем реальные данные.', time: '10:00', incoming: true, ts: 1000 }
|
| 1392 |
+
],
|
| 1393 |
+
members: [{ name: 'Lead Dev' }]
|
| 1394 |
+
}
|
| 1395 |
+
};
|
| 1396 |
+
|
| 1397 |
+
updateUserProfileUI();
|
| 1398 |
switchTab('client');
|
| 1399 |
+
selectRoom('!matrix_gen:matrix.org');
|
| 1400 |
+
showToast('Вы вошли в демо-режим. Для подключения к своим реальным чатам используйте форму Входа.');
|
| 1401 |
+
}
|
| 1402 |
+
|
| 1403 |
+
function updateUserProfileUI() {
|
| 1404 |
+
document.getElementById('client-user-name').innerText = matrixSession.displayName || matrixSession.userId || 'Пользователь';
|
| 1405 |
+
document.getElementById('client-user-avatar').innerText = (matrixSession.displayName || 'U')[0].toUpperCase();
|
| 1406 |
+
}
|
| 1407 |
+
|
| 1408 |
+
function handleLogout() {
|
| 1409 |
+
if (matrixSession.syncTimeoutId) clearTimeout(matrixSession.syncTimeoutId);
|
| 1410 |
+
matrixSession.accessToken = '';
|
| 1411 |
+
matrixSession.userId = '';
|
| 1412 |
+
matrixSession.rooms = {};
|
| 1413 |
+
matrixSession.activeRoomId = null;
|
| 1414 |
+
switchTab('login');
|
| 1415 |
+
showToast('Вы вышли из аккаунта.');
|
| 1416 |
}
|
| 1417 |
|
| 1418 |
function renderRoomsList() {
|
| 1419 |
const container = document.getElementById('rooms-list-container');
|
| 1420 |
container.innerHTML = '';
|
| 1421 |
|
| 1422 |
+
const roomArray = Object.values(matrixSession.rooms);
|
| 1423 |
+
|
| 1424 |
+
if (roomArray.length === 0) {
|
| 1425 |
+
container.innerHTML = `
|
| 1426 |
+
<div style="padding: 20px; text-align: center; color: var(--tg-subtext); font-size: 13px;">
|
| 1427 |
+
${matrixSession.isDemo ? 'Нет комнат' : 'Загрузка комнат из Matrix...'}
|
| 1428 |
+
</div>
|
| 1429 |
+
`;
|
| 1430 |
+
return;
|
| 1431 |
+
}
|
| 1432 |
+
|
| 1433 |
+
roomArray.forEach(room => {
|
| 1434 |
const lastMsg = room.messages[room.messages.length - 1];
|
| 1435 |
const li = document.createElement('li');
|
| 1436 |
+
li.className = `room-item ${matrixSession.activeRoomId === room.id ? 'active' : ''}`;
|
| 1437 |
li.onclick = () => selectRoom(room.id);
|
| 1438 |
|
| 1439 |
+
const initial = room.name ? room.name[0].toUpperCase() : '#';
|
| 1440 |
+
|
| 1441 |
+
let avatarHtml = `<div class="avatar" style="background-color: #5682a3;">${initial}</div>`;
|
| 1442 |
+
if (room.avatar) {
|
| 1443 |
+
avatarHtml = `<div class="avatar"><img src="${room.avatar}" alt="Avatar" onerror="this.parentNode.innerText='${initial}'"></div>`;
|
| 1444 |
+
}
|
| 1445 |
+
|
| 1446 |
li.innerHTML = `
|
| 1447 |
+
${avatarHtml}
|
| 1448 |
<div class="room-details">
|
| 1449 |
<div class="room-header-row">
|
| 1450 |
+
<span class="room-title">${escapeHtml(room.name)}</span>
|
| 1451 |
<span class="room-time">${lastMsg ? lastMsg.time : ''}</span>
|
| 1452 |
</div>
|
| 1453 |
+
<div class="room-last-msg">${lastMsg ? `${lastMsg.sender}: ${escapeHtml(lastMsg.text)}` : 'Нет сообщений'}</div>
|
| 1454 |
</div>
|
| 1455 |
`;
|
| 1456 |
container.appendChild(li);
|
|
|
|
| 1459 |
|
| 1460 |
function filterRooms() {
|
| 1461 |
const query = document.getElementById('room-search-input').value.toLowerCase();
|
| 1462 |
+
const roomArray = Object.values(matrixSession.rooms);
|
| 1463 |
const items = document.querySelectorAll('.room-item');
|
| 1464 |
+
|
| 1465 |
+
roomArray.forEach((room, index) => {
|
| 1466 |
+
if (items[index]) {
|
| 1467 |
+
if (room.name.toLowerCase().includes(query)) {
|
| 1468 |
+
items[index].style.display = 'flex';
|
| 1469 |
+
} else {
|
| 1470 |
+
items[index].style.display = 'none';
|
| 1471 |
+
}
|
| 1472 |
}
|
| 1473 |
});
|
| 1474 |
}
|
| 1475 |
|
| 1476 |
function selectRoom(roomId) {
|
| 1477 |
+
matrixSession.activeRoomId = roomId;
|
| 1478 |
+
const room = matrixSession.rooms[roomId];
|
| 1479 |
|
| 1480 |
if (!room) return;
|
| 1481 |
|
| 1482 |
document.getElementById('chat-empty-state').style.display = 'none';
|
| 1483 |
document.getElementById('chat-active-state').style.display = 'flex';
|
| 1484 |
|
| 1485 |
+
// Header info
|
| 1486 |
document.getElementById('active-chat-title').innerText = room.name;
|
| 1487 |
+
document.getElementById('active-chat-status').innerText = room.id;
|
| 1488 |
|
| 1489 |
// Info panel
|
| 1490 |
+
const initial = room.name ? room.name[0].toUpperCase() : '#';
|
| 1491 |
+
const avatarBox = document.getElementById('info-avatar-box');
|
| 1492 |
+
|
| 1493 |
+
if (room.avatar) {
|
| 1494 |
+
avatarBox.innerHTML = `<img src="${room.avatar}" alt="Avatar" onerror="this.parentNode.innerText='${initial}'">`;
|
| 1495 |
+
} else {
|
| 1496 |
+
avatarBox.innerText = initial;
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
document.getElementById('info-name-box').innerText = room.name;
|
| 1500 |
+
document.getElementById('info-count-box').innerText = room.id;
|
| 1501 |
+
document.getElementById('info-description-box').innerText = room.topic || 'Описание отсутствует.';
|
| 1502 |
|
| 1503 |
+
renderMessages(room);
|
| 1504 |
+
renderRoomsList();
|
| 1505 |
+
fetchRoomMembersIfNeeded(room);
|
| 1506 |
+
}
|
| 1507 |
+
|
| 1508 |
+
async function fetchRoomMembersIfNeeded(room) {
|
| 1509 |
+
const memberList = document.getElementById('info-member-list');
|
| 1510 |
+
memberList.innerHTML = `<li style="font-size:12px; color:var(--tg-subtext);">Загрузка участников...</li>`;
|
| 1511 |
+
|
| 1512 |
+
if (matrixSession.isDemo) {
|
| 1513 |
+
renderMembersList(room.members || []);
|
| 1514 |
+
return;
|
| 1515 |
+
}
|
| 1516 |
+
|
| 1517 |
+
try {
|
| 1518 |
+
const res = await fetch(`${matrixSession.homeserver}/_matrix/client/v3/rooms/${encodeURIComponent(room.id)}/joined_members`, {
|
| 1519 |
+
headers: { 'Authorization': `Bearer ${matrixSession.accessToken}` }
|
| 1520 |
+
});
|
| 1521 |
+
|
| 1522 |
+
if (res.ok) {
|
| 1523 |
+
const data = await res.json();
|
| 1524 |
+
const members = [];
|
| 1525 |
+
|
| 1526 |
+
if (data.joined) {
|
| 1527 |
+
for (const [mId, mInfo] of Object.entries(data.joined)) {
|
| 1528 |
+
members.push({
|
| 1529 |
+
name: mInfo.display_name || mId.split(':')[0].replace('@', ''),
|
| 1530 |
+
avatar: mInfo.avatar_url ? mxcToHttp(mInfo.avatar_url) : ''
|
| 1531 |
+
});
|
| 1532 |
+
}
|
| 1533 |
+
}
|
| 1534 |
+
|
| 1535 |
+
room.members = members;
|
| 1536 |
+
renderMembersList(members);
|
| 1537 |
+
} else {
|
| 1538 |
+
memberList.innerHTML = `<li style="font-size:12px; color:var(--tg-subtext);">Не удалось загрузить участников</li>`;
|
| 1539 |
+
}
|
| 1540 |
+
} catch (e) {
|
| 1541 |
+
memberList.innerHTML = `<li style="font-size:12px; color:var(--tg-subtext);">Участники недоступны</li>`;
|
| 1542 |
+
}
|
| 1543 |
+
}
|
| 1544 |
+
|
| 1545 |
+
function renderMembersList(members) {
|
| 1546 |
const memberList = document.getElementById('info-member-list');
|
| 1547 |
memberList.innerHTML = '';
|
| 1548 |
+
|
| 1549 |
+
if (members.length === 0) {
|
| 1550 |
+
memberList.innerHTML = `<li style="font-size:12px; color:var(--tg-subtext);">Список пуст</li>`;
|
| 1551 |
+
return;
|
| 1552 |
+
}
|
| 1553 |
+
|
| 1554 |
+
members.slice(0, 50).forEach(m => {
|
| 1555 |
const item = document.createElement('li');
|
| 1556 |
item.className = 'member-item';
|
| 1557 |
+
const initial = m.name ? m.name[0].toUpperCase() : 'U';
|
| 1558 |
+
|
| 1559 |
+
let avatarContent = initial;
|
| 1560 |
+
if (m.avatar) {
|
| 1561 |
+
avatarContent = `<img src="${m.avatar}" alt="Avatar" onerror="this.parentNode.innerText='${initial}'">`;
|
| 1562 |
+
}
|
| 1563 |
+
|
| 1564 |
item.innerHTML = `
|
| 1565 |
+
<div class="member-avatar">${avatarContent}</div>
|
| 1566 |
+
<div style="min-width: 0;">
|
| 1567 |
+
<div class="member-name">${escapeHtml(m.name)}</div>
|
| 1568 |
+
<div class="member-status">online</div>
|
| 1569 |
</div>
|
| 1570 |
`;
|
| 1571 |
memberList.appendChild(item);
|
| 1572 |
});
|
|
|
|
|
|
|
|
|
|
| 1573 |
}
|
| 1574 |
|
| 1575 |
function renderMessages(room) {
|
| 1576 |
const container = document.getElementById('messages-container');
|
| 1577 |
container.innerHTML = '';
|
| 1578 |
|
| 1579 |
+
if (room.messages.length === 0) {
|
| 1580 |
+
container.innerHTML = `
|
| 1581 |
+
<div style="text-align: center; color: var(--tg-subtext); margin-top: 40px; font-size: 13px;">
|
| 1582 |
+
В этом чате пока нет сообщений
|
| 1583 |
+
</div>
|
| 1584 |
+
`;
|
| 1585 |
+
return;
|
| 1586 |
+
}
|
| 1587 |
+
|
| 1588 |
room.messages.forEach(msg => {
|
| 1589 |
const bubble = document.createElement('div');
|
| 1590 |
bubble.className = `message-bubble ${msg.incoming ? 'incoming' : 'outgoing'}`;
|
| 1591 |
|
| 1592 |
bubble.innerHTML = `
|
| 1593 |
+
${msg.incoming ? `<div class="msg-sender">${escapeHtml(msg.sender)}</div>` : ''}
|
| 1594 |
<div>${escapeHtml(msg.text)}</div>
|
| 1595 |
<div class="msg-time">${msg.time}</div>
|
| 1596 |
`;
|
|
|
|
| 1601 |
container.scrollTop = container.scrollHeight;
|
| 1602 |
}
|
| 1603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1604 |
function handleKeyPress(e) {
|
| 1605 |
if (e.key === 'Enter') {
|
| 1606 |
sendMessage();
|
|
|
|
| 1608 |
}
|
| 1609 |
|
| 1610 |
function escapeHtml(text) {
|
| 1611 |
+
if (!text) return '';
|
| 1612 |
+
return String(text)
|
| 1613 |
+
.replace(/&/g, "&")
|
| 1614 |
+
.replace(/</g, "<")
|
| 1615 |
+
.replace(/>/g, ">")
|
| 1616 |
+
.replace(/"/g, """)
|
| 1617 |
+
.replace(/'/g, "'");
|
| 1618 |
}
|
| 1619 |
|
| 1620 |
window.onload = function() {
|
| 1621 |
+
renderPopularServersTable();
|
|
|
|
| 1622 |
};
|
| 1623 |
</script>
|
| 1624 |
</body>
|