0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

⬆️ Update backend dependencies

This commit is contained in:
Andrey Antukh 2024-10-20 23:52:23 +02:00
parent b31a6f33a5
commit f949649ba3
14 changed files with 50 additions and 79 deletions

View file

@ -6,7 +6,7 @@
org.clojure/clojure {:mvn/version "1.12.0"} org.clojure/clojure {:mvn/version "1.12.0"}
org.clojure/tools.namespace {:mvn/version "1.5.0"} org.clojure/tools.namespace {:mvn/version "1.5.0"}
com.github.luben/zstd-jni {:mvn/version "1.5.6-3"} com.github.luben/zstd-jni {:mvn/version "1.5.6-6"}
io.prometheus/simpleclient {:mvn/version "0.16.0"} io.prometheus/simpleclient {:mvn/version "0.16.0"}
io.prometheus/simpleclient_hotspot {:mvn/version "0.16.0"} io.prometheus/simpleclient_hotspot {:mvn/version "0.16.0"}
@ -17,7 +17,7 @@
io.prometheus/simpleclient_httpserver {:mvn/version "0.16.0"} io.prometheus/simpleclient_httpserver {:mvn/version "0.16.0"}
io.lettuce/lettuce-core {:mvn/version "6.3.2.RELEASE"} io.lettuce/lettuce-core {:mvn/version "6.4.0.RELEASE"}
java-http-clj/java-http-clj {:mvn/version "0.4.3"} java-http-clj/java-http-clj {:mvn/version "0.4.3"}
funcool/yetti funcool/yetti
@ -26,24 +26,24 @@
:git/url "https://github.com/funcool/yetti.git" :git/url "https://github.com/funcool/yetti.git"
:exclusions [org.slf4j/slf4j-api]} :exclusions [org.slf4j/slf4j-api]}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.939"} com.github.seancorfield/next.jdbc {:mvn/version "1.3.955"}
metosin/reitit-core {:mvn/version "0.7.0"} metosin/reitit-core {:mvn/version "0.7.2"}
nrepl/nrepl {:mvn/version "1.1.2"} nrepl/nrepl {:mvn/version "1.3.0"}
cider/cider-nrepl {:mvn/version "0.48.0"} cider/cider-nrepl {:mvn/version "0.50.2"}
org.postgresql/postgresql {:mvn/version "42.7.3"} org.postgresql/postgresql {:mvn/version "42.7.4"}
org.xerial/sqlite-jdbc {:mvn/version "3.46.0.0"} org.xerial/sqlite-jdbc {:mvn/version "3.46.1.3"}
com.zaxxer/HikariCP {:mvn/version "5.1.0"} com.zaxxer/HikariCP {:mvn/version "6.0.0"}
io.whitfin/siphash {:mvn/version "2.0.0"} io.whitfin/siphash {:mvn/version "2.0.0"}
buddy/buddy-hashers {:mvn/version "2.0.167"} buddy/buddy-hashers {:mvn/version "2.0.167"}
buddy/buddy-sign {:mvn/version "3.5.351"} buddy/buddy-sign {:mvn/version "3.6.1-359"}
com.github.ben-manes.caffeine/caffeine {:mvn/version "3.1.8"} com.github.ben-manes.caffeine/caffeine {:mvn/version "3.1.8"}
org.jsoup/jsoup {:mvn/version "1.17.2"} org.jsoup/jsoup {:mvn/version "1.18.1"}
org.im4java/im4java org.im4java/im4java
{:git/tag "1.4.0-penpot-2" {:git/tag "1.4.0-penpot-2"
:git/sha "e2b3e16" :git/sha "e2b3e16"
@ -58,7 +58,7 @@
;; Pretty Print specs ;; Pretty Print specs
pretty-spec/pretty-spec {:mvn/version "0.1.4"} pretty-spec/pretty-spec {:mvn/version "0.1.4"}
software.amazon.awssdk/s3 {:mvn/version "2.25.63"} software.amazon.awssdk/s3 {:mvn/version "2.28.26"}
} }
:paths ["src" "resources" "target/classes"] :paths ["src" "resources" "target/classes"]
@ -74,7 +74,7 @@
:build :build
{:extra-deps {:extra-deps
{io.github.clojure/tools.build {:git/tag "v0.10.3" :git/sha "15ead66"}} {io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}}
:ns-default build} :ns-default build}
:test :test

View file

@ -222,7 +222,7 @@
(defn copy-stream! (defn copy-stream!
[^OutputStream output ^InputStream input ^long size] [^OutputStream output ^InputStream input ^long size]
(let [written (io/copy! input output :size size)] (let [written (io/copy input output :size size)]
(l/trace :fn "copy-stream!" :position @*position* :size size :written written ::l/sync? true) (l/trace :fn "copy-stream!" :position @*position* :size size :written written ::l/sync? true)
(swap! *position* + written) (swap! *position* + written)
written)) written))
@ -251,11 +251,11 @@
(if (> s bfc/temp-file-threshold) (if (> s bfc/temp-file-threshold)
(with-open [^OutputStream output (io/output-stream p)] (with-open [^OutputStream output (io/output-stream p)]
(let [readed (io/copy! input output :offset 0 :size s)] (let [readed (io/copy input output :offset 0 :size s)]
(l/trace :fn "read-stream*!" :expected s :readed readed :position @*position* ::l/sync? true) (l/trace :fn "read-stream*!" :expected s :readed readed :position @*position* ::l/sync? true)
(swap! *position* + readed) (swap! *position* + readed)
[s p])) [s p]))
[s (io/read! input :size s)]))) [s (io/read input :size s)])))
(defmacro assert-read-label! (defmacro assert-read-label!
[input expected-label] [input expected-label]
@ -699,7 +699,7 @@
(dm/assert! (dm/assert!
"expected instance of jio/IOFactory for `input`" "expected instance of jio/IOFactory for `input`"
(satisfies? jio/IOFactory output)) (io/coercible? output))
(let [id (uuid/next) (let [id (uuid/next)
tp (dt/tpoint) tp (dt/tpoint)

View file

@ -190,7 +190,7 @@
[{:keys [::sto/storage] :as cfg} id] [{:keys [::sto/storage] :as cfg} id]
(let [sobj (sto/get-object storage id) (let [sobj (sto/get-object storage id)
data (with-open [input (sto/get-object-data storage sobj)] data (with-open [input (sto/get-object-data storage sobj)]
(io/read-as-bytes input))] (io/read input))]
(l/trc :hint "write" :obj "storage-object" :id (str id) :size (:size sobj)) (l/trc :hint "write" :obj "storage-object" :id (str id) :size (:size sobj))
(write! cfg :storage-object id (meta sobj) data))) (write! cfg :storage-object id (meta sobj) data)))

View file

@ -236,7 +236,7 @@
(with-open [input (sto/get-object-data storage sobject)] (with-open [input (sto/get-object-data storage sobject)]
(.putNextEntry output (ZipEntry. (str "objects/" id ext))) (.putNextEntry output (ZipEntry. (str "objects/" id ext)))
(io/copy! input output (:size sobject)) (io/copy input output :size (:size sobject))
(.closeEntry output)))))) (.closeEntry output))))))
(defn- export-file (defn- export-file
@ -385,7 +385,7 @@
(defn- zip-entry-reader (defn- zip-entry-reader
[^ZipFile input ^ZipEntry entry] [^ZipFile input ^ZipEntry entry]
(-> (zip-entry-stream input entry) (-> (zip-entry-stream input entry)
(jio/reader :encoding "UTF-8"))) (io/reader :encoding "UTF-8")))
(defn- zip-entry-storage-content (defn- zip-entry-storage-content
"Wraps a ZipFile and ZipEntry into a penpot storage compatible "Wraps a ZipFile and ZipEntry into a penpot storage compatible
@ -929,7 +929,7 @@
(dm/assert! (dm/assert!
"expected instance of jio/IOFactory for `input`" "expected instance of jio/IOFactory for `input`"
(satisfies? jio/IOFactory input)) (io/coercible? input))
(let [id (uuid/next) (let [id (uuid/next)
tp (dt/tpoint) tp (dt/tpoint)

View file

@ -1298,7 +1298,7 @@
(let [[mtype data] (parse-datauri href) (let [[mtype data] (parse-datauri href)
size (alength ^bytes data) size (alength ^bytes data)
path (tmp/tempfile :prefix "penpot.media.download.") path (tmp/tempfile :prefix "penpot.media.download.")
written (io/write-to-file! data path :size size)] written (io/write* path data :size size)]
(when (not= written size) (when (not= written size)
(ex/raise :type :internal (ex/raise :type :internal

View file

@ -123,7 +123,7 @@
[{:keys [::db/pool]} {:keys [::session/profile-id params] :as request}] [{:keys [::db/pool]} {:keys [::session/profile-id params] :as request}]
(let [profile (profile/get-profile pool profile-id) (let [profile (profile/get-profile pool profile-id)
project-id (:default-project-id profile) project-id (:default-project-id profile)
data (some-> params :file :path io/read-as-bytes)] data (some-> params :file :path io/read*)]
(if (and data project-id) (if (and data project-id)
(let [fname (str "Imported file *: " (dt/now)) (let [fname (str "Imported file *: " (dt/now))

View file

@ -225,7 +225,7 @@
(letfn [(ttf->otf [data] (letfn [(ttf->otf [data]
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "") (let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".otf")) foutput (fs/path (str finput ".otf"))
_ (io/write-to-file! data finput) _ (io/write* finput data)
res (sh/sh "fontforge" "-lang=ff" "-c" res (sh/sh "fontforge" "-lang=ff" "-c"
(str/fmt "Open('%s'); Generate('%s')" (str/fmt "Open('%s'); Generate('%s')"
(str finput) (str finput)
@ -236,7 +236,7 @@
(otf->ttf [data] (otf->ttf [data]
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "") (let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".ttf")) foutput (fs/path (str finput ".ttf"))
_ (io/write-to-file! data finput) _ (io/write* finput data)
res (sh/sh "fontforge" "-lang=ff" "-c" res (sh/sh "fontforge" "-lang=ff" "-c"
(str/fmt "Open('%s'); Generate('%s')" (str/fmt "Open('%s'); Generate('%s')"
(str finput) (str finput)
@ -250,14 +250,14 @@
;; command. ;; command.
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "") (let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".woff")) foutput (fs/path (str finput ".woff"))
_ (io/write-to-file! data finput) _ (io/write* finput data)
res (sh/sh "sfnt2woff" (str finput))] res (sh/sh "sfnt2woff" (str finput))]
(when (zero? (:exit res)) (when (zero? (:exit res))
foutput))) foutput)))
(woff->sfnt [data] (woff->sfnt [data]
(let [finput (tmp/tempfile :prefix "penpot" :suffix "") (let [finput (tmp/tempfile :prefix "penpot" :suffix "")
_ (io/write-to-file! data finput) _ (io/write* finput data)
res (sh/sh "woff2sfnt" (str finput) res (sh/sh "woff2sfnt" (str finput)
:out-enc :bytes)] :out-enc :bytes)]
(when (zero? (:exit res)) (when (zero? (:exit res))

View file

@ -88,22 +88,6 @@
::yres/headers {"content-type" "application/octet-stream"} ::yres/headers {"content-type" "application/octet-stream"}
::yres/body body}))) ::yres/body body})))
;; {::yres/status 200
;; ::yres/headers {"content-type" "application/octet-stream"}
;; ::yres/body (yres/stream-body
;; (fn [_ output-stream]
;; (try
;; (-> cfg
;; (assoc ::bf.v1/ids #{file-id})
;; (assoc ::bf.v1/embed-assets embed-assets)
;; (assoc ::bf.v1/include-libraries include-libraries)
;; (bf.v1/export-files! output-stream))
;; (catch Throwable cause
;; (l/err :hint "exception on exporting file"
;; :file-id (str file-id)
;; :cause cause)))))}))
;; --- Command: import-binfile ;; --- Command: import-binfile
(defn- import-binfile-v1 (defn- import-binfile-v1

View file

@ -216,7 +216,7 @@
{:response-type :input-stream :sync? true}) {:response-type :input-stream :sync? true})
{:keys [size mtype]} (parse-and-validate response) {:keys [size mtype]} (parse-and-validate response)
path (tmp/tempfile :prefix "penpot.media.download.") path (tmp/tempfile :prefix "penpot.media.download.")
written (io/write-to-file! body path :size size)] written (io/write* path body :size size)]
(when (not= written size) (when (not= written size)
(ex/raise :type :internal (ex/raise :type :internal

View file

@ -18,9 +18,13 @@
[datoteka.io :as io] [datoteka.io :as io]
[integrant.core :as ig]) [integrant.core :as ig])
(:import (:import
java.io.InputStream
java.io.OutputStream
java.nio.file.Files java.nio.file.Files
java.nio.file.Path)) java.nio.file.Path))
(set! *warn-on-reflection* true)
;; --- BACKEND INIT ;; --- BACKEND INIT
(s/def ::directory ::us/string) (s/def ::directory ::us/string)
@ -58,9 +62,9 @@
(when-not (fs/exists? (fs/parent full)) (when-not (fs/exists? (fs/parent full))
(fs/create-dir (fs/parent full))) (fs/create-dir (fs/parent full)))
(dm/with-open [src (io/input-stream content) (with-open [^InputStream src (io/input-stream content)]
dst (io/output-stream full)] (with-open [^OutputStream dst (io/output-stream full)]
(io/copy! src dst)) (io/copy src dst)))
object)) object))
@ -78,8 +82,8 @@
(defmethod impl/get-object-bytes :fs (defmethod impl/get-object-bytes :fs
[backend object] [backend object]
(dm/with-open [input (impl/get-object-data backend object)] (with-open [^InputStream input (impl/get-object-data backend object)]
(io/read-as-bytes input))) (io/read input)))
(defmethod impl/get-object-url :fs (defmethod impl/get-object-url :fs
[{:keys [::uri] :as backend} {:keys [id] :as object} _] [{:keys [::uri] :as backend} {:keys [id] :as object} _]

View file

@ -28,8 +28,7 @@
font-id (uuid/custom 10 1) font-id (uuid/custom 10 1)
ttfdata (-> (io/resource "backend_tests/test_files/font-1.ttf") ttfdata (-> (io/resource "backend_tests/test_files/font-1.ttf")
io/input-stream (io/read*))
io/read-as-bytes)
params {::th/type :create-font-variant params {::th/type :create-font-variant
::rpc/profile-id (:id prof) ::rpc/profile-id (:id prof)
@ -65,8 +64,7 @@
font-id (uuid/custom 10 1) font-id (uuid/custom 10 1)
data (-> (io/resource "backend_tests/test_files/font-1.woff") data (-> (io/resource "backend_tests/test_files/font-1.woff")
io/input-stream (io/read*))
io/read-as-bytes)
params {::th/type :create-font-variant params {::th/type :create-font-variant
::rpc/profile-id (:id prof) ::rpc/profile-id (:id prof)
@ -100,12 +98,10 @@
font-id (uuid/custom 10 1) font-id (uuid/custom 10 1)
data1 (-> (io/resource "backend_tests/test_files/font-1.woff") data1 (-> (io/resource "backend_tests/test_files/font-1.woff")
io/input-stream (io/read*))
io/read-as-bytes)
data2 (-> (io/resource "backend_tests/test_files/font-2.woff") data2 (-> (io/resource "backend_tests/test_files/font-2.woff")
io/input-stream (io/read*))]
io/read-as-bytes)]
;; Create front variant ;; Create front variant
(let [params {::th/type :create-font-variant (let [params {::th/type :create-font-variant
@ -162,12 +158,10 @@
font-id (uuid/custom 10 1) font-id (uuid/custom 10 1)
data1 (-> (io/resource "backend_tests/test_files/font-1.woff") data1 (-> (io/resource "backend_tests/test_files/font-1.woff")
io/input-stream (io/read*))
io/read-as-bytes)
data2 (-> (io/resource "backend_tests/test_files/font-2.woff") data2 (-> (io/resource "backend_tests/test_files/font-2.woff")
io/input-stream (io/read*))]
io/read-as-bytes)]
;; Create front variant ;; Create front variant
(let [params {::th/type :create-font-variant (let [params {::th/type :create-font-variant
@ -224,12 +218,10 @@
font-id (uuid/custom 10 1) font-id (uuid/custom 10 1)
data1 (-> (io/resource "backend_tests/test_files/font-1.woff") data1 (-> (io/resource "backend_tests/test_files/font-1.woff")
io/input-stream (io/read*))
io/read-as-bytes)
data2 (-> (io/resource "backend_tests/test_files/font-2.woff") data2 (-> (io/resource "backend_tests/test_files/font-2.woff")
io/input-stream (io/read*))
io/read-as-bytes)
params1 {::th/type :create-font-variant params1 {::th/type :create-font-variant
::rpc/profile-id (:id prof) ::rpc/profile-id (:id prof)
:team-id team-id :team-id team-id

View file

@ -47,11 +47,7 @@
(t/is (sto/object? mobj1)) (t/is (sto/object? mobj1))
(t/is (sto/object? mobj2)) (t/is (sto/object? mobj2))
(t/is (= 122785 (:size mobj1))) (t/is (= 122785 (:size mobj1)))
;; This is because in ubuntu 21.04 generates different (t/is (= 3302 (:size mobj2)))))))
;; thumbnail that in ubuntu 22.04. This hack should be removed
;; when we all use the ubuntu 22.04 devenv image.
(t/is (or (= 3302 (:size mobj2))
(= 3303 (:size mobj2))))))))
(t/deftest media-object-upload (t/deftest media-object-upload
(let [prof (th/create-profile* 1) (let [prof (th/create-profile* 1)
@ -166,11 +162,7 @@
(t/is (sto/object? mobj1)) (t/is (sto/object? mobj1))
(t/is (sto/object? mobj2)) (t/is (sto/object? mobj2))
(t/is (= 122785 (:size mobj1))) (t/is (= 122785 (:size mobj1)))
;; This is because in ubuntu 21.04 generates different (t/is (= 3302 (:size mobj2)))))))
;; thumbnail that in ubuntu 22.04. This hack should be removed
;; when we all use the ubuntu 22.04 devenv image.
(t/is (or (= 3302 (:size mobj2))
(= 3303 (:size mobj2))))))))
(t/deftest media-object-upload-command (t/deftest media-object-upload-command
(let [prof (th/create-profile* 1) (let [prof (th/create-profile* 1)

View file

@ -202,8 +202,7 @@
:is-shared false}) :is-shared false})
ttfdata (-> (io/resource "backend_tests/test_files/font-1.ttf") ttfdata (-> (io/resource "backend_tests/test_files/font-1.ttf")
io/input-stream (io/read*))
io/read-as-bytes)
mfile {:filename "sample.jpg" mfile {:filename "sample.jpg"
:path (th/tempfile "backend_tests/test_files/sample.jpg") :path (th/tempfile "backend_tests/test_files/sample.jpg")

View file

@ -38,7 +38,7 @@
funcool/datoteka funcool/datoteka
{:git/tag "4.0.0" {:git/tag "4.0.0"
:git/sha "8dcb8fc" :git/sha "3372f3a"
:git/url "https://github.com/funcool/datoteka"} :git/url "https://github.com/funcool/datoteka"}
lambdaisland/uri {:mvn/version "1.19.155" lambdaisland/uri {:mvn/version "1.19.155"
@ -72,7 +72,7 @@
:build :build
{:extra-deps {:extra-deps
{io.github.clojure/tools.build {:git/tag "v0.10.3" :git/sha "15ead66"}} {io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}}
:ns-default build} :ns-default build}
:test :test