fix: address the comments

This commit is contained in:
leonace924
2026-01-05 20:26:15 -05:00
parent 0b0f017508
commit ad1b0c10a0
4 changed files with 14 additions and 19 deletions

View File

@@ -202,7 +202,6 @@ async function createTables() {
table.text("footer_text");
table.text("custom_css");
table.boolean("show_powered_by").notNullable().defaultTo(true);
table.string("rss_title", 255);
table.string("google_analytics_tag_id");
});

View File

@@ -32,8 +32,9 @@ class StatusPage extends BeanModel {
]);
if (statusPage) {
const feedUrl = await StatusPage.buildRSSUrl(slug, request);
response.type("application/rss+xml");
response.send(await StatusPage.renderRSS(statusPage, slug, request));
response.send(await StatusPage.renderRSS(statusPage, feedUrl));
} else {
response.status(404).send(UptimeKumaServer.getInstance().indexHTML);
}
@@ -67,16 +68,12 @@ class StatusPage extends BeanModel {
/**
* SSR for RSS feed
* @param {StatusPage} statusPage Status page object
* @param {string} slug Status page slug
* @param {Request} request Express request object
* @param {string} feedUrl The URL for the RSS feed
* @returns {Promise<string>} The rendered RSS XML
*/
static async renderRSS(statusPage, slug, request) {
static async renderRSS(statusPage, feedUrl) {
const { heartbeats, statusDescription } = await StatusPage.getRSSPageData(statusPage);
// Build the feed URL, respecting proxy headers if trustProxy is enabled
const feedUrl = await StatusPage.buildRSSUrl(slug, request);
// Use custom RSS title if set, otherwise fall back to status page title
let feedTitle = "Uptime Kuma RSS Feed";
if (statusPage.rss_title) {

View File

@@ -34,15 +34,6 @@
</div>
</div>
<!-- RSS Title -->
<div class="my-3">
<label for="rss-title" class="form-label">{{ $t("RSS Title") }}</label>
<input id="rss-title" v-model="config.rssTitle" type="text" class="form-control" data-testid="rss-title-input">
<div class="form-text">
{{ $t("Leave blank to use status page title") }}
</div>
</div>
<div class="my-3">
<label for="auto-refresh-interval" class="form-label">{{ $t("Refresh Interval") }}</label>
<input id="auto-refresh-interval" v-model="config.autoRefreshInterval" type="number" class="form-control" :min="5" data-testid="refresh-interval-input">
@@ -125,6 +116,15 @@
<input id="analyticsScriptUrl" v-model="config.analyticsScriptUrl" type="url" class="form-control" data-testid="analytics-script-url-input">
</div>
<!-- RSS Title -->
<div class="my-3">
<label for="rss-title" class="form-label">{{ $t("RSS Title") }}</label>
<input id="rss-title" v-model="config.rssTitle" type="text" class="form-control" data-testid="rss-title-input">
<div class="form-text">
{{ $t("Leave blank to use status page title") }}
</div>
</div>
<!-- Custom CSS -->
<div class="my-3">
<div class="mb-1">{{ $t("Custom CSS") }}</div>

View File

@@ -326,8 +326,7 @@ test.describe("Status Page", () => {
expect(rssContent).toContain(`<title>${statusPageTitle} RSS Feed</title>`);
// Verify RSS link uses the correct domain (not localhost hardcoded)
expect(rssContent).toContain("<link>http://");
expect(rssContent).toContain("/status/rss-test</link>");
expect(rssContent).toMatch(/<link>https?:\/\/[^<]+\/status\/rss-test<\/link>/);
await testInfo.attach("rss-feed-default-title.xml", {
body: rssContent,