Обновить сервер и клиент для описания приложения

This commit is contained in:
AidarKC
2026-12-03 14:53:48 +03:00
parent 4427d1de97
commit ac66096e58
29 changed files with 543 additions and 185 deletions
+22
View File
@@ -0,0 +1,22 @@
// Текст сервера недоверенный: никакого HTML, только текст и HTTPS-ссылки.
export function appendAboutText(container, text) {
const value = String(text);
let offset = 0;
for (const match of value.matchAll(/https:\/\/[^\s<>"']+/gu)) {
container.append(document.createTextNode(value.slice(offset, match.index)));
try {
const url = new URL(match[0]);
if (url.protocol !== 'https:' || url.username || url.password) throw new Error('Invalid URL');
const link = document.createElement('a');
link.href = url.href;
link.textContent = match[0];
link.target = '_blank';
link.rel = 'noopener noreferrer';
container.append(link);
} catch {
container.append(document.createTextNode(match[0]));
}
offset = match.index + match[0].length;
}
container.append(document.createTextNode(value.slice(offset)));
}