2026-07-01 15:53:07 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="ru">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<title>Ваши ссылки — Send2Streamer</title>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
font-family: system-ui, sans-serif;
|
|
|
|
|
max-width: 640px;
|
|
|
|
|
margin: 60px auto;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
}
|
|
|
|
|
h1 { font-size: 28px; }
|
|
|
|
|
.card {
|
|
|
|
|
background: #f6f6f6;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 20px 24px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
.card h2 {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
margin: 0 0 4px;
|
|
|
|
|
}
|
|
|
|
|
.card p {
|
|
|
|
|
color: #666;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
margin: 0 0 12px;
|
|
|
|
|
}
|
|
|
|
|
.url-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
.url-row input {
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 8px 10px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
|
|
|
|
.url-row button {
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
#logout {
|
|
|
|
|
color: #888;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
2026-07-01 16:56:49 +00:00
|
|
|
.settings-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
.settings-row input {
|
|
|
|
|
width: 80px;
|
|
|
|
|
padding: 8px 10px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
}
|
2026-07-08 17:28:36 +00:00
|
|
|
.settings-row input#ai-name {
|
|
|
|
|
width: 220px;
|
|
|
|
|
}
|
2026-07-01 16:56:49 +00:00
|
|
|
.settings-row button {
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
#settings-status {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: #888;
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
min-height: 16px;
|
|
|
|
|
}
|
2026-07-08 18:04:02 +00:00
|
|
|
.stats-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 24px;
|
|
|
|
|
}
|
|
|
|
|
.stat {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
.stat .value {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
.stat .label {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
2026-07-01 15:53:07 +00:00
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<h1>Ваши ссылки</h1>
|
|
|
|
|
|
2026-07-08 18:04:02 +00:00
|
|
|
<div class="card">
|
|
|
|
|
<h2>Статистика</h2>
|
|
|
|
|
<div class="stats-row">
|
|
|
|
|
<div class="stat">
|
|
|
|
|
<div class="value" id="stat-visitors">—</div>
|
|
|
|
|
<div class="label">заходили по ссылке</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="stat">
|
|
|
|
|
<div class="value" id="stat-messages">—</div>
|
|
|
|
|
<div class="label">сообщений отправлено</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="stat">
|
|
|
|
|
<div class="value" id="stat-unique-senders">—</div>
|
|
|
|
|
<div class="label">уникальных отправителей</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-07-01 15:53:07 +00:00
|
|
|
<div class="card">
|
|
|
|
|
<h2>Ссылка для OBS / StreamLabs</h2>
|
|
|
|
|
<p>Вставьте в свойства Browser Source (URL).</p>
|
|
|
|
|
<div class="url-row">
|
|
|
|
|
<input id="overlay-url" readonly />
|
|
|
|
|
<button data-copy="overlay-url">Копировать</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h2>Ссылка для зрителей</h2>
|
|
|
|
|
<p>Опубликуйте её — зрители авторизуются через Google и смогут слать вам сообщения на стрим.</p>
|
|
|
|
|
<div class="url-row">
|
|
|
|
|
<input id="sender-url" readonly />
|
|
|
|
|
<button data-copy="sender-url">Копировать</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-07-01 16:56:49 +00:00
|
|
|
<div class="card">
|
|
|
|
|
<h2>Длительность показа сообщения</h2>
|
|
|
|
|
<p>Сколько секунд сообщение зрителя остаётся на экране.</p>
|
|
|
|
|
<div class="settings-row">
|
|
|
|
|
<input id="display-duration" type="number" min="1" max="120" />
|
|
|
|
|
<span>сек.</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-07-08 17:28:36 +00:00
|
|
|
<div class="card">
|
|
|
|
|
<h2>Имя ИИ-помощника</h2>
|
|
|
|
|
<p>Как зовут вашего ИИ-помощника, который отвечает зрителям (по умолчанию «Альтушка Ирина»).</p>
|
|
|
|
|
<div class="settings-row">
|
|
|
|
|
<input id="ai-name" type="text" maxlength="60" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="settings-row">
|
|
|
|
|
<button id="save-settings">Сохранить</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="settings-status"></div>
|
|
|
|
|
|
2026-07-01 15:53:07 +00:00
|
|
|
<p id="logout">выйти</p>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
async function init() {
|
|
|
|
|
const meRes = await fetch('/me');
|
|
|
|
|
const { user } = await meRes.json();
|
|
|
|
|
if (!user) {
|
|
|
|
|
window.location.href = '/';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const res = await fetch('/api/dashboard');
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
window.location.href = '/';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
document.getElementById('overlay-url').value = data.overlayUrl;
|
|
|
|
|
document.getElementById('sender-url').value = data.senderUrl;
|
2026-07-01 16:56:49 +00:00
|
|
|
document.getElementById('display-duration').value = data.displayDurationSeconds;
|
2026-07-08 17:28:36 +00:00
|
|
|
document.getElementById('ai-name').value = data.aiName;
|
2026-07-08 18:04:02 +00:00
|
|
|
document.getElementById('stat-visitors').textContent = data.stats.visitors;
|
|
|
|
|
document.getElementById('stat-messages').textContent = data.stats.messages;
|
|
|
|
|
document.getElementById('stat-unique-senders').textContent = data.stats.uniqueSenders;
|
2026-07-01 15:53:07 +00:00
|
|
|
}
|
|
|
|
|
|
2026-07-08 17:28:36 +00:00
|
|
|
document.getElementById('save-settings').addEventListener('click', async () => {
|
2026-07-01 16:56:49 +00:00
|
|
|
const statusEl = document.getElementById('settings-status');
|
|
|
|
|
const seconds = Number(document.getElementById('display-duration').value);
|
2026-07-08 17:28:36 +00:00
|
|
|
const aiName = document.getElementById('ai-name').value;
|
2026-07-01 16:56:49 +00:00
|
|
|
const res = await fetch('/api/settings', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
2026-07-08 17:28:36 +00:00
|
|
|
body: JSON.stringify({ displayDurationSeconds: seconds, aiName }),
|
2026-07-01 16:56:49 +00:00
|
|
|
});
|
|
|
|
|
if (res.ok) {
|
|
|
|
|
statusEl.textContent = 'Сохранено';
|
|
|
|
|
} else {
|
|
|
|
|
const { error } = await res.json();
|
|
|
|
|
statusEl.textContent = 'Ошибка: ' + error;
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => { statusEl.textContent = ''; }, 2000);
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-01 15:53:07 +00:00
|
|
|
document.querySelectorAll('[data-copy]').forEach((btn) => {
|
|
|
|
|
btn.addEventListener('click', () => {
|
|
|
|
|
const input = document.getElementById(btn.dataset.copy);
|
|
|
|
|
input.select();
|
|
|
|
|
navigator.clipboard.writeText(input.value);
|
|
|
|
|
btn.textContent = 'Скопировано';
|
|
|
|
|
setTimeout(() => { btn.textContent = 'Копировать'; }, 1500);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.getElementById('logout').addEventListener('click', async () => {
|
|
|
|
|
await fetch('/auth/logout', { method: 'POST' });
|
|
|
|
|
window.location.href = '/';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|