You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
Add markdown support in changelog
This commit is contained in:
@@ -92,7 +92,7 @@ release_note() {
|
|||||||
awk '
|
awk '
|
||||||
/^### v[0-9]+\.[0-9]+$/ {
|
/^### v[0-9]+\.[0-9]+$/ {
|
||||||
if (!found) {
|
if (!found) {
|
||||||
version = $2;
|
version = $0;
|
||||||
found = 1;
|
found = 1;
|
||||||
next
|
next
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
6
module/webui/scripts/marked.min.js
vendored
Normal file
6
module/webui/scripts/marked.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
import { basePath, execCommand, showPrompt, noConnection } from './main.js';
|
import { basePath, execCommand, showPrompt, noConnection, linkRedirect } from './main.js';
|
||||||
import { updateCard } from './applist.js';
|
import { updateCard } from './applist.js';
|
||||||
|
|
||||||
const updateCardText = document.getElementById('redirect-to-release');
|
const updateCardText = document.getElementById('redirect-to-release');
|
||||||
@@ -55,14 +55,23 @@ function setupUpdateMenu() {
|
|||||||
showPrompt("prompt.downloaded");
|
showPrompt("prompt.downloaded");
|
||||||
}
|
}
|
||||||
const changelog = await execCommand(`sh ${basePath}common/get_extra.sh --release-note`);
|
const changelog = await execCommand(`sh ${basePath}common/get_extra.sh --release-note`);
|
||||||
const lines = changelog
|
window.linkRedirect = linkRedirect;
|
||||||
|
marked.setOptions({
|
||||||
|
sanitize: true,
|
||||||
|
walkTokens(token) {
|
||||||
|
if (token.type === 'link') {
|
||||||
|
const href = token.href;
|
||||||
|
token.href = "javascript:void(0);";
|
||||||
|
token.type = "html";
|
||||||
|
token.text = `<a href="javascript:void(0);" onclick="linkRedirect('${href}')">${token.text}</a>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const cleanedChangelog = changelog
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(line => line.trim() !== '')
|
.filter(line => line.trim() !== '')
|
||||||
.map(line => line.startsWith('- ') ? line.slice(2) : line);
|
.join('\n');
|
||||||
const formattedChangelog = `
|
const formattedChangelog = marked.parse(cleanedChangelog);
|
||||||
<li class="changelog-title">${lines[0]}</li>
|
|
||||||
${lines.slice(1).map(line => `<li>${line}</li>`).join('')}
|
|
||||||
`;
|
|
||||||
releaseNotes.innerHTML = formattedChangelog;
|
releaseNotes.innerHTML = formattedChangelog;
|
||||||
openUpdateMenu();
|
openUpdateMenu();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -85,37 +85,39 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.update-content h3 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
.update-content ul {
|
.update-content ul {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.changelog-title {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 22px;
|
|
||||||
list-style-type: none;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.update-content ul li {
|
.update-content ul li {
|
||||||
|
margin-left: 15px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
list-style-type: disc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.update-content ul li:not(:first-child) {
|
.update-content a {
|
||||||
list-style-type: disc;
|
color: #6E6E6E;
|
||||||
margin-left: 15px;
|
cursor: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-content a:active {
|
||||||
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.update-button-container {
|
.update-button-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0;
|
padding-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.install,
|
.install,
|
||||||
.reboot {
|
.reboot {
|
||||||
margin-left: 0;
|
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -357,4 +359,8 @@
|
|||||||
.update-menu {
|
.update-menu {
|
||||||
background-color: #343434;
|
background-color: #343434;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.update-content a {
|
||||||
|
color: #C2C2C2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user