diff --git a/README.md b/README.md index 13177dd..17e9ae3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Read the [configuation guide](docs/CONFIG.md) for configuration help (in config. * user creation, modification and deletion via frontend * multi user * powerful customisation via EJS -* site wide rss, atom +* site wide and user specific rss, atom * hitcount * Markdown syntax in posts * Commenting on posts @@ -29,7 +29,6 @@ Read the [configuation guide](docs/CONFIG.md) for configuration help (in config. * probably insecure as hell # Planned features/todo list -* user specific RSS/atom feeds * federation (looks tricky) * All strings (including in edit and post page) customisable * formatable custom strings diff --git a/src/functions.js b/src/functions.js index d5db46c..51843f3 100644 --- a/src/functions.js +++ b/src/functions.js @@ -29,7 +29,7 @@ export function unix_time_to_rss_date(unix_time) { export function unix_time_to_atom_date(unix_time) { const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library let date = fromUnixTime(unix_time) - let formatted_date = format(date, "yyyy-MM-dd\\THH:mm:ss\\Z") + let formatted_date = format(date, "yyyy-MM-dd'T'HH:mm:ss'Z'") return `${formatted_date}` } // This function accepts a list of strings eg ["string1","string2,"string3"] (any length) diff --git a/src/server.js b/src/server.js index 5b6649f..b0a9dee 100644 --- a/src/server.js +++ b/src/server.js @@ -60,7 +60,7 @@ app.set('view engine', 'ejs'); app.set('views', '../views') ////////////////////// SYNDICATION //////////////////////// -// RSS protocol gets +// global RSS protocol gets app.get("/rss", (req,res) => { if (config.rss == false) { res.render("partials/message", { @@ -78,7 +78,28 @@ app.get("/rss", (req,res) => { }) }; }); -// ATOM protocol gets +// user RSS protocol gets +app.get("/user/:username/rss", (req,res) => { + const username = req.params.username; + const userID = func.get_userID(username); + if (config.rss == false) { + res.render("partials/message", { + message: config.string.rss_disabled, + config: config, + }) + } + else { + res.setHeader('content-type', 'application/rss+xml'); + res.render("syndication/user_rss", { + config, + posts, + converter, + func, + userID, + }) + }; +}); +// global ATOM protocol gets app.get("/atom", (req,res) => { if (config.rss == false) { res.render("partials/message", { @@ -93,6 +114,29 @@ app.get("/atom", (req,res) => { posts, converter, func, + getUnixTime, + }) + }; +}); +// user ATOM protocol gets +app.get("/user/:username/atom", (req,res) => { + const username = req.params.username; + const userID = func.get_userID(username); + if (config.rss == false) { + res.render("partials/message", { + message: config.string.rss_disabled, + config: config, + }) + } + else { + res.setHeader('content-type', 'application/rss+xml'); + res.render("syndication/user_atom", { + config, + posts, + converter, + func, + userID, + getUnixTime, }) }; }); diff --git a/views/headers/timeline.ejs b/views/headers/timeline.ejs index d289f0b..a4ce164 100644 --- a/views/headers/timeline.ejs +++ b/views/headers/timeline.ejs @@ -4,7 +4,8 @@
<%- converter.makeHtml(user.description) %>
-edit account +edit account