feat(quizzes): публичные ссылки по токену и флаг no_shuffle

- quizzes.public_token (VARCHAR 32, уникальный индекс) вместо числового id в публичных роутах /api/public-quizzes/:token
- бэкилл токенов для существующих строк в db/migration.sql + ensureQuizTables
- quiz_questions.no_shuffle — вопрос исключён из перемешивания
- POST /api/quizzes/:id/public-token/rotate — сброс утёкшей ссылки (автор/админ)
- restore: no_shuffle в INSERT quiz_questions, backup.selftest обновлён
- документация AGENTS.md + handoff
This commit is contained in:
dev
2026-12-03 00:33:50 +03:00
parent a92fa830a2
commit d9b785d36c
13 changed files with 157 additions and 58 deletions
+2 -2
View File
@@ -70,7 +70,7 @@
} else {
if (q.can_take) actions.push(`<a class="btn-link" href="quiz.html?id=${q.id}">Пройти</a>`);
if (q.can_edit) actions.push(`<a class="btn-link" href="quiz-edit.html?id=${q.id}">Изменить</a>`);
if (q.can_edit && q.allow_anonymous && q.is_published) actions.push(`<button type="button" class="btn-link" data-copy-link="${q.id}">Ссылку</button>`);
if (q.can_edit && q.allow_anonymous && q.is_published && q.public_token) actions.push(`<button type="button" class="btn-link" data-copy-link="${q.public_token}">Ссылку</button>`);
if (q.stats_available) actions.push(`<button type="button" class="btn-link" data-stats="${q.id}">Статистика</button>`);
if (q.can_edit) actions.push(`<button type="button" class="btn-link danger" data-del="${q.id}">Удалить</button>`);
}
@@ -668,7 +668,7 @@
const copyLink = e.target.closest('[data-copy-link]');
if (copyLink) {
e.preventDefault();
const url = location.origin + '/quiz-public.html?id=' + copyLink.dataset.copyLink;
const url = location.origin + '/quiz-public.html?t=' + encodeURIComponent(copyLink.dataset.copyLink);
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(() => showToast('Ссылка скопирована'), () => showToast('Не удалось скопировать ссылку', true));
} else {