feat: manage download articles entirely in Markdown

This commit is contained in:
2026-11-02 11:15:23 +08:00
parent bbe0aaf88e
commit bcc32d9626
9 changed files with 100 additions and 58 deletions
+34 -6
View File
@@ -3,6 +3,7 @@ package main
import ( import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"html"
"strings" "strings"
) )
@@ -29,6 +30,38 @@ func normalizeDownloads(input []Download) []Download {
output = append(output, item) output = append(output, item)
} }
} }
for index, item := range output {
if len(item.Files) == 0 || len(item.Files) > 100 {
continue
}
valid := true
for _, file := range item.Files {
if strings.TrimSpace(file.Label) == "" || len(file.Label) > 500 || !navigationURL(file.URL) {
valid = false
break
}
}
if !valid {
continue // Keep invalid legacy fields so writes are rejected rather than silently dropping them.
}
links := make([]string, 0, len(item.Files))
for _, file := range item.Files {
label := strings.NewReplacer("\\", "\\\\", "[", "\\[", "]", "\\]", "\r", " ", "\n", " ").Replace(html.EscapeString(file.Label))
url := strings.NewReplacer("<", "%3C", ">", "%3E", "\\", "%5C", " ", "%20").Replace(file.URL)
if strings.Contains(item.Description, "]("+file.URL+")") || strings.Contains(item.Description, "](<"+file.URL+">)") || strings.Contains(item.Description, "]("+url+")") || strings.Contains(item.Description, "](<"+url+">)") {
continue
}
links = append(links, fmt.Sprintf("- [%s](<%s>)", label, url))
}
if len(links) > 0 {
if item.Description != "" {
item.Description += "\n\n"
}
item.Description += strings.Join(links, "\n")
}
item.Files = nil
output[index] = item
}
return output return output
} }
@@ -38,18 +71,13 @@ func validDownloads(items []Download) bool {
} }
ids := map[string]bool{} ids := map[string]bool{}
for _, item := range items { for _, item := range items {
if !validName(item.ID) || ids[item.ID] || strings.TrimSpace(item.Name) == "" || len(item.Name) > 300 || len(item.Description) > 100000 || len(item.Files) < 1 || len(item.Files) > 100 || item.Version != "" || item.URL != "" { if !validName(item.ID) || ids[item.ID] || strings.TrimSpace(item.Name) == "" || len(item.Name) > 300 || strings.TrimSpace(item.Description) == "" || len(item.Description) > 100000 || len(item.Files) != 0 || item.Version != "" || item.URL != "" {
return false return false
} }
if item.Category != "os" && item.Category != "software" && item.Category != "fonts" { if item.Category != "os" && item.Category != "software" && item.Category != "fonts" {
return false return false
} }
ids[item.ID] = true ids[item.ID] = true
for _, file := range item.Files {
if strings.TrimSpace(file.Label) == "" || len(file.Label) > 500 || !navigationURL(file.URL) {
return false
}
}
} }
return true return true
} }
+51 -11
View File
@@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"path/filepath" "path/filepath"
"reflect" "reflect"
"strings"
"testing" "testing"
) )
@@ -31,7 +32,7 @@ func TestDownloadCatalogLegacyCompatibilityAndPersistence(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
items := public.Site.Downloads items := public.Site.Downloads
if len(items) != 2 || items[0].Name != "Ubuntu" || len(items[0].Files) != 2 || items[0].Files[1].Label != "24.04 (arm64)" || items[1].Files[0].Label != "Tool" || items[0].Category != "software" || !validName(items[0].ID) || items[0].URL != "" { if len(items) != 2 || items[0].Name != "Ubuntu" || len(items[0].Files) != 0 || !strings.Contains(items[0].Description, "[24.04 (arm64)](<https://example.invalid/ubuntu-arm.iso>)") || !strings.Contains(items[0].Description, "[24.04 (amd64)](<https://example.invalid/ubuntu.iso>)") || !strings.Contains(items[1].Description, "[Tool](<https://example.invalid/tool.zip>)") || items[0].Category != "software" || !validName(items[0].ID) || items[0].URL != "" {
t.Fatalf("legacy projects or version links lost: %+v", items) t.Fatalf("legacy projects or version links lost: %+v", items)
} }
c.app.db.QueryRow("SELECT data FROM records WHERE kind='settings' AND id='site'").Scan(&rawAfter) c.app.db.QueryRow("SELECT data FROM records WHERE kind='settings' AND id='site'").Scan(&rawAfter)
@@ -49,9 +50,8 @@ func TestDownloadCatalogLegacyCompatibilityAndPersistence(t *testing.T) {
t.Fatal("older form lost downloads or changed stable project IDs") t.Fatal("older form lost downloads or changed stable project IDs")
} }
settings.Downloads[0].Category = "os" settings.Downloads[0].Category = "os"
settings.Downloads[0].Description = "## Ubuntu\n\n选择适合设备架构的版本。" settings.Downloads[0].Description = "## Ubuntu\n\n[24.04 (amd64)](/mirrors/ubuntu-releases/24.04/ubuntu.iso)\n\nSHA256: `0123456789abcdef`"
settings.Downloads[0].Files[0].URL = "/mirrors/ubuntu-releases/24.04/ubuntu.iso" settings.Downloads = append(settings.Downloads, Download{ID: "fonts", Name: "字体", Category: "fonts", Description: "字体的安装方法。"})
settings.Downloads = append(settings.Downloads, Download{ID: "fonts", Name: "字体", Category: "fonts", Files: []DownloadFile{{Label: "字体压缩包", URL: "https://example.invalid/font.zip"}}})
w = c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": saved.Revision}, true) w = c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": saved.Revision}, true)
status(t, w, 200) status(t, w, 200)
status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": saved.Revision}, true), 409) status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": saved.Revision}, true), 409)
@@ -87,19 +87,19 @@ func TestDownloadCatalogValidationAndPermissions(t *testing.T) {
c := fixture(t) c := fixture(t)
c.login("admin") c.login("admin")
record, _ := c.app.record("settings", "site") record, _ := c.app.record("settings", "site")
base := Download{ID: "ubuntu", Name: "Ubuntu", Category: "os", Files: []DownloadFile{{Label: "24.04 LTS (amd64)", URL: "/mirrors/ubuntu-releases/24.04/ubuntu.iso"}}} base := Download{ID: "ubuntu", Name: "Ubuntu", Category: "os", Description: "## Ubuntu\n\n[24.04 LTS (amd64)](/mirrors/ubuntu-releases/24.04/ubuntu.iso)"}
mutations := []func(*Download){ mutations := []func(*Download){
func(d *Download) { d.ID = "" }, func(d *Download) { d.ID = "" },
func(d *Download) { d.Category = "unknown" }, func(d *Download) { d.Category = "unknown" },
func(d *Download) { d.Name = " " }, func(d *Download) { d.Name = " " },
func(d *Download) { d.Files = nil }, func(d *Download) { d.Description = " \n\t" },
func(d *Download) { d.Files[0].Label = " " }, func(d *Download) { d.Description = strings.Repeat("a", 100001) },
func(d *Download) { d.Files[0].URL = "javascript:alert(1)" }, func(d *Download) { d.Files = []DownloadFile{{Label: " ", URL: "/mirrors/a.iso"}} },
func(d *Download) { d.Files[0].URL = "//example.invalid/a.iso" },
func(d *Download) { d.Files[0].URL = "/\\example.invalid/a.iso" },
func(d *Download) { d.Files[0].URL = "https://user:password@example.invalid/a.iso" },
func(d *Download) { d.URL = "https://example.invalid/ambiguous-old-field" }, func(d *Download) { d.URL = "https://example.invalid/ambiguous-old-field" },
} }
for _, url := range []string{"javascript:alert(1)", "//example.invalid/a.iso", "/\\example.invalid/a.iso", "https://user:password@example.invalid/a.iso"} {
mutations = append(mutations, func(d *Download) { d.Files = []DownloadFile{{Label: "ISO", URL: url}} })
}
for index, mutate := range mutations { for index, mutate := range mutations {
var item Download var item Download
decodeData(base, &item) decodeData(base, &item)
@@ -115,6 +115,46 @@ func TestDownloadCatalogValidationAndPermissions(t *testing.T) {
settings.Downloads = []Download{base, base} settings.Downloads = []Download{base, base}
status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": record.Revision}, true), 400) status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": record.Revision}, true), 400)
settings.Downloads = []Download{base} settings.Downloads = []Download{base}
status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": record.Revision}, true), 200)
c.login("editor") c.login("editor")
status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": record.Revision}, true), 403) status(t, c.call("PUT", "/api/v1/admin/records/settings/site", map[string]any{"data": settings, "revision": record.Revision}, true), 403)
} }
func TestDownloadArticlesPreserveExistingMarkdownAndLinksOnce(t *testing.T) {
body := "## Debian 13\n\n版本、签名与 SHA256:`abc123`。\n\n[签名](/mirrors/debian-cd/SHA256SUMS.sign)"
input := []Download{{ID: "debian", Name: "Debian", Category: "os", Description: body, Files: []DownloadFile{
{Label: "ISO [amd64] <mirror>", URL: "/mirrors/debian-cd/image (amd64).iso?source=<mirror>"},
{Label: "SHA256SUMS", URL: "https://example.invalid/SHA256SUMS"},
}}}
articles := normalizeDownloads(input)
if len(articles[0].Files) != 0 || !validDownloads(articles) || !strings.HasPrefix(articles[0].Description, body+"\n\n") {
t.Fatal("existing article or legacy links were lost")
}
for _, link := range []string{
"- [ISO \\[amd64\\] &lt;mirror&gt;](</mirrors/debian-cd/image%20(amd64).iso?source=%3Cmirror%3E>)",
"- [SHA256SUMS](<https://example.invalid/SHA256SUMS>)",
} {
if !strings.Contains(articles[0].Description, link) {
t.Fatalf("legacy link not safely preserved: %s", articles[0].Description)
}
}
if !reflect.DeepEqual(normalizeDownloads(articles), articles) || len(input[0].Files) != 2 || input[0].Description != body {
t.Fatal("normalization duplicated links or mutated the input")
}
raw, _ := json.Marshal(articles)
if strings.Contains(string(raw), `"files"`) {
t.Fatal("article response still exposes a separate download-link module")
}
}
func TestDownloadArticlesReuseLinksAlreadyInMarkdown(t *testing.T) {
body := "## 下载\n\n[ISO](/mirrors/debian/image.iso)\n\n[签名](<https://example.invalid/image.iso.sig>)"
input := []Download{{ID: "debian", Name: "Debian", Category: "os", Description: body, Files: []DownloadFile{
{Label: "安装镜像", URL: "/mirrors/debian/image.iso"},
{Label: "签名", URL: "https://example.invalid/image.iso.sig"},
}}}
output := normalizeDownloads(input)
if !validDownloads(output) || output[0].Description != body || len(output[0].Files) != 0 {
t.Fatal("migration duplicated links already maintained in the article")
}
}
+7 -7
View File
@@ -13,14 +13,14 @@ type RelatedLink struct {
URL string `json:"url"` URL string `json:"url"`
} }
type Download struct { type Download struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Category string `json:"category"` Category string `json:"category"`
Description string `json:"description"` Description string `json:"description"`
Files []DownloadFile `json:"files"`
// Read old settings and submissions without losing existing download links. // Read old settings and submissions without losing existing download links.
Version string `json:"version,omitempty"` Files []DownloadFile `json:"files,omitempty"`
URL string `json:"url,omitempty"` Version string `json:"version,omitempty"`
URL string `json:"url,omitempty"`
} }
type DownloadFile struct { type DownloadFile struct {
Label string `json:"label"` Label string `json:"label"`
+1 -2
View File
@@ -2,8 +2,7 @@ export type Localized = Record<string, string>
export interface SiteLink { title: Localized; url: string } export interface SiteLink { title: Localized; url: string }
export interface RelatedLink extends SiteLink { kind: 'url' | 'help' } export interface RelatedLink extends SiteLink { kind: 'url' | 'help' }
export type DownloadCategory = 'os' | 'software' | 'fonts' export type DownloadCategory = 'os' | 'software' | 'fonts'
export interface DownloadFile { label: string; url: string } export interface SiteDownload { id: string; name: string; category: DownloadCategory; description: string }
export interface SiteDownload { id: string; name: string; category: DownloadCategory; description: string; files: DownloadFile[] }
export interface SiteSettings { export interface SiteSettings {
name: Localized; description: Localized; logoLight: string; logoDark: string; favicon: string; avatar: string name: Localized; description: Localized; logoLight: string; logoDark: string; favicon: string; avatar: string
email: string; address: Localized; links: SiteLink[]; relatedLinks: RelatedLink[]; downloads: SiteDownload[] email: string; address: Localized; links: SiteLink[]; relatedLinks: RelatedLink[]; downloads: SiteDownload[]
+4 -21
View File
@@ -15,7 +15,7 @@ watch(() => items.value.map(item => item.id), ids => {
}, { immediate: true }) }, { immediate: true })
function addProject() { function addProject() {
const id = Array.from(crypto.getRandomValues(new Uint8Array(16)), byte => byte.toString(16).padStart(2, '0')).join('') const id = Array.from(crypto.getRandomValues(new Uint8Array(16)), byte => byte.toString(16).padStart(2, '0')).join('')
items.value.push({ id, name: '', category: 'software', description: '', files: [{ label: '', url: '' }] }) items.value.push({ id, name: '', category: 'software', description: '' })
selectedId.value = id selectedId.value = id
} }
function moveProject(offset: number) { function moveProject(offset: number) {
@@ -30,13 +30,7 @@ function removeProject() {
items.value.splice(from, 1) items.value.splice(from, 1)
selectedId.value = items.value[Math.min(from, items.value.length - 1)]?.id || '' selectedId.value = items.value[Math.min(from, items.value.length - 1)]?.id || ''
} }
function moveFile(index: number, offset: number) { const invalidProject = computed(() => items.value.find(item => !item.name.trim() || !item.description.trim()))
const files = selected.value?.files, to = index + offset
if (!files || to < 0 || to >= files.length) return
const [file] = files.splice(index, 1)
if (file) files.splice(to, 0, file)
}
const invalidProject = computed(() => items.value.find(item => !item.name.trim() || !item.files.length || item.files.some(file => !file.label.trim() || !file.url.trim())))
function validate() { function validate() {
if (invalidProject.value) selectedId.value = invalidProject.value.id if (invalidProject.value) selectedId.value = invalidProject.value.id
return !invalidProject.value return !invalidProject.value
@@ -52,16 +46,8 @@ defineExpose({ validate })
<fieldset v-if="selected" :disabled="busy" class="catalog-fields"> <fieldset v-if="selected" :disabled="busy" class="catalog-fields">
<div class="catalog-project-actions"><button type="button" :disabled="selectedIndex === 0" @click="moveProject(-1)">{{ t('admin.moveUp') }}</button><button type="button" :disabled="selectedIndex === items.length - 1" @click="moveProject(1)">{{ t('admin.moveDown') }}</button><button type="button" @click="removeProject">{{ t('admin.removeDownloadProject') }}</button></div> <div class="catalog-project-actions"><button type="button" :disabled="selectedIndex === 0" @click="moveProject(-1)">{{ t('admin.moveUp') }}</button><button type="button" :disabled="selectedIndex === items.length - 1" @click="moveProject(1)">{{ t('admin.moveDown') }}</button><button type="button" @click="removeProject">{{ t('admin.removeDownloadProject') }}</button></div>
<label>{{ t('admin.softwareName') }}<input v-model="selected.name" maxlength="100" required /></label> <label>{{ t('admin.softwareName') }}<input v-model="selected.name" maxlength="100" required /></label>
<label>{{ t('admin.downloadDescription') }}<textarea v-model="selected.description" rows="6" maxlength="30000" lang="zh-CN" /></label> <label>{{ t('admin.downloadDescription') }}<textarea v-model="selected.description" rows="18" maxlength="30000" lang="zh-CN" required /></label>
<details v-if="selected.description" class="catalog-preview"><summary>{{ t('admin.preview') }}</summary><MarkdownContent :source="selected.description" lang="zh-CN" /></details> <details v-if="selected.description" class="catalog-preview"><summary>{{ t('admin.preview') }}</summary><MarkdownContent :source="selected.description" lang="zh-CN" /></details>
<section class="catalog-files" aria-labelledby="catalog-file-title"><h3 id="catalog-file-title">{{ t('admin.downloadFiles') }}</h3>
<div v-for="(file, index) in selected.files" :key="index" class="catalog-file" role="group" :aria-label="t('admin.downloadFileEntry', { index: index + 1 })">
<label>{{ t('admin.downloadLabel') }}<input v-model="file.label" required maxlength="160" /></label>
<label>{{ t('admin.url') }}<input v-model="file.url" required maxlength="2047" :placeholder="t('admin.downloadUrlPlaceholder')" /></label>
<div class="catalog-file-actions"><button type="button" :disabled="index === 0" @click="moveFile(index, -1)">{{ t('admin.moveUp') }}</button><button type="button" :disabled="index === selected.files.length - 1" @click="moveFile(index, 1)">{{ t('admin.moveDown') }}</button><button type="button" @click="selected.files.splice(index, 1)">{{ t('admin.remove') }}</button></div>
</div>
<button type="button" :disabled="selected.files.length >= 100" @click="selected.files.push({ label: '', url: '' })">{{ t('admin.addDownloadFile') }}</button>
</section>
</fieldset> </fieldset>
</div> </div>
<p v-else>{{ t('admin.noDownloadProjects') }}</p> <p v-else>{{ t('admin.noDownloadProjects') }}</p>
@@ -76,16 +62,13 @@ defineExpose({ validate })
.catalog-projects button { display: grid; width: 100%; gap: 4px; padding: 12px; border: 0; text-align: left; overflow-wrap: anywhere; } .catalog-projects button { display: grid; width: 100%; gap: 4px; padding: 12px; border: 0; text-align: left; overflow-wrap: anywhere; }
.catalog-projects [aria-current] { background: var(--blue-soft); color: var(--blue); } .catalog-projects [aria-current] { background: var(--blue-soft); color: var(--blue); }
.catalog-fields { display: grid; min-width: 0; gap: 22px; margin: 0; padding: 0; border: 0; } .catalog-fields { display: grid; min-width: 0; gap: 22px; margin: 0; padding: 0; border: 0; }
.catalog-project-actions, .catalog-file-actions { display: flex; gap: 8px; flex-wrap: wrap; } .catalog-project-actions { display: flex; gap: 8px; flex-wrap: wrap; }
label { display: grid; gap: 8px; min-width: 0; font-size: 14px; } label { display: grid; gap: 8px; min-width: 0; font-size: 14px; }
input, textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--ink); font: inherit; } input, textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--ink); font: inherit; }
textarea { resize: vertical; line-height: 1.7; } textarea { resize: vertical; line-height: 1.7; }
button { min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; } button { min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; }
button:hover { border-color: var(--blue); color: var(--blue); } button:disabled { opacity: .5; cursor: default; } button:hover { border-color: var(--blue); color: var(--blue); } button:disabled { opacity: .5; cursor: default; }
.catalog-preview summary { cursor: pointer; color: var(--blue); } .catalog-preview .markdown-content { margin-top: 16px; } .catalog-preview summary { cursor: pointer; color: var(--blue); } .catalog-preview .markdown-content { margin-top: 16px; }
.catalog-files h3 { margin: 0 0 14px; font-size: 20px; }
.catalog-file { display: grid; gap: 14px; margin-bottom: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.catalog-file-actions { justify-content: end; }
@media (max-width: 760px) { @media (max-width: 760px) {
.catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; } .catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
.catalog-projects { display: flex; max-height: none; padding: 0 0 8px; overflow-x: auto; } .catalog-projects { display: flex; max-height: none; padding: 0 0 8px; overflow-x: auto; }
-6
View File
@@ -37,7 +37,6 @@ async function moveProject(event: KeyboardEvent, index: number) {
<section v-if="selected" id="download-project-panel" class="download-detail" role="tabpanel" :aria-labelledby="`download-project-${selected.id}`" tabindex="0"> <section v-if="selected" id="download-project-panel" class="download-detail" role="tabpanel" :aria-labelledby="`download-project-${selected.id}`" tabindex="0">
<h3>{{ selected.name }}</h3> <h3>{{ selected.name }}</h3>
<MarkdownContent v-if="selected.description" class="download-description" :source="selected.description" lang="zh-CN" /> <MarkdownContent v-if="selected.description" class="download-description" :source="selected.description" lang="zh-CN" />
<ul class="download-files" :aria-label="t('announcements.downloadLinks')"><li v-for="(file, index) in selected.files" :key="`${index}:${file.url}`"><a :href="file.url" target="_blank" rel="noopener noreferrer">{{ file.label }}</a></li></ul>
</section> </section>
<p v-else class="downloads-empty" role="status">{{ t('common.noDownloads') }}</p> <p v-else class="downloads-empty" role="status">{{ t('common.noDownloads') }}</p>
</div> </div>
@@ -54,10 +53,6 @@ async function moveProject(event: KeyboardEvent, index: number) {
.download-detail { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px 8px 12px 0; overflow-wrap: anywhere; } .download-detail { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px 8px 12px 0; overflow-wrap: anywhere; }
.download-detail h3 { margin: 0 0 18px; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.4; } .download-detail h3 { margin: 0 0 18px; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.4; }
.download-description { margin-bottom: 22px; font-size: 15px; } .download-description { margin-bottom: 22px; font-size: 15px; }
.download-files { margin: 0; padding-left: 20px; }
.download-files li { padding: 5px 0; color: var(--ink); }
.download-files a { color: var(--blue); font-size: 16px; line-height: 1.6; text-underline-offset: 4px; }
.download-files a:hover { text-decoration: underline; }
.download-mobile-select { display: none; } .download-mobile-select { display: none; }
.downloads-empty { grid-column: 1 / -1; margin: 8px 0; color: var(--ink); font-size: 15px; } .downloads-empty { grid-column: 1 / -1; margin: 8px 0; color: var(--ink); font-size: 15px; }
@media (max-width: 640px) { @media (max-width: 640px) {
@@ -67,6 +62,5 @@ async function moveProject(event: KeyboardEvent, index: number) {
.download-mobile-select select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; } .download-mobile-select select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.download-detail { flex: 1; } .download-detail { flex: 1; }
.download-detail h3 { font-size: 24px; } .download-detail h3 { font-size: 24px; }
.download-files li { padding-block: 8px; }
} }
</style> </style>
+3 -3
View File
@@ -1,9 +1,9 @@
const pairs = { const pairs = {
viewHelp: ['查看帮助页', 'View usage guide'], viewHelp: ['查看帮助页', 'View usage guide'],
downloadProjects: ['软件项目', 'Software projects'], addDownloadProject: ['添加软件', 'Add software'], removeDownloadProject: ['移除软件', 'Remove software'], softwareName: ['软件名称', 'Software name'], downloadProjects: ['软件项目', 'Software projects'], addDownloadProject: ['添加软件', 'Add software'], removeDownloadProject: ['移除软件', 'Remove software'], softwareName: ['软件名称', 'Software name'],
downloadDescription: ['软件说明(中文,Markdown)', 'Description (Chinese, Markdown)'], downloadFiles: ['下载链接', 'Download links'], downloadLabel: ['链接名称(版本 / 架构)', 'Link label (version / architecture)'], addDownloadFile: ['添加下载链接', 'Add download link'], saveDownloads: ['保存下载配置', 'Save download catalog'], downloadDescription: ['软件文章(中文,Markdown)', 'Article (Chinese, Markdown)'], saveDownloads: ['保存下载配置', 'Save download catalog'],
downloadFileEntry: ['下载链接 {index}', 'Download link {index}'], downloadProjectCount: ['共 {count} 个软件', '{count} projects'], unnamedDownload: ['未命名软件 {index}', 'Untitled project {index}'], noDownloadProjects: ['暂无软件,点击“添加软件”开始配置。', 'No projects yet. Select “Add software” to get started.'], downloadProjectCount: ['共 {count} 个软件', '{count} projects'], unnamedDownload: ['未命名软件 {index}', 'Untitled project {index}'], noDownloadProjects: ['暂无软件,点击“添加软件”开始配置。', 'No projects yet. Select “Add software” to get started.'],
downloadUrlPlaceholder: ['https:// 或 /mirrors/ 开头的地址', 'https:// URL or /mirrors/ path'], incompleteDownload: ['请填写软件名称,并为每个软件添加至少一条完整的下载链接。', 'Enter a software name and at least one complete download link for each project.'], incompleteDownload: ['请填写软件名称和文章内容。', 'Enter a software name and article content for each project.'],
editArticle: ['编辑公告', 'Edit announcement'], write: ['编辑', 'Write'], articleView: ['公告编辑视图', 'Announcement editor view'], previewEmpty: ['输入 Markdown 正文后在这里预览。', 'Write Markdown to preview your announcement here.'], editArticle: ['编辑公告', 'Edit announcement'], write: ['编辑', 'Write'], articleView: ['公告编辑视图', 'Announcement editor view'], previewEmpty: ['输入 Markdown 正文后在这里预览。', 'Write Markdown to preview your announcement here.'],
saveDraft: ['保存草稿', 'Save draft'], publishArticle: ['发布公告', 'Publish announcement'], updateArticle: ['更新公告', 'Update announcement'], withdrawArticle: ['撤回为草稿', 'Unpublish as draft'], viewArticle: ['查看公告', 'View announcement'], viewAnnouncements: ['打开公告页', 'Open announcements'], saveDraft: ['保存草稿', 'Save draft'], publishArticle: ['发布公告', 'Publish announcement'], updateArticle: ['更新公告', 'Update announcement'], withdrawArticle: ['撤回为草稿', 'Unpublish as draft'], viewArticle: ['查看公告', 'View announcement'], viewAnnouncements: ['打开公告页', 'Open announcements'],
draftSaved: ['草稿已保存,尚未公开。', 'Draft saved. It is not public.'], articlePublished: ['公告已发布。', 'Announcement published.'], articleUpdated: ['公告已更新。', 'Announcement updated.'], articleWithdrawn: ['公告已撤回并保存为草稿。', 'Announcement unpublished and saved as a draft.'], draftSaved: ['草稿已保存,尚未公开。', 'Draft saved. It is not public.'], articlePublished: ['公告已发布。', 'Announcement published.'], articleUpdated: ['公告已更新。', 'Announcement updated.'], articleWithdrawn: ['公告已撤回并保存为草稿。', 'Announcement unpublished and saved as a draft.'],
-1
View File
@@ -15,7 +15,6 @@ export default {
"newsIntro": "These announcements describe the interface preview.", "newsIntro": "These announcements describe the interface preview.",
"downloadsTitle": "Downloads", "downloadsTitle": "Downloads",
"chooseSoftware": "Choose software", "chooseSoftware": "Choose software",
"downloadLinks": "Download links",
"downloadName": "Name", "downloadName": "Name",
"downloadVersion": "Version", "downloadVersion": "Version",
"downloadAction": "Download", "downloadAction": "Download",
-1
View File
@@ -15,7 +15,6 @@ export default {
"newsIntro": "以下为界面预览公告。", "newsIntro": "以下为界面预览公告。",
"downloadsTitle": "常用下载", "downloadsTitle": "常用下载",
"chooseSoftware": "选择软件", "chooseSoftware": "选择软件",
"downloadLinks": "下载链接",
"downloadName": "名称", "downloadName": "名称",
"downloadVersion": "版本", "downloadVersion": "版本",
"downloadAction": "下载", "downloadAction": "下载",