diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn
index b28c332..7cb3251 100644
--- a/env/dev/resources/config.edn
+++ b/env/dev/resources/config.edn
@@ -6,4 +6,9 @@
:nrepl-port 7000
:database-url "jdbc:sqlite:yenu_dev.db"
+
+ :basepath "http://localhost"
+ :authors ["Aaron Fischer"]
+
+ :images_per_page 25
}
diff --git a/env/prod/resources/config.edn b/env/prod/resources/config.edn
index 8d8c40b..7104a45 100644
--- a/env/prod/resources/config.edn
+++ b/env/prod/resources/config.edn
@@ -4,4 +4,9 @@
:port 3000
:database-url "jdbc:sqlite:yenu.db"
+
+ :basepath "http://localhost"
+ :authors ["Aaron Fischer"]
+
+ :images_per_page 25
}
diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql
index 2a382e4..009b012 100644
--- a/resources/sql/queries.sql
+++ b/resources/sql/queries.sql
@@ -44,6 +44,15 @@ UPDATE images
SET hash = :hash
WHERE id = :id
+-- :name get-first-year :? :1
+SELECT created_at FROM images
+ORDER BY created_at ASC
+LIMIT 1
+
+-- :name get-recent-year :? :1
+SELECT created_at FROM images
+ORDER BY created_at DESC
+LIMIT 1
-- :name create-tag! :i!
INSERT OR IGNORE INTO tags (tagname)
diff --git a/resources/templates/layout.html b/resources/templates/layout.html
index d222e5e..60596fe 100644
--- a/resources/templates/layout.html
+++ b/resources/templates/layout.html
@@ -75,7 +75,7 @@
-
© 2013 - {% now yyyy %} Aaron & Beatrice Fischer
+
{{ footer }}
{% style "/assets/bootstrap/css/bootstrap.min.css" %}
diff --git a/src/clj/yenu/layout.clj b/src/clj/yenu/layout.clj
index 6cb38c2..b8ccf68 100644
--- a/src/clj/yenu/layout.clj
+++ b/src/clj/yenu/layout.clj
@@ -7,6 +7,7 @@
[ring.middleware.anti-forgery :refer [*anti-forgery-token*]]
[clj-time.format :as time-format]
[yenu.config :refer [env]]
+ [yenu.db.core :as db]
[digest :as digest]
[clj-time.core :as time])
(:use [markdown.core]))
@@ -20,6 +21,12 @@
(filter/add-filter! :markdown-to-html md-to-html-string)
(filter/add-filter! :parse-date #(time/to-time-zone (time-format/parse %) (time/default-time-zone)))
+(defn footer []
+ (let [first-year (subs (:created_at (db/get-first-year)) 0 4)
+ recent-year (subs (:created_at (db/get-recent-year)) 0 4)
+ copy (if (= first-year recent-year) first-year (str first-year " - " recent-year))]
+ (str "© " copy " " (clojure.string/join ", " (:authors env)))))
+
(defn render-file [template & [params]]
(content-type
(ok
@@ -27,6 +34,7 @@
template
(assoc params
:page template
+ :footer (footer)
:csrf-token *anti-forgery-token*
:servlet-context *app-context*
:passwordhash (digest/md5 (:user-password env))
diff --git a/src/clj/yenu/routes/feed.clj b/src/clj/yenu/routes/feed.clj
index ea7453b..3298368 100644
--- a/src/clj/yenu/routes/feed.clj
+++ b/src/clj/yenu/routes/feed.clj
@@ -15,16 +15,15 @@
"\n"
(h/html
[:feed {:xmlns "http://www.w3.org/2005/Atom"}
- [:author [:name "Aaron Fischer"]]
- [:author [:name "Beatrice Fischer"]]
+ (for [a (:authors env)] [:author [:name a]])
[:title "yenu -- the image sharing tool for friends"]
- [:id (str "https://yenu.de/")]
+ [:id (str (:basepath env))]
[:updated (with-ts (:created_at (first entries)))]
(for [e entries]
[:entry
[:title (h/h (:title e))]
- [:link {:href (str "https://yenu.de/show/" (:id e)) :rel "alternate"}]
- [:id (str "https://yenu.de/show/" (:id e))]
+ [:link {:href (str (:basepath env) "/show/" (:id e)) :rel "alternate"}]
+ [:id (str (:basepath env) "/show/" (:id e))]
[:updated (with-ts (:created_at e))]
[:summary (h/h (:title e))]
[:content {:type "xhtml"}
diff --git a/yenu.properties b/yenu.properties
index eb6a018..6d307f9 100644
--- a/yenu.properties
+++ b/yenu.properties
@@ -1,4 +1,4 @@
-domain=localhost
+basepath=http://localhost
port=3000
# Passwords
@@ -7,4 +7,4 @@ creator-password=creator
# Content stuff
images_per_page=25
-footer=© 2013 - 2017 Aaron & Beatrice Fischer
\ No newline at end of file
+authors=Aaron Fischer,Beatrice Fischer