mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update RSS
This commit is contained in:
parent
f2885fc235
commit
555af7d113
@ -20,14 +20,12 @@ async function parseChangelog(): Promise<ChangelogEntry[]> {
|
||||
const fileContents = fs.readFileSync(changelogPath, "utf8")
|
||||
const entries: ChangelogEntry[] = []
|
||||
|
||||
// Split content by versions (assuming format ## [version] - date)
|
||||
const sections = fileContents.split(/^## /gm).filter((section) => section.trim())
|
||||
|
||||
for (const section of sections) {
|
||||
const lines = section.split("\n")
|
||||
const headerLine = lines[0]
|
||||
|
||||
// Extract version and date from header
|
||||
const versionMatch = headerLine.match(/\[([^\]]+)\]/)
|
||||
const dateMatch = headerLine.match(/(\d{4}-\d{2}-\d{2})/)
|
||||
|
||||
@ -45,7 +43,7 @@ async function parseChangelog(): Promise<ChangelogEntry[]> {
|
||||
}
|
||||
}
|
||||
|
||||
return entries.slice(0, 10) // Latest 10 entries
|
||||
return entries.slice(0, 10)
|
||||
} catch (error) {
|
||||
console.error("Error parsing changelog:", error)
|
||||
return []
|
||||
@ -62,17 +60,18 @@ export async function GET() {
|
||||
<title>ProxMenux Changelog</title>
|
||||
<description>Latest updates and changes in ProxMenux</description>
|
||||
<link>${siteUrl}/changelog</link>
|
||||
<atom:link href="${siteUrl}/api/rss" rel="self" type="application/rss+xml"/>
|
||||
<language>en</language>
|
||||
<atom:link href="${siteUrl}/rss.xml" rel="self" type="application/rss+xml"/>
|
||||
<language>en-US</language>
|
||||
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
||||
<generator>ProxMenux RSS Generator</generator>
|
||||
<ttl>60</ttl>
|
||||
|
||||
${entries
|
||||
.map(
|
||||
(entry) => `
|
||||
<item>
|
||||
<title>ProxMenux ${entry.version}</title>
|
||||
<description><![CDATA[${entry.content.substring(0, 500)}...]]></description>
|
||||
<description><![CDATA[${entry.content.substring(0, 500)}${entry.content.length > 500 ? "..." : ""}]]></description>
|
||||
<link>${entry.url}</link>
|
||||
<guid isPermaLink="true">${entry.url}</guid>
|
||||
<pubDate>${new Date(entry.date).toUTCString()}</pubDate>
|
@ -46,7 +46,7 @@ export default function Navbar() {
|
||||
|
||||
{/* RSS Feed Link */}
|
||||
<Link
|
||||
href="/api/rss"
|
||||
href="/rss.xml"
|
||||
className="flex items-center space-x-2 transition-colors hover:text-primary text-orange-600 hover:text-orange-700"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@ -81,7 +81,7 @@ export default function Navbar() {
|
||||
|
||||
{/* RSS Feed Link - Mobile */}
|
||||
<Link
|
||||
href="/api/rss"
|
||||
href="/rss.xml"
|
||||
className="flex items-center space-x-2 py-2 transition-colors hover:text-primary text-orange-600 hover:text-orange-700"
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
target="_blank"
|
||||
|
@ -6,7 +6,7 @@ import { useState } from "react"
|
||||
|
||||
export default function RSSLink() {
|
||||
const [copied, setCopied] = useState(false)
|
||||
const rssUrl = `${typeof window !== "undefined" ? window.location.origin : ""}/api/rss`
|
||||
const rssUrl = `${typeof window !== "undefined" ? window.location.origin : ""}/rss.xml`
|
||||
|
||||
const copyToClipboard = async () => {
|
||||
try {
|
||||
@ -20,36 +20,39 @@ export default function RSSLink() {
|
||||
|
||||
return (
|
||||
<div className="mb-8 p-4 bg-orange-50 border border-orange-200 rounded-lg">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex-1">
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold text-orange-900 mb-1">Stay Updated!</h3>
|
||||
<p className="text-orange-700 text-sm mb-3">
|
||||
Subscribe to our RSS feed to get notified of new changes. Copy the URL below or click the RSS button.
|
||||
</p>
|
||||
<p className="text-orange-700 text-sm">Subscribe to our RSS feed to get notified of new changes.</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 text-xs">
|
||||
<code className="bg-orange-100 text-orange-800 px-2 py-1 rounded flex-1 min-w-0 truncate">{rssUrl}</code>
|
||||
{/* RSS URL and buttons - Responsive layout */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<code className="bg-orange-100 text-orange-800 px-2 py-1 rounded text-xs flex-1 min-w-0 truncate">
|
||||
{rssUrl}
|
||||
</code>
|
||||
<button
|
||||
onClick={copyToClipboard}
|
||||
className="flex items-center gap-1 px-2 py-1 bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors whitespace-nowrap"
|
||||
className="flex items-center gap-1 px-2 py-1 bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors text-xs whitespace-nowrap"
|
||||
title="Copy RSS URL"
|
||||
>
|
||||
{copied ? <Check className="h-3 w-3" /> : <Copy className="h-3 w-3" />}
|
||||
{copied ? "Copied!" : "Copy"}
|
||||
<span className="hidden sm:inline">{copied ? "Copied!" : "Copy"}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href="/api/rss"
|
||||
className="ml-4 flex items-center space-x-2 px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 transition-colors"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title="Open RSS Feed"
|
||||
>
|
||||
<Rss className="h-4 w-4" />
|
||||
<span>RSS</span>
|
||||
</Link>
|
||||
<Link
|
||||
href="/rss.xml"
|
||||
className="inline-flex items-center justify-center space-x-2 px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 transition-colors w-full sm:w-auto"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title="Open RSS Feed"
|
||||
>
|
||||
<Rss className="h-4 w-4" />
|
||||
<span>Open RSS Feed</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user