Add session middleware

main
Eric Ihli 4 years ago
parent 4907cfc196
commit 084db50b9e

@ -10,5 +10,5 @@ docker run \
-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
-e POSTGRES_USER=$POSTGRES_USER \ -e POSTGRES_USER=$POSTGRES_USER \
-v $PGDATA:/var/lib/postgresql/data \ -v $PGDATA:/var/lib/postgresql/data \
-p 5432:5432 \ -p 127.0.0.1:5432:5432 \
darklimericks-db darklimericks-db

@ -26,4 +26,5 @@
:paths ["src" "resources"] :paths ["src" "resources"]
:aliases {:dev {:extra-paths ["dev"] :aliases {:dev {:extra-paths ["dev"]
:extra-deps {hawk {:mvn/version "0.2.11"} :extra-deps {hawk {:mvn/version "0.2.11"}
seancorfield/depstar {:mvn/version "1.1.132"}
ring/ring-devel {:mvn/version "1.8.2"}}}}} ring/ring-devel {:mvn/version "1.8.2"}}}}}

@ -49,7 +49,7 @@
(defn init [] (defn init []
(repl/halt) (repl/halt)
(-> "server/config.edn" (-> "config.edn"
io/resource io/resource
slurp slurp
ig/read-string ig/read-string
@ -62,6 +62,7 @@
(defn reset [] (defn reset []
(repl/halt)) (repl/halt))
(comment (comment
(init) (init)
(auto-reset) (auto-reset)
@ -73,14 +74,12 @@
(map string/lower-case) (map string/lower-case)
(map #(identicon/generate % 128)))) (map #(identicon/generate % 128))))
(do
(repeatedly (repeatedly
5 5
(fn [] (fn []
(car/wcar (car/wcar
(-> state/system :database.kv/connection) (-> state/system :database.kv/connection)
(car-mq/enqueue "limericks" '((A 8) (A 8) (B 4) (B 4) (A 8)))))) (car-mq/enqueue "limericks" '((A 8) (A 8) (B 4) (B 4) (A 8))))))
nil)
(car/wcar (car/wcar
(-> state/system :database.kv/connection) (-> state/system :database.kv/connection)

@ -1,5 +1,5 @@
{:app/logging {:min-level :debug} {:app/logging {:min-level :debug}
:app/server {:port 8000 :handler #ig/ref :app/handler} :app/server {:port 80 :handler #ig/ref :app/handler}
:app/cache {} :app/cache {}
:worker/limerick-gen {:kv #ig/ref :database.kv/connection :worker/limerick-gen {:kv #ig/ref :database.kv/connection
:db #ig/ref :database.sql/connection} :db #ig/ref :database.sql/connection}

@ -4,6 +4,8 @@
[reitit.ring :as ring] [reitit.ring :as ring]
[clojure.string :as string] [clojure.string :as string]
[clojure.core.async :as async] [clojure.core.async :as async]
[taoensso.carmine :as car]
[taoensso.carmine.message-queue :as car-mq]
[com.darklimericks.server.util :as util] [com.darklimericks.server.util :as util]
[com.darklimericks.db.albums :as db.albums] [com.darklimericks.db.albums :as db.albums]
[com.darklimericks.db.limericks :as db.limericks] [com.darklimericks.db.limericks :as db.limericks]
@ -26,6 +28,7 @@
{:status 200 {:status 200
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (hiccup/html (views/home :body (hiccup/html (views/home
db
request request
recent-albums recent-albums
artists-by-album))}))) artists-by-album))})))
@ -35,27 +38,16 @@
(defn limerick-generation-post-handler (defn limerick-generation-post-handler
[db cache] [db cache]
(fn [{{:keys [scheme]} :params :as request}] (fn [{{:keys [scheme]} :params :as request}]
(let [tasks (:tasks @cache)] (let [scheme (limericks/parse-scheme scheme)
(let [task-id (java.util.UUID/randomUUID) mid (car/wcar db (car-mq/enqueue "limericks" scheme))]
limerick-chan (limericks/generate-limerick cache scheme task-id)]
(swap! cache assoc-in [:tasks task-id] {:status :pending})
(async/go
(let [limerick (async/<! limerick-chan)
[artist-id album-id] (limericks/get-artist-and-album-for-new-limerick db)]
(db.limericks/insert-limerick
db
(limericks/get-limerick-name limerick)
(string/join "\n" limerick)
album-id))))
{:status 301 {:status 301
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (views/wrapper :body (views/wrapper
db db
request
{} {}
[:h1 "Creating your limerick..."] [:h1 "Creating your limerick..."]
[:div "Submission processing..."] [:div "Submission processing... " mid])})))
[:h1 "Current limericks"]
(views/limerick-tasks tasks))})))
(defn limericks-get-handler [db cache] (defn limericks-get-handler [db cache]
(fn [request] (fn [request]
@ -68,6 +60,7 @@
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (views/wrapper :body (views/wrapper
db db
request
{} {}
[:div.flex.items-center.flex-column [:div.flex.items-center.flex-column
[:div.f3.pt4.light-yellow [:div.f3.pt4.light-yellow
@ -90,7 +83,9 @@
request request
:com.darklimericks.server.system/album :com.darklimericks.server.system/album
{:artist-id (:artist/id artist) {:artist-id (:artist/id artist)
:album-id (:album/id album)}) :artist-name (util/slug (:artist/name artist))
:album-id (:album/id album)
:album-name (util/slug (:album/name album))})
i)] i)]
[:a.db.light-yellow [:a.db.light-yellow
{:href limerick-url} {:href limerick-url}
@ -125,8 +120,10 @@
(let [tasks (:tasks @cache)] (let [tasks (:tasks @cache)]
{:status 200 {:status 200
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (views/page :body (views/wrapper
"Dark Limericks" db
request
{}
(views/limerick-tasks tasks))}))) (views/limerick-tasks tasks))})))
(defn artists-by-letter [db] (defn artists-by-letter [db]
@ -136,6 +133,7 @@
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (views/wrapper :body (views/wrapper
db db
req
{} {}
(when artists (when artists
(let [[right-hand-side-artists (let [[right-hand-side-artists
@ -146,11 +144,12 @@
[:div.bg-near-black.br4.flex [:div.bg-near-black.br4.flex
[:div.fl.w-50.pa2 [:div.fl.w-50.pa2
(for [artist right-hand-side-artists] (for [artist right-hand-side-artists]
[:a.washed-yellow [:a.washed-yellow.link
{:href (util/route-name->path {:href (util/route-name->path
req req
:com.darklimericks.server.system/artist :com.darklimericks.server.system/artist
{:artist-id (:artist/id artist)})} {:artist-id (:artist/id artist)
:artist-name (:artist/name artist)})}
(:artist/name artist)])] (:artist/name artist)])]
[:div.fl.w-50.pa2 [:div.fl.w-50.pa2
(for [artist left-hand-side-artists] (for [artist left-hand-side-artists]
@ -170,8 +169,10 @@
albums))] albums))]
{:status 200 {:status 200
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (views/page :body (views/wrapper
"Dark Limericks" db
request
{}
[:div [:div
[:div.f3.pt3.light-yellow [:div.f3.pt3.light-yellow
(->> artist (->> artist
@ -188,10 +189,26 @@
request request
:com.darklimericks.server.system/album :com.darklimericks.server.system/album
{:artist-id (:artist/id artist) {:artist-id (:artist/id artist)
:album-id (:album/id album)})] :artist-name (util/slug (:artist/name artist))
:album-id (:album/id album)
:album-name (util/slug (:album/name album))})]
(map-indexed (map-indexed
(fn [index limerick] (fn [index limerick]
[:a.f5.washed-yellow.db [:a.f5.washed-yellow.db
{:href (format "%s#%s" album-url (inc index))} {:href (format "%s#%s" album-url (inc index))}
(:limerick/name limerick)]) (:limerick/name limerick)])
(get limericks (:album/id album))))])])}))) (get limericks (:album/id album))))])])})))
(defn submit-limericks-get-handler [db]
(fn [request]
{:status 200
:headers {"Content-Type" "text/html; charset=uft-8"}
:session (if (empty? (:session request))
{:session-id (java.util.UUID/randomUUID)}
(:session request))
:body (views/wrapper
db
request
{}
(views/submit-limericks request))}))

@ -3,7 +3,10 @@
[muuntaja.interceptor :as muuntaja-interceptor] [muuntaja.interceptor :as muuntaja-interceptor]
[reitit.interceptor.sieppari :as sieppari] [reitit.interceptor.sieppari :as sieppari]
[ring.middleware.keyword-params :refer [keyword-params-request]] [ring.middleware.keyword-params :refer [keyword-params-request]]
[ring.middleware.session]
[ring.middleware.session.memory :as mem]
[taoensso.timbre :as timbre] [taoensso.timbre :as timbre]
[taoensso.carmine.ring :as carmine.ring]
[reitit.core :as reitit] [reitit.core :as reitit]
[reitit.coercion :as coercion] [reitit.coercion :as coercion]
[reitit.impl :as impl])) [reitit.impl :as impl]))
@ -18,11 +21,11 @@
(def logging-interceptor (def logging-interceptor
{:enter (fn [{:keys [request] :as ctx}] {:enter (fn [{:keys [request] :as ctx}]
(timbre/info #_(timbre/info
(str "Entering " (dissoc request ::reitit/match))) (str "Entering " (dissoc request ::reitit/match)))
ctx) ctx)
:exit (fn [{:keys [response] :as ctx}] :leave (fn [{:keys [response] :as ctx}]
(timbre/info #_(timbre/info
(str "Exiting " (dissoc response ::reitit/match))) (str "Exiting " (dissoc response ::reitit/match)))
ctx)}) ctx)})
@ -38,3 +41,35 @@
(let [coerced (coercion/coerce-request coercers request)] (let [coerced (coercion/coerce-request coercers request)]
(assoc-in ctx [:request :parameters] coerced)) (assoc-in ctx [:request :parameters] coerced))
ctx))))}) ctx))))})
(defn- session-options
[cache options]
{:store (options :store (carmine.ring/carmine-store cache))
:cookie-name (options :cookie-name "ring-session")
:cookie-attrs (merge {:path "/"
:http-only true}
(options :cookie-attrs)
(if-let [root (options :root)]
{:path root}))})
(defn session-interceptor
([cache]
(session-interceptor cache {}))
([cache options]
(let [options (session-options cache options)]
{:enter
(fn [ctx]
(update
ctx
:request
ring.middleware.session/session-request
options))
:leave
(fn [{:keys [response request] :as ctx}]
(update
ctx
:response
ring.middleware.session/session-response
request
options))}))
)

@ -5,6 +5,7 @@
[com.darklimericks.db.artists :as artists] [com.darklimericks.db.artists :as artists]
[com.darklimericks.db.albums :as albums] [com.darklimericks.db.albums :as albums]
[com.darklimericks.db.limericks :as db.limericks] [com.darklimericks.db.limericks :as db.limericks]
[com.darklimericks.util.identicon :as identicon]
[com.darklimericks.linguistics.core :as linguistics] [com.darklimericks.linguistics.core :as linguistics]
[com.owoga.prhyme.limerick :as limerick] [com.owoga.prhyme.limerick :as limerick]
[com.owoga.prhyme.data.dictionary :as dict] [com.owoga.prhyme.data.dictionary :as dict]
@ -18,6 +19,8 @@
"Expected a letter followed by an integer.") "Expected a letter followed by an integer.")
(let [text (re-find #"[a-zA-Z]+" (first tokens)) (let [text (re-find #"[a-zA-Z]+" (first tokens))
count (Integer/parseInt (re-find #"\d+" (first tokens)))] count (Integer/parseInt (re-find #"\d+" (first tokens)))]
(assert (and (< 5 count) (< count 14))
"Expected syllable counts between 5 and 14.")
[(rest tokens) (conj ctx [text count])])) [(rest tokens) (conj ctx [text count])]))
(or (= 4 (count tokens)) (or (= 4 (count tokens))
@ -77,7 +80,7 @@
(nil? album-id)) (nil? album-id))
(throw (ex-info "Nil artist or album" {:artist artist (throw (ex-info "Nil artist or album" {:artist artist
:album album-id}))) :album album-id})))
[(:artist/id artist) album-id]) ^:new-album [(:artist/id artist) album-id])
:else :else
(let [artist-name (linguistics/gen-artist) (let [artist-name (linguistics/gen-artist)
@ -88,7 +91,7 @@
(nil? album-id)) (nil? album-id))
(throw (ex-info "Nil artist or album" {:artist artist-id (throw (ex-info "Nil artist or album" {:artist artist-id
:album album-id}))) :album album-id})))
[artist-id album-id])))) ^:new-album ^:new-artist [artist-id album-id]))))
(defn get-limerick-name [lines] (defn get-limerick-name [lines]
(->> lines (->> lines
@ -121,7 +124,13 @@
dict/prhyme-dict dict/prhyme-dict
darklyrics-markov-2 darklyrics-markov-2
scheme) scheme)
[artist-id album-id] (get-artist-and-album-for-new-limerick db)] album-artist (get-artist-and-album-for-new-limerick db)
[artist-id album-id] album-artist
album (albums/album db album-id)]
(when (:new-album (meta album-artist))
(identicon/generate (-> (:album/name album)
string/lower-case
(string/replace #" " "-")) 128))
(db.limericks/insert-limerick (db.limericks/insert-limerick
db db
(get-limerick-name limerick) (get-limerick-name limerick)

@ -5,6 +5,7 @@
[next.jdbc :as jdbc] [next.jdbc :as jdbc]
[environ.core :refer [env]] [environ.core :refer [env]]
[taoensso.carmine.message-queue :as car-mq] [taoensso.carmine.message-queue :as car-mq]
[ring.middleware.session :refer [wrap-session]]
[reitit.http :as http] [reitit.http :as http]
[reitit.ring :as ring] [reitit.ring :as ring]
[reitit.coercion.spec] [reitit.coercion.spec]
@ -46,6 +47,9 @@
(defmethod ig/init-key :database.kv/connection [_ config] (defmethod ig/init-key :database.kv/connection [_ config]
config) config)
(defmethod ig/init-key :app/session-store [_ {:keys [cache]}]
{})
(defmethod ig/prep-key :database.sql/connection [_ _] (defmethod ig/prep-key :database.sql/connection [_ _]
{:jdbcUrl (str "jdbc:postgresql://localhost:5432/?user=" {:jdbcUrl (str "jdbc:postgresql://localhost:5432/?user="
(or (env :postgres-user) (or (env :postgres-user)
@ -79,14 +83,17 @@
{:name ::limerick-generation-task {:name ::limerick-generation-task
:post {:handler (handlers/limerick-generation-post-handler db cache)} :post {:handler (handlers/limerick-generation-post-handler db cache)}
:get {:handler (handlers/limerick-generation-get-handler db cache)}}] :get {:handler (handlers/limerick-generation-get-handler db cache)}}]
["/submit"
{:name ::submit
:get {:handler (handlers/submit-limericks-get-handler db)}}]
["/limericks" ["/limericks"
["/:artist-id/:album-id" ["/{artist-name}-{artist-id}/{album-name}-{album-id}"
{:name ::album {:name ::album
:coercion reitit.coercion.spec/coercion :coercion reitit.coercion.spec/coercion
:parameters {:path {:artist-id int? :parameters {:path {:artist-id int?
:album-id int?}} :album-id int?}}
:get {:handler (handlers/limericks-get-handler db cache)}}] :get {:handler (handlers/limericks-get-handler db cache)}}]
["/:artist-id" ["/{artist-name}-{artist-id}"
{:name ::artist {:name ::artist
:coercion reitit.coercion.spec/coercion :coercion reitit.coercion.spec/coercion
:parameters {:path {:artist-id int?}} :parameters {:path {:artist-id int?}}
@ -94,7 +101,8 @@
["/assets/*" handlers/resource-handler]]] ["/assets/*" handlers/resource-handler]]]
(http/router (http/router
routes routes
{:data {:interceptors [interceptors/coerce-request-interceptor {:data {:interceptors [(interceptors/session-interceptor cache)
interceptors/coerce-request-interceptor
interceptors/logging-interceptor interceptors/logging-interceptor
interceptors/format-interceptor interceptors/format-interceptor
(parameters-interceptor) (parameters-interceptor)

@ -1,5 +1,6 @@
(ns com.darklimericks.server.util (ns com.darklimericks.server.util
(:require [reitit.core :as reitit])) (:require [reitit.core :as reitit]
[clojure.string :as string]))
(defn route-name->path (defn route-name->path
([request name] ([request name]
@ -8,3 +9,8 @@
(->> name (->> name
(#(reitit/match-by-name (::reitit/router request) % params)) (#(reitit/match-by-name (::reitit/router request) % params))
reitit/match->path))) reitit/match->path)))
(defn slug [s]
(-> s
(string/replace #"\s+" "_")
string/lower-case))

@ -7,7 +7,7 @@
[com.darklimericks.server.util :as util])) [com.darklimericks.server.util :as util]))
(defn wrapper (defn wrapper
([db opts & body] ([db request opts & body]
(let [default-opts {:title "Dark Limericks"} (let [default-opts {:title "Dark Limericks"}
opts (merge default-opts opts) opts (merge default-opts opts)
title (:title opts) title (:title opts)
@ -25,7 +25,11 @@
[:a.link.dim.washed-yellow {:href "/"} "DarkLimericks.com"]] [:a.link.dim.washed-yellow {:href "/"} "DarkLimericks.com"]]
[:div.w-50-ns.w-90.center.bg-dark-gray.pa2 [:div.w-50-ns.w-90.center.bg-dark-gray.pa2
[:div.f6.lh-copy.flex.justify-between [:div.f6.lh-copy.flex.justify-between
[:a.washed-yellow.pl1 {:href "#"} "SUBMIT LIMERICKS"] [:a.washed-yellow.pl1
{:href (util/route-name->path
request
:com.darklimericks.server.system/submit)}
"SUBMIT LIMERICKS"]
[:span.dark-yellow [:span.dark-yellow
(format (format
"METAL LIMERICKS - CURRENTLY %d ALBUMS FROM %d+ BANDS" "METAL LIMERICKS - CURRENTLY %d ALBUMS FROM %d+ BANDS"
@ -69,70 +73,22 @@
[:strong (string/upper-case letter)]]))] [:strong (string/upper-case letter)]]))]
[:div.f6.lh-copy.flex.justify-between [:div.f6.lh-copy.flex.justify-between
[:a.washed-yellow.pr1 {:href "#"} "SUBMIT LIMERICKS"] [:a.washed-yellow.pr1
[:span.dark-yellow "METAL LIMERICKS - CURRENTLY 0 ALBUMS FROM 0+ BANDS"] {:href (util/route-name->path
request
:com.darklimericks.server.system/submit)}
"SUBMIT LIMERICKS"]
[:span.dark-yellow
(format
"METAL LIMERICKS - CURRENTLY %d ALBUMS FROM %d+ BANDS"
num-albums
num-artists)]
[:a.washed-yellow.pl1 {:href "#"} "LINKS"]]]])))) [:a.washed-yellow.pl1 {:href "#"} "LINKS"]]]]))))
(defn page [title & body] (defn home [db request recent-albums artists-by-album]
(page/html5 (wrapper
[:head db
[:meta {:charset "utf-8"}] request
[:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]
(page/include-css "/assets/tachyons.css")
[:title title]
[:link {:rel "shortcut icon" :href "/assets/favicon.ico"}]]
[:body.tc.washed-yellow.bg-near-black.avenir
[:h1
[:a.link.dim.washed-yellow {:href "/"} "DarkLimericks.com"]]
[:div.w-50-ns.w-90.center.bg-dark-gray.pa2
[:div.f6.lh-copy.flex.justify-between
[:a.washed-yellow.pl1 {:href "#"} "SUBMIT LIMERICKS"]
[:span.dark-yellow "METAL LIMERICKS - CURRENTLY 0 ALBUMS FROM 0+ BANDS"]
[:a.washed-yellow.pr1 {:href "#"} "LINKS"]]
[:div.flex.items-stretch.bg-near-black.flex-wrap.flex-nowrap-l.f6
(let [letters (map (comp str char) (range 97 123))]
(for [letter letters]
[:a.link.washed-yellow.bg-mid-gray.pv2.w1.w-100-ns.flex-auto
{:href (format "/%s.html" letter)
:style "margin: 1px;"}
[:strong (string/upper-case letter)]]))]
[:div.flex.items-center.justify-center.pv2
[:span.f6.ph2 "Search the darkness for limericks most heartless"]
[:form.ph2
{:method "GET" :action "#"}
[:input.bg-white.w4.w5-ns
{:type "text"
:name "search"
:id "search"
:value ""}]]]
[:div.bg-near-black.br4.pa2
body]
[:div.flex.items-center.justify-center.pv2
[:span.f6.ph2 "Search the darkness for limericks most heartless"]
[:form.ph2
{:method "GET" :action "#"}
[:input.bg-white.w4.w5-ns
{:type "text"
:name "search"
:id "search"
:value ""}]]]
[:div.flex.items-stretch.w-100.bg-near-black
(let [letters (map (comp str char) (range 97 123))]
(for [letter letters]
[:a.washed-yellow.bg-mid-gray.w-100.pv2.flex-grow-1
{:href (format "/%s.html" letter)
:style "margin: 1px;"}
(string/upper-case letter)]))]
[:div.f6.lh-copy.flex.justify-between
[:a.washed-yellow.pl1 {:href "#"} "SUBMIT LIMERICKS"]
[:span.dark-yellow "METAL LIMERICKS - CURRENTLY 0 ALBUMS FROM 0+ BANDS"]
[:a.washed-yellow.pr1 {:href "#"} "LINKS"]]]]))
(defn home [request recent-albums artists-by-album]
(page
"Dark Limericks"
[:div.f3.light-yellow.pb3 [:div.f3.light-yellow.pb3
"Welcome to DARK LIMERICKS !"] "Welcome to DARK LIMERICKS !"]
[:div.f6.washed-yellow.pb3 [:div.f6.washed-yellow.pb3
@ -159,7 +115,12 @@
{:href (util/route-name->path {:href (util/route-name->path
request request
:com.darklimericks.server.system/artist :com.darklimericks.server.system/artist
{:artist-id (:album/artist_id album)})} {:artist-id (:album/artist_id album)
:artist-name (-> album
:album/id
artists-by-album
:artist/name
util/slug)})}
(-> album :album/id (artists-by-album) :artist/name)]] (-> album :album/id (artists-by-album) :artist/name)]]
[:div.p2 [:div.p2
[:a.link.washed-yellow.f6 [:a.link.washed-yellow.f6
@ -167,12 +128,14 @@
request request
:com.darklimericks.server.system/album :com.darklimericks.server.system/album
{:artist-id (:album/artist_id album) {:artist-id (:album/artist_id album)
:album-id (:album/id album)})} :artist-name (-> album
(format "\"%s\"" (:album/name album))]]])] :album/id
(form/form-to artists-by-album
[:post (util/route-name->path request :com.darklimericks.server.system/limerick-generation-task)] :artist/name
(form/text-field "scheme") util/slug)
(form/submit-button "Generate dark limerick")))) :album-id (:album/id album)
:album-name (util/slug (:album/name album))})}
(format "\"%s\"" (:album/name album))]]])]))
(defn limerick-tasks [tasks] (defn limerick-tasks [tasks]
[:ul [:ul
@ -192,3 +155,17 @@
[:h3.f3.washed-yellow (format "%s. %s" (inc i) name)]] [:h3.f3.washed-yellow (format "%s. %s" (inc i) name)]]
(for [line lines] (for [line lines]
[:div line])])) [:div line])]))
(defn submit-limericks
[{{:keys [session-id]} :session :as request}]
[:div
[:h1 "Submit Limericks"]
(form/form-to
[:post (util/route-name->path
request
:com.darklimericks.server.system/limerick-generation-task)]
(form/text-field "scheme")
(form/submit-button "Generate dark limerick"))
[:div
"Currently processing "
session-id]])

@ -116,7 +116,8 @@
(fill-background draw size) (fill-background draw size)
(.setColor draw color) (.setColor draw color)
(draw-it draw tile-size 0 (to-bools md5)) (draw-it draw tile-size 0 (to-bools md5))
(ImageIO/write icon "png" (File. (file-name identifier size))))) (ImageIO/write icon "png" (File. (file-name identifier size)))
file-name))
(comment (comment
(generate "foobar-bazz" 128)) (generate "foobar-bazz" 128))

Loading…
Cancel
Save