Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08908bede8 |
@@ -19,7 +19,11 @@ KillMode=mixed
|
|||||||
TimeoutStopSec=300
|
TimeoutStopSec=300
|
||||||
|
|
||||||
# Всё своё панель держит в /opt/pzmanager, домашние каталоги ей не нужны.
|
# Всё своё панель держит в /opt/pzmanager, домашние каталоги ей не нужны.
|
||||||
NoNewPrivileges=true
|
#
|
||||||
|
# NoNewPrivileges здесь намеренно не выставлен: он запрещает процессу и его
|
||||||
|
# потомкам повышать привилегии, а значит ломает sudo — и вместе с ним кнопки
|
||||||
|
# обновления и перезапуска панели. Прикрытием служит sudoers: сервисному
|
||||||
|
# пользователю разрешена ровно одна команда, pzmanager-admin.
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
|
|||||||
+42
-1
@@ -1241,7 +1241,7 @@ async function loadUpdateInfo() {
|
|||||||
|
|
||||||
const notes = $("#update-notes");
|
const notes = $("#update-notes");
|
||||||
notes.hidden = !(info.available && info.notes);
|
notes.hidden = !(info.available && info.notes);
|
||||||
if (!notes.hidden) $("#update-notes-body").textContent = info.notes;
|
if (!notes.hidden) renderReleaseNotes(info.notes, info.url);
|
||||||
|
|
||||||
$("#btn-manager-restart").disabled = !info.can_apply;
|
$("#btn-manager-restart").disabled = !info.can_apply;
|
||||||
$("#btn-manager-restart").title = info.can_apply
|
$("#btn-manager-restart").title = info.can_apply
|
||||||
@@ -1249,6 +1249,47 @@ async function loadUpdateInfo() {
|
|||||||
: "Недоступно: панель не может управлять своей службой";
|
: "Недоступно: панель не может управлять своей службой";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Описание релиза приходит из Gitea разметкой Markdown, и показывать её как
|
||||||
|
// есть неудобно: первым идёт раздел про установку, который в уже работающей
|
||||||
|
// панели ни к чему. Берём только список изменений.
|
||||||
|
function renderReleaseNotes(text, url) {
|
||||||
|
const body = $("#update-notes-body");
|
||||||
|
body.replaceChildren();
|
||||||
|
|
||||||
|
const changesSection = text.split(/^##\s+Изменения\s*$/m)[1];
|
||||||
|
const items = (changesSection ?? text)
|
||||||
|
.split("\n")
|
||||||
|
.map((line) => line.trim())
|
||||||
|
.filter((line) => line.startsWith("- "))
|
||||||
|
.map((line) => line.slice(2).trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
|
if (items.length) {
|
||||||
|
const list = document.createElement("ul");
|
||||||
|
items.forEach((item) => {
|
||||||
|
const li = document.createElement("li");
|
||||||
|
li.textContent = item;
|
||||||
|
list.appendChild(li);
|
||||||
|
});
|
||||||
|
body.appendChild(list);
|
||||||
|
} else {
|
||||||
|
// Непривычный формат описания — показываем как есть, лишь бы не потерять.
|
||||||
|
const raw = document.createElement("pre");
|
||||||
|
raw.textContent = text.trim();
|
||||||
|
body.appendChild(raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.target = "_blank";
|
||||||
|
link.rel = "noopener noreferrer";
|
||||||
|
link.className = "release-link";
|
||||||
|
link.textContent = "Полное описание релиза";
|
||||||
|
body.appendChild(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$("#btn-update-check").addEventListener("click", async () => {
|
$("#btn-update-check").addEventListener("click", async () => {
|
||||||
const button = $("#btn-update-check");
|
const button = $("#btn-update-check");
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
<p class="muted small" id="update-manual" hidden></p>
|
<p class="muted small" id="update-manual" hidden></p>
|
||||||
<details id="update-notes" hidden>
|
<details id="update-notes" hidden>
|
||||||
<summary>Что нового</summary>
|
<summary>Что нового</summary>
|
||||||
<pre class="release-notes" id="update-notes-body"></pre>
|
<div class="release-notes" id="update-notes-body"></div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -465,16 +465,32 @@ input.input-sm, .input-sm { width: auto; padding: 6px 10px; font-size: 13px; }
|
|||||||
|
|
||||||
.release-notes {
|
.release-notes {
|
||||||
margin: 10px 0 0;
|
margin: 10px 0 0;
|
||||||
padding: 12px;
|
padding: 12px 14px;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
max-height: 260px;
|
max-height: 240px;
|
||||||
overflow: auto;
|
/* Прокручивается сам блок, а не страница под ним. */
|
||||||
white-space: pre-wrap;
|
overflow-y: auto;
|
||||||
word-break: break-word;
|
overscroll-behavior: contain;
|
||||||
font-size: 12.5px;
|
font-size: 13px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.release-notes ul { margin: 0; padding-left: 20px; }
|
||||||
|
.release-notes li { margin-bottom: 5px; }
|
||||||
|
.release-notes li:last-child { margin-bottom: 0; }
|
||||||
|
|
||||||
|
.release-notes pre {
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
font-size: 12.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.release-link { display: inline-block; margin-top: 10px; color: var(--info); }
|
||||||
|
|
||||||
|
/* Команду для терминала удобнее читать моноширинным. */
|
||||||
|
#update-manual { font-family: var(--mono); word-break: break-all; }
|
||||||
|
|
||||||
.update-available { color: var(--accent); }
|
.update-available { color: var(--accent); }
|
||||||
|
|||||||
Reference in New Issue
Block a user