mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
Merge remote-tracking branch 'origin/develop' into HEAD
This commit is contained in:
@@ -24,23 +24,27 @@ export async function generateMetadata({ params }: { params: Promise<{ locale: s
|
||||
}
|
||||
}
|
||||
|
||||
async function getCodeOfConductContent(notFoundMsg: string, loadFailedMsg: string) {
|
||||
async function getCodeOfConductContent(notFoundMsg: string, loadFailedMsg: string, translatedMarkdown?: string) {
|
||||
try {
|
||||
const codeOfConductPath = path.join(process.cwd(), "..", "CODE_OF_CONDUCT.md")
|
||||
|
||||
if (!fs.existsSync(codeOfConductPath)) {
|
||||
if (!translatedMarkdown && !fs.existsSync(codeOfConductPath)) {
|
||||
console.error("CODE_OF_CONDUCT.md file not found.")
|
||||
return `<p class='text-red-600'>${notFoundMsg}</p>`
|
||||
}
|
||||
|
||||
const fileContents = fs.readFileSync(codeOfConductPath, "utf8")
|
||||
const fileContents = translatedMarkdown || fs.readFileSync(codeOfConductPath, "utf8")
|
||||
|
||||
const result = await remark()
|
||||
.use(gfm.default || gfm)
|
||||
.use(html)
|
||||
.process(fileContents)
|
||||
|
||||
return result.toString()
|
||||
// Repository-relative policy links otherwise resolve under the docs URL.
|
||||
return result.toString().replaceAll(
|
||||
'href="./SECURITY.md"',
|
||||
'href="https://github.com/MacRimi/ProxMenux/blob/main/SECURITY.md"',
|
||||
)
|
||||
} catch (error) {
|
||||
console.error("Error reading the CODE_OF_CONDUCT.md file", error)
|
||||
return `<p class='text-red-600'>${loadFailedMsg}</p>`
|
||||
@@ -71,7 +75,11 @@ export default async function CodeOfConductPage({ params }: { params: Promise<{
|
||||
const { locale } = await params
|
||||
setRequestLocale(locale)
|
||||
const t = await getTranslations({ locale, namespace: "docs.about.codeOfConduct" })
|
||||
const codeOfConductContent = await getCodeOfConductContent(t("errors.notFound"), t("errors.loadFailed"))
|
||||
const translatedMarkdown = t.has("contentMarkdown") ? t.raw("contentMarkdown") : undefined
|
||||
const codeOfConductContent = await getCodeOfConductContent(
|
||||
t("errors.notFound"), t("errors.loadFailed"),
|
||||
typeof translatedMarkdown === "string" ? translatedMarkdown : undefined,
|
||||
)
|
||||
const cleanedInlineCode = cleanInlineCode(codeOfConductContent)
|
||||
const parsedContent = wrapCodeBlocksWithCopyable(cleanedInlineCode)
|
||||
|
||||
|
||||
@@ -89,10 +89,12 @@ export default async function PostInstallPage({
|
||||
docs: { postInstall: {
|
||||
routes: Route[]
|
||||
related: { items: RelatedItem[] }
|
||||
pbs?: { items: string[] }
|
||||
} }
|
||||
}
|
||||
const routes = messages.docs.postInstall.routes
|
||||
const relatedItems = messages.docs.postInstall.related.items
|
||||
const pbsItems = messages.docs.postInstall.pbs?.items ?? []
|
||||
|
||||
const code = (chunks: React.ReactNode) => <code>{chunks}</code>
|
||||
const strong = (chunks: React.ReactNode) => <strong>{chunks}</strong>
|
||||
@@ -210,6 +212,14 @@ export default async function PostInstallPage({
|
||||
{t.rich("community.body", { em, code, a: communityAnchor, link: externalRepoLink })}
|
||||
</p>
|
||||
|
||||
<h2 className="text-2xl font-semibold mt-10 mb-4 text-gray-900">{t("pbs.heading")}</h2>
|
||||
<p className="mb-4 text-gray-800 leading-relaxed">{t.rich("pbs.body", { strong })}</p>
|
||||
<ul className="list-disc pl-6 mb-4 text-gray-800 leading-relaxed space-y-2">
|
||||
{pbsItems.map((_, i) => (
|
||||
<li key={i}>{t.rich(`pbs.items.${i}`, { strong, em })}</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<h2 className="text-2xl font-semibold mt-10 mb-4 text-gray-900">{t("related.heading")}</h2>
|
||||
<ul className="list-disc pl-6 text-gray-800 leading-relaxed space-y-1">
|
||||
{relatedItems.map((item) => (
|
||||
|
||||
Reference in New Issue
Block a user