mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-01-31 11:03:11 +08:00
fix: address the comments
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user