Remove all user specific data into the config

This commit is contained in:
Aaron Fischer 2017-05-11 21:37:39 +02:00
parent 1877d81ac7
commit c663ef6d2a
7 changed files with 34 additions and 8 deletions

View file

@ -6,4 +6,9 @@
:nrepl-port 7000
:database-url "jdbc:sqlite:yenu_dev.db"
:basepath "http://localhost"
:authors ["Aaron Fischer"]
:images_per_page 25
}

View file

@ -4,4 +4,9 @@
:port 3000
:database-url "jdbc:sqlite:yenu.db"
:basepath "http://localhost"
:authors ["Aaron Fischer"]
:images_per_page 25
}

View file

@ -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)

View file

@ -75,7 +75,7 @@
<div class="col-md-12 text-right mt-4 mb-1 text-muted">
<hr>
<p>© 2013 - {% now yyyy %} Aaron & Beatrice Fischer</p>
<p>{{ footer }}</p>
</div>
{% style "/assets/bootstrap/css/bootstrap.min.css" %}

View file

@ -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))

View file

@ -15,16 +15,15 @@
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\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"}

View file

@ -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
authors=Aaron Fischer,Beatrice Fischer