diff of 1c878e0c547630c34b66c42a982ec7fd189f4a25
1c878e0c547630c34b66c42a982ec7fd189f4a25
diff --git a/src/local-lib/lisp-fixup.lisp b/src/local-lib/lisp-fixup.lisp
index 5989790..7d3caf1 100644
--- a/src/local-lib/lisp-fixup.lisp
+++ b/src/local-lib/lisp-fixup.lisp
@@ -1,6 +1,6 @@
(defpackage lisp-fixup
(:use :cl)
- (:export :sha-512 :partial :compose :drop :slurp-bytes :slurp-utf-8))
+ (:export :*rfc822* :sha-512 :partial :compose :drop :slurp-bytes :slurp-utf-8))
(in-package :lisp-fixup)
@@ -47,9 +47,46 @@
:initial-value x
:from-end t)))
+(defvar *rfc822* nil)
+
+(defun weekday->string (day)
+ (case day
+ (1 "Mon")
+ (2 "Tue")
+ (3 "Wed")
+ (4 "Thu")
+ (5 "Fri")
+ (6 "Sat")
+ (0 "Sun")
+ (t "")))
+
+(defun month->string (day)
+ (case day
+ (1 "Jan")
+ (2 "Feb")
+ (3 "Mar")
+ (4 "Apr")
+ (5 "May")
+ (6 "Jun")
+ (7 "Jul")
+ (8 "Aug")
+ (9 "Sep")
+ (10 "Oct")
+ (11 "Nov")
+ (12 "Dec")
+ (t "")))
+
(defun fix-timestamp (timestamp)
"Fixes timestamps returned from postmodern to a json-format elm can parse"
(multiple-value-bind (year month day hour minute second millisec)
(simple-date:decode-timestamp timestamp)
- (declare (ignore millisec))
- (format nil "~d-~2,'0d-~2,'0dT~2,'0d:~2,'0d:~2,'0dZ" year month day hour minute second)))
+ (let ((weekday (simple-date:day-of-week timestamp)))
+
+ (if *rfc822*
+ (format nil "~a, ~2,'0d ~a ~d ~2,'0d:~2,'0d:~2,'0d EST"
+ (weekday->string weekday)
+ day
+ (month->string month)
+ year
+ hour minute second)
+ (format nil "~d-~2,'0d-~2,'0dT~2,'0d:~2,'0d:~2,'0dZ" year month day hour minute second)))))
diff --git a/src/routes/rss-routes.lisp b/src/routes/rss-routes.lisp
index be337bb..8348b17 100644
--- a/src/routes/rss-routes.lisp
+++ b/src/routes/rss-routes.lisp
@@ -23,7 +23,7 @@
:language lang)
(dolist (post posts)
(xml-emitter:rss-item (gethash "title" post)
- :link (format nil "/post/~d" (gethash "id" post))
+ :link (format nil "~a/post/~d" link (gethash "id" post))
:description (let ((len (length (gethash "content" post))))
(if (> len 500)
(subseq (gethash "content" post)
@@ -35,9 +35,10 @@
(get-output-stream-string output)))
(defroute rsssss ("/api/rss" :method :get
- :decorators ( @transaction)) ()
- (let* ((settings (get-settings))
- (page-size (gethash "recent-post-count" settings))
- (page (get-page 1 page-size :allow-hidden? nil)))
- (setf (hunchentoot:content-type*) "application/rss+xml")
- (posts->rss page)))
+ :decorators ( @transaction)) ()
+ (let ((lisp-fixup:*rfc822* t))
+ (let* ((settings (get-settings))
+ (page-size (gethash "recent-post-count" settings))
+ (page (get-page 1 page-size :allow-hidden? nil)))
+ (setf (hunchentoot:content-type*) "application/rss+xml")
+ (posts->rss page))))