From 926189387434505a5657d0d0f0c68ec85a833da8 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Sat, 31 Jul 2021 00:05:13 +0200 Subject: [PATCH] Update all dependencies and change language to EN Update bootstrap required a lot of template work, so I had no change to split the commit in two separate commits to rebase the language change. This means, yenu is EN only by now. --- project.clj | 61 ++++++++------- resources/templates/admin/upload.html | 36 ++++----- resources/templates/comments.html | 50 ++++++------ resources/templates/detail.html | 55 ++++++------- resources/templates/error.html | 2 +- resources/templates/layout.html | 108 ++++++++++++++------------ resources/templates/login.html | 6 +- resources/templates/statistics.html | 2 +- src/clj/yenu/layout.clj | 7 +- src/clj/yenu/routes/admin.clj | 10 +-- src/clj/yenu/routes/auth.clj | 6 +- src/clj/yenu/routes/core.clj | 14 ++-- website/index.html | 2 +- 13 files changed, 188 insertions(+), 171 deletions(-) diff --git a/project.clj b/project.clj index 3af100b..0fb4b39 100644 --- a/project.clj +++ b/project.clj @@ -1,38 +1,45 @@ +;;; We need to allow http connections because some dependencies are fetched +;;; over http instead of https. See here for more detail: +;;; https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md +(require 'cemerick.pomegranate.aether) +(cemerick.pomegranate.aether/register-wagon-factory! + "http" #(org.apache.maven.wagon.providers.http.HttpWagon.)) + (defproject yenu "1.0.1" :description "yenu -- The image sharing tool for friends" :url "https://yenu.de/" :dependencies [[bouncer "1.0.1"] - [compojure "1.6.1"] - [conman "0.7.8"] - [cprop "0.1.11"] - [luminus-immutant "0.2.4"] - [luminus-migrations "0.5.0"] - [luminus-nrepl "0.1.4"] - [metosin/ring-http-response "0.9.0"] - [mount "0.1.12"] - [org.clojure/clojure "1.9.0"] - [org.clojure/tools.cli "0.3.5"] - [org.clojure/tools.logging "0.4.0"] - [org.webjars/jquery "3.3.1"] - [org.webjars/bootstrap "4.1.0"] + [compojure "1.6.2"] + [conman "0.9.1"] + [cprop "0.1.18"] + [luminus-immutant "0.2.5"] + [luminus-migrations "0.7.1"] + [luminus-nrepl "0.1.7"] + [metosin/ring-http-response "0.9.2"] + [mount "0.1.16"] + [clojure.java-time "0.3.2"] + [org.clojure/clojure "1.10.3"] + [org.clojure/tools.cli "1.0.206"] + [org.clojure/tools.logging "1.1.0"] + [org.webjars/jquery "3.6.0"] + [org.webjars/bootstrap "5.0.1"] [org.webjars/webjars-locator-jboss-vfs "0.1.0"] - [org.webjars.bower/tether "1.4.3"] + [org.webjars.bower/tether "1.4.7"] [org.webjars.bower/font-awesome "4.7.0"] - [org.xerial/sqlite-jdbc "3.21.0"] + [org.xerial/sqlite-jdbc "3.36.0"] [ring-webjars "0.2.0"] - [ring-middleware-format "0.7.2"] - [ring/ring-core "1.6.3"] - [ring/ring-defaults "0.3.1"] - [selmer "1.11.7"] + [ring-middleware-format "0.7.4"] + [ring/ring-core "1.9.3"] + [ring/ring-defaults "0.3.3"] + [selmer "1.12.44"] [hiccup "1.0.5"] [image-resizer "0.1.10"] [me.raynes/fs "1.4.6"] ;; R.I.P. Anthony! - [digest "1.4.8"] - [markdown-clj "1.0.2"] + [digest "1.4.10"] + [markdown-clj "1.10.5"] [clj-exif-orientation "0.2.1"] - [clj-time "0.14.3"] - [buddy/buddy-auth "2.1.0"]] + [buddy/buddy-auth "3.0.1"]] :min-lein-version "2.0.0" @@ -43,11 +50,11 @@ :main yenu.core :migratus {:store :database :db ~(get (System/getenv) "DATABASE_URL")} - :plugins [[lein-cprop "1.0.1"] - [migratus-lein "0.4.3"] + :plugins [[lein-cprop "1.0.3"] + [migratus-lein "0.7.3"] [lein-immutant "2.1.0"] - [lein-sassc "0.10.4"] - [lein-auto "0.1.2"]] + [lein-sassc "0.10.5"] + [lein-auto "0.1.3"]] :sassc [{:src "resources/scss/screen.scss" :output-to "resources/public/css/screen.css" diff --git a/resources/templates/admin/upload.html b/resources/templates/admin/upload.html index 44cabe5..7e8d360 100644 --- a/resources/templates/admin/upload.html +++ b/resources/templates/admin/upload.html @@ -2,51 +2,49 @@ {% block content %} {% if image %} -

Bild editieren

-

Hier kann ein bestehendes Bild bearbeitet werden. Das Bild selbst kann nicht - verändert werden (hierzu muss das Bild gelöscht und neu angelegt werden)

+

Edit image

+

Edit an image metadata. To change the image itself, you need to delete and add a new one.

{% else %} -

Bild hochladen

-

Hier kann ein neues Bild der Gallerie hinzugefügt werden. Dabei sind alle - gängigen Bildformate und Auflösungen möglich. Das hochgeladene Bild wird - zugeschnitten (Thumbnail) und skaliert (Detailseite).

+

Upload image

+

Here you can add a new image to the gallery. You can use all common image types. The uploaded + image will be cropped (Thumbnail) and resized (detail image).

{% endif %}
{% csrf-field %} {% if not image %} -
- +
+
{% endif %} -
- +
+ + placeholder="Leave empty for filename">
-
- +
+
-
- +
+ + placeholder="Separate with space or comma">
diff --git a/resources/templates/comments.html b/resources/templates/comments.html index 2db1621..baa8f34 100644 --- a/resources/templates/comments.html +++ b/resources/templates/comments.html @@ -1,32 +1,34 @@ {% extends "layout.html" %} {% block content %} -

Kommentarstream

+

Comments

- + {% endfor %} +
{% endblock %} diff --git a/resources/templates/detail.html b/resources/templates/detail.html index c89ed2c..6bc472d 100644 --- a/resources/templates/detail.html +++ b/resources/templates/detail.html @@ -2,20 +2,20 @@ {% block content %} -
+ @@ -47,60 +47,63 @@
{% ifequal identity ":creator" %} -
+ {% endifequal %} -

{{ image.created_at|parse-date|date:"dd.MM.yyyy, HH:mm" }} Uhr

+

{{ image.created_at|parse-date|date:"dd.MM.yyyy, HH:mm" }}

{% if image.description|length > 0 %}

{{ image.description|markdown-to-html|safe }}

{% endif %} -
    - {% for comment in comments %} -
  • +
    + {% for comment in comments %} - -
    -
    {{ comment.author }}
    - {% ifequal identity ":creator" %} - Löschen - {% endifequal %} - {{ comment.comment|markdown-to-html|safe }} +
    +
    + +
    +
    +
    {{ comment.author }}
    + {% ifequal identity ":creator" %} + Delete + {% endifequal %} + + {{ comment.comment|markdown-to-html|safe }} +
    -
  • - {% endfor %} -
+ {% endfor %} +
{% csrf-field %} -
- +
+
-
- +
+
diff --git a/resources/templates/error.html b/resources/templates/error.html index 4ba273a..ff17577 100644 --- a/resources/templates/error.html +++ b/resources/templates/error.html @@ -1,7 +1,7 @@ {% extends "layout.html" %} {% block content %} -

Fehler: {{status}}

+

Error: {{status}}


{% if title %}

{{title}}

diff --git a/resources/templates/layout.html b/resources/templates/layout.html index 7660efd..58c48a9 100644 --- a/resources/templates/layout.html +++ b/resources/templates/layout.html @@ -9,60 +9,66 @@ {% endif %} + -
+
{% if flash.message %} -
+

-

{{ footer }}

+
+

{{ footer }}

+
{% style "/assets/bootstrap/css/bootstrap.min.css" %} diff --git a/resources/templates/login.html b/resources/templates/login.html index 9d7d680..a6a4e20 100644 --- a/resources/templates/login.html +++ b/resources/templates/login.html @@ -6,13 +6,13 @@
-

Um die Seite anzusehen oder die Aktion auszuführen wird ein Passwort benötigt.

+

To access this area, you need a password.

{% csrf-field %} -
- +
+
diff --git a/resources/templates/statistics.html b/resources/templates/statistics.html index 8d49968..25e0c53 100644 --- a/resources/templates/statistics.html +++ b/resources/templates/statistics.html @@ -1,6 +1,6 @@ {% extends "layout.html" %} {% block content %} -

Statistiken

+

Stats

{% endblock %} diff --git a/src/clj/yenu/layout.clj b/src/clj/yenu/layout.clj index c905a6d..60a74b4 100644 --- a/src/clj/yenu/layout.clj +++ b/src/clj/yenu/layout.clj @@ -5,11 +5,10 @@ [ring.util.anti-forgery :refer [anti-forgery-field]] [yenu.helpers.images :as image-helper] [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]) + [java-time :refer [local-date-time]]) (:use [markdown.core])) (declare ^:dynamic *identity*) @@ -19,7 +18,7 @@ (filter/add-filter! :inc inc) (filter/add-filter! :dec dec) (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))) +(filter/add-filter! :parse-date #(local-date-time "yyyy-MM-dd HH:mm:ss" %)) (defn footer [] (if (= (:count (db/get-image-count)) 0) @@ -27,7 +26,7 @@ (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)))))) + (str "© " copy " " (:authors env))))) (defn render-file [template & [params]] (content-type diff --git a/src/clj/yenu/routes/admin.clj b/src/clj/yenu/routes/admin.clj index 0c1bfe5..f6623ee 100644 --- a/src/clj/yenu/routes/admin.clj +++ b/src/clj/yenu/routes/admin.clj @@ -74,20 +74,20 @@ (do (add-image-to-database imghash title description tags) (-> (redirect "/upload") - (assoc :flash {:message "Upload erfolgreich." :type "success"}))) + (assoc :flash {:message "Upload successfull" :type "success"}))) (-> (redirect "/upload") - (assoc :flash {:message "Fehler beim Upload." :type "danger"}))))) + (assoc :flash {:message "Upload failed" :type "danger"}))))) (GET "/delete/:id" [id :as request] (delete-image! id request) (-> (redirect "/page/1") - (assoc :flash {:message "Bild wurde gelöscht" :type "danger"}))) + (assoc :flash {:message "Image deleted" :type "danger"}))) (GET "/delete-comment/:id" [id] (let [image-id (image-id-from-comment id)] (db/delete-comment! {:id id}) (-> (redirect (str "/show/" image-id)) - (assoc :flash {:message "Kommentar wurde gelöscht" :type "danger"})))) + (assoc :flash {:message "Comment deleted" :type "danger"})))) (GET "/edit/:id" [id :as request] (edit-image-form id request)) @@ -95,7 +95,7 @@ (POST "/edit/:id" [id title description tags :as request] (edit-image! id title description tags request) (-> (redirect (str "/show/" id)) - (assoc :flash {:message "Bild wurde bearbeitet" :type "success"}))) + (assoc :flash {:message "Image edited" :type "success"}))) (GET "/statistics" [] (layout/render-file "statistics.html")) diff --git a/src/clj/yenu/routes/auth.clj b/src/clj/yenu/routes/auth.clj index 0f7cf27..69c9e4b 100644 --- a/src/clj/yenu/routes/auth.clj +++ b/src/clj/yenu/routes/auth.clj @@ -17,15 +17,15 @@ (if user-identity (let [updated-session (assoc session :identity user-identity)] (-> (redirect next-url) - (assoc :flash {:message "Erfolgreich eingeloggt." :type "success"}) + (assoc :flash {:message "Login successfull" :type "success"}) (assoc :session updated-session))) (-> (redirect (format "/login?next=%s" next-url)) - (assoc :flash {:message "Falsches Passwort." :type "danger"}))))) + (assoc :flash {:message "Wrong password" :type "danger"}))))) (defn logout! [request] (-> (redirect "/login") (assoc :session {}) - (assoc :flash {:message "Erfolgreich ausgeloggt." :type "success"}))) + (assoc :flash {:message "Logout successfull" :type "success"}))) (defroutes auth-routes (GET "/login" [:as request] diff --git a/src/clj/yenu/routes/core.clj b/src/clj/yenu/routes/core.clj index 4df93ee..f088768 100644 --- a/src/clj/yenu/routes/core.clj +++ b/src/clj/yenu/routes/core.clj @@ -30,15 +30,15 @@ (if (< num 2) "" (h/html - [:nav.float-right.clearfix {:aria-label "Page navigation"} + [:nav.pull-right.clearfix {:aria-label "Page navigation"} [:ul.pagination.d-none.d-sm-none.d-xs-none.d-md-flex - (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) + (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Prev")) (cond (< num 13) (pagelist 1 num current) (<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current)) (>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current)) :else (h/html (pagelist 1 2 current) (dots) (pagelist (- current 3) (+ current 3) current) (dots) (pagelist (- num 1) num current))) - (page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]] + (page (inc current) (= current num) "disabled" (h/html "Next " [:span.fa.fa-arrow-right]))]] [:div.clearfix]))) (defn pagination-mobile [num current] @@ -46,12 +46,12 @@ "" (h/html [:ul.pagination.justify-content-end.d-md-none - (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) + (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Prev")) [:form.form-inline [:select#page-switcher.form-control (for [p (range 1 (inc num))] [:option (cond-> {:value p} (= p current) (assoc :selected "selected")) p])]] - (page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]))) + (page (inc current) (= current num) "disabled" (h/html "Next " [:span.fa.fa-arrow-right]))]))) (defn index-page [current request] (let [image-count (:images-per-page env) @@ -90,8 +90,8 @@ :comment comment})) (-> (redirect (str "/show/" image-id)) (assoc :flash (if (not= comment "") - {:message "Danke für deinen Kommentar" :type "success"} - {:message "Der kommentar war leider leer." :type "danger"})) + {:message "Thank you for your comment." :type "success"} + {:message "The comment was empty." :type "danger"})) (assoc-in [:cookies "author"] {:value author :path "/" diff --git a/website/index.html b/website/index.html index ccbbdea..beef790 100644 --- a/website/index.html +++ b/website/index.html @@ -63,7 +63,7 @@

This tool is written in Clojure by Aaron Fischer. It is free to use and is placed under the GPL v.3. You - can inspect and download the sourcecode here. The images, + can inspect and download the sourcecode here. The images, comments and other metadata belongs to you. Make sure, you store the data on a place you trust and make backups.