diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index 33d087c89..18fdfd0de 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -757,7 +757,8 @@ {::doc/added "1.17"} [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id emails role] :as params}] (db/with-atomic [conn pool] - (let [team (create-team conn params) + (let [params (assoc params :profile-id profile-id) + team (create-team conn params) profile (db/get-by-id conn :profile profile-id) cfg (assoc cfg ::conn conn)] diff --git a/common/src/app/common/geom/shapes/intersect.cljc b/common/src/app/common/geom/shapes/intersect.cljc index 72d5bf47a..12b64f897 100644 --- a/common/src/app/common/geom/shapes/intersect.cljc +++ b/common/src/app/common/geom/shapes/intersect.cljc @@ -363,10 +363,10 @@ c2 (+ (* a2 (:x c)) (* b2 (:y c))) ;; Cramer's rule - det (- (* a1 b2) (* a2 b1))] + det (- (* a1 b2) (* a2 b1)) + det (if (mth/almost-zero? det) 0.001 det) - ;; If almost zero the lines are parallel - (when (not (mth/almost-zero? det)) - (let [x (/ (- (* b2 c1) (* b1 c2)) det) - y (/ (- (* c2 a1) (* c1 a2)) det)] - (gpt/point x y))))) + x (/ (- (* b2 c1) (* b1 c2)) det) + y (/ (- (* c2 a1) (* c1 a2)) det)] + + (gpt/point x y))) diff --git a/docker/images/Dockerfile.backend b/docker/images/Dockerfile.backend index 7a7102332..be6cdaa75 100644 --- a/docker/images/Dockerfile.backend +++ b/docker/images/Dockerfile.backend @@ -1,15 +1,35 @@ -FROM ubuntu:22.04 as jre-build +FROM ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive \ +LABEL maintainer="Andrey Antukh " +ENV LANG='en_US.UTF-8' \ + LC_ALL='en_US.UTF-8' \ + JAVA_HOME="/opt/jdk" \ + PATH=/opt/jdk/bin:$PATH \ + DEBIAN_FRONTEND=noninteractive \ TZ=Etc/UTC -RUN set -eux; \ +RUN set -ex; \ + useradd -U -M -u 1001 -s /bin/false -d /opt/penpot penpot; \ apt-get -qq update; \ + apt-get -qq upgrade; \ apt-get -qqy --no-install-recommends install \ - curl \ - ca-certificates \ - binutils \ + curl \ + tzdata \ + locales \ + ca-certificates \ + imagemagick \ + webp \ + rlwrap \ + fontconfig \ + woff-tools \ + woff2 \ + python3 \ + fontforge \ ; \ + echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ + locale-gen; \ + mkdir -p /opt/penpot/assets; \ + chown -R penpot:penpot /opt/penpot; \ rm -rf /var/lib/apt/lists/*; RUN set -eux; \ @@ -39,49 +59,6 @@ RUN set -eux; \ tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ rm -rf /tmp/openjdk.tar.gz; -RUN /opt/jdk/bin/jlink \ - --verbose \ - --module-path /opt/jdk/jmods \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress 0 \ - --add-modules java.base,java.naming,java.xml,java.logging,java.net.http,java.sql,java.management,java.desktop,jdk.jfr,jdk.unsupported,jdk.management.jfr \ - --output /opt/jre - - -FROM ubuntu:22.04 - -LABEL maintainer="Andrey Antukh " -ENV LANG='en_US.UTF-8' \ - LC_ALL='en_US.UTF-8' \ - JAVA_HOME="/opt/jre" \ - PATH=/opt/jre/bin:$PATH \ - TZ=Etc/UTC - -COPY --from=jre-build /opt/jre /opt/jre - -RUN set -ex; \ - useradd -U -M -u 1001 -s /bin/false -d /opt/penpot penpot; \ - apt-get -qq update; \ - apt-get -qqy --no-install-recommends install \ - curl \ - tzdata \ - locales \ - ca-certificates \ - imagemagick \ - webp \ - fontconfig \ - woff-tools \ - woff2 \ - python3 \ - fontforge \ - ; \ - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen; \ - mkdir -p /opt/penpot/assets; \ - chown -R penpot:penpot /opt/penpot; \ - rm -rf /var/lib/apt/lists/*; COPY --chown=penpot:penpot ./bundle-backend/ /opt/penpot/backend/ diff --git a/docker/images/build.sh b/docker/images/build.sh index 6957c12e6..e9118b1b1 100755 --- a/docker/images/build.sh +++ b/docker/images/build.sh @@ -4,10 +4,13 @@ set -x DOCKER_CLI_EXPERIMENTAL=enabled ORG=${PENPOT_DOCKER_NAMESPACE:-penpotapp}; PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64}; -IMAGE=${1:-backend}; + +IMAGE=${PENPOT_BUILD_IMAGE:-backend} +PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64}; +VERSION=${PENPOT_BUILD_VERSION:-latest} DOCKER_IMAGE="$ORG/$IMAGE"; -OPTIONS="-t $DOCKER_IMAGE:$PENPOT_BUILD_VERSION"; +OPTIONS="-t $DOCKER_IMAGE:$VERSION"; IFS=", " read -a TAGS <<< $PENPOT_BUILD_TAGS; @@ -16,10 +19,6 @@ for element in "${TAGS[@]}"; do OPTIONS="$OPTIONS -t $DOCKER_IMAGE:$element"; done -if [ "$PENPOT_BUILD_PUSH" = "true" ]; then - OPTIONS="--push $OPTIONS" -fi - docker buildx inspect penpot > /dev/null 2>&1; docker run --privileged --rm tonistiigi/binfmt --install all @@ -32,4 +31,5 @@ else fi unset IFS; + docker buildx build --platform ${PLATFORM// /,} $OPTIONS -f Dockerfile.$IMAGE "$@" .; diff --git a/docker/images/docker-compose.yaml b/docker/images/docker-compose.yaml index 2e224c720..90deed915 100644 --- a/docker/images/docker-compose.yaml +++ b/docker/images/docker-compose.yaml @@ -134,7 +134,7 @@ services: ## environment variables for the backend here: ## https://help.penpot.app/technical-guide/configuration/#advanced-configuration - - PENPOT_FLAGS=enable-registration enable-login disable-email-verification enable-smtp enable-prepl-server + - PENPOT_FLAGS=enable-registration enable-login-with-password disable-email-verification enable-smtp enable-prepl-server ## Penpot SECRET KEY. It serves as a master key from which other keys for subsystems ## (eg http sessions) are derived. @@ -260,40 +260,6 @@ services: ports: - "1080:1080" - ## An optional admin application for pentpot. It allows manage users, teams and inspect - ## some parts of the database. You can read more about it on: - ## https://github.com/penpot/penpot-admin - ## - ## If you are going to use admin, ensure to have `enable-prepl-server` in backend flags - ## and uncomment the `PENPOT_PREPL_HOST` environment variable. - ## - ## Status: EXPERIMENTAL - - # penpot-admin: - # image: "penpotapp/admin:latest" - # networks: - # - penpot - # - # depends_on: - # - penpot-postgres - # - penpot-backend - # - # environment: - # ## Adjust to the same value as on backend - # - PENPOT_PUBLIC_URI=http://localhost:9001 - # - # ## Do not touch it, this is an internal routes - # - PENPOT_API_URI=http://penpot-frontend/ - # - PENPOT_PREPL_URI=tcp://penpot-backend:6063/ - # - PENPOT_DEBUG="false" - # - # ## Adjust to the same values as on backend - # - PENPOT_DATABASE_HOST=penpot-postgres - # - PENPOT_DATABASE_NAME=penpot - # - PENPOT_DATABASE_USERNAME=penpot - # - PENPOT_DATABASE_PASSWORD=penpot - # - PENPOT_REDIS_URI=redis://penpot-redis/0 - ## Example configuration of MiniIO (S3 compatible object storage service); If you don't ## have preference, then just use filesystem, this is here just for the completeness. diff --git a/docker/images/files/nginx.conf b/docker/images/files/nginx.conf index cc089b770..f628aacfe 100644 --- a/docker/images/files/nginx.conf +++ b/docker/images/files/nginx.conf @@ -102,9 +102,9 @@ http { proxy_pass http://penpot-backend:6060/api; } - location /admin { - proxy_pass http://penpot-admin:6065/admin; - } + # location /admin { + # proxy_pass http://penpot-admin:6065/admin; + # } location /ws/notifications { proxy_set_header Upgrade $http_upgrade; diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 317d5a1d9..fc7176c21 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -426,8 +426,8 @@ (rx/ignore))))) (defn update-team-photo - [{:keys [file] :as params}] - (us/assert! ::di/file file) + [file] + (us/assert! ::di/blob file) (ptk/reify ::update-team-photo ptk/WatchEvent (watch [_ state _] diff --git a/frontend/src/app/main/data/workspace/shape_layout.cljs b/frontend/src/app/main/data/workspace/shape_layout.cljs index 3ced06e11..9734c6179 100644 --- a/frontend/src/app/main/data/workspace/shape_layout.cljs +++ b/frontend/src/app/main/data/workspace/shape_layout.cljs @@ -56,14 +56,17 @@ {:layout :grid}) (defn get-layout-initializer - [type] + [type from-frame?] (let [initial-layout-data (if (= type :flex) initial-flex-layout initial-grid-layout)] (fn [shape] (-> shape - (merge shape initial-layout-data))))) + (merge initial-layout-data) + ;; If the original shape is not a frame we set clip content and show-viewer to false + (cond-> (not from-frame?) + (assoc :show-content true :hide-in-viewer true)))))) (defn create-layout-from-id - [ids type] + [ids type from-frame?] (ptk/reify ::create-layout-from-id ptk/WatchEvent (watch [_ state _] @@ -71,7 +74,7 @@ children-ids (into [] (mapcat #(get-in objects [% :shapes])) ids) undo-id (js/Symbol)] (rx/of (dwu/start-undo-transaction undo-id) - (dwc/update-shapes ids (get-layout-initializer type)) + (dwc/update-shapes ids (get-layout-initializer type from-frame?)) (ptk/data-event :layout/update ids) (dwc/update-shapes children-ids #(dissoc % :constraints-h :constraints-v)) (dwu/commit-undo-transaction undo-id)))))) @@ -173,7 +176,7 @@ (dws/create-artboard-from-selection new-shape-id parent-id group-index) (cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1}) - (create-layout-from-id [new-shape-id] type) + (create-layout-from-id [new-shape-id] type false) (dwc/update-shapes [new-shape-id] (fn [shape] @@ -193,7 +196,7 @@ (dws/create-artboard-from-selection new-shape-id) (cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1}) - (create-layout-from-id [new-shape-id] type) + (create-layout-from-id [new-shape-id] type false) (dwc/update-shapes [new-shape-id] (fn [shape] @@ -233,7 +236,7 @@ (if (and single? is-frame?) (rx/of (dwu/start-undo-transaction undo-id) - (create-layout-from-id [(first selected)] :flex) + (create-layout-from-id [(first selected)] :flex true) (dwu/commit-undo-transaction undo-id)) (rx/of (dwu/start-undo-transaction undo-id) diff --git a/frontend/src/app/main/ui/auth/register.cljs b/frontend/src/app/main/ui/auth/register.cljs index 16206ab94..e5c1190f2 100644 --- a/frontend/src/app/main/ui/auth/register.cljs +++ b/frontend/src/app/main/ui/auth/register.cljs @@ -252,9 +252,9 @@ [:span (tr "auth.terms-privacy-agreement") [:div - [:a {:href "https://penpot.app/terms.html" :target "_blank"} (tr "auth.terms-of-service")] + [:a {:href "https://penpot.app/terms" :target "_blank"} (tr "auth.terms-of-service")] [:span ",\u00A0"] - [:a {:href "https://penpot.app/privacy.html" :target "_blank"} (tr "auth.privacy-policy")]]]]]) + [:a {:href "https://penpot.app/privacy" :target "_blank"} (tr "auth.privacy-policy")]]]]]) [:& fm/submit-button {:label (tr "auth.register-submit") diff --git a/frontend/src/app/main/ui/dashboard.cljs b/frontend/src/app/main/ui/dashboard.cljs index 4cc988689..ea4acca7e 100644 --- a/frontend/src/app/main/ui/dashboard.cljs +++ b/frontend/src/app/main/ui/dashboard.cljs @@ -169,7 +169,7 @@ [:div.template-card [:div.img-container [:a {:tab-index "0" - :href "https://penpot.app/libraries-templates.html" :target "_blank" :on-click handle-template-link} + :href "https://penpot.app/libraries-templates" :target "_blank" :on-click handle-template-link} [:div.template-link [:div.template-link-title (tr "dashboard.libraries-and-templates")] [:div.template-link-text (tr "dashboard.libraries-and-templates.explore")]]]]]]] diff --git a/frontend/src/app/main/ui/dashboard/sidebar.cljs b/frontend/src/app/main/ui/dashboard/sidebar.cljs index 0b4e574f5..301a81684 100644 --- a/frontend/src/app/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/app/main/ui/dashboard/sidebar.cljs @@ -746,10 +746,10 @@ [:li.separator {:tab-index (if show "0" "-1") - :on-click #(dom/open-new-window "https://penpot.app/libraries-templates.html") + :on-click #(dom/open-new-window "https://penpot.app/libraries-templates") :on-key-down (fn [event] (when (kbd/enter? event) - (dom/open-new-window "https://penpot.app/libraries-templates.html"))) + (dom/open-new-window "https://penpot.app/libraries-templates"))) :data-test "libraries-templates-profile-opt"} [:span.text (tr "labels.libraries-and-templates")]] [:li {:tab-index (if show @@ -763,10 +763,10 @@ [:li {:tab-index (if show "0" "-1") - :on-click #(dom/open-new-window "https://penpot.app/terms.html") + :on-click #(dom/open-new-window "https://penpot.app/terms") :on-key-down (fn [event] (when (kbd/enter? event) - (dom/open-new-window "https://penpot.app/terms.html")))} + (dom/open-new-window "https://penpot.app/terms")))} [:span (tr "auth.terms-of-service")]] (when (contains? @cf/flags :user-feedback) diff --git a/frontend/src/app/main/ui/dashboard/team.cljs b/frontend/src/app/main/ui/dashboard/team.cljs index b1450a734..8c0becf46 100644 --- a/frontend/src/app/main/ui/dashboard/team.cljs +++ b/frontend/src/app/main/ui/dashboard/team.cljs @@ -888,7 +888,7 @@ on-file-selected (fn [file] - (st/emit! (dd/update-team-photo {:file file})))] + (st/emit! (dd/update-team-photo file)))] (mf/use-effect diff --git a/frontend/src/app/main/ui/onboarding/newsletter.cljs b/frontend/src/app/main/ui/onboarding/newsletter.cljs index 27dd432ae..33b465840 100644 --- a/frontend/src/app/main/ui/onboarding/newsletter.cljs +++ b/frontend/src/app/main/ui/onboarding/newsletter.cljs @@ -52,7 +52,7 @@ :id "newsletter-news" :on-change #(toggle newsletter-news)}] [:label {:for "newsletter-news"} (tr "onboarding-v2.newsletter.news")]]] - [:p (tr "onboarding-v2.newsletter.privacy1") [:a {:target "_blank" :href "https://penpot.app/privacy.html"} (tr "onboarding.newsletter.policy")]] + [:p (tr "onboarding-v2.newsletter.privacy1") [:a {:target "_blank" :href "https://penpot.app/privacy"} (tr "onboarding.newsletter.policy")]] [:p (tr "onboarding-v2.newsletter.privacy2")]] [:div.modal-footer [:button.btn-primary {:on-click accept} (tr "labels.continue")]] diff --git a/frontend/src/app/main/ui/releases/v1_10.cljs b/frontend/src/app/main/ui/releases/v1_10.cljs index b2e0c7cf3..a837bd806 100644 --- a/frontend/src/app/main/ui/releases/v1_10.cljs +++ b/frontend/src/app/main/ui/releases/v1_10.cljs @@ -24,7 +24,7 @@ [:div.modal-content [:p "Penpot’s officially beta!"] [:p "We carefully analyzed everything important to us before taking this step. And now we’re ready to move forward onto the beta version. Have a play around if you haven’t yet."] - [:a {:href "https://penpot.app/why-beta.html" :target "_blank"} "Learn why we made this decision."]] + [:a {:href "https://penpot.app/why-beta" :target "_blank"} "Learn why we made this decision."]] [:div.modal-navigation [:button.btn-secondary {:on-click finish} "Explore Penpot Beta 1.10"]]] [:img.deco {:src "images/deco-left.png" :border "0"}] diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index 1bf722ad2..215bdeff8 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -375,7 +375,7 @@ is-flex-container? (and is-frame? (= :flex (:layout (first shapes)))) ids (->> shapes (map :id)) add-flex #(st/emit! (if is-frame? - (dwsl/create-layout-from-id ids :flex) + (dwsl/create-layout-from-id ids :flex true) (dwsl/create-layout-from-selection :flex))) remove-flex #(st/emit! (dwsl/remove-layout ids))] diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index f8e5729ec..8c5418ff4 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -416,11 +416,11 @@ [:span (tr "labels.tutorials")]] [:li {:on-click show-release-notes} [:span (tr "labels.release-notes")]] - [:li.separator {:on-click #(dom/open-new-window "https://penpot.app/libraries-templates.html")} + [:li.separator {:on-click #(dom/open-new-window "https://penpot.app/libraries-templates")} [:span (tr "labels.libraries-and-templates")]] [:li {:on-click #(dom/open-new-window "https://github.com/penpot/penpot")} [:span (tr "labels.github-repo")]] - [:li {:on-click #(dom/open-new-window "https://penpot.app/terms.html")} + [:li {:on-click #(dom/open-new-window "https://penpot.app/terms")} [:span (tr "auth.terms-of-service")]] [:li.separator {:on-click #(st/emit! (when (contains? layout :collapse-left-sidebar) (dw/toggle-layout-flag :collapse-left-sidebar)) (-> (dw/toggle-layout-flag :shortcuts)