mirror of
https://github.com/penpot/penpot.git
synced 2026-01-24 14:21:26 -05:00
Compare commits
85 Commits
hiru-refac
...
2.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5eee1cdbf3 | ||
|
|
54c506100d | ||
|
|
7c64ed84f1 | ||
|
|
5fef0b64f4 | ||
|
|
3294058e16 | ||
|
|
5e8c164a44 | ||
|
|
3472359168 | ||
|
|
1b17742fc3 | ||
|
|
98038b10a0 | ||
|
|
91ca55742a | ||
|
|
e83c90203e | ||
|
|
b4a7a15045 | ||
|
|
b847754e3b | ||
|
|
9c5f7373de | ||
|
|
3e8c665b7f | ||
|
|
cf6bea1974 | ||
|
|
b8bff31aca | ||
|
|
54c4e9af6c | ||
|
|
07d859f9bd | ||
|
|
d008d82a11 | ||
|
|
abff7d324d | ||
|
|
39613944bb | ||
|
|
9194e257b6 | ||
|
|
b54b99becf | ||
|
|
b357cf505d | ||
|
|
632165d6dc | ||
|
|
4d463537dd | ||
|
|
ae6cb551cb | ||
|
|
0f181df767 | ||
|
|
8d104de41c | ||
|
|
a94f1d6fe4 | ||
|
|
c616e3c932 | ||
|
|
bbb64b8be9 | ||
|
|
2c3ae851ea | ||
|
|
7117ea1f7e | ||
|
|
0fc7d8529e | ||
|
|
a8fae53564 | ||
|
|
23bd57e9bb | ||
|
|
11f2d7e711 | ||
|
|
3a71068a48 | ||
|
|
bebdc78ce6 | ||
|
|
22939aa689 | ||
|
|
6901acb37e | ||
|
|
e0fe7181f1 | ||
|
|
a65282c01b | ||
|
|
5b35176584 | ||
|
|
857429290d | ||
|
|
3c842d2b81 | ||
|
|
38fd385d5d | ||
|
|
9bf5b1a8cd | ||
|
|
7c80c605d1 | ||
|
|
0cb2e6d07d | ||
|
|
d907812513 | ||
|
|
d8bf48e49e | ||
|
|
b667f1bb2c | ||
|
|
8e9fa66e2f | ||
|
|
17fb5283cc | ||
|
|
03c9f6b1e1 | ||
|
|
908229b7a8 | ||
|
|
2a752e3625 | ||
|
|
c6fabc349e | ||
|
|
3ea3923751 | ||
|
|
293ab3c80e | ||
|
|
89fa8ce66e | ||
|
|
3bf5648b5b | ||
|
|
57346ab685 | ||
|
|
380c77a704 | ||
|
|
2bca2b005e | ||
|
|
33bdf5e83f | ||
|
|
2a6b9f06b3 | ||
|
|
36e66c4dd9 | ||
|
|
41cdd2453a | ||
|
|
f97b705468 | ||
|
|
5c5188920d | ||
|
|
86ba875317 | ||
|
|
9adfaae6bc | ||
|
|
b130cc40f0 | ||
|
|
227b2fe085 | ||
|
|
c5109a1cd5 | ||
|
|
8093555acc | ||
|
|
4029735364 | ||
|
|
c97f2d620d | ||
|
|
0c302e30c9 | ||
|
|
2fa06baa36 | ||
|
|
9474700d09 |
16
CHANGES.md
16
CHANGES.md
@@ -1,5 +1,13 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 2.0.3
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
- Fix chrome scrollbar styling [Taiga Issue #7852](https://tree.taiga.io/project/penpot/issue/7852)
|
||||
- Fix incorrect password encoding on create-profile manage scritp [Github #3651](https://github.com/penpot/penpot/issues/3651)
|
||||
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### :sparkles: Enhancements
|
||||
@@ -7,6 +15,11 @@
|
||||
- Fix locking contention on cron subsystem (causes backend start blocking)
|
||||
- Fix locking contention on file object thumbails backend RPC calls
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
- Fix color palette sorting [Taiga Issue #7458](https://tree.taiga.io/project/penpot/issue/7458)
|
||||
- Fix style scoping problem with imported SVG [Taiga #7671](https://tree.taiga.io/project/penpot/issue/7671)
|
||||
|
||||
|
||||
## 2.0.1
|
||||
|
||||
@@ -14,6 +27,7 @@
|
||||
|
||||
- Fix different issues related to components v2 migrations including [Github #4443](https://github.com/penpot/penpot/issues/4443)
|
||||
|
||||
|
||||
## 2.0.0 - I Just Can't Get Enough
|
||||
|
||||
### :rocket: Epics and highlights
|
||||
@@ -28,6 +42,8 @@
|
||||
### :boom: Breaking changes & Deprecations
|
||||
|
||||
- New strokes default to inside border [Taiga #6847](https://tree.taiga.io/project/penpot/issue/6847)
|
||||
- Change default z ordering on layers in flex layout. The previous behavior was inconsistent with how HTML works and we changed it to be more consistent. Previous layers that overlapped could be hidden, the fastest way to fix this is changing the z-index property but a better way is to change the order of your layers.
|
||||
|
||||
|
||||
### :heart: Community contributions (Thank you!)
|
||||
- New Hausa, Yoruba and Igbo translations and update translation files (by All For Tech Empowerment Foundation) [Taiga #6950](https://tree.taiga.io/project/penpot/us/6950), [Taiga #6534](https://tree.taiga.io/project/penpot/us/6534)
|
||||
|
||||
124
README.md
124
README.md
@@ -2,11 +2,10 @@
|
||||
[uri_license]: https://www.mozilla.org/en-US/MPL/2.0
|
||||
[uri_license_image]: https://img.shields.io/badge/MPL-2.0-blue.svg
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://penpot.app/images/readme/github-dark-mode.png">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://penpot.app/images/readme/github-light-mode.png">
|
||||
<img alt="penpot header image" src="https://penpot.app/images/readme/github-light-mode.png">
|
||||
</picture>
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<img src="https://penpot.app/images/readme/git-readme-header.png" alt="PENPOT">
|
||||
</h1>
|
||||
|
||||
<p align="center"><a href="https://www.mozilla.org/en-US/MPL/2.0" rel="nofollow"><img src="https://camo.githubusercontent.com/3fcf3d6b678ea15fde3cf7d6af0e242160366282d62a7c182d83a50bfee3f45e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d504c2d322e302d626c75652e737667" alt="License: MPL-2.0" data-canonical-src="https://img.shields.io/badge/MPL-2.0-blue.svg" style="max-width:100%;"></a>
|
||||
<a href="https://gitter.im/penpot/community" rel="nofollow"><img src="https://camo.githubusercontent.com/5b0aecb33434f82a7b158eab7247544235ada0cf7eeb9ce8e52562dd67f614b7/68747470733a2f2f6261646765732e6769747465722e696d2f736572656e6f2d78797a2f636f6d6d756e6974792e737667" alt="Gitter" data-canonical-src="https://badges.gitter.im/sereno-xyz/community.svg" style="max-width:100%;"></a>
|
||||
@@ -14,37 +13,22 @@
|
||||
<a href="https://gitpod.io/#https://github.com/penpot/penpot" rel="nofollow"><img src="https://camo.githubusercontent.com/daadb4894128d1e19b72d80236f5959f1f2b47f9fe081373f3246131f0189f6c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f476974706f642d72656164792d2d746f2d2d636f64652d626c75653f6c6f676f3d676974706f64" alt="Gitpod ready-to-code" data-canonical-src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod" style="max-width:100%;"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://penpot.app/"><b>Website</b></a> •
|
||||
<a href="https://help.penpot.app/technical-guide/getting-started/"><b>Getting Started</b></a> •
|
||||
<a href="https://help.penpot.app/user-guide/"><b>User Guide</b></a> •
|
||||
<a href="https://help.penpot.app/user-guide/introduction/info/"><b>Tutorials & Info</b></a> •
|
||||
<a href="https://community.penpot.app/"><b>Community</b></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://www.youtube.com/@Penpot"><b>Youtube</b></a> •
|
||||
<a href="https://peertube.kaleidos.net/a/penpot_app/video-channels"><b>Peertube</b></a> •
|
||||
<a href="https://www.linkedin.com/company/penpot/"><b>Linkedin</b></a> •
|
||||
<a href="https://instagram.com/penpot.app"><b>Instagram</b></a> •
|
||||
<a href="https://fosstodon.org/@penpot/"><b>Mastodon</b></a> •
|
||||
<a href="https://twitter.com/penpotapp"><b>X</b></a>
|
||||
|
||||
<a href="https://penpot.app/"><b>Website</b></a> •
|
||||
<a href="https://help.penpot.app/technical-guide/getting-started/"><b>Getting Started</b></a> •
|
||||
<a href="https://help.penpot.app/user-guide/"><b>User Guide</b></a> •
|
||||
<a href="https://help.penpot.app/user-guide/introduction/info/"><b>Tutorials & Info</b></a> •
|
||||
<a href="https://community.penpot.app/"><b>Community</b></a> •
|
||||
<a href="https://twitter.com/penpotapp"><b>Twitter</b></a> •
|
||||
<a href="https://instagram.com/penpot.app"><b>Instagram</b></a> •
|
||||
<a href="https://fosstodon.org/@penpot/"><b>Mastodon</b></a> •
|
||||
<a href="https://www.youtube.com/channel/UCAqS8G72uv9P5HG1IfgnQ9g"><b>Youtube</b></a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||

|
||||
|
||||
[Penpot video](https://github.com/penpot/penpot/assets/5446186/b8ad0764-585e-4ddc-b098-9b4090d337cc)
|
||||
🎇 **Penpot Fest exceeded all expectations - it was a complete success!** 🎇 Penpot Fest is our first Design event that brought designers and developers from the Open Source communities and beyond. Watch the replay of the talks on our [Youtube channel](https://www.youtube.com/playlist?list=PLgcCPfOv5v56-fghJo2dHNBqL9zlDTslh) or [Peertube channel](https://peertube.kaleidos.net/w/p/1tWgyJTt8sKbWwCEcBimZW)
|
||||
|
||||
<br />
|
||||
|
||||
Penpot is the first **open-source** design tool for design and code collaboration. Designers can create stunning designs, interactive prototypes, design systems at scale, while developers enjoy ready-to-use code and make their workflow easy and fast. And all of this with no handoff drama.
|
||||
|
||||
Penpot is available on browser and [self host](https://penpot.app/self-host). It’s web-based and works with open standards (SVG, CSS and HTML). And last but not least, it’s free!
|
||||
|
||||
Penpot’s latest [huge release 2.0](https://penpot.app/dev-diaries), takes the platform to a whole new level. This update introduces the ground-breaking [CSS Grid Layout feature](https://penpot.app/penpot-2.0), a complete UI redesign, a new Components system, and much more. Plus, it's faster and more accessible.
|
||||
|
||||
|
||||
🎇 **Penpot Fest is back!** Our design, code & Open Source event is happening in Barcelona | June 5-7th. [Get your tickets](https://www.eventbrite.es/e/penpot-fest-2024-tickets-859331883797) to join other designers and developers from open-source communities and beyond.
|
||||
Check out the highlights from [Penpot Fest 2023 edition](https://www.youtube.com/watch?v=sOpLZaK5mDc)!
|
||||
Penpot is the first **Open Source** design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, Penpot is web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return.
|
||||
|
||||
## Table of contents ##
|
||||
|
||||
@@ -56,47 +40,48 @@ Check out the highlights from [Penpot Fest 2023 edition](https://www.youtube.com
|
||||
|
||||
## Why Penpot ##
|
||||
|
||||
Penpot expresses designs as code. Designers can do their best work and see it will be beautifully implemented by developers in a two-way collaboration.
|
||||
Penpot makes design and prototyping accessible to every team in the world.
|
||||
|
||||
### Designed for developers ###
|
||||
Penpot was built to serve both designers and developers and create a fluid design-code process. You have the choice to enjoy real-time collaboration or play "solo".
|
||||
### For cross-domain teams ###
|
||||
We have a clear focus on design and code teams and our capabilities reflect exactly that. The less hand-off mindset, the more fun for everyone.
|
||||
|
||||
### Inspect mode ###
|
||||
Work with ready-to-use code and make your workflow easy and fast. The inspect tab gives instant access to SVG, CSS and HTML code.
|
||||
### Multiplatform ###
|
||||
Being web based, Penpot is not dependent on operating systems or local installations, you will only need to run a modern browser.
|
||||
|
||||
### Self host your own instance ###
|
||||
Provide your team or organization with a completely owned collaborative design tool. Use Penpot's cloud service or deploy your own Penpot server.
|
||||
|
||||
### Integrations ###
|
||||
Penpot offers integration into the development toolchain, thanks to its support for webhooks and an API accessible through access tokens.
|
||||
|
||||
### What’s great for design ###
|
||||
With Penpot you can design libraries to share and reuse; turn design elements into components and tokens to allow reusability and scalability; and build realistic user flows and interactions.
|
||||
|
||||
<br />
|
||||
### Open Standards ###
|
||||
Using SVG as no other design and prototyping tool does, Penpot files sport compatibility with most of the vectorial tools, are tech friendly and extremely easy to use on the web. We make sure you will always own your work.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.plasmic.app/img-optimizer/v1/img?src=https%3A%2F%2Fimg.plasmic.app%2Fimg-optimizer%2Fv1%2Fimg%2F9dd677c36afb477e9666ccd1d3f009ad.png" alt="Open Source" style="width: 65%;">
|
||||
<img src="https://penpot.app/images/readme/git-open.png" alt="Open Source" style="width: 65%;">
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
## Getting started ##
|
||||
|
||||
### Install with Elestio ###
|
||||
Penpot is the only design & prototype platform that is deployment agnostic. You can use it or deploy it anywhere.
|
||||
[Elestio](https://elest.io/) offers a fully managed service for on-premise instances of a selection of open-source software! This means you can deploy a dedicated instance of Penpot in just 3 minutes with no technical knowledge needed.
|
||||
|
||||
Learn how to install it with Elestio and Docker, or other options on [our website](https://penpot.app/self-host).
|
||||
<br />
|
||||
You don’t need to worry about DNS configuration, SMTP, backups, SSL certificates, OS & Penpot upgrades, and much more.
|
||||
|
||||
[Get started with Elestio.](https://help.penpot.app/technical-guide/getting-started/#install-with-elestio)
|
||||
|
||||
### Install with Docker ###
|
||||
|
||||
You can also get started with Penpot locally or self-host it with **docker** and **docker-compose**.
|
||||
|
||||
Here’s a step-by-step guide on [getting started with Docker.](https://help.penpot.app/technical-guide/getting-started/#install-with-docker)
|
||||
|
||||
### Penpot cloud app ###
|
||||
|
||||
If you prefer not to install Penpot in a local environment, [login or register on our Penpot cloud app](https://design.penpot.app). Create a team to work together on projects and share design assets or jump right away into Penpot and **start designing** on your own.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://site-assets.plasmic.app/2168cf524dd543caeff32384eb9ea0a1.svg" alt="Open Source" style="width: 65%;">
|
||||
<img src="https://penpot.app/images/readme/git-self-host.png" alt="Getting started" style="width: 65%;">
|
||||
</p>
|
||||
<br />
|
||||
|
||||
## Community ##
|
||||
|
||||
We love the Open Source software community. Contributing is our passion and if it’s yours too, participate and [improve](https://community.penpot.app/c/help-us-improve-penpot/7) Penpot. All your designs, code and ideas are welcome!
|
||||
We love the open source software community. Contributing is our passion and if it’s yours too, [participate](https://community.penpot.app/) and [improve](https://community.penpot.app/c/help-us-improve-penpot/7) Penpot. All your ideas and code are welcome!
|
||||
|
||||
If you need help or have any questions; if you’d like to share your experience using Penpot or get inspired; if you’d rather meet our community of developers and designers, [join our Community](https://community.penpot.app/)!
|
||||
|
||||
@@ -108,41 +93,30 @@ You will find the following categories:
|
||||
- [Events and Announcements](https://community.penpot.app/c/announcements/5)
|
||||
- [Inside Penpot](https://community.penpot.app/c/inside-penpot/21)
|
||||
- [Penpot in your language](https://community.penpot.app/c/penpot-in-your-language/12)
|
||||
- [Design and Code Essentials](https://community.penpot.app/c/design-and-code-essentials/22)
|
||||
|
||||
|
||||
<br />
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/penpot/penpot/assets/5446186/6ac62220-a16c-46c9-ab21-d24ae357ed03" alt="Community" style="width: 65%;">
|
||||
<img src="https://penpot.app/images/readme/git-collaborate.png" alt="Communnity" style="width: 65%;">
|
||||
</p>
|
||||
<br />
|
||||
|
||||
## Contributing ##
|
||||
|
||||
Any contribution will make a difference to improve Penpot. How can you get involved?
|
||||
Every sort of contribution will be very helpful to enhance Penpot. How you’ll participate? All your ideas, designs and code are welcome:
|
||||
|
||||
Choose your way:
|
||||
|
||||
- Create and [share Libraries & Templates](https://penpot.app/libraries-templates.html) that will be helpful for the community
|
||||
- Invite your [team to join](https://design.penpot.app/#/auth/register)
|
||||
- Star this repo and follow us on Social Media: [Mastodon](https://fosstodon.org/@penpot/), [Youtube](https://www.youtube.com/c/Penpot), [Instagram](https://instagram.com/penpot.app), [Linkedin](https://www.linkedin.com/company/penpotdesign), [Peertube](https://peertube.kaleidos.net/a/penpot_app) and [X](https://twitter.com/penpotapp).
|
||||
- Participate in the [Community](https://community.penpot.app/) space by asking and answering questions; reacting to others’ articles; opening your own conversations and following along on decisions affecting the project.
|
||||
- Star this repo and follow us on Social Media: [Twitter](https://twitter.com/penpotapp), [Instagram](https://instagram.com/penpot.app), [Youtube](https://www.youtube.com/c/Penpot) or [Mastodon](https://fosstodon.org/@penpot/).
|
||||
- Participate in the [Community](https://community.penpot.app/) asking and answering questions, reacting to others’ articles or opening your own conversations.
|
||||
- Report bugs with our easy [guide for bugs hunting](https://help.penpot.app/contributing-guide/reporting-bugs/) or [GitHub issues](https://github.com/penpot/penpot/issues)
|
||||
- Create and [share Libraries & templates](https://penpot.app/libraries-templates.html) that will be helpful for the community
|
||||
- Become a [translator](https://help.penpot.app/contributing-guide/translations)
|
||||
- Give feedback: [Email us](mailto:support@penpot.app)
|
||||
- Give feedback: [Mail us](mailto:support@penpot.app)
|
||||
- **Contribute to Penpot's code:** [Watch this video](https://www.youtube.com/watch?v=TpN0osiY-8k) by Alejandro Alonso, CIO and developer at Penpot, where he gives us a hands-on demo of how to use Penpot’s repository and make changes in both front and back end
|
||||
|
||||
To find (almost) everything you need to know on how to contribute to Penpot, refer to the [contributing guide](https://help.penpot.app/contributing-guide/).
|
||||
|
||||
<br />
|
||||
To find (almost) everything you need to know on how to contribute to Penpot, refer to the [contributing-guide](https://help.penpot.app/contributing-guide/).
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/penpot/penpot/assets/5446186/fea18923-dc06-49be-86ad-c3496a7956e6" alt="Libraries and templates" style="width: 65%;">
|
||||
<img src="https://penpot.app/images/readme/git-community.png" alt="Contributing" style="width: 65%;">
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
## Resources ##
|
||||
|
||||
You can ask and answer questions, have open-ended conversations, and follow along on decisions affecting the project.
|
||||
@@ -167,4 +141,4 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Copyright (c) KALEIDOS INC
|
||||
```
|
||||
Penpot is a Kaleidos’ [open source project](https://kaleidos.net/)
|
||||
Penpot is a Kaleidos’ [open source project](https://kaleidos.net/products)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
:deps
|
||||
{penpot/common {:local/root "../common"}
|
||||
org.clojure/clojure {:mvn/version "1.12.0-alpha9"}
|
||||
org.clojure/tools.namespace {:mvn/version "1.5.0"}
|
||||
org.clojure/clojure {:mvn/version "1.12.0-alpha5"}
|
||||
org.clojure/tools.namespace {:mvn/version "1.4.4"}
|
||||
|
||||
com.github.luben/zstd-jni {:mvn/version "1.5.5-11"}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
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.3.0.RELEASE"}
|
||||
java-http-clj/java-http-clj {:mvn/version "0.4.3"}
|
||||
|
||||
funcool/yetti
|
||||
@@ -26,13 +26,13 @@
|
||||
:git/url "https://github.com/funcool/yetti.git"
|
||||
:exclusions [org.slf4j/slf4j-api]}
|
||||
|
||||
com.github.seancorfield/next.jdbc {:mvn/version "1.3.925"}
|
||||
com.github.seancorfield/next.jdbc {:mvn/version "1.3.909"}
|
||||
metosin/reitit-core {:mvn/version "0.6.0"}
|
||||
nrepl/nrepl {:mvn/version "1.1.1"}
|
||||
cider/cider-nrepl {:mvn/version "0.47.1"}
|
||||
nrepl/nrepl {:mvn/version "1.1.0"}
|
||||
cider/cider-nrepl {:mvn/version "0.44.0"}
|
||||
|
||||
org.postgresql/postgresql {:mvn/version "42.7.3"}
|
||||
org.xerial/sqlite-jdbc {:mvn/version "3.45.2.0"}
|
||||
org.postgresql/postgresql {:mvn/version "42.7.1"}
|
||||
org.xerial/sqlite-jdbc {:mvn/version "3.44.1.0"}
|
||||
|
||||
com.zaxxer/HikariCP {:mvn/version "5.1.0"}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
org.clojars.pntblnk/clj-ldap {:mvn/version "0.0.17"}
|
||||
|
||||
dawran6/emoji {:mvn/version "0.1.5"}
|
||||
markdown-clj/markdown-clj {:mvn/version "1.12.1"}
|
||||
markdown-clj/markdown-clj {:mvn/version "1.11.7"}
|
||||
|
||||
;; Pretty Print specs
|
||||
pretty-spec/pretty-spec {:mvn/version "0.1.4"}
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
:build
|
||||
{:extra-deps
|
||||
{io.github.clojure/tools.build {:git/tag "v0.10.0" :git/sha "3a2c484"}}
|
||||
{io.github.clojure/tools.build {:git/tag "v0.9.5" :git/sha "24f2894"}}
|
||||
:ns-default build}
|
||||
|
||||
:test
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
[app.http.client :as http]
|
||||
[app.http.session :as session]
|
||||
[app.loggers.audit :as audit]
|
||||
[app.main :as-alias main]
|
||||
[app.rpc.commands.profile :as profile]
|
||||
[app.setup :as-alias setup]
|
||||
[app.tokens :as tokens]
|
||||
@@ -282,12 +283,12 @@
|
||||
(into [(keyword (:name provider) fitem)] (map keyword) items)))
|
||||
|
||||
(defn- build-redirect-uri
|
||||
[{:keys [::provider] :as cfg}]
|
||||
[{:keys [provider] :as cfg}]
|
||||
(let [public (u/uri (cf/get :public-uri))]
|
||||
(str (assoc public :path (str "/api/auth/oauth/" (:name provider) "/callback")))))
|
||||
|
||||
(defn- build-auth-uri
|
||||
[{:keys [::provider] :as cfg} state]
|
||||
[{:keys [provider] :as cfg} state]
|
||||
(let [params {:client_id (:client-id provider)
|
||||
:redirect_uri (build-redirect-uri cfg)
|
||||
:response_type "code"
|
||||
@@ -298,19 +299,15 @@
|
||||
(assoc :query query)
|
||||
(str))))
|
||||
|
||||
(defn- qualify-prop-key
|
||||
[provider k]
|
||||
(keyword (:name provider) (name k)))
|
||||
|
||||
(defn- qualify-props
|
||||
[provider props]
|
||||
(reduce-kv (fn [result k v]
|
||||
(assoc result (qualify-prop-key provider k) v))
|
||||
(assoc result (keyword (:name provider) (name k)) v))
|
||||
{}
|
||||
props))
|
||||
|
||||
(defn- fetch-access-token
|
||||
[{:keys [::provider] :as cfg} code]
|
||||
(defn fetch-access-token
|
||||
[{:keys [provider] :as cfg} code]
|
||||
(let [params {:client_id (:client-id provider)
|
||||
:client_secret (:client-secret provider)
|
||||
:code code
|
||||
@@ -367,7 +364,7 @@
|
||||
:props props})))
|
||||
|
||||
(defn- fetch-user-info
|
||||
[{:keys [::provider] :as cfg} tdata]
|
||||
[{:keys [provider] :as cfg} tdata]
|
||||
(l/trace :hint "fetch user info"
|
||||
:uri (:user-uri provider)
|
||||
:token (obfuscate-string (:token/access tdata)))
|
||||
@@ -392,7 +389,7 @@
|
||||
(-> response :body json/decode)))
|
||||
|
||||
(defn- get-user-info
|
||||
[{:keys [::provider]} tdata]
|
||||
[{:keys [provider]} tdata]
|
||||
(try
|
||||
(when (:token/id tdata)
|
||||
(let [{:keys [kid alg] :as theader} (jwt/decode-header (:token/id tdata))]
|
||||
@@ -416,8 +413,8 @@
|
||||
::fullname
|
||||
::props]))
|
||||
|
||||
(defn- get-info
|
||||
[{:keys [::provider ::setup/props] :as cfg} {:keys [params] :as request}]
|
||||
(defn get-info
|
||||
[{:keys [provider ::setup/props] :as cfg} {:keys [params] :as request}]
|
||||
(when-let [error (get params :error)]
|
||||
(ex/raise :type :internal
|
||||
:code :error-on-retrieving-code
|
||||
@@ -475,108 +472,83 @@
|
||||
(update :props merge (:props state)))))
|
||||
|
||||
(defn- get-profile
|
||||
[cfg info]
|
||||
(db/run! cfg (fn [{:keys [::db/conn]}]
|
||||
(some->> (:email info)
|
||||
(profile/clean-email)
|
||||
(profile/get-profile-by-email conn)))))
|
||||
[{:keys [::db/pool] :as cfg} info]
|
||||
(dm/with-open [conn (db/open pool)]
|
||||
(some->> (:email info)
|
||||
(profile/clean-email)
|
||||
(profile/get-profile-by-email conn))))
|
||||
|
||||
(defn- redirect-response
|
||||
[uri]
|
||||
{::rres/status 302
|
||||
::rres/headers {"location" (str uri)}})
|
||||
|
||||
(defn- redirect-with-error
|
||||
([error] (redirect-with-error error nil))
|
||||
([error hint]
|
||||
(let [params {:error error :hint hint}
|
||||
params (d/without-nils params)
|
||||
uri (-> (u/uri (cf/get :public-uri))
|
||||
(assoc :path "/#/auth/login")
|
||||
(assoc :query (u/map->query-string params)))]
|
||||
(redirect-response uri))))
|
||||
(defn- generate-error-redirect
|
||||
[_ cause]
|
||||
(let [data (if (ex/error? cause) (ex-data cause) nil)
|
||||
code (or (:code data) :unexpected)
|
||||
type (or (:type data) :internal)
|
||||
hint (or (:hint data)
|
||||
(if (ex/exception? cause)
|
||||
(ex-message cause)
|
||||
(str cause)))
|
||||
|
||||
(defn- redirect-to-register
|
||||
[cfg info]
|
||||
(let [info (assoc info
|
||||
:iss :prepared-register
|
||||
:exp (dt/in-future {:hours 48}))
|
||||
params {:error "unable-to-auth"
|
||||
:hint hint
|
||||
:type type
|
||||
:code code}
|
||||
|
||||
params {:token (tokens/generate (::setup/props cfg) info)
|
||||
:fullname (:fullname info)}
|
||||
params (d/without-nils params)]
|
||||
|
||||
(redirect-response
|
||||
(-> (u/uri (cf/get :public-uri))
|
||||
(assoc :path "/#/auth/register/validate")
|
||||
(assoc :query (u/map->query-string params))))))
|
||||
|
||||
(defn- redirect-to-verify-token
|
||||
[token]
|
||||
(let [params {:token token}
|
||||
uri (-> (u/uri (cf/get :public-uri))
|
||||
(assoc :path "/#/auth/verify-token")
|
||||
(assoc :path "/#/auth/login")
|
||||
(assoc :query (u/map->query-string params)))]
|
||||
|
||||
(redirect-response uri)))
|
||||
|
||||
(defn- provider-has-email-verified?
|
||||
[{:keys [::provider] :as cfg} {:keys [props] :as info}]
|
||||
(let [prop (qualify-prop-key provider :email_verified)]
|
||||
(true? (get props prop))))
|
||||
|
||||
(defn- profile-has-provider-props?
|
||||
[{:keys [::provider] :as cfg} profile]
|
||||
(let [prop (qualify-prop-key provider :email)]
|
||||
(contains? (:props profile) prop)))
|
||||
|
||||
(defn- provider-matches-profile?
|
||||
[{:keys [::provider] :as cfg} profile info]
|
||||
(or (= (:auth-backend profile) (:name provider))
|
||||
(profile-has-provider-props? cfg profile)
|
||||
(provider-has-email-verified? cfg info)))
|
||||
|
||||
(defn- process-callback
|
||||
(defn- generate-redirect
|
||||
[cfg request info profile]
|
||||
(cond
|
||||
(some? profile)
|
||||
(cond
|
||||
(:is-blocked profile)
|
||||
(redirect-with-error "profile-blocked")
|
||||
(if profile
|
||||
(let [sxf (session/create-fn cfg (:id profile))
|
||||
token (or (:invitation-token info)
|
||||
(tokens/generate (::setup/props cfg)
|
||||
{:iss :auth
|
||||
:exp (dt/in-future "15m")
|
||||
:profile-id (:id profile)}))
|
||||
params {:token token}
|
||||
uri (-> (u/uri (cf/get :public-uri))
|
||||
(assoc :path "/#/auth/verify-token")
|
||||
(assoc :query (u/map->query-string params)))]
|
||||
|
||||
(not (provider-matches-profile? cfg profile info))
|
||||
(redirect-with-error "auth-provider-not-allowed")
|
||||
(when (:is-blocked profile)
|
||||
(ex/raise :type :restriction
|
||||
:code :profile-blocked))
|
||||
|
||||
(not (:is-active profile))
|
||||
(let [info (assoc info :profile-id (:id profile))]
|
||||
(redirect-to-register cfg info))
|
||||
(audit/submit! cfg {::audit/type "command"
|
||||
::audit/name "login-with-oidc"
|
||||
::audit/profile-id (:id profile)
|
||||
::audit/ip-addr (audit/parse-client-ip request)
|
||||
::audit/props (audit/profile->props profile)})
|
||||
|
||||
:else
|
||||
(let [sxf (session/create-fn cfg (:id profile))
|
||||
token (or (:invitation-token info)
|
||||
(tokens/generate (::setup/props cfg)
|
||||
{:iss :auth
|
||||
:exp (dt/in-future "15m")
|
||||
:props (:props info)
|
||||
:profile-id (:id profile)}))]
|
||||
(->> (redirect-response uri)
|
||||
(sxf request)))
|
||||
|
||||
(audit/submit! cfg {::audit/type "command"
|
||||
::audit/name "login-with-oidc"
|
||||
::audit/profile-id (:id profile)
|
||||
::audit/ip-addr (audit/parse-client-ip request)
|
||||
::audit/props (audit/profile->props profile)})
|
||||
|
||||
(->> (redirect-to-verify-token token)
|
||||
(sxf request))))
|
||||
(if (auth/email-domain-in-whitelist? (:email info))
|
||||
(let [info (assoc info
|
||||
:iss :prepared-register
|
||||
:is-active true
|
||||
:exp (dt/in-future {:hours 48}))
|
||||
token (tokens/generate (::setup/props cfg) info)
|
||||
params (d/without-nils
|
||||
{:token token
|
||||
:provider (:provider (:path-params request))
|
||||
:fullname (:fullname info)})
|
||||
uri (-> (u/uri (cf/get :public-uri))
|
||||
(assoc :path "/#/auth/register/validate")
|
||||
(assoc :query (u/map->query-string params)))]
|
||||
|
||||
(not (auth/email-domain-in-whitelist? (:email info)))
|
||||
(redirect-with-error "email-domain-not-allowed")
|
||||
(redirect-response uri))
|
||||
(generate-error-redirect cfg "email-domain-not-allowed"))))
|
||||
|
||||
:else
|
||||
(let [info (assoc info :is-active (provider-has-email-verified? cfg info))]
|
||||
(if (contains? cf/flags :registration)
|
||||
(redirect-to-register cfg info)
|
||||
(redirect-with-error "registration-disabled")))))
|
||||
|
||||
(defn- auth-handler
|
||||
[cfg {:keys [params] :as request}]
|
||||
@@ -595,10 +567,10 @@
|
||||
(try
|
||||
(let [info (get-info cfg request)
|
||||
profile (get-profile cfg info)]
|
||||
(process-callback cfg request info profile))
|
||||
(generate-redirect cfg request info profile))
|
||||
(catch Throwable cause
|
||||
(l/err :hint "error on oauth process" :cause cause)
|
||||
(redirect-with-error "unable-to-auth" (ex-message cause)))))
|
||||
(l/warn :hint "error on oauth process" :cause cause)
|
||||
(generate-error-redirect cfg cause))))
|
||||
|
||||
(def provider-lookup
|
||||
{:compile
|
||||
@@ -607,12 +579,13 @@
|
||||
(fn [request]
|
||||
(let [provider (some-> request :path-params :provider keyword)]
|
||||
(if-let [provider (get providers provider)]
|
||||
(handler (assoc cfg ::provider provider) request)
|
||||
(handler (assoc cfg :provider provider) request)
|
||||
(ex/raise :type :restriction
|
||||
:code :provider-not-configured
|
||||
:provider provider
|
||||
:hint "provider not configured"))))))})
|
||||
|
||||
|
||||
(s/def ::client-id ::cf/oidc-client-id)
|
||||
(s/def ::client-secret ::cf/oidc-client-secret)
|
||||
(s/def ::base-uri ::cf/oidc-base-uri)
|
||||
@@ -625,6 +598,7 @@
|
||||
(s/def ::email-attr ::cf/oidc-email-attr)
|
||||
(s/def ::name-attr ::cf/oidc-name-attr)
|
||||
|
||||
;; FIXME: migrate to qualified-keywords
|
||||
(s/def ::provider
|
||||
(s/keys :req-un [::client-id
|
||||
::client-secret]
|
||||
|
||||
@@ -113,8 +113,7 @@
|
||||
(s/def ::worker-default-parallelism ::us/integer)
|
||||
(s/def ::worker-webhook-parallelism ::us/integer)
|
||||
|
||||
(s/def ::authenticated-cookie-domain ::us/string)
|
||||
(s/def ::authenticated-cookie-name ::us/string)
|
||||
(s/def ::auth-data-cookie-domain ::us/string)
|
||||
(s/def ::auth-token-cookie-name ::us/string)
|
||||
(s/def ::auth-token-cookie-max-age ::dt/duration)
|
||||
|
||||
@@ -222,7 +221,6 @@
|
||||
::audit-log-http-handler-concurrency
|
||||
::auth-token-cookie-name
|
||||
::auth-token-cookie-max-age
|
||||
::authenticated-cookie-name
|
||||
::authenticated-cookie-domain
|
||||
::database-password
|
||||
::database-uri
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
[app.config :as cf]
|
||||
[app.db :as db]
|
||||
[app.http.session :as session]
|
||||
[app.main :as-alias main]
|
||||
[app.rpc.commands.auth :as auth]
|
||||
[app.rpc.commands.files-create :refer [create-file]]
|
||||
[app.rpc.commands.profile :as profile]
|
||||
@@ -340,57 +341,57 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn- resend-email-notification
|
||||
[cfg {:keys [params] :as request}]
|
||||
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
||||
(when-not (contains? params :force)
|
||||
(ex/raise :type :validation
|
||||
:code :missing-force
|
||||
:hint "missing force checkbox"))
|
||||
[{:keys [::db/pool ::setup/props] :as cfg} {:keys [params] :as request}]
|
||||
|
||||
(let [profile (some->> params
|
||||
:email
|
||||
(profile/clean-email)
|
||||
(profile/get-profile-by-email conn))]
|
||||
(when-not (contains? params :force)
|
||||
(ex/raise :type :validation
|
||||
:code :missing-force
|
||||
:hint "missing force checkbox"))
|
||||
|
||||
(when-not profile
|
||||
(ex/raise :type :validation
|
||||
:code :missing-profile
|
||||
:hint "unable to find profile by email"))
|
||||
(let [profile (some->> params
|
||||
:email
|
||||
(profile/clean-email)
|
||||
(profile/get-profile-by-email pool))]
|
||||
|
||||
(cond
|
||||
(contains? params :block)
|
||||
(do
|
||||
(db/update! conn :profile {:is-blocked true} {:id (:id profile)})
|
||||
(db/delete! conn :http-session {:profile-id (:id profile)})
|
||||
(when-not profile
|
||||
(ex/raise :type :validation
|
||||
:code :missing-profile
|
||||
:hint "unable to find profile by email"))
|
||||
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' BLOCKED" (:email profile))})
|
||||
(cond
|
||||
(contains? params :block)
|
||||
(do
|
||||
(db/update! pool :profile {:is-blocked true} {:id (:id profile)})
|
||||
(db/delete! pool :http-session {:profile-id (:id profile)})
|
||||
|
||||
(contains? params :unblock)
|
||||
(do
|
||||
(db/update! conn :profile {:is-blocked false} {:id (:id profile)})
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' UNBLOCKED" (:email profile))})
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' BLOCKED" (:email profile))})
|
||||
|
||||
(contains? params :resend)
|
||||
(if (:is-blocked profile)
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body "PROFILE ALREADY BLOCKED"}
|
||||
(do
|
||||
(#'auth/send-email-verification! cfg profile)
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "RESENDED FOR '%'" (:email profile))}))
|
||||
(contains? params :unblock)
|
||||
(do
|
||||
(db/update! pool :profile {:is-blocked false} {:id (:id profile)})
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' UNBLOCKED" (:email profile))})
|
||||
|
||||
:else
|
||||
(do
|
||||
(db/update! conn :profile {:is-active true} {:id (:id profile)})
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' ACTIVATED" (:email profile))}))))))
|
||||
(contains? params :resend)
|
||||
(if (:is-blocked profile)
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body "PROFILE ALREADY BLOCKED"}
|
||||
(do
|
||||
(auth/send-email-verification! pool props profile)
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "RESENDED FOR '%'" (:email profile))}))
|
||||
|
||||
:else
|
||||
(do
|
||||
(db/update! pool :profile {:is-active true} {:id (:id profile)})
|
||||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/plain"}
|
||||
::rres/body (str/ffmt "PROFILE '%' ACTIVATED" (:email profile))}))))
|
||||
|
||||
|
||||
(defn- reset-file-version
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[app.common.data :as d]
|
||||
[app.common.logging :as l]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uri :as u]
|
||||
[app.config :as cf]
|
||||
[app.db :as db]
|
||||
[app.db.sql :as sql]
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
;; A cookie that we can use to check from other sites of the same
|
||||
;; domain if a user is authenticated.
|
||||
(def default-authenticated-cookie-name "authenticated")
|
||||
(def default-auth-data-cookie-name "auth-data")
|
||||
|
||||
;; Default value for cookie max-age
|
||||
(def default-cookie-max-age (dt/duration {:days 7}))
|
||||
@@ -133,9 +134,9 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(declare ^:private assign-auth-token-cookie)
|
||||
(declare ^:private assign-authenticated-cookie)
|
||||
(declare ^:private assign-auth-data-cookie)
|
||||
(declare ^:private clear-auth-token-cookie)
|
||||
(declare ^:private clear-authenticated-cookie)
|
||||
(declare ^:private clear-auth-data-cookie)
|
||||
(declare ^:private gen-token)
|
||||
|
||||
(defn create-fn
|
||||
@@ -153,7 +154,7 @@
|
||||
(l/trace :hint "create" :profile-id (str profile-id))
|
||||
(-> response
|
||||
(assign-auth-token-cookie session)
|
||||
(assign-authenticated-cookie session)))))
|
||||
(assign-auth-data-cookie session)))))
|
||||
|
||||
(defn delete-fn
|
||||
[{:keys [::manager]}]
|
||||
@@ -167,7 +168,7 @@
|
||||
(assoc :status 204)
|
||||
(assoc :body nil)
|
||||
(clear-auth-token-cookie)
|
||||
(clear-authenticated-cookie)))))
|
||||
(clear-auth-data-cookie)))))
|
||||
|
||||
(defn- gen-token
|
||||
[props {:keys [profile-id created-at]}]
|
||||
@@ -229,7 +230,7 @@
|
||||
(let [session (update! manager session)]
|
||||
(-> response
|
||||
(assign-auth-token-cookie session)
|
||||
(assign-authenticated-cookie session)))
|
||||
(assign-auth-data-cookie session)))
|
||||
response))))
|
||||
|
||||
(def soft-auth
|
||||
@@ -262,11 +263,11 @@
|
||||
:secure secure?}]
|
||||
(update response :cookies assoc name cookie)))
|
||||
|
||||
(defn- assign-authenticated-cookie
|
||||
[response {updated-at :updated-at}]
|
||||
(defn- assign-auth-data-cookie
|
||||
[response {profile-id :profile-id updated-at :updated-at}]
|
||||
(let [max-age (cf/get :auth-token-cookie-max-age default-cookie-max-age)
|
||||
domain (cf/get :authenticated-cookie-domain)
|
||||
cname (cf/get :authenticated-cookie-name "authenticated")
|
||||
domain (cf/get :auth-data-cookie-domain)
|
||||
cname default-auth-data-cookie-name
|
||||
|
||||
created-at (or updated-at (dt/now))
|
||||
renewal (dt/plus created-at default-renewal-max-age)
|
||||
@@ -274,14 +275,17 @@
|
||||
|
||||
comment (str "Renewal at: " (dt/format-instant renewal :rfc1123))
|
||||
secure? (contains? cf/flags :secure-session-cookies)
|
||||
strict? (contains? cf/flags :strict-session-cookies)
|
||||
cors? (contains? cf/flags :cors)
|
||||
|
||||
cookie {:domain domain
|
||||
:expires expires
|
||||
:path "/"
|
||||
:comment comment
|
||||
:value true
|
||||
:same-site :strict
|
||||
:value (u/map->query-string {:profile-id profile-id})
|
||||
:same-site (if cors? :none (if strict? :strict :lax))
|
||||
:secure secure?}]
|
||||
|
||||
(cond-> response
|
||||
(string? domain)
|
||||
(update :cookies assoc cname cookie))))
|
||||
@@ -291,10 +295,10 @@
|
||||
(let [cname (cf/get :auth-token-cookie-name default-auth-token-cookie-name)]
|
||||
(update response :cookies assoc cname {:path "/" :value "" :max-age 0})))
|
||||
|
||||
(defn- clear-authenticated-cookie
|
||||
(defn- clear-auth-data-cookie
|
||||
[response]
|
||||
(let [cname (cf/get :authenticated-cookie-name default-authenticated-cookie-name)
|
||||
domain (cf/get :authenticated-cookie-domain)]
|
||||
(let [cname default-auth-data-cookie-name
|
||||
domain (cf/get :auth-data-cookie-domain)]
|
||||
(cond-> response
|
||||
(string? domain)
|
||||
(update :cookies assoc cname {:domain domain :path "/" :value "" :max-age 0}))))
|
||||
|
||||
@@ -150,9 +150,8 @@
|
||||
(clean-props))
|
||||
|
||||
token-id (::actoken/id request)
|
||||
context (-> (::context resultm)
|
||||
(assoc :access-token-id (some-> token-id str))
|
||||
(d/without-nils))]
|
||||
context (d/without-nils
|
||||
{:access-token-id (some-> token-id str)})]
|
||||
|
||||
{::type (or (::type resultm)
|
||||
(::rpc/type cfg))
|
||||
|
||||
@@ -77,10 +77,19 @@
|
||||
(when (seq events)
|
||||
(db/insert-many! pool :audit-log event-columns events))))
|
||||
|
||||
(def valid-event-types
|
||||
#{"action" "identify"})
|
||||
|
||||
(def schema:event
|
||||
[:map {:title "Event"}
|
||||
[:name [:string {:max 250}]]
|
||||
[:type [:string {:max 250}]]
|
||||
[:name
|
||||
[:and {:gen/elements ["update-file", "get-profile"]}
|
||||
[:string {:max 250}]
|
||||
[:re #"[\d\w-]{1,50}"]]]
|
||||
[:type
|
||||
[:and {:gen/elements valid-event-types}
|
||||
[:string {:max 250}]
|
||||
[::sm/one-of {:format "string"} valid-event-types]]]
|
||||
[:props
|
||||
[:map-of :keyword :any]]
|
||||
[:context {:optional true}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
[app.email :as eml]
|
||||
[app.http.session :as session]
|
||||
[app.loggers.audit :as audit]
|
||||
[app.main :as-alias main]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.rpc.climit :as-alias climit]
|
||||
[app.rpc.commands.profile :as profile]
|
||||
@@ -37,14 +38,6 @@
|
||||
(def schema:token
|
||||
[::sm/word-string {:max 6000}])
|
||||
|
||||
(def ^:private default-verify-threshold
|
||||
(dt/duration "15m"))
|
||||
|
||||
(defn- elapsed-verify-threshold?
|
||||
[profile]
|
||||
(let [elapsed (dt/diff (:modified-at profile) (dt/now))]
|
||||
(pos? (compare elapsed default-verify-threshold))))
|
||||
|
||||
;; ---- COMMAND: login with password
|
||||
|
||||
(defn login-with-password
|
||||
@@ -146,7 +139,7 @@
|
||||
|
||||
(update-password [conn profile-id]
|
||||
(let [pwd (profile/derive-password cfg password)]
|
||||
(db/update! conn :profile {:password pwd :is-active true} {:id profile-id})
|
||||
(db/update! conn :profile {:password pwd} {:id profile-id})
|
||||
nil))]
|
||||
|
||||
(db/with-atomic [conn pool]
|
||||
@@ -169,8 +162,8 @@
|
||||
|
||||
;; ---- COMMAND: Prepare Register
|
||||
|
||||
(defn- validate-register-attempt!
|
||||
[cfg params]
|
||||
(defn validate-register-attempt!
|
||||
[{:keys [::db/pool] :as cfg} params]
|
||||
|
||||
(when-not (contains? cf/flags :registration)
|
||||
(when-not (contains? params :invitation-token)
|
||||
@@ -178,9 +171,7 @@
|
||||
:code :registration-disabled)))
|
||||
|
||||
(when (contains? params :invitation-token)
|
||||
(let [invitation (tokens/verify (::setup/props cfg)
|
||||
{:token (:invitation-token params)
|
||||
:iss :team-invitation})]
|
||||
(let [invitation (tokens/verify (::setup/props cfg) {:token (:invitation-token params) :iss :team-invitation})]
|
||||
(when-not (= (:email params) (:member-email invitation))
|
||||
(ex/raise :type :restriction
|
||||
:code :email-does-not-match-invitation
|
||||
@@ -190,6 +181,13 @@
|
||||
(ex/raise :type :validation
|
||||
:code :email-domain-is-not-allowed))
|
||||
|
||||
;; Don't allow proceed in preparing registration if the profile is
|
||||
;; already reported as spammer.
|
||||
(when (eml/has-bounce-reports? pool (:email params))
|
||||
(ex/raise :type :validation
|
||||
:code :email-has-permanent-bounces
|
||||
:hint "looks like the email has one or many bounces reported"))
|
||||
|
||||
;; Perform a basic validation of email & password
|
||||
(when (= (str/lower (:email params))
|
||||
(str/lower (:password params)))
|
||||
@@ -197,13 +195,35 @@
|
||||
:code :email-as-password
|
||||
:hint "you can't use your email as password")))
|
||||
|
||||
(def register-retry-threshold
|
||||
(dt/duration "15m"))
|
||||
|
||||
(defn- elapsed-register-retry-threshold?
|
||||
[profile]
|
||||
(let [elapsed (dt/diff (:modified-at profile) (dt/now))]
|
||||
(pos? (compare elapsed register-retry-threshold))))
|
||||
|
||||
(defn prepare-register
|
||||
[{:keys [::db/pool] :as cfg} {:keys [email] :as params}]
|
||||
|
||||
(validate-register-attempt! cfg params)
|
||||
|
||||
(let [email (profile/clean-email email)
|
||||
profile (profile/get-profile-by-email pool email)
|
||||
profile (when-let [profile (profile/get-profile-by-email pool email)]
|
||||
(cond
|
||||
(:is-blocked profile)
|
||||
(ex/raise :type :restriction
|
||||
:code :profile-blocked)
|
||||
|
||||
(and (not (:is-active profile))
|
||||
(elapsed-register-retry-threshold? profile))
|
||||
profile
|
||||
|
||||
:else
|
||||
(ex/raise :type :validation
|
||||
:code :email-already-exists
|
||||
:hint "profile already exists")))
|
||||
|
||||
params {:email email
|
||||
:password (:password params)
|
||||
:invitation-token (:invitation-token params)
|
||||
@@ -213,6 +233,7 @@
|
||||
:exp (dt/in-future {:days 7})}
|
||||
|
||||
params (d/without-nils params)
|
||||
|
||||
token (tokens/generate (::setup/props cfg) params)]
|
||||
(with-meta {:token token}
|
||||
{::audit/profile-id uuid/zero})))
|
||||
@@ -296,16 +317,17 @@
|
||||
{::db/return-keys true})
|
||||
(profile/decode-row))))
|
||||
|
||||
|
||||
(defn send-email-verification!
|
||||
[{:keys [::db/conn] :as cfg} profile]
|
||||
(let [vtoken (tokens/generate (::setup/props cfg)
|
||||
[conn props profile]
|
||||
(let [vtoken (tokens/generate props
|
||||
{:iss :verify-email
|
||||
:exp (dt/in-future "72h")
|
||||
:profile-id (:id profile)
|
||||
:email (:email profile)})
|
||||
;; NOTE: this token is mainly used for possible complains
|
||||
;; identification on the sns webhook
|
||||
ptoken (tokens/generate (::setup/props cfg)
|
||||
ptoken (tokens/generate props
|
||||
{:iss :profile-identity
|
||||
:profile-id (:id profile)
|
||||
:exp (dt/in-future {:days 30})})]
|
||||
@@ -324,94 +346,69 @@
|
||||
(into params)
|
||||
(assoc :fullname fullname))
|
||||
|
||||
is-active (or (:is-active params)
|
||||
(not (contains? cf/flags :email-verification)))
|
||||
|
||||
profile (if-let [profile-id (:profile-id claims)]
|
||||
(profile/get-profile conn profile-id)
|
||||
(let [is-active (or (boolean (:is-active params))
|
||||
(not (contains? cf/flags :email-verification)))
|
||||
params (-> params
|
||||
(assoc :is-active is-active)
|
||||
(update :password #(profile/derive-password cfg %)))]
|
||||
(let [params (-> params
|
||||
(assoc :is-active is-active)
|
||||
(update :password #(profile/derive-password cfg %)))]
|
||||
(->> (create-profile! conn params)
|
||||
(create-profile-rels! conn))))
|
||||
|
||||
invitation (when-let [token (:invitation-token params)]
|
||||
(tokens/verify (::setup/props cfg) {:token token :iss :team-invitation}))
|
||||
|
||||
props (audit/profile->props profile)]
|
||||
(tokens/verify (::setup/props cfg) {:token token :iss :team-invitation}))]
|
||||
|
||||
;; If profile is filled in claims, means it tries to register
|
||||
;; again, so we proceed to update the modified-at attr
|
||||
;; accordingly.
|
||||
(when-let [id (:profile-id claims)]
|
||||
(db/update! conn :profile {:modified-at (dt/now)} {:id id})
|
||||
(audit/submit! cfg
|
||||
{::audit/type "fact"
|
||||
::audit/name "register-profile-retry"
|
||||
::audit/profile-id id}))
|
||||
(cond
|
||||
;; When profile is blocked, we just ignore it and return plain data
|
||||
(:is-blocked profile)
|
||||
(do
|
||||
(l/wrn :hint "register attempt for already blocked profile"
|
||||
:profile-id (str (:id profile))
|
||||
:profile-email (:email profile))
|
||||
(rph/with-meta {:email (:email profile)}
|
||||
{::audit/replace-props props
|
||||
::audit/context {:action "ignore-because-blocked"}
|
||||
::audit/profile-id (:id profile)
|
||||
::audit/name "register-profile-retry"}))
|
||||
|
||||
;; If invitation token comes in params, this is because the user
|
||||
;; comes from team-invitation process; in this case, regenerate
|
||||
;; token and send back to the user a new invitation token (and
|
||||
;; mark current session as logged). This happens only if the
|
||||
;; invitation email matches with the register email.
|
||||
(and (some? invitation)
|
||||
(= (:email profile)
|
||||
(:member-email invitation)))
|
||||
;; If invitation token comes in params, this is because the
|
||||
;; user comes from team-invitation process; in this case,
|
||||
;; regenerate token and send back to the user a new invitation
|
||||
;; token (and mark current session as logged). This happens
|
||||
;; only if the invitation email matches with the register
|
||||
;; email.
|
||||
(and (some? invitation) (= (:email profile) (:member-email invitation)))
|
||||
(let [claims (assoc invitation :member-id (:id profile))
|
||||
token (tokens/generate (::setup/props cfg) claims)]
|
||||
(-> {:invitation-token token}
|
||||
token (tokens/generate (::setup/props cfg) claims)
|
||||
resp {:invitation-token token}]
|
||||
(-> resp
|
||||
(rph/with-transform (session/create-fn cfg (:id profile)))
|
||||
(rph/with-meta {::audit/replace-props props
|
||||
::audit/context {:action "accept-invitation"}
|
||||
(rph/with-meta {::audit/replace-props (audit/profile->props profile)
|
||||
::audit/profile-id (:id profile)})))
|
||||
|
||||
;; When a new user is created and it is already activated by
|
||||
;; configuration or specified by OIDC, we just mark the profile
|
||||
;; as logged-in
|
||||
(not (:profile-id claims))
|
||||
(if (:is-active claims)
|
||||
(-> (profile/strip-private-attrs profile)
|
||||
(rph/with-transform (session/create-fn cfg (:id profile)))
|
||||
(rph/with-meta
|
||||
{::audit/replace-props props
|
||||
::audit/context {:action "login"}
|
||||
::audit/profile-id (:id profile)}))
|
||||
;; If auth backend is different from "penpot" means user is
|
||||
;; registering using third party auth mechanism; in this case
|
||||
;; we need to mark this session as logged.
|
||||
(not= "penpot" (:auth-backend profile))
|
||||
(-> (profile/strip-private-attrs profile)
|
||||
(rph/with-transform (session/create-fn cfg (:id profile)))
|
||||
(rph/with-meta {::audit/replace-props (audit/profile->props profile)
|
||||
::audit/profile-id (:id profile)}))
|
||||
|
||||
(do
|
||||
(send-email-verification! cfg profile)
|
||||
(rph/with-meta {:email (:email profile)}
|
||||
{::audit/replace-props props
|
||||
::audit/context {:action "email-verification"}
|
||||
::audit/profile-id (:id profile)})))
|
||||
;; If the `:enable-insecure-register` flag is set, we proceed
|
||||
;; to sign in the user directly, without email verification.
|
||||
(true? is-active)
|
||||
(-> (profile/strip-private-attrs profile)
|
||||
(rph/with-transform (session/create-fn cfg (:id profile)))
|
||||
(rph/with-meta {::audit/replace-props (audit/profile->props profile)
|
||||
::audit/profile-id (:id profile)}))
|
||||
|
||||
;; In all other cases, send a verification email.
|
||||
:else
|
||||
(let [elapsed? (elapsed-verify-threshold? profile)
|
||||
bounce? (eml/has-bounce-reports? conn (:email profile))
|
||||
action (if bounce?
|
||||
"ignore-because-bounce"
|
||||
(if elapsed?
|
||||
"resend-email-verification"
|
||||
"ignore"))]
|
||||
|
||||
(l/wrn :hint "repeated registry detected"
|
||||
:profile-id (str (:id profile))
|
||||
:profile-email (:email profile)
|
||||
:context-action action)
|
||||
|
||||
(when (= action "resend-email-verification")
|
||||
(db/update! conn :profile
|
||||
{:modified-at (dt/now)}
|
||||
{:id (:id profile)})
|
||||
(send-email-verification! cfg profile))
|
||||
|
||||
(rph/with-meta {:email (:email profile)}
|
||||
(do
|
||||
(send-email-verification! conn (::setup/props cfg) profile)
|
||||
(rph/with-meta profile
|
||||
{::audit/replace-props (audit/profile->props profile)
|
||||
::audit/context {:action action}
|
||||
::audit/profile-id (:id profile)
|
||||
::audit/name "register-profile-retry"})))))
|
||||
::audit/profile-id (:id profile)})))))
|
||||
|
||||
(def schema:register-profile
|
||||
[:map {:title "register-profile"}
|
||||
@@ -430,7 +427,7 @@
|
||||
|
||||
;; ---- COMMAND: Request Profile Recovery
|
||||
|
||||
(defn- request-profile-recovery
|
||||
(defn request-profile-recovery
|
||||
[{:keys [::db/pool] :as cfg} {:keys [email] :as params}]
|
||||
(letfn [(create-recovery-token [{:keys [id] :as profile}]
|
||||
(let [token (tokens/generate (::setup/props cfg)
|
||||
@@ -454,38 +451,26 @@
|
||||
nil))]
|
||||
|
||||
(db/with-atomic [conn pool]
|
||||
(let [profile (->> (profile/clean-email email)
|
||||
(profile/get-profile-by-email conn))]
|
||||
(when-let [profile (->> (profile/clean-email email)
|
||||
(profile/get-profile-by-email conn))]
|
||||
(when-not (eml/allow-send-emails? conn profile)
|
||||
(ex/raise :type :validation
|
||||
:code :profile-is-muted
|
||||
:hint "looks like the profile has reported repeatedly as spam or has permanent bounces."))
|
||||
|
||||
(cond
|
||||
(not profile)
|
||||
(l/wrn :hint "attempt of profile recovery: no profile found"
|
||||
:profile-email email)
|
||||
(when-not (:is-active profile)
|
||||
(ex/raise :type :validation
|
||||
:code :profile-not-verified
|
||||
:hint "the user need to validate profile before recover password"))
|
||||
|
||||
(not (eml/allow-send-emails? conn profile))
|
||||
(l/wrn :hint "attempt of profile recovery: profile is muted"
|
||||
:profile-id (str (:id profile))
|
||||
:profile-email (:email profile))
|
||||
(when (eml/has-bounce-reports? conn (:email profile))
|
||||
(ex/raise :type :validation
|
||||
:code :email-has-permanent-bounces
|
||||
:hint "looks like the email you invite has been repeatedly reported as spam or permanent bounce"))
|
||||
|
||||
(eml/has-bounce-reports? conn (:email profile))
|
||||
(l/wrn :hint "attempt of profile recovery: email has bounces"
|
||||
:profile-id (str (:id profile))
|
||||
:profile-email (:email profile))
|
||||
|
||||
(not (elapsed-verify-threshold? profile))
|
||||
(l/wrn :hint "attempt of profile recovery: retry attempt threshold not elapsed"
|
||||
:profile-id (str (:id profile))
|
||||
:profile-email (:email profile))
|
||||
|
||||
|
||||
:else
|
||||
(do
|
||||
(db/update! conn :profile
|
||||
{:modified-at (dt/now)}
|
||||
{:id (:id profile)})
|
||||
(->> profile
|
||||
(create-recovery-token)
|
||||
(send-email-notification conn))))))))
|
||||
(->> profile
|
||||
(create-recovery-token)
|
||||
(send-email-notification conn))))))
|
||||
|
||||
|
||||
(def schema:request-profile-recovery
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
[app.db.sql :as sql]
|
||||
[app.features.components-v2 :as feat.compv2]
|
||||
[app.features.fdata :as fdata]
|
||||
[app.loggers.audit :as audit]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.rpc.commands.files :as files]
|
||||
[app.rpc.commands.files-create :as files.create]
|
||||
@@ -23,6 +24,7 @@
|
||||
[app.rpc.commands.projects :as projects]
|
||||
[app.rpc.commands.teams :as teams]
|
||||
[app.rpc.doc :as-alias doc]
|
||||
[app.rpc.helpers :as rph]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.pointer-map :as pmap]
|
||||
[app.util.services :as sv]
|
||||
@@ -100,7 +102,9 @@
|
||||
:revn revn
|
||||
:data nil
|
||||
:changes (blob/encode changes)})
|
||||
nil)))
|
||||
(rph/with-meta (rph/wrap nil)
|
||||
{::audit/replace-props {:file-id id
|
||||
:revn revn}}))))
|
||||
|
||||
;; --- MUTATION COMMAND: persist-temp-file
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
[app.db :as db]
|
||||
[app.http.session :as session]
|
||||
[app.loggers.audit :as-alias audit]
|
||||
[app.main :as-alias main]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.rpc.commands.auth :as auth]
|
||||
[app.rpc.commands.profile :as profile]
|
||||
@@ -72,7 +73,7 @@
|
||||
(rph/with-meta {::audit/props (:props profile)
|
||||
::audit/profile-id (:id profile)})))
|
||||
|
||||
(-> (profile/strip-private-attrs profile)
|
||||
(-> profile
|
||||
(rph/with-transform (session/create-fn cfg (:id profile)))
|
||||
(rph/with-meta {::audit/props (:props profile)
|
||||
::audit/profile-id (:id profile)}))))))
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
|
||||
(defn get-profile
|
||||
"Get profile by id. Throws not-found exception if no profile found."
|
||||
[conn id & {:as opts}]
|
||||
(-> (db/get-by-id conn :profile id opts)
|
||||
[conn id & {:as attrs}]
|
||||
(-> (db/get-by-id conn :profile id attrs)
|
||||
(decode-row)))
|
||||
|
||||
;; --- MUTATION: Update Profile (own)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.db.sql :as-alias sql]
|
||||
[app.http.session :as session]
|
||||
[app.loggers.audit :as audit]
|
||||
[app.main :as-alias main]
|
||||
@@ -83,16 +82,8 @@
|
||||
|
||||
(defmethod process-token :auth
|
||||
[{:keys [conn] :as cfg} _params {:keys [profile-id] :as claims}]
|
||||
(let [profile (profile/get-profile conn profile-id {::sql/for-update true})
|
||||
props (merge (:props profile)
|
||||
(:props claims))]
|
||||
(when (not= props (:props profile))
|
||||
(db/update! conn :profile
|
||||
{:props (db/tjson props)}
|
||||
{:id profile-id}))
|
||||
|
||||
(let [profile (assoc profile :props props)]
|
||||
(assoc claims :profile profile))))
|
||||
(let [profile (profile/get-profile conn profile-id)]
|
||||
(assoc claims :profile profile)))
|
||||
|
||||
;; --- Team Invitation
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.rpc.commands.auth :as cmd.auth]
|
||||
[app.rpc.commands.profile :as cmd.profile]
|
||||
[app.util.json :as json]
|
||||
[app.util.time :as dt]
|
||||
[cuerdas.core :as str]))
|
||||
@@ -37,12 +38,13 @@
|
||||
:or {is-active true}}]
|
||||
(when-let [system (get-current-system)]
|
||||
(db/with-atomic [conn (:app.db/pool system)]
|
||||
(let [params {:id (uuid/next)
|
||||
:email email
|
||||
:fullname fullname
|
||||
:is-active is-active
|
||||
:password password
|
||||
:props {}}]
|
||||
(let [password (cmd.profile/derive-password system password)
|
||||
params {:id (uuid/next)
|
||||
:email email
|
||||
:fullname fullname
|
||||
:is-active is-active
|
||||
:password password
|
||||
:props {}}]
|
||||
(->> (cmd.auth/create-profile! conn params)
|
||||
(cmd.auth/create-profile-rels! conn))))))
|
||||
|
||||
|
||||
@@ -86,11 +86,13 @@
|
||||
|
||||
(defn resend-email-verification-email!
|
||||
[email]
|
||||
(db/tx-run! main/system
|
||||
(fn [{:keys [::db/conn] :as cfg}]
|
||||
(let [email (profile/clean-email email)
|
||||
profile (profile/get-profile-by-email conn email)]
|
||||
(#'auth/send-email-verification! cfg profile)))))
|
||||
(let [sprops (:app.setup/props main/system)
|
||||
pool (:app.db/pool main/system)
|
||||
email (profile/clean-email email)
|
||||
profile (profile/get-profile-by-email pool email)]
|
||||
|
||||
(auth/send-email-verification! pool sprops profile)
|
||||
:email-sent))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; PROFILES MANAGEMENT
|
||||
|
||||
@@ -229,51 +229,20 @@
|
||||
(t/is (= "mtma" (:penpot/mtm-campaign props)))))))
|
||||
|
||||
(t/deftest prepare-register-and-register-profile-2
|
||||
(with-mocks [mock {:target 'app.email/send! :return nil}]
|
||||
(let [current-token (atom nil)]
|
||||
;; PREPARE REGISTER
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)
|
||||
token (get-in out [:result :token])]
|
||||
(t/is (th/success? out))
|
||||
(reset! current-token token))
|
||||
(with-redefs [app.rpc.commands.auth/register-retry-threshold (dt/duration 500)]
|
||||
(with-mocks [mock {:target 'app.email/send! :return nil}]
|
||||
(let [current-token (atom nil)]
|
||||
|
||||
;; DO REGISTRATION
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
;; PREPARE REGISTER
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)
|
||||
token (get-in out [:result :token])]
|
||||
(t/is (string? token))
|
||||
(reset! current-token token))
|
||||
|
||||
(th/reset-mock! mock)
|
||||
|
||||
;; PREPARE REGISTER: second attempt
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)
|
||||
token (get-in out [:result :token])]
|
||||
(t/is (th/success? out))
|
||||
(reset! current-token token))
|
||||
|
||||
;; DO REGISTRATION: second attempt
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (= 0 (:call-count @mock))))
|
||||
|
||||
(with-mocks [_ {:target 'app.rpc.commands.auth/elapsed-verify-threshold?
|
||||
:return true}]
|
||||
;; DO REGISTRATION: third attempt
|
||||
;; DO REGISTRATION: try correct register attempt 1
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
@@ -281,57 +250,45 @@
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
|
||||
(th/reset-mock! mock)
|
||||
|
||||
;; PREPARE REGISTER without waiting for threshold
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)]
|
||||
(t/is (not (th/success? out)))
|
||||
(t/is (= :validation (-> out :error th/ex-type)))
|
||||
(t/is (= :email-already-exists (-> out :error th/ex-code))))
|
||||
|
||||
(th/sleep {:millis 500})
|
||||
(th/reset-mock! mock)
|
||||
|
||||
;; PREPARE REGISTER waiting the threshold
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)]
|
||||
|
||||
(t/is (th/success? out))
|
||||
(t/is (= 0 (:call-count @mock)))
|
||||
|
||||
(let [result (:result out)]
|
||||
(t/is (contains? result :token))
|
||||
(reset! current-token (:token result))))
|
||||
|
||||
;; DO REGISTRATION: try correct register attempt 1
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (th/success? out))
|
||||
(t/is (= 1 (:call-count @mock))))))))
|
||||
|
||||
(t/deftest prepare-register-and-register-profile-3
|
||||
(with-mocks [mock {:target 'app.email/send! :return nil}]
|
||||
(let [current-token (atom nil)]
|
||||
;; PREPARE REGISTER
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)
|
||||
token (get-in out [:result :token])]
|
||||
(t/is (th/success? out))
|
||||
(reset! current-token token))
|
||||
|
||||
;; DO REGISTRATION
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
|
||||
(th/reset-mock! mock)
|
||||
|
||||
(th/db-update! :profile
|
||||
{:is-blocked true}
|
||||
{:email "hello@example.com"})
|
||||
|
||||
;; PREPARE REGISTER: second attempt
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
:email "hello@example.com"
|
||||
:password "foobar"}
|
||||
out (th/command! data)
|
||||
token (get-in out [:result :token])]
|
||||
(t/is (th/success? out))
|
||||
(reset! current-token token))
|
||||
|
||||
(with-mocks [_ {:target 'app.rpc.commands.auth/elapsed-verify-threshold?
|
||||
:return true}]
|
||||
;; DO REGISTRATION: second attempt
|
||||
(let [data {::th/type :register-profile
|
||||
:token @current-token
|
||||
:fullname "foobar"
|
||||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (= 0 (:call-count @mock))))))))
|
||||
|
||||
|
||||
(t/deftest prepare-and-register-with-invitation-and-disabled-registration-1
|
||||
(with-redefs [app.config/flags [:disable-registration]]
|
||||
@@ -402,13 +359,13 @@
|
||||
:email (:email profile)
|
||||
:password "foobar"}
|
||||
out (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (th/success? out))
|
||||
(let [result (:result out)]
|
||||
(t/is (contains? result :token)))))
|
||||
|
||||
(t/deftest prepare-register-profile-with-bounced-email
|
||||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :email-already-exists (:code edata))))))
|
||||
|
||||
(t/deftest register-profile-with-bounced-email
|
||||
(let [pool (:app.db/pool th/*system*)
|
||||
data {::th/type :prepare-register-profile
|
||||
:email "user@example.com"
|
||||
@@ -417,9 +374,10 @@
|
||||
(th/create-global-complaint-for pool {:type :bounce :email "user@example.com"})
|
||||
|
||||
(let [out (th/command! data)]
|
||||
(t/is (th/success? out))
|
||||
(let [result (:result out)]
|
||||
(t/is (contains? result :token))))))
|
||||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :email-has-permanent-bounces (:code edata)))))))
|
||||
|
||||
(t/deftest register-profile-with-complained-email
|
||||
(let [pool (:app.db/pool th/*system*)
|
||||
@@ -497,7 +455,7 @@
|
||||
|
||||
(t/deftest request-profile-recovery
|
||||
(with-mocks [mock {:target 'app.email/send! :return nil}]
|
||||
(let [profile1 (th/create-profile* 1 {:is-active false})
|
||||
(let [profile1 (th/create-profile* 1)
|
||||
profile2 (th/create-profile* 2 {:is-active true})
|
||||
pool (:app.db/pool th/*system*)
|
||||
data {::th/type :request-profile-recovery}]
|
||||
@@ -510,47 +468,38 @@
|
||||
|
||||
;; with valid email inactive user
|
||||
(let [data (assoc data :email (:email profile1))
|
||||
out (th/command! data)]
|
||||
out (th/command! data)
|
||||
error (:error out)]
|
||||
(t/is (= 0 (:call-count @mock)))
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (nil? (:error out))))
|
||||
|
||||
(with-mocks [_ {:target 'app.rpc.commands.auth/elapsed-verify-threshold?
|
||||
:return true}]
|
||||
;; with valid email inactive user
|
||||
(let [data (assoc data :email (:email profile1))
|
||||
out (th/command! data)]
|
||||
(t/is (= 1 (:call-count @mock)))
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (nil? (:error out)))))
|
||||
|
||||
(th/reset-mock! mock)
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :validation))
|
||||
(t/is (th/ex-of-code? error :profile-not-verified)))
|
||||
|
||||
;; with valid email and active user
|
||||
(with-mocks [_ {:target 'app.rpc.commands.auth/elapsed-verify-threshold?
|
||||
:return true}]
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
|
||||
;; with valid email and active user with global complaints
|
||||
(th/create-global-complaint-for pool {:type :complaint :email (:email profile2)})
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (= 2 (:call-count @mock))))
|
||||
;; with valid email and active user with global complaints
|
||||
(th/create-global-complaint-for pool {:type :complaint :email (:email profile2)})
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (= 2 (:call-count @mock))))
|
||||
|
||||
;; with valid email and active user with global bounce
|
||||
(th/create-global-complaint-for pool {:type :bounce :email (:email profile2)})
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:result out)))
|
||||
(t/is (nil? (:error out)))
|
||||
;; (th/print-result! out)
|
||||
(t/is (= 2 (:call-count @mock))))))))
|
||||
;; with valid email and active user with global bounce
|
||||
(th/create-global-complaint-for pool {:type :bounce :email (:email profile2)})
|
||||
(let [data (assoc data :email (:email profile2))
|
||||
out (th/command! data)
|
||||
error (:error out)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (= 2 (:call-count @mock)))
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :validation))
|
||||
(t/is (th/ex-of-code? error :email-has-permanent-bounces))))))
|
||||
|
||||
|
||||
(t/deftest update-profile-password
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{:deps
|
||||
{org.clojure/clojure {:mvn/version "1.11.2"}
|
||||
{org.clojure/clojure {:mvn/version "1.11.1"}
|
||||
org.clojure/data.json {:mvn/version "2.5.0"}
|
||||
org.clojure/tools.cli {:mvn/version "1.0.219"}
|
||||
org.clojure/clojurescript {:mvn/version "1.11.132"}
|
||||
@@ -7,12 +7,12 @@
|
||||
org.clojure/data.fressian {:mvn/version "1.0.0"}
|
||||
|
||||
;; Logging
|
||||
org.apache.logging.log4j/log4j-api {:mvn/version "2.23.1"}
|
||||
org.apache.logging.log4j/log4j-core {:mvn/version "2.23.1"}
|
||||
org.apache.logging.log4j/log4j-web {:mvn/version "2.23.1"}
|
||||
org.apache.logging.log4j/log4j-jul {:mvn/version "2.23.1"}
|
||||
org.apache.logging.log4j/log4j-slf4j2-impl {:mvn/version "2.23.1"}
|
||||
org.slf4j/slf4j-api {:mvn/version "2.0.12"}
|
||||
org.apache.logging.log4j/log4j-api {:mvn/version "2.22.1"}
|
||||
org.apache.logging.log4j/log4j-core {:mvn/version "2.22.1"}
|
||||
org.apache.logging.log4j/log4j-web {:mvn/version "2.22.1"}
|
||||
org.apache.logging.log4j/log4j-jul {:mvn/version "2.22.1"}
|
||||
org.apache.logging.log4j/log4j-slf4j2-impl {:mvn/version "2.22.1"}
|
||||
org.slf4j/slf4j-api {:mvn/version "2.0.10"}
|
||||
pl.tkowalcz.tjahzi/log4j2-appender {:mvn/version "0.9.32"}
|
||||
|
||||
selmer/selmer {:mvn/version "1.12.59"}
|
||||
@@ -28,7 +28,7 @@
|
||||
integrant/integrant {:mvn/version "0.8.1"}
|
||||
|
||||
org.apache.commons/commons-pool2 {:mvn/version "2.12.0"}
|
||||
org.graalvm.js/js {:mvn/version "23.0.3"}
|
||||
org.graalvm.js/js {:mvn/version "23.0.2"}
|
||||
|
||||
funcool/tubax {:mvn/version "2021.05.20-0"}
|
||||
funcool/cuerdas {:mvn/version "2023.11.09-407"}
|
||||
@@ -41,7 +41,7 @@
|
||||
:git/tag "3.0.0"
|
||||
:git/url "https://github.com/funcool/datoteka"}
|
||||
|
||||
lambdaisland/uri {:mvn/version "1.19.155"
|
||||
lambdaisland/uri {:mvn/version "1.16.134"
|
||||
:exclusions [org.clojure/data.json]}
|
||||
|
||||
frankiesardo/linked {:mvn/version "1.3.0"}
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
:build
|
||||
{:extra-deps
|
||||
{io.github.clojure/tools.build {:git/tag "v0.10.0" :git/sha "3a2c484"}}
|
||||
{io.github.clojure/tools.build {:git/tag "v0.9.5" :git/sha "24f2894"}}
|
||||
:ns-default build}
|
||||
|
||||
:test
|
||||
|
||||
@@ -274,6 +274,13 @@
|
||||
(catch #?(:clj Throwable :cljs :default) _cause
|
||||
[0 0 0])))
|
||||
|
||||
(defn hex->lum
|
||||
[color]
|
||||
(let [[r g b] (hex->rgb color)]
|
||||
(mth/sqrt (+ (* 0.241 r)
|
||||
(* 0.691 g)
|
||||
(* 0.068 b)))))
|
||||
|
||||
(defn- int->hex
|
||||
"Convert integer to hex string"
|
||||
[v]
|
||||
@@ -455,3 +462,19 @@
|
||||
|
||||
:else
|
||||
[r g (inc b)]))
|
||||
|
||||
(defn reduce-range
|
||||
[value range]
|
||||
(/ (mth/floor (* value range)) range))
|
||||
|
||||
(defn sort-colors
|
||||
[a b]
|
||||
(let [[ah _ av] (hex->hsv (:color a))
|
||||
[bh _ bv] (hex->hsv (:color b))
|
||||
ah (reduce-range (/ ah 60) 8)
|
||||
bh (reduce-range (/ bh 60) 8)
|
||||
av (/ av 255)
|
||||
bv (/ bv 255)
|
||||
a (+ (* ah 100) (* av 10))
|
||||
b (+ (* bh 100) (* bv 10))]
|
||||
(compare a b)))
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
(ns app.common.files.defaults)
|
||||
|
||||
(def version 46)
|
||||
(def version 48)
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
[app.common.schema :as sm]
|
||||
[app.common.svg :as csvg]
|
||||
[app.common.text :as txt]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape.shadow :as ctss]
|
||||
[app.common.uuid :as uuid]
|
||||
@@ -898,6 +900,43 @@
|
||||
(update :pages-index update-vals update-container)
|
||||
(update :components update-vals update-container))))
|
||||
|
||||
(defn migrate-up-47
|
||||
[data]
|
||||
(letfn [(fix-shape [page shape]
|
||||
(let [file {:id (:id data) :data data}
|
||||
component-file (:component-file shape)
|
||||
;; On cloning a file, the component-file of the shapes point to the old file id
|
||||
;; this is a workaround to be able to found the components in that case
|
||||
libraries {component-file {:id component-file :data data}}
|
||||
ref-shape (ctf/find-ref-shape file page libraries shape {:include-deleted? true :with-context? true})
|
||||
ref-parent (get (:objects (:container (meta ref-shape))) (:parent-id ref-shape))
|
||||
shape-swap-slot (ctk/get-swap-slot shape)
|
||||
ref-swap-slot (ctk/get-swap-slot ref-shape)]
|
||||
(if (and (some? shape-swap-slot)
|
||||
(= shape-swap-slot ref-swap-slot)
|
||||
(ctk/main-instance? ref-parent))
|
||||
(ctk/remove-swap-slot shape)
|
||||
shape)))
|
||||
|
||||
(update-page [page]
|
||||
(d/update-when page :objects update-vals (partial fix-shape page)))]
|
||||
(-> data
|
||||
(update :pages-index update-vals update-page))))
|
||||
|
||||
(defn migrate-up-48
|
||||
[data]
|
||||
(letfn [(fix-shape [shape]
|
||||
(let [swap-slot (ctk/get-swap-slot shape)]
|
||||
(if (and (some? swap-slot)
|
||||
(not (ctk/subcopy-head? shape)))
|
||||
(ctk/remove-swap-slot shape)
|
||||
shape)))
|
||||
|
||||
(update-page [page]
|
||||
(d/update-when page :objects update-vals fix-shape))]
|
||||
(-> data
|
||||
(update :pages-index update-vals update-page))))
|
||||
|
||||
(def migrations
|
||||
"A vector of all applicable migrations"
|
||||
[{:id 2 :migrate-up migrate-up-2}
|
||||
@@ -935,4 +974,6 @@
|
||||
{:id 43 :migrate-up migrate-up-43}
|
||||
{:id 44 :migrate-up migrate-up-44}
|
||||
{:id 45 :migrate-up migrate-up-45}
|
||||
{:id 46 :migrate-up migrate-up-46}])
|
||||
{:id 46 :migrate-up migrate-up-46}
|
||||
{:id 47 :migrate-up migrate-up-47}
|
||||
{:id 48 :migrate-up migrate-up-48}])
|
||||
|
||||
@@ -460,6 +460,34 @@
|
||||
(pcb/with-library-data file-data)
|
||||
(pcb/update-component (:id shape) repair-component))))
|
||||
|
||||
(defmethod repair-error :misplaced-slot
|
||||
[_ {:keys [shape page-id] :as error} file-data _]
|
||||
(let [repair-shape
|
||||
(fn [shape]
|
||||
;; Remove the swap slot
|
||||
(log/debug :hint (str " -> remove swap-slot"))
|
||||
(ctk/remove-swap-slot shape))]
|
||||
|
||||
(log/dbg :hint "repairing shape :misplaced-slot" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||
(-> (pcb/empty-changes nil page-id)
|
||||
(pcb/with-file-data file-data)
|
||||
(pcb/update-shapes [(:id shape)] repair-shape))))
|
||||
|
||||
(defmethod repair-error :missing-slot
|
||||
[_ {:keys [shape page-id args] :as error} file-data _]
|
||||
(let [repair-shape
|
||||
(fn [shape]
|
||||
;; Set the desired swap slot
|
||||
(let [slot (:swap-slot args)]
|
||||
(when (some? slot)
|
||||
(log/debug :hint (str " -> set swap-slot to " slot))
|
||||
(update shape :touched cfh/set-touched-group (ctk/build-swap-slot-group slot)))))]
|
||||
|
||||
(log/dbg :hint "repairing shape :missing-slot" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||
(-> (pcb/empty-changes nil page-id)
|
||||
(pcb/with-file-data file-data)
|
||||
(pcb/update-shapes [(:id shape)] repair-shape))))
|
||||
|
||||
(defmethod repair-error :default
|
||||
[_ error file _]
|
||||
(log/error :hint "Unknown error code, don't know how to repair" :code (:code error))
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
(ns app.common.files.validate
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.files.helpers :as cfh]
|
||||
@@ -50,7 +51,9 @@
|
||||
:not-head-copy-not-allowed
|
||||
:not-component-not-allowed
|
||||
:component-nil-objects-not-allowed
|
||||
:instance-head-not-frame})
|
||||
:instance-head-not-frame
|
||||
:misplaced-slot
|
||||
:missing-slot})
|
||||
|
||||
(def ^:private
|
||||
schema:error
|
||||
@@ -285,6 +288,14 @@
|
||||
"Shape inside main instance should not have shape-ref"
|
||||
shape file page)))
|
||||
|
||||
(defn- check-empty-swap-slot
|
||||
"Validate that this shape does not have any swap slot."
|
||||
[shape file page]
|
||||
(when (some? (ctk/get-swap-slot shape))
|
||||
(report-error :misplaced-slot
|
||||
"This shape should not have swap slot"
|
||||
shape file page)))
|
||||
|
||||
(defn- check-shape-main-root-top
|
||||
"Root shape of a top main instance:
|
||||
|
||||
@@ -296,6 +307,7 @@
|
||||
(check-component-main-head shape file page libraries)
|
||||
(check-component-root shape file page)
|
||||
(check-component-not-ref shape file page)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :main-top) (:shapes shape)))
|
||||
|
||||
(defn- check-shape-main-root-nested
|
||||
@@ -307,6 +319,7 @@
|
||||
(check-component-main-head shape file page libraries)
|
||||
(check-component-not-root shape file page)
|
||||
(check-component-not-ref shape file page)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :main-nested) (:shapes shape)))
|
||||
|
||||
(defn- check-shape-copy-root-top
|
||||
@@ -321,6 +334,7 @@
|
||||
(check-component-not-main-head shape file page libraries)
|
||||
(check-component-root shape file page)
|
||||
(check-component-ref shape file page libraries)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :copy-top :library-exists library-exists) (:shapes shape))))
|
||||
|
||||
(defn- check-shape-copy-root-nested
|
||||
@@ -343,6 +357,7 @@
|
||||
(check-component-not-main-not-head shape file page)
|
||||
(check-component-not-root shape file page)
|
||||
(check-component-not-ref shape file page)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :main-any) (:shapes shape)))
|
||||
|
||||
(defn- check-shape-copy-not-root
|
||||
@@ -351,6 +366,7 @@
|
||||
(check-component-not-main-not-head shape file page)
|
||||
(check-component-not-root shape file page)
|
||||
(check-component-ref shape file page libraries)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :copy-any) (:shapes shape)))
|
||||
|
||||
(defn- check-shape-not-component
|
||||
@@ -360,6 +376,7 @@
|
||||
(check-component-not-main-not-head shape file page)
|
||||
(check-component-not-root shape file page)
|
||||
(check-component-not-ref shape file page)
|
||||
(check-empty-swap-slot shape file page)
|
||||
(run! #(check-shape % file page libraries :context :not-component) (:shapes shape)))
|
||||
|
||||
(defn- check-shape
|
||||
@@ -454,6 +471,8 @@
|
||||
;; PUBLIC API: VALIDATION FUNCTIONS
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(declare check-swap-slots)
|
||||
|
||||
(defn validate-file
|
||||
"Validate full referential integrity and semantic coherence on file data.
|
||||
|
||||
@@ -464,6 +483,8 @@
|
||||
|
||||
(doseq [page (filter :id (ctpl/pages-seq data))]
|
||||
(check-shape uuid/zero file page libraries)
|
||||
(when (str/includes? (:name file) "check-swap-slot")
|
||||
(check-swap-slots uuid/zero file page libraries))
|
||||
(->> (get-orphan-shapes page)
|
||||
(run! #(check-shape % file page libraries))))
|
||||
|
||||
@@ -517,3 +538,41 @@
|
||||
:hint "error on validating file referential integrity"
|
||||
:file-id (:id file)
|
||||
:details errors)))
|
||||
|
||||
|
||||
(declare compare-slots)
|
||||
|
||||
;; Optional check to look for missing swap slots.
|
||||
;; Search for copies that do not point the shape-ref to the near component but don't have swap slot
|
||||
;; (looking for position relative to the parent, in the copy and the main).
|
||||
;;
|
||||
;; This check cannot be generally enabled, because files that have been migrated from components v1
|
||||
;; may have copies with shapes that do not match by position, but have not been swapped. So we enable
|
||||
;; it for specific files only. To activate the check, you need to add the string "check-swap-slot" to
|
||||
;; the name of the file.
|
||||
(defn- check-swap-slots
|
||||
[shape-id file page libraries]
|
||||
(let [shape (ctst/get-shape page shape-id)]
|
||||
(if (and (ctk/instance-root? shape) (ctk/in-component-copy? shape))
|
||||
(let [ref-shape (ctf/find-ref-shape file page libraries shape :include-deleted? true :with-context? true)
|
||||
container (:container (meta ref-shape))]
|
||||
(when (some? ref-shape)
|
||||
(compare-slots shape ref-shape file page container)))
|
||||
(doall (for [child-id (:shapes shape)]
|
||||
(check-swap-slots child-id file page libraries))))))
|
||||
|
||||
(defn- compare-slots
|
||||
[shape-copy shape-main file container-copy container-main]
|
||||
(if (and (not= (:shape-ref shape-copy) (:id shape-main))
|
||||
(nil? (ctk/get-swap-slot shape-copy)))
|
||||
(report-error :missing-slot
|
||||
"Shape has been swapped, should have swap slot"
|
||||
shape-copy file container-copy
|
||||
:swap-slot (or (ctk/get-swap-slot shape-main) (:id shape-main)))
|
||||
(when (nil? (ctk/get-swap-slot shape-copy))
|
||||
(let [children-id-pairs (d/zip-all (:shapes shape-copy) (:shapes shape-main))]
|
||||
(doall (for [[child-copy-id child-main-id] children-id-pairs]
|
||||
(let [child-copy (ctst/get-shape container-copy child-copy-id)
|
||||
child-main (ctst/get-shape container-main child-main-id)]
|
||||
(when (and (some? child-copy) (some? child-main))
|
||||
(compare-slots child-copy child-main file container-copy container-main)))))))))
|
||||
|
||||
@@ -130,6 +130,15 @@
|
||||
(and (some? (:component-id shape))
|
||||
(nil? (:component-root shape))))
|
||||
|
||||
(defn subcopy-head?
|
||||
"Check if this shape is the head of a subinstance that is a copy."
|
||||
[shape]
|
||||
;; This is redundant with the previous one, but may give more security
|
||||
;; in case of bugs.
|
||||
(and (some? (:component-id shape))
|
||||
(nil? (:component-root shape))
|
||||
(some? (:shape-ref shape))))
|
||||
|
||||
(defn instance-of?
|
||||
[shape file-id component-id]
|
||||
(and (some? (:component-id shape))
|
||||
@@ -227,7 +236,6 @@
|
||||
:shape-ref
|
||||
:touched))
|
||||
|
||||
|
||||
(defn- extract-ids [shape]
|
||||
(if (map? shape)
|
||||
(let [current-id (:id shape)
|
||||
|
||||
@@ -5,8 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ENV NODE_VERSION=v20.11.1 \
|
||||
CLOJURE_VERSION=1.11.1.1435 \
|
||||
CLJKONDO_VERSION=2024.03.13 \
|
||||
BABASHKA_VERSION=1.3.189 \
|
||||
CLJKONDO_VERSION=2024.02.12 \
|
||||
BABASHKA_VERSION=1.3.188 \
|
||||
CLJFMT_VERSION=0.12.0 \
|
||||
LANG=en_US.UTF-8 \
|
||||
LC_ALL=en_US.UTF-8
|
||||
|
||||
@@ -224,7 +224,7 @@ http {
|
||||
add_header Last-Modified $date_gmt;
|
||||
add_header Cache-Control "no-store, no-cache, max-age=0" always;
|
||||
if_modified_since off;
|
||||
try_files $uri /index.html$is_args$args /index.html =404;
|
||||
try_files $uri /index.html$is_args$args =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,15 @@ cd ~;
|
||||
|
||||
source ~/.bashrc
|
||||
|
||||
set -e;
|
||||
|
||||
echo "[start-tmux.sh] Installing node dependencies"
|
||||
pushd ~/penpot/frontend/
|
||||
yarn install
|
||||
yarn run playwright install --with-deps chromium
|
||||
popd
|
||||
pushd ~/penpot/exporter/
|
||||
yarn install
|
||||
yarn run playwright install --with-deps chromium
|
||||
npx playwright install chromium
|
||||
popd
|
||||
|
||||
tmux -2 new-session -d -s penpot
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
version: "3.5"
|
||||
version: "3.8"
|
||||
|
||||
networks:
|
||||
penpot:
|
||||
|
||||
@@ -202,7 +202,7 @@ http {
|
||||
add_header Last-Modified $date_gmt;
|
||||
add_header Cache-Control "no-store, no-cache, max-age=0" always;
|
||||
if_modified_since off;
|
||||
try_files $uri /index.html$is_args$args /index.html =404;
|
||||
try_files $uri /index.html$is_args$args =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
:dev
|
||||
{:extra-deps
|
||||
{thheller/shadow-cljs {:mvn/version "2.28.3"}}}
|
||||
{thheller/shadow-cljs {:mvn/version "2.27.4"}}}
|
||||
|
||||
:shadow-cljs
|
||||
{:main-opts ["-m" "shadow.cljs.devtools.cli"]}
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
"url": "https://github.com/penpot/penpot"
|
||||
},
|
||||
"dependencies": {
|
||||
"archiver": "^6.0.2",
|
||||
"archiver": "^6.0.1",
|
||||
"cookies": "^0.9.1",
|
||||
"generic-pool": "^3.9.0",
|
||||
"inflation": "^2.1.0",
|
||||
"ioredis": "^5.3.2",
|
||||
"luxon": "^3.4.4",
|
||||
"playwright": "^1.43.0",
|
||||
"playwright": "^1.40.1",
|
||||
"raw-body": "^2.5.2",
|
||||
"xml-js": "^1.6.11",
|
||||
"xregexp": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"shadow-cljs": "2.28.3",
|
||||
"shadow-cljs": "2.27.4",
|
||||
"source-map-support": "^0.5.21"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -135,9 +135,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"archiver@npm:^6.0.2":
|
||||
version: 6.0.2
|
||||
resolution: "archiver@npm:6.0.2"
|
||||
"archiver@npm:^6.0.1":
|
||||
version: 6.0.1
|
||||
resolution: "archiver@npm:6.0.1"
|
||||
dependencies:
|
||||
archiver-utils: "npm:^4.0.1"
|
||||
async: "npm:^3.2.4"
|
||||
@@ -146,7 +146,7 @@ __metadata:
|
||||
readdir-glob: "npm:^1.1.2"
|
||||
tar-stream: "npm:^3.0.0"
|
||||
zip-stream: "npm:^5.0.1"
|
||||
checksum: 23a470d468c01cd40fc13b6bd3dbc6d04c4f7b770785dcc7e1e4af256c3d79c4ffd7f7e0e84ae320437e5b8d0a2117aecfca0586b8c0fbd6edc3e04977c438cc
|
||||
checksum: 54c5a634b39691114e727d4b4f360439fa7cd40b414c9d909606fbfd7048037f7dccefa49337f9ed19b1f5c209e021ce5e1ff9c6b547907257bc71f1af6f8cf3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -727,15 +727,15 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "exporter@workspace:."
|
||||
dependencies:
|
||||
archiver: "npm:^6.0.2"
|
||||
archiver: "npm:^6.0.1"
|
||||
cookies: "npm:^0.9.1"
|
||||
generic-pool: "npm:^3.9.0"
|
||||
inflation: "npm:^2.1.0"
|
||||
ioredis: "npm:^5.3.2"
|
||||
luxon: "npm:^3.4.4"
|
||||
playwright: "npm:^1.43.0"
|
||||
playwright: "npm:^1.40.1"
|
||||
raw-body: "npm:^2.5.2"
|
||||
shadow-cljs: "npm:2.28.3"
|
||||
shadow-cljs: "npm:2.27.4"
|
||||
source-map-support: "npm:^0.5.21"
|
||||
xml-js: "npm:^1.6.11"
|
||||
xregexp: "npm:^5.1.1"
|
||||
@@ -1546,27 +1546,27 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"playwright-core@npm:1.43.0":
|
||||
version: 1.43.0
|
||||
resolution: "playwright-core@npm:1.43.0"
|
||||
"playwright-core@npm:1.40.1":
|
||||
version: 1.40.1
|
||||
resolution: "playwright-core@npm:1.40.1"
|
||||
bin:
|
||||
playwright-core: cli.js
|
||||
checksum: 3afdcc79176e0c872b3bb66994ef6288b10819dfb800234b81134a35daffc8100596d65ccff10faa8941a450a259a78f446db570898e53031abba7f542602c6a
|
||||
checksum: 56c283012974982313a6ae583b975ee4af76d52059fb9a25d9cc616a11224685ec64682b391910c795d2b12d2ab5c7eec31124722c75c0b1703a76ac9b6fd1c2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"playwright@npm:^1.43.0":
|
||||
version: 1.43.0
|
||||
resolution: "playwright@npm:1.43.0"
|
||||
"playwright@npm:^1.40.1":
|
||||
version: 1.40.1
|
||||
resolution: "playwright@npm:1.40.1"
|
||||
dependencies:
|
||||
fsevents: "npm:2.3.2"
|
||||
playwright-core: "npm:1.43.0"
|
||||
playwright-core: "npm:1.40.1"
|
||||
dependenciesMeta:
|
||||
fsevents:
|
||||
optional: true
|
||||
bin:
|
||||
playwright: cli.js
|
||||
checksum: 82506d3937416439d42ed7940e03b62225651a049792b7c122cd1fb4318674e5789dbcd38e31c8e2f41d99e3b7dc9aa0898bfdd26dff5456eb3f89a166252bd8
|
||||
checksum: 5dae164d1f69162da8d7eee52da651296fb885c76a8b36049f216975c751a0a826ff05795a1c0902dc0bd193fe606ae17d5def655f4cbcccb8d8b71afb74b950
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1842,9 +1842,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"shadow-cljs@npm:2.28.3":
|
||||
version: 2.28.3
|
||||
resolution: "shadow-cljs@npm:2.28.3"
|
||||
"shadow-cljs@npm:2.27.4":
|
||||
version: 2.27.4
|
||||
resolution: "shadow-cljs@npm:2.27.4"
|
||||
dependencies:
|
||||
node-libs-browser: "npm:^2.2.1"
|
||||
readline-sync: "npm:^1.4.7"
|
||||
@@ -1854,7 +1854,7 @@ __metadata:
|
||||
ws: "npm:^7.4.6"
|
||||
bin:
|
||||
shadow-cljs: cli/runner.js
|
||||
checksum: 623b536a0d95d7696dd465c09ab3cb5d921c867a577a33463ad58dbc40f51f5d0424ba2791a8803f33a94f5c877198de91c3c7f7616618a6b4ae90e80d5d213e
|
||||
checksum: bae23e71df9c2b2979259a0cde8747c923ee295f58ab4637c9d6b103d82542b40ef39172d4be2dbb94af2e6458a177d1ec96c1eb1e73b1d8f3a4ddb5eaaba7d4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
5
frontend/.gitignore
vendored
5
frontend/.gitignore
vendored
@@ -5,8 +5,3 @@
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
node_modules/
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
|
||||
@@ -30,14 +30,11 @@
|
||||
"translations:find-unused": "node ./scripts/find-unused-translations.js",
|
||||
"compile": "node ./scripts/compile.js",
|
||||
"watch": "node ./scripts/watch.js",
|
||||
"e2e:server": "NODE_NO_WARNINGS=1 http-server ./resources/public -p 3500 -a 0.0.0.0",
|
||||
"e2e:test": "playwright test",
|
||||
"storybook:compile": "gulp template:storybook && clojure -M:dev:shadow-cljs compile storybook",
|
||||
"storybook:watch": "npm run storybook:compile && concurrently \"clojure -M:dev:shadow-cljs watch storybook\" \"storybook dev -p 6006\"",
|
||||
"storybook:build": "npm run storybook:compile && storybook build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.42.1",
|
||||
"@storybook/addon-essentials": "^7.6.17",
|
||||
"@storybook/addon-interactions": "^7.6.17",
|
||||
"@storybook/addon-links": "^7.6.17",
|
||||
@@ -62,7 +59,6 @@
|
||||
"gulp-sass": "^5.1.0",
|
||||
"gulp-sourcemaps": "^3.0.0",
|
||||
"gulp-svg-sprite": "^2.0.3",
|
||||
"http-server": "^14.1.1",
|
||||
"jsdom": "^24.0.0",
|
||||
"map-stream": "0.0.7",
|
||||
"marked": "^12.0.0",
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// require('dotenv').config();
|
||||
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: "./playwright",
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: !!process.env.CI,
|
||||
/* Retry on CI only */
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: "html",
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: "http://0.0.0.0:3500",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: "on-first-retry",
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: {
|
||||
command: "yarn e2e:server",
|
||||
url: "http://0.0.0.0:3500",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test("has title", async ({ page }) => {
|
||||
await page.route("**/api/rpc/command/get-profile", (route) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/transit+json",
|
||||
path: "playwright/fixtures/get-profile-anonymous.json",
|
||||
});
|
||||
});
|
||||
await page.goto("/");
|
||||
|
||||
await expect(page).toHaveTitle(/Penpot/);
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"~:id": "~u00000000-0000-0000-0000-000000000000",
|
||||
"~:fullname": "Anonymous User"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -28,9 +28,16 @@ body {
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
scrollbar-width: thin;
|
||||
// transition: all .4s ease;
|
||||
}
|
||||
|
||||
@-moz-document url-prefix() {
|
||||
* {
|
||||
scrollbar-width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.global-zeroclipboard-container {
|
||||
transition: none;
|
||||
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
|
||||
// SCROLLBAR
|
||||
.new-scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(170, 181, 186, 0.3) transparent;
|
||||
&:hover {
|
||||
scrollbar-color: rgba(170, 181, 186, 0.7) transparent;
|
||||
}
|
||||
|
||||
// These rules do not apply in chrome - 121 or higher
|
||||
// We keep them to preserve backward compatibility.
|
||||
::-webkit-scrollbar {
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
@@ -585,6 +593,9 @@
|
||||
width: 100%;
|
||||
z-index: $z-index-modal;
|
||||
background-color: var(--overlay-color);
|
||||
&.onboarding-a-b-test {
|
||||
background-color: var(--overlay-color-onboarding-a-b-test);
|
||||
}
|
||||
}
|
||||
|
||||
.modal-container-base {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// Dark background
|
||||
--db-primary: #18181a;
|
||||
--db-primary-60: #{color.change(#18181a, $alpha: 0.6)};
|
||||
--db-primary-90: #{color.change(#18181a, $alpha: 0.9)};
|
||||
--db-secondary: #000000;
|
||||
--db-secondary-30: #{color.change(#000000, $alpha: 0.3)};
|
||||
--db-secondary-80: #{color.change(#000000, $alpha: 0.8)};
|
||||
@@ -35,6 +36,7 @@
|
||||
// Light background
|
||||
--lb-primary: #ffffff;
|
||||
--lb-primary-60: #{color.change(#ffffff, $alpha: 0.6)};
|
||||
--lb-primary-90: #{color.change(#ffffff, $alpha: 0.9)};
|
||||
--lb-secondary: #e8eaee;
|
||||
--lb-secondary-30: #{color.change(#e8eaee, $alpha: 0.3)};
|
||||
--lb-secondary-80: #{color.change(#e8eaee, $alpha: 0.8)};
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
--color-info-foreground: var(--status-color-info-500);
|
||||
|
||||
--overlay-color: var(--db-primary-60);
|
||||
--overlay-color-onboarding-a-b-test: var(--db-primary-90);
|
||||
|
||||
--shadow-color: var(--db-secondary-30);
|
||||
--radio-button-box-shadow: 0 0 0 1px var(--db-secondary-30) inset;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
--color-info-foreground: var(--status-color-info-500);
|
||||
|
||||
--overlay-color: var(--lb-primary-60);
|
||||
--overlay-color-onboarding-a-b-test: var(--lb-primary-90);
|
||||
|
||||
--shadow-color: var(--lf-secondary-40);
|
||||
--radio-button-box-shadow: 0 0 0 1px var(--lb-secondary) inset;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
||||
|
||||
@@ -130,6 +130,10 @@
|
||||
(def worker-uri
|
||||
(obj/get global "penpotWorkerURI" "/js/worker.js"))
|
||||
|
||||
(defn external-feature-flag [flag value]
|
||||
(when-let [fn (obj/get global "externalFeatureFlag")]
|
||||
(fn flag value)))
|
||||
|
||||
;; --- Helper Functions
|
||||
|
||||
(defn ^boolean check-browser? [candidate]
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
(ns app.libs.file-builder
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.features :as cfeat]
|
||||
[app.common.files.builder :as fb]
|
||||
[app.common.media :as cm]
|
||||
[app.common.types.components-list :as ctkl]
|
||||
@@ -73,7 +74,7 @@
|
||||
|
||||
manifest-stream
|
||||
(->> files-stream
|
||||
(rx/map #(e/create-manifest (uuid/next) (:id file) :all % false))
|
||||
(rx/map #(e/create-manifest (uuid/next) (:id file) :all % cfeat/default-features))
|
||||
(rx/map (fn [a]
|
||||
(vector "manifest.json" a))))
|
||||
|
||||
@@ -144,7 +145,7 @@
|
||||
(str (:current-page-id file)))
|
||||
|
||||
(addPage [_ name options]
|
||||
(set! file (fb/add-page file {:name name :options options}))
|
||||
(set! file (fb/add-page file {:name name :options (parse-data options)}))
|
||||
(str (:current-page-id file)))
|
||||
|
||||
(closePage [_]
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
[app.config :as cf]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.media :as di]
|
||||
[app.main.data.messages :as msg]
|
||||
[app.main.data.websocket :as ws]
|
||||
[app.main.features :as features]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.i18n :as i18n]
|
||||
[app.util.router :as rt]
|
||||
[app.util.storage :refer [storage]]
|
||||
[beicon.v2.core :as rx]
|
||||
@@ -232,35 +231,8 @@
|
||||
(rx/observe-on :async)))))
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(def ^:private schema:login-with-ldap
|
||||
(sm/define
|
||||
[:map
|
||||
[:email ::sm/email]
|
||||
[:password :string]]))
|
||||
|
||||
(defn login-with-ldap
|
||||
[params]
|
||||
|
||||
(dm/assert!
|
||||
"expected valid params"
|
||||
(sm/check! schema:login-with-ldap params))
|
||||
|
||||
(ptk/reify ::login-with-ldap
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(let [{:keys [on-error on-success]
|
||||
:or {on-error rx/throw
|
||||
on-success identity}} (meta params)]
|
||||
(->> (rp/cmd! :login-with-ldap params)
|
||||
(rx/tap on-success)
|
||||
(rx/map (fn [profile]
|
||||
(-> profile
|
||||
(with-meta {::ev/source "login-with-ldap"})
|
||||
(logged-in))))
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(defn login-from-token
|
||||
"Used mainly as flow continuation after token validation."
|
||||
[{:keys [profile] :as tdata}]
|
||||
(ptk/reify ::login-from-token
|
||||
ptk/WatchEvent
|
||||
@@ -684,24 +656,3 @@
|
||||
(->> (rp/cmd! :delete-access-token params)
|
||||
(rx/tap on-success)
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(defn show-redirect-error
|
||||
"A helper event that interprets the OIDC redirect errors on the URI
|
||||
and shows an appropriate error message using the notification
|
||||
banners."
|
||||
[error]
|
||||
(ptk/reify ::show-redirect-error
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(let [hint (case error
|
||||
"registration-disabled"
|
||||
(tr "errors.registration-disabled")
|
||||
"profile-blocked"
|
||||
(tr "errors.profile-blocked")
|
||||
"auth-provider-not-allowed"
|
||||
(tr "errors.auth-provider-not-allowed")
|
||||
"email-domain-not-allowed"
|
||||
(tr "errors.email-domain-not-allowed")
|
||||
:else
|
||||
(tr "errors.generic"))]
|
||||
(rx/of (msg/warn hint))))))
|
||||
|
||||
@@ -143,18 +143,12 @@
|
||||
(map-indexed vector)
|
||||
(filter #(#{(:id group)} (second %)))
|
||||
(ffirst)
|
||||
inc)
|
||||
|
||||
;; Shapes that are in a component (including root) must be detached,
|
||||
;; because cannot be easyly synchronized back to the main component.
|
||||
shapes-to-detach (filter ctk/in-component-copy?
|
||||
(cfh/get-children-with-self objects (:id group)))]
|
||||
inc)]
|
||||
|
||||
(-> (pcb/empty-changes it page-id)
|
||||
(pcb/with-objects objects)
|
||||
(pcb/change-parent parent-id children index-in-parent)
|
||||
(pcb/remove-objects [(:id group)])
|
||||
(pcb/update-shapes (map :id shapes-to-detach) ctk/detach-shape))))
|
||||
(pcb/remove-objects [(:id group)]))))
|
||||
|
||||
(defn remove-frame-changes
|
||||
[it page-id frame objects]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
[app.common.files.libraries-helpers :as cflh]
|
||||
[app.common.files.shapes-helpers :as cfsh]
|
||||
[app.common.geom.point :as gpt]
|
||||
;; [app.common.logging :as log]
|
||||
[app.common.logging :as log]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.components-list :as ctkl]
|
||||
@@ -51,28 +51,26 @@
|
||||
[cuerdas.core :as str]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; ;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||
;; (log/set-level! :debug)
|
||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||
(log/set-level! :warn)
|
||||
|
||||
(defn- log-changes
|
||||
[changes file]
|
||||
(let [extract-change
|
||||
(fn [change]
|
||||
(let [shape (if-let [obj (:obj change)]
|
||||
obj
|
||||
(when (:id change)
|
||||
(cond
|
||||
(:page-id change)
|
||||
(get-in file [:pages-index
|
||||
(:page-id change)
|
||||
:objects
|
||||
(:id change)])
|
||||
(:component-id change)
|
||||
(get-in file [:components
|
||||
(:component-id change)
|
||||
:objects
|
||||
(:id change)])
|
||||
:else nil)))
|
||||
(let [shape (when (:id change)
|
||||
(cond
|
||||
(:page-id change)
|
||||
(get-in file [:pages-index
|
||||
(:page-id change)
|
||||
:objects
|
||||
(:id change)])
|
||||
(:component-id change)
|
||||
(get-in file [:components
|
||||
(:component-id change)
|
||||
:objects
|
||||
(:id change)])
|
||||
:else nil))
|
||||
|
||||
prefix (if (:component-id change) "[C] " "[P] ")
|
||||
|
||||
@@ -713,7 +711,7 @@
|
||||
(ptk/reify ::sync-head
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(dwlh/dbg-warn "SYNC-HEAD of shape" :id id)
|
||||
(log/info :msg "SYNC-head of shape" :id (str id))
|
||||
(let [file (wsh/get-local-file state)
|
||||
file-full (wsh/get-local-file-full state)
|
||||
libraries (wsh/get-libraries state)
|
||||
@@ -735,7 +733,9 @@
|
||||
(pcb/with-objects (:objects container))
|
||||
(dwlh/generate-sync-shape-direct file-full libraries container (:id head) false components-v2))]
|
||||
|
||||
(dwlh/dbg-info "SYNC-HEAD finished" :rchanges (dwlh/dbg-obj (log-changes (:redo-changes changes) file)))
|
||||
(log/debug :msg "SYNC-head finished" :js/rchanges (log-changes
|
||||
(:redo-changes changes)
|
||||
file))
|
||||
(rx/of (dch/commit-changes changes))))))
|
||||
|
||||
(defn reset-component
|
||||
@@ -747,7 +747,7 @@
|
||||
(ptk/reify ::reset-component
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(dwlh/dbg-warn "RESET-COMPONENT of shape" :id id)
|
||||
(log/info :msg "RESET-COMPONENT of shape" :id (str id))
|
||||
(let [file (wsh/get-local-file state)
|
||||
file-full (wsh/get-local-file-full state)
|
||||
libraries (wsh/get-libraries state)
|
||||
@@ -769,7 +769,9 @@
|
||||
(pcb/with-objects (:objects container))
|
||||
(dwlh/generate-sync-shape-direct file-full libraries container id true components-v2))]
|
||||
|
||||
(dwlh/dbg-info "RESET-COMPONENT finished" :rchanges (dwlh/dbg-obj (log-changes (:redo-changes changes) file)))
|
||||
(log/debug :msg "RESET-COMPONENT finished" :js/rchanges (log-changes
|
||||
(:redo-changes changes)
|
||||
file))
|
||||
(rx/of
|
||||
(dwu/start-undo-transaction undo-id)
|
||||
(dch/commit-changes changes)
|
||||
@@ -806,7 +808,7 @@
|
||||
(ptk/reify ::update-component
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(dwlh/dbg-warn "UPDATE-COMPONENT of shape" :id id :undo-group undo-group)
|
||||
(log/info :msg "UPDATE-COMPONENT of shape" :id (str id) :undo-group undo-group)
|
||||
(let [page-id (get state :current-page-id)
|
||||
local-file (wsh/get-local-file state)
|
||||
full-file (wsh/get-local-file-full state)
|
||||
@@ -842,9 +844,13 @@
|
||||
(update :redo-changes #(into [] xf-remove %))
|
||||
(update :undo-changes #(into [] xf-remove %)))]
|
||||
|
||||
(dwlh/dbg-info "UPDATE-COMPONENT finished"
|
||||
:local-changes (dwlh/dbg-obj (log-changes (:redo-changes local-changes) file))
|
||||
:nonlocal-changes (dwlh/dbg-obj (log-changes (:redo-changes nonlocal-changes) file)))
|
||||
(log/debug :msg "UPDATE-COMPONENT finished"
|
||||
:js/local-changes (log-changes
|
||||
(:redo-changes local-changes)
|
||||
file)
|
||||
:js/nonlocal-changes (log-changes
|
||||
(:redo-changes nonlocal-changes)
|
||||
file))
|
||||
|
||||
(rx/of
|
||||
(when (seq (:redo-changes local-changes))
|
||||
@@ -1032,10 +1038,10 @@
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [undo-id (js/Symbol)]
|
||||
(dwlh/dbg-warn "COMPONENT-SWAP"
|
||||
:file (dwlh/dbg-file file-id state)
|
||||
:id-new-component id-new-component
|
||||
:undo-id undo-id)
|
||||
(log/info :msg "COMPONENT-SWAP"
|
||||
:file (dwlh/pretty-file file-id state)
|
||||
:id-new-component id-new-component
|
||||
:undo-id undo-id)
|
||||
(rx/concat
|
||||
(rx/of (dwu/start-undo-transaction undo-id))
|
||||
(rx/map #(component-swap % file-id id-new-component) (rx/from shapes))
|
||||
@@ -1085,12 +1091,12 @@
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(when (and (some? file-id) (some? library-id)) ; Prevent race conditions while navigating out of the file
|
||||
(dwlh/dbg-warn "SYNC-FILE"
|
||||
:file (dwlh/dbg-file file-id state)
|
||||
:library (dwlh/dbg-file library-id state)
|
||||
:asset-type asset-type
|
||||
:asset-id asset-id
|
||||
:undo-group undo-group)
|
||||
(log/info :msg "SYNC-FILE"
|
||||
:file (dwlh/pretty-file file-id state)
|
||||
:library (dwlh/pretty-file library-id state)
|
||||
:asset-type asset-type
|
||||
:asset-id asset-id
|
||||
:undo-group undo-group)
|
||||
(let [file (wsh/get-file state file-id)
|
||||
|
||||
sync-components? (or (nil? asset-type) (= asset-type :components))
|
||||
@@ -1130,8 +1136,9 @@
|
||||
(mapcat find-frames)
|
||||
distinct)]
|
||||
|
||||
(dwlh/dbg-info "SYNC-FILE finished"
|
||||
:rchanges (dwlh/dbg-obj (log-changes (:redo-changes changes) file)))
|
||||
(log/debug :msg "SYNC-FILE finished" :js/rchanges (log-changes
|
||||
(:redo-changes changes)
|
||||
file))
|
||||
(rx/concat
|
||||
(rx/of (set-updating-library false)
|
||||
(msg/hide-tag :sync-dialog))
|
||||
@@ -1299,9 +1306,9 @@
|
||||
|
||||
(if (d/not-empty? changed-components)
|
||||
(if save-undo?
|
||||
(do (dwlh/dbg-warn "DETECTED COMPONENTS CHANGED"
|
||||
:ids (map dwlh/dbg-id changed-components)
|
||||
:undo-group undo-group)
|
||||
(do (log/info :msg "DETECTED COMPONENTS CHANGED"
|
||||
:ids (map str changed-components)
|
||||
:undo-group undo-group)
|
||||
|
||||
(->> (rx/from changed-components)
|
||||
(rx/map #(component-changed % (:id old-data) undo-group))))
|
||||
@@ -1320,7 +1327,7 @@
|
||||
notifier-s
|
||||
(->> changes-s
|
||||
(rx/debounce 5000)
|
||||
(rx/tap #(dwlh/dbg-log "buffer initialized")))]
|
||||
(rx/tap #(log/trc :hint "buffer initialized")))]
|
||||
|
||||
(when components-v2?
|
||||
(->> (rx/merge
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.geom.shapes.grid-layout :as gslg]
|
||||
;; [app.common.logging :as log]
|
||||
[app.common.logging :as log]
|
||||
[app.common.spec :as us]
|
||||
[app.common.text :as txt]
|
||||
[app.common.types.color :as ctc]
|
||||
@@ -27,97 +27,10 @@
|
||||
[app.common.types.typography :as cty]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[cljs.spec.alpha :as s]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]))
|
||||
[clojure.set :as set]))
|
||||
|
||||
;; ---- Logging utilities ----
|
||||
|
||||
(def dbg-level-log 1)
|
||||
(def dbg-level-info 2)
|
||||
(def dbg-level-warn 3)
|
||||
|
||||
;; Change this to one of the levels to display traces of this level or higher
|
||||
(def dbg-level dbg-level-info)
|
||||
|
||||
;; Add some uuids to this to filter log messages affecting only to those shapes
|
||||
(def dbg-filters #{})
|
||||
|
||||
(defn dbg-id
|
||||
[uuid]
|
||||
(let [uuid-str (str uuid)]
|
||||
(str "#" (subs uuid-str (- (count uuid-str) 6)))))
|
||||
|
||||
(defn dbg-file
|
||||
[file-id state]
|
||||
(if (= file-id (:current-file-id state))
|
||||
"<local>"
|
||||
(str "<" (get-in state [:workspace-libraries file-id :name]) "> " (dbg-id file-id))))
|
||||
|
||||
(defn dbg-page
|
||||
[page]
|
||||
(with-meta page {:dbg-type :page}))
|
||||
|
||||
(defn dbg-component
|
||||
[component]
|
||||
(with-meta component {:dbg-type :component}))
|
||||
|
||||
(defn dbg-container
|
||||
[container]
|
||||
(if (cfh/page? container)
|
||||
(with-meta container {:dbg-type :page})
|
||||
(with-meta container {:dbg-type :component})))
|
||||
|
||||
(defn dbg-shape
|
||||
[shape]
|
||||
(with-meta shape {:dbg-type :shape}))
|
||||
|
||||
(defn dbg-obj
|
||||
[obj]
|
||||
(clj->js obj))
|
||||
|
||||
(defn js-value?
|
||||
[[_key value]]
|
||||
;; (prn value)
|
||||
;; (prn (type value))
|
||||
(or (object? value) (array? value)))
|
||||
|
||||
(defn dbg-format-str
|
||||
[[key value]]
|
||||
(let [value-str (case (:dbg-type (meta value))
|
||||
:page (str "[P \"" (subs (:name value) 0 50) "\" " (dbg-id (:id value)) "]")
|
||||
:component (str "[C \"" (subs (:name value) 0 50) "\" " (dbg-id (:id value)) "]")
|
||||
:shape (str "\"" (subs (:name value) 0 50) "\" " (dbg-id (:id value)))
|
||||
(cond
|
||||
(uuid? value) (dbg-id value)
|
||||
(js-symbol? value) (.toString value)
|
||||
:else (d/nilv value "nil")))]
|
||||
(str (name key) "=" value-str)))
|
||||
|
||||
(defn dbg
|
||||
[level msg & args]
|
||||
(when (>= level dbg-level)
|
||||
(let [kvargs (apply sorted-map args)
|
||||
ids (into #{} (filter uuid? (vals kvargs)))]
|
||||
(when (or (empty? dbg-filters)
|
||||
(empty? ids)
|
||||
(seq (set/intersection dbg-filters ids)))
|
||||
(let [dbg-fn (condp = level
|
||||
dbg-level-log js/console.log
|
||||
dbg-level-info js/console.info
|
||||
dbg-level-warn js/console.warn)
|
||||
kv-objects (d/filterm js-value? kvargs)
|
||||
kv-rest (d/removem js-value? kvargs)]
|
||||
(dbg-fn (->> (cons msg (map dbg-format-str kv-rest))
|
||||
(str/join " ")))
|
||||
(when (seq kv-objects)
|
||||
(dorun (for [[key value] kv-objects]
|
||||
(dbg-fn (str key) value)))))))))
|
||||
|
||||
(defn dbg-log [& args] (apply dbg (cons dbg-level-log args)))
|
||||
(defn dbg-info [& args] (apply dbg (cons dbg-level-info args)))
|
||||
(defn dbg-warn [& args] (apply dbg (cons dbg-level-warn args)))
|
||||
|
||||
;; ---- Advanced declaration of helpers ----
|
||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||
(log/set-level! :warn)
|
||||
|
||||
(declare generate-sync-container)
|
||||
(declare generate-sync-shape)
|
||||
@@ -145,6 +58,17 @@
|
||||
(declare reposition-shape)
|
||||
(declare make-change)
|
||||
|
||||
(defn pretty-file
|
||||
[file-id state]
|
||||
(if (= file-id (:current-file-id state))
|
||||
"<local>"
|
||||
(str "<" (get-in state [:workspace-libraries file-id :name]) ">")))
|
||||
|
||||
(defn pretty-uuid
|
||||
[uuid]
|
||||
(let [uuid-str (str uuid)]
|
||||
(subs uuid-str (- (count uuid-str) 6))))
|
||||
|
||||
;; ---- Components and instances creation ----
|
||||
|
||||
(defn duplicate-component
|
||||
@@ -296,7 +220,7 @@
|
||||
with a component."
|
||||
[changes container libraries shape-id]
|
||||
(let [shape (ctn/get-shape container shape-id)]
|
||||
(dbg-info "Detach instance" :shape-id shape-id :container (:id container))
|
||||
(log/debug :msg "Detach instance" :shape-id shape-id :container (:id container))
|
||||
(generate-detach-recursive changes container libraries shape-id true (true? (:component-root shape)))))
|
||||
|
||||
(defn- generate-detach-recursive
|
||||
@@ -309,6 +233,10 @@
|
||||
; If the initial shape was component-root, first level subinstances are converted in top instances
|
||||
(pcb/update-shapes [shape-id] #(assoc % :component-root true))
|
||||
|
||||
:always
|
||||
; First level subinstances of a detached component can't have swap-slot
|
||||
(pcb/update-shapes [shape-id] ctk/remove-swap-slot)
|
||||
|
||||
:always
|
||||
; Near shape-refs need to be advanced one level
|
||||
(generate-advance-nesting-level nil container libraries (:id shape)))
|
||||
@@ -386,11 +314,11 @@
|
||||
(s/assert ::us/uuid file-id)
|
||||
(s/assert ::us/uuid library-id)
|
||||
|
||||
(dbg-info "Sync file with library"
|
||||
(log/info :msg "Sync file with library"
|
||||
:asset-type asset-type
|
||||
:asset-id asset-id
|
||||
:file (dbg-file file-id state)
|
||||
:library (dbg-file library-id state))
|
||||
:file (pretty-file file-id state)
|
||||
:library (pretty-file library-id state))
|
||||
|
||||
(let [file (wsh/get-file state file-id)
|
||||
components-v2 (get-in file [:options :components-v2])]
|
||||
@@ -423,11 +351,11 @@
|
||||
(s/assert ::us/uuid file-id)
|
||||
(s/assert ::us/uuid library-id)
|
||||
|
||||
(dbg-info "Sync local components with library"
|
||||
(log/info :msg "Sync local components with library"
|
||||
:asset-type asset-type
|
||||
:asset-id asset-id
|
||||
:file (dbg-file file-id state)
|
||||
:library (dbg-file library-id state))
|
||||
:file (pretty-file file-id state)
|
||||
:library (pretty-file library-id state))
|
||||
|
||||
(let [file (wsh/get-file state file-id)
|
||||
components-v2 (get-in file [:options :components-v2])]
|
||||
@@ -452,8 +380,8 @@
|
||||
[it asset-type asset-id library-id state container components-v2]
|
||||
|
||||
(if (cfh/page? container)
|
||||
(dbg-info "Sync page in local file" :page (dbg-page container))
|
||||
(dbg-info "Sync component in local library" :component (dbg-component container)))
|
||||
(log/debug :msg "Sync page in local file" :page-id (:id container))
|
||||
(log/debug :msg "Sync component in local library" :component-id (:id container)))
|
||||
|
||||
(let [linked-shapes (->> (vals (:objects container))
|
||||
(filter #(uses-assets? asset-type asset-id % library-id)))]
|
||||
@@ -508,7 +436,7 @@
|
||||
|
||||
(defmethod generate-sync-shape :colors
|
||||
[_ changes library-id state _ shape _]
|
||||
(dbg-info "Sync colors of shape" :shape (dbg-shape shape))
|
||||
(log/debug :msg "Sync colors of shape" :shape (:name shape))
|
||||
|
||||
;; Synchronize a shape that uses some colors of the library. The value of the
|
||||
;; color in the library is copied to the shape.
|
||||
@@ -519,7 +447,7 @@
|
||||
|
||||
(defmethod generate-sync-shape :typographies
|
||||
[_ changes library-id state container shape _]
|
||||
(dbg-info "Sync typographies of shape" :shape (dbg-shape shape))
|
||||
(log/debug :msg "Sync typographies of shape" :shape (:name shape))
|
||||
|
||||
;; Synchronize a shape that uses some typographies of the library. The attributes
|
||||
;; of the typography are copied to the shape."
|
||||
@@ -687,7 +615,7 @@
|
||||
"Generate changes to synchronize one shape that is the root of a component
|
||||
instance, and all its children, from the given component."
|
||||
[changes file libraries container shape-id reset? components-v2]
|
||||
(dbg-info "Sync shape direct" :shape-id shape-id :reset? reset?)
|
||||
(log/debug :msg "Sync shape direct" :shape-inst (str shape-id) :reset? reset?)
|
||||
(let [shape-inst (ctn/get-shape container shape-id)
|
||||
library (dm/get-in libraries [(:component-file shape-inst) :data])
|
||||
component (ctkl/get-component library (:component-id shape-inst) true)]
|
||||
@@ -724,7 +652,6 @@
|
||||
reset?
|
||||
initial-root?
|
||||
redirect-shaperef
|
||||
1
|
||||
components-v2)
|
||||
;; If the component is not found, because the master component has been
|
||||
;; deleted or the library unlinked, do nothing in v2 or detach in v1.
|
||||
@@ -751,10 +678,10 @@
|
||||
nil))))))
|
||||
|
||||
(defn- generate-sync-shape-direct-recursive
|
||||
[changes container shape-inst component library file libraries shape-main root-inst root-main reset? initial-root? redirect-shaperef level components-v2]
|
||||
(dbg-info (str (str/repeat "-" level) "> Sync shape direct recursive")
|
||||
:shape-inst (dbg-shape shape-inst)
|
||||
:component (dbg-component component))
|
||||
[changes container shape-inst component library file libraries shape-main root-inst root-main reset? initial-root? redirect-shaperef components-v2]
|
||||
(log/debug :msg "Sync shape direct recursive"
|
||||
:shape-inst (str (:name shape-inst) " " (pretty-uuid (:id shape-inst)))
|
||||
:component (:name component))
|
||||
|
||||
(if (nil? shape-main)
|
||||
;; This should not occur, but protect against it in any case
|
||||
@@ -810,7 +737,8 @@
|
||||
(map #(redirect-shaperef %) children-inst) children-inst)
|
||||
|
||||
only-inst (fn [changes child-inst]
|
||||
(dbg-log " *Only inst:" :child-inst (dbg-shape child-inst))
|
||||
(log/trace :msg "Only inst"
|
||||
:child-inst (str (:name child-inst) " " (pretty-uuid (:id child-inst))))
|
||||
(if-not (and omit-touched?
|
||||
(contains? (:touched shape-inst)
|
||||
:shapes-group))
|
||||
@@ -821,7 +749,8 @@
|
||||
changes))
|
||||
|
||||
only-main (fn [changes child-main]
|
||||
(dbg-log " *Only main:" :child-main (dbg-shape child-main))
|
||||
(log/trace :msg "Only main"
|
||||
:child-main (str (:name child-main) " " (pretty-uuid (:id child-main))))
|
||||
(if-not (and omit-touched?
|
||||
(contains? (:touched shape-inst)
|
||||
:shapes-group))
|
||||
@@ -839,9 +768,9 @@
|
||||
changes))
|
||||
|
||||
both (fn [changes child-inst child-main]
|
||||
(dbg-log " *Both:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(log/trace :msg "Both"
|
||||
:child-inst (str (:name child-inst) " " (pretty-uuid (:id child-inst)))
|
||||
:child-main (str (:name child-main) " " (pretty-uuid (:id child-main))))
|
||||
(generate-sync-shape-direct-recursive changes
|
||||
container
|
||||
child-inst
|
||||
@@ -855,20 +784,19 @@
|
||||
reset?
|
||||
initial-root?
|
||||
redirect-shaperef
|
||||
(inc level)
|
||||
components-v2))
|
||||
|
||||
swapped (fn [changes child-inst child-main]
|
||||
(dbg-log " *Match slot:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(log/trace :msg "Match slot"
|
||||
:child-inst (str (:name child-inst) " " (pretty-uuid (:id child-inst)))
|
||||
:child-main (str (:name child-main) " " (pretty-uuid (:id child-main))))
|
||||
;; For now we don't make any sync here.
|
||||
changes)
|
||||
|
||||
moved (fn [changes child-inst child-main]
|
||||
(dbg-log " *Move:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(log/trace :msg "Move"
|
||||
:child-inst (str (:name child-inst) " " (pretty-uuid (:id child-inst)))
|
||||
:child-main (str (:name child-main) " " (pretty-uuid (:id child-main))))
|
||||
(move-shape
|
||||
changes
|
||||
child-inst
|
||||
@@ -916,7 +844,7 @@
|
||||
"Generate changes to update the component a shape is linked to, from
|
||||
the values in the shape and all its children."
|
||||
[changes file libraries container shape-id components-v2]
|
||||
(dbg-info "Sync shape inverse" :shape-id shape-id)
|
||||
(log/debug :msg "Sync shape inverse" :shape (str shape-id))
|
||||
(let [redirect-shaperef (partial redirect-shaperef container libraries)
|
||||
shape-inst (ctn/get-shape container shape-id)
|
||||
library (dm/get-in libraries [(:component-file shape-inst) :data])
|
||||
@@ -953,15 +881,14 @@
|
||||
root-main
|
||||
initial-root?
|
||||
redirect-shaperef
|
||||
1
|
||||
components-v2)
|
||||
changes)))
|
||||
|
||||
(defn- generate-sync-shape-inverse-recursive
|
||||
[changes container shape-inst component library file libraries shape-main root-inst root-main initial-root? redirect-shaperef level components-v2]
|
||||
(dbg-log (str (str/repeat "-" level) "> Sync shape inverse recursive")
|
||||
:shape-inst (dbg-shape shape-inst)
|
||||
:component (dbg-component component))
|
||||
[changes container shape-inst component library file libraries shape-main root-inst root-main initial-root? redirect-shaperef components-v2]
|
||||
(log/trace :msg "Sync shape inverse recursive"
|
||||
:shape (str (:name shape-inst))
|
||||
:component (:name component))
|
||||
|
||||
(if (nil? shape-main)
|
||||
;; This should not occur, but protect against it in any case
|
||||
@@ -1019,7 +946,6 @@
|
||||
children-inst)
|
||||
|
||||
only-inst (fn [changes child-inst]
|
||||
(dbg-log " *Only inst:" :child-inst (dbg-shape child-inst))
|
||||
(add-shape-to-main changes
|
||||
child-inst
|
||||
(d/index-of children-inst
|
||||
@@ -1032,16 +958,12 @@
|
||||
components-v2))
|
||||
|
||||
only-main (fn [changes child-main]
|
||||
(dbg-log " *Only main:" :child-main (dbg-shape child-main))
|
||||
(remove-shape changes
|
||||
child-main
|
||||
component-container
|
||||
false))
|
||||
|
||||
both (fn [changes child-inst child-main]
|
||||
(dbg-log " *Both:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(generate-sync-shape-inverse-recursive changes
|
||||
container
|
||||
child-inst
|
||||
@@ -1054,20 +976,16 @@
|
||||
root-main
|
||||
initial-root?
|
||||
redirect-shaperef
|
||||
(inc level)
|
||||
components-v2))
|
||||
|
||||
swapped (fn [changes child-inst child-main]
|
||||
(dbg-log " *Match slot:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(log/trace :msg "Match slot"
|
||||
:child-inst (str (:name child-inst) " " (pretty-uuid (:id child-inst)))
|
||||
:child-main (str (:name child-main) " " (pretty-uuid (:id child-main))))
|
||||
;; For now we don't make any sync here.
|
||||
changes)
|
||||
|
||||
moved (fn [changes child-inst child-main]
|
||||
(dbg-log " *Move:"
|
||||
:child-inst (dbg-shape child-inst)
|
||||
:child-main (dbg-shape child-main))
|
||||
(move-shape
|
||||
changes
|
||||
child-main
|
||||
@@ -1110,13 +1028,14 @@
|
||||
|
||||
(defn- compare-children
|
||||
[changes children-inst children-main container-inst container-main file libraries only-inst-cb only-main-cb both-cb swapped-cb moved-cb inverse? reset? components-v2]
|
||||
(dbg-log "Compare children")
|
||||
(log/trace :msg "Compare children")
|
||||
(loop [children-inst (seq (or children-inst []))
|
||||
children-main (seq (or children-main []))
|
||||
changes changes]
|
||||
(let [child-inst (first children-inst)
|
||||
child-main (first children-main)]
|
||||
(dbg-log " " :main (dbg-shape child-main) :inst (dbg-shape child-inst))
|
||||
(log/trace :main (str (:name child-main) " " (pretty-uuid (:id child-main)))
|
||||
:inst (str (:name child-inst) " " (pretty-uuid (:id child-inst))))
|
||||
(cond
|
||||
(and (nil? child-inst) (nil? child-main))
|
||||
changes
|
||||
@@ -1178,7 +1097,10 @@
|
||||
|
||||
(defn- add-shape-to-instance
|
||||
[changes component-shape index component-page container root-instance root-main omit-touched? set-remote-synced? components-v2]
|
||||
(dbg-warn "ADD TO INST" :container (dbg-container container) :component-shape (dbg-shape component-shape))
|
||||
(log/info :msg (str "ADD [P " (pretty-uuid (:id container)) "] "
|
||||
(:name component-shape)
|
||||
" "
|
||||
(pretty-uuid (:id component-shape))))
|
||||
(let [component-parent-shape (ctn/get-shape component-page (:parent-id component-shape))
|
||||
parent-shape (d/seek #(ctk/is-main-of? component-parent-shape % components-v2)
|
||||
(cfh/get-children-with-self (:objects container)
|
||||
@@ -1207,7 +1129,7 @@
|
||||
update-original-shape (fn [original-shape _new-shape]
|
||||
original-shape)
|
||||
|
||||
[new-shape new-shapes _]
|
||||
[_ new-shapes _]
|
||||
(ctst/clone-shape component-shape
|
||||
(:id parent-shape)
|
||||
(get component-page :objects)
|
||||
@@ -1244,14 +1166,16 @@
|
||||
:shapes all-parents}))
|
||||
changes' (reduce del-obj-change changes' new-shapes)]
|
||||
|
||||
(dbg-log " " :parent-shape (dbg-shape parent-shape) :new-shape (dbg-shape new-shape))
|
||||
(if (and (cfh/touched-group? parent-shape :shapes-group) omit-touched?)
|
||||
changes
|
||||
changes')))
|
||||
|
||||
(defn- add-shape-to-main
|
||||
[changes shape index component component-container page root-instance root-main components-v2]
|
||||
(dbg-warn "ADD TO MAIN" :component-container (dbg-container component-container) :shape (dbg-shape shape))
|
||||
(log/info :msg (str "ADD [C " (pretty-uuid (:id component-container)) "] "
|
||||
(:name shape)
|
||||
" "
|
||||
(pretty-uuid (:id shape))))
|
||||
(let [parent-shape (ctn/get-shape page (:parent-id shape))
|
||||
component-parent-shape (d/seek #(ctk/is-main-of? % parent-shape components-v2)
|
||||
(cfh/get-children-with-self (:objects component-container)
|
||||
@@ -1269,7 +1193,7 @@
|
||||
(assoc original-shape
|
||||
:shape-ref (:id new-shape)))
|
||||
|
||||
[new-shape new-shapes updated-shapes]
|
||||
[_new-shape new-shapes updated-shapes]
|
||||
(ctst/clone-shape shape
|
||||
(:id component-parent-shape)
|
||||
(get page :objects)
|
||||
@@ -1347,12 +1271,16 @@
|
||||
changes' (reduce mod-obj-change changes' updated-shapes)
|
||||
changes' (reduce del-obj-change changes' new-shapes)]
|
||||
|
||||
(dbg-log " " :component-parent-shape (dbg-shape component-parent-shape) :new-shape (dbg-shape new-shape))
|
||||
changes'))
|
||||
|
||||
(defn- remove-shape
|
||||
[changes shape container omit-touched?]
|
||||
(dbg-warn "REMOVE SHAPE" :container (dbg-container container) :shape (dbg-shape shape))
|
||||
(log/info :msg (str "REMOVE-SHAPE "
|
||||
(if (cfh/page? container) "[P " "[C ")
|
||||
(pretty-uuid (:id container)) "] "
|
||||
(:name shape)
|
||||
" "
|
||||
(pretty-uuid (:id shape))))
|
||||
(let [objects (get container :objects)
|
||||
parents (cfh/get-parent-ids objects (:id shape))
|
||||
parent (first parents)
|
||||
@@ -1399,10 +1327,16 @@
|
||||
|
||||
(defn- move-shape
|
||||
[changes shape index-before index-after container omit-touched?]
|
||||
(dbg-warn "MOVE"
|
||||
:container (dbg-container container)
|
||||
:shape (dbg-shape shape)
|
||||
:index (str index-before "->" index-after))
|
||||
(log/info :msg (str "MOVE "
|
||||
(if (cfh/page? container) "[P " "[C ")
|
||||
(pretty-uuid (:id container)) "] "
|
||||
(:name shape)
|
||||
" "
|
||||
(pretty-uuid (:id shape))
|
||||
" "
|
||||
index-before
|
||||
" -> "
|
||||
index-after))
|
||||
(let [parent (ctn/get-shape container (:parent-id shape))
|
||||
|
||||
changes' (-> changes
|
||||
@@ -1433,11 +1367,13 @@
|
||||
(if (nil? (:shape-ref dest-shape))
|
||||
changes
|
||||
(do
|
||||
(dbg-warn "CHANGE TOUCHED"
|
||||
:container (dbg-container container)
|
||||
:dest-shape (dbg-shape dest-shape)
|
||||
:reset-touched? reset-touched?
|
||||
:copy-touched? copy-touched?)
|
||||
(log/info :msg (str "CHANGE-TOUCHED "
|
||||
(if (cfh/page? container) "[P " "[C ")
|
||||
(pretty-uuid (:id container)) "] "
|
||||
(:name dest-shape)
|
||||
" "
|
||||
(pretty-uuid (:id dest-shape)))
|
||||
:options options)
|
||||
(let [new-touched (cond
|
||||
reset-touched?
|
||||
nil
|
||||
@@ -1473,10 +1409,13 @@
|
||||
(if (nil? (:shape-ref shape))
|
||||
changes
|
||||
(do
|
||||
(dbg-warn "CHANGE REMOTE SYNCED"
|
||||
:container (dbg-container container)
|
||||
:shape (dbg-shape shape)
|
||||
:remote-synced? remote-synced?)
|
||||
(log/info :msg (str "CHANGE-REMOTE-SYNCED? "
|
||||
(if (cfh/page? container) "[P " "[C ")
|
||||
(pretty-uuid (:id container)) "] "
|
||||
(:name shape)
|
||||
" "
|
||||
(pretty-uuid (:id shape)))
|
||||
:remote-synced remote-synced?)
|
||||
(-> changes
|
||||
(update :redo-changes conj (make-change
|
||||
container
|
||||
@@ -1501,10 +1440,16 @@
|
||||
in the destination shape will not be copied."
|
||||
[changes dest-shape origin-shape dest-root origin-root container omit-touched?]
|
||||
|
||||
(dbg-warn "SYNC"
|
||||
:origin-shape (dbg-shape origin-shape)
|
||||
:container (dbg-container container)
|
||||
:dest-shape (dbg-shape dest-shape))
|
||||
(log/info :msg (str "SYNC "
|
||||
(:name origin-shape)
|
||||
" "
|
||||
(pretty-uuid (:id origin-shape))
|
||||
" -> "
|
||||
(if (cfh/page? container) "[P " "[C ")
|
||||
(pretty-uuid (:id container)) "] "
|
||||
(:name dest-shape)
|
||||
" "
|
||||
(pretty-uuid (:id dest-shape))))
|
||||
|
||||
(let [;; To synchronize geometry attributes we need to make a prior
|
||||
;; operation, because coordinates are absolute, but we need to
|
||||
|
||||
@@ -486,6 +486,7 @@
|
||||
duplicating-component? (or duplicating-component? (ctk/instance-head? obj))
|
||||
is-component-main? (ctk/main-instance? obj)
|
||||
subinstance-head? (ctk/subinstance-head? obj)
|
||||
instance-root? (ctk/instance-root? obj)
|
||||
|
||||
into-component? (and duplicating-component?
|
||||
(ctn/in-any-component? objects parent))
|
||||
@@ -508,7 +509,9 @@
|
||||
:parent-id parent-id
|
||||
:frame-id frame-id)
|
||||
|
||||
(cond-> (and subinstance-head? remove-swap-slot?)
|
||||
(cond-> (and (not instance-root?)
|
||||
subinstance-head?
|
||||
remove-swap-slot?)
|
||||
(ctk/remove-swap-slot))
|
||||
|
||||
(dissoc :shapes
|
||||
@@ -581,8 +584,9 @@
|
||||
true
|
||||
(and remove-swap-slot?
|
||||
;; only remove swap slot of children when the current shape
|
||||
;; is not a subinstance head
|
||||
(not subinstance-head?))))
|
||||
;; is not a subinstance head nor a instance root
|
||||
(not subinstance-head?)
|
||||
(not instance-root?))))
|
||||
changes
|
||||
(map (d/getf objects) (:shapes obj)))))))
|
||||
|
||||
|
||||
@@ -133,7 +133,10 @@
|
||||
(defn- fetch-gfont-css
|
||||
[url]
|
||||
(->> (http/send! {:method :get :uri url :mode :cors :response-type :text})
|
||||
(rx/map :body)))
|
||||
(rx/map :body)
|
||||
(rx/catch (fn [err]
|
||||
(.warn js/console "Cannot find the font" (obj/get err "message"))
|
||||
(rx/empty)))))
|
||||
|
||||
(defmethod load-font :google
|
||||
[{:keys [id ::on-loaded] :as font}]
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
[:& (mf/provider ctx/current-route) {:value route}
|
||||
[:& (mf/provider ctx/current-profile) {:value profile}
|
||||
(if edata
|
||||
[:& static/exception-page {:data edata}]
|
||||
[:& static/exception-page {:data edata :route route}]
|
||||
[:*
|
||||
[:& msgs/notifications-hub]
|
||||
(when route
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.config :as cf]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.auth.login :refer [login-page]]
|
||||
[app.main.ui.auth.recovery :refer [recovery-page]]
|
||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
||||
@@ -44,18 +42,14 @@
|
||||
{::mf/props :obj}
|
||||
[{:keys [route]}]
|
||||
(let [section (dm/get-in route [:data :name])
|
||||
params (:query-params route)
|
||||
error (:error params)]
|
||||
params (:query-params route)]
|
||||
|
||||
(mf/with-effect []
|
||||
(dom/set-html-title (tr "title.default")))
|
||||
|
||||
(mf/with-effect [error]
|
||||
(when error
|
||||
(st/emit! (du/show-redirect-error error))))
|
||||
|
||||
[:main {:class (stl/css :auth-section)}
|
||||
[:a {:href "#/" :class (stl/css :logo-btn)} i/logo]
|
||||
[:h1 {:class (stl/css :logo-container)}
|
||||
[:a {:href "#/" :title "Penpot" :class (stl/css :logo-btn)} i/logo]]
|
||||
[:div {:class (stl/css :login-illustration)}
|
||||
i/login-illustration]
|
||||
|
||||
|
||||
@@ -24,6 +24,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
position: absolute;
|
||||
top: $s-20;
|
||||
left: $s-20;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
width: $s-120;
|
||||
margin-block-end: $s-52;
|
||||
}
|
||||
|
||||
.login-illustration {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -55,14 +65,6 @@
|
||||
}
|
||||
|
||||
.logo-btn {
|
||||
position: absolute;
|
||||
top: $s-20;
|
||||
left: $s-20;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
width: $s-120;
|
||||
margin-block-end: $s-52;
|
||||
|
||||
svg {
|
||||
width: $s-120;
|
||||
height: $s-40;
|
||||
|
||||
@@ -42,10 +42,6 @@
|
||||
{:type :warning
|
||||
:content (tr "auth.demo-warning")}])
|
||||
|
||||
(defn create-demo-profile
|
||||
[]
|
||||
(st/emit! (du/create-demo-profile)))
|
||||
|
||||
(defn- login-with-oidc
|
||||
[event provider params]
|
||||
(dom/prevent-default event)
|
||||
@@ -64,6 +60,28 @@
|
||||
:else
|
||||
(st/emit! (msg/error (tr "errors.generic"))))))))
|
||||
|
||||
(defn- login-with-ldap
|
||||
[event params]
|
||||
(dom/prevent-default event)
|
||||
(dom/stop-propagation event)
|
||||
(let [{:keys [on-error]} (meta params)]
|
||||
(->> (rp/cmd! :login-with-ldap params)
|
||||
(rx/subs! (fn [profile]
|
||||
(if-let [token (:invitation-token profile)]
|
||||
(st/emit! (rt/nav :auth-verify-token {} {:token token}))
|
||||
(st/emit! (du/login-from-token {:profile profile}))))
|
||||
(fn [{:keys [type code] :as error}]
|
||||
(cond
|
||||
(and (= type :restriction)
|
||||
(= code :ldap-not-initialized))
|
||||
(st/emit! (msg/error (tr "errors.ldap-disabled")))
|
||||
|
||||
(fn? on-error)
|
||||
(on-error error)
|
||||
|
||||
:else
|
||||
(st/emit! (msg/error (tr "errors.generic")))))))))
|
||||
|
||||
(s/def ::email ::us/email)
|
||||
(s/def ::password ::us/not-empty-string)
|
||||
(s/def ::invitation-token ::us/not-empty-string)
|
||||
@@ -89,18 +107,13 @@
|
||||
:initial initial)
|
||||
|
||||
on-error
|
||||
(fn [cause]
|
||||
(let [cause (ex-data cause)]
|
||||
(fn [err]
|
||||
(let [cause (ex-data err)]
|
||||
(cond
|
||||
(and (= :restriction (:type cause))
|
||||
(= :profile-blocked (:code cause)))
|
||||
(reset! error (tr "errors.profile-blocked"))
|
||||
|
||||
(and (= :restriction (:type cause))
|
||||
(= :ldap-not-initialized (:code cause)))
|
||||
(st/emit! (msg/error (tr "errors.ldap-disabled")))
|
||||
|
||||
|
||||
(and (= :restriction (:type cause))
|
||||
(= :admin-only-profile (:code cause)))
|
||||
(reset! error (tr "errors.profile-blocked"))
|
||||
@@ -117,10 +130,9 @@
|
||||
(reset! error (tr "errors.generic")))))
|
||||
|
||||
on-success-default
|
||||
(mf/use-fn
|
||||
(fn [data]
|
||||
(when-let [token (:invitation-token data)]
|
||||
(st/emit! (rt/nav :auth-verify-token {} {:token token})))))
|
||||
(fn [data]
|
||||
(when-let [token (:invitation-token data)]
|
||||
(st/emit! (rt/nav :auth-verify-token {} {:token token}))))
|
||||
|
||||
on-success
|
||||
(fn [data]
|
||||
@@ -141,15 +153,11 @@
|
||||
(mf/use-callback
|
||||
(mf/deps form)
|
||||
(fn [event]
|
||||
(dom/prevent-default event)
|
||||
(dom/stop-propagation event)
|
||||
|
||||
(reset! error nil)
|
||||
(let [params (:clean-data @form)
|
||||
params (with-meta params
|
||||
{:on-error on-error
|
||||
:on-success on-success})]
|
||||
(st/emit! (du/login-with-ldap params)))))
|
||||
(let [params (:clean-data @form)]
|
||||
(login-with-ldap event (with-meta params
|
||||
{:on-error on-error
|
||||
:on-success on-success})))))
|
||||
|
||||
on-recovery-request
|
||||
(mf/use-fn
|
||||
@@ -300,11 +308,5 @@
|
||||
[:& lk/link {:action go-register
|
||||
:class (stl/css :register-link)
|
||||
:data-test "register-submit"}
|
||||
(tr "auth.register-submit")]])]
|
||||
(tr "auth.register-submit")]])]]))
|
||||
|
||||
(when (contains? cf/flags :demo-users)
|
||||
[:div {:class (stl/css :link-entry :demo-account)}
|
||||
[:span (tr "auth.create-demo-profile") " "]
|
||||
[:& lk/link {:action create-demo-profile
|
||||
:data-test "demo-account-link"}
|
||||
(tr "auth.create-demo-account")]])]))
|
||||
|
||||
@@ -26,20 +26,18 @@
|
||||
|
||||
;; --- PAGE: Register
|
||||
|
||||
(defn- validate-password-length
|
||||
(defn- validate
|
||||
[errors data]
|
||||
(let [password (:password data)]
|
||||
(cond-> errors
|
||||
(> 8 (count password))
|
||||
(assoc :password {:message "errors.password-too-short"}))))
|
||||
|
||||
(defn- validate-email
|
||||
[errors _]
|
||||
(d/update-when errors :email
|
||||
(fn [{:keys [code] :as error}]
|
||||
(cond-> error
|
||||
(= code ::us/email)
|
||||
(assoc :message (tr "errors.email-invalid"))))))
|
||||
(assoc :password {:message "errors.password-too-short"})
|
||||
:always
|
||||
(d/update-when :email
|
||||
(fn [{:keys [code] :as error}]
|
||||
(cond-> error
|
||||
(= code ::us/email)
|
||||
(assoc :message (tr "errors.email-invalid"))))))))
|
||||
|
||||
(s/def ::fullname ::us/not-empty-string)
|
||||
(s/def ::password ::us/not-empty-string)
|
||||
@@ -51,20 +49,31 @@
|
||||
(s/keys :req-un [::password ::email]
|
||||
:opt-un [::invitation-token]))
|
||||
|
||||
(defn- on-prepare-register-error
|
||||
(defn- handle-prepare-register-error
|
||||
[form cause]
|
||||
(let [{:keys [type code]} (ex-data cause)]
|
||||
(condp = [type code]
|
||||
[:restriction :registration-disabled]
|
||||
(st/emit! (msg/error (tr "errors.registration-disabled")))
|
||||
|
||||
[:restriction :profile-blocked]
|
||||
(st/emit! (msg/error (tr "errors.profile-blocked")))
|
||||
|
||||
[:validation :email-has-permanent-bounces]
|
||||
(let [email (get @form [:data :email])]
|
||||
(st/emit! (msg/error (tr "errors.email-has-permanent-bounces" email))))
|
||||
|
||||
[:validation :email-already-exists]
|
||||
(swap! form assoc-in [:errors :email]
|
||||
{:message "errors.email-already-exists"})
|
||||
|
||||
[:validation :email-as-password]
|
||||
(swap! form assoc-in [:errors :password]
|
||||
{:message "errors.email-as-password"})
|
||||
|
||||
(st/emit! (msg/error (tr "errors.generic"))))))
|
||||
|
||||
(defn- on-prepare-register-success
|
||||
(defn- handle-prepare-register-success
|
||||
[params]
|
||||
(st/emit! (rt/nav :auth-register-validate {} params)))
|
||||
|
||||
@@ -72,30 +81,28 @@
|
||||
[{:keys [params on-success-callback]}]
|
||||
(let [initial (mf/use-memo (mf/deps params) (constantly params))
|
||||
form (fm/use-form :spec ::register-form
|
||||
:validators [validate-password-length
|
||||
validate-email
|
||||
:validators [validate
|
||||
(fm/validate-not-empty :password (tr "auth.password-not-empty"))]
|
||||
:initial initial)
|
||||
|
||||
submitted? (mf/use-state false)
|
||||
|
||||
on-success (fn [p]
|
||||
(if (nil? on-success-callback)
|
||||
(handle-prepare-register-success p)
|
||||
(on-success-callback p)))
|
||||
|
||||
on-submit
|
||||
(mf/use-fn
|
||||
(mf/deps on-success-callback)
|
||||
(fn [form _event]
|
||||
(reset! submitted? true)
|
||||
(let [cdata (:clean-data @form)
|
||||
on-success (fn [data]
|
||||
(if (nil? on-success-callback)
|
||||
(on-prepare-register-success data)
|
||||
(on-success-callback data)))
|
||||
on-error (fn [data]
|
||||
(on-prepare-register-error form data))]
|
||||
|
||||
(let [cdata (:clean-data @form)]
|
||||
(->> (rp/cmd! :prepare-register-profile cdata)
|
||||
(rx/map #(merge % params))
|
||||
(rx/finalize #(reset! submitted? false))
|
||||
(rx/subs! on-success on-error)))))]
|
||||
(rx/subs!
|
||||
on-success
|
||||
(partial handle-prepare-register-error form))))))]
|
||||
|
||||
|
||||
[:& fm/form {:on-submit on-submit :form form}
|
||||
[:div {:class (stl/css :fields-row)}
|
||||
@@ -119,6 +126,7 @@
|
||||
:data-test "register-form-submit"
|
||||
:class (stl/css :register-btn)}]]))
|
||||
|
||||
|
||||
(mf/defc register-methods
|
||||
{::mf/props :obj}
|
||||
[{:keys [params on-success-callback]}]
|
||||
@@ -154,15 +162,22 @@
|
||||
[:*
|
||||
[:hr {:class (stl/css :separator)}]
|
||||
[:div {:class (stl/css :demo-account)}
|
||||
[:& lk/link {:action login/create-demo-profile
|
||||
[:& lk/link {:action #(st/emit! (du/create-demo-profile))
|
||||
:class (stl/css :demo-account-link)}
|
||||
(tr "auth.create-demo-account")]]])]])
|
||||
|
||||
;; --- PAGE: register validation
|
||||
|
||||
(defn- handle-register-error
|
||||
[_form _data]
|
||||
(st/emit! (msg/error (tr "errors.generic"))))
|
||||
[form error]
|
||||
(case (:code error)
|
||||
:email-already-exists
|
||||
(swap! form assoc-in [:errors :email]
|
||||
{:message "errors.email-already-exists"})
|
||||
|
||||
(do
|
||||
(println (:explain error))
|
||||
(st/emit! (msg/error (tr "errors.generic"))))))
|
||||
|
||||
(defn- handle-register-success
|
||||
[data]
|
||||
@@ -171,6 +186,8 @@
|
||||
(let [token (:invitation-token data)]
|
||||
(st/emit! (rt/nav :auth-verify-token {} {:token token})))
|
||||
|
||||
;; The :is-active flag is true, when insecure-register is enabled
|
||||
;; or the user used external auth provider.
|
||||
(:is-active data)
|
||||
(st/emit! (du/login-from-register))
|
||||
|
||||
@@ -265,3 +282,5 @@
|
||||
[:div {:class (stl/css :notification-text)} (tr "auth.verification-email-sent")]
|
||||
[:div {:class (stl/css :notification-text-email)} (:email params "")]
|
||||
[:div {:class (stl/css :notification-text)} (tr "auth.check-your-email")]])
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
(def current-page-id (mf/create-context nil))
|
||||
(def current-file-id (mf/create-context nil))
|
||||
(def current-vbox (mf/create-context nil))
|
||||
(def current-svg-root-id (mf/create-context nil))
|
||||
|
||||
(def active-frames (mf/create-context nil))
|
||||
(def render-thumbnails (mf/create-context nil))
|
||||
|
||||
@@ -7,15 +7,11 @@
|
||||
(ns app.main.ui.dashboard.projects
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.config :as cf]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.messages :as msg]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.errors :as errors]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.dashboard.grid :refer [line-grid]]
|
||||
@@ -100,80 +96,6 @@
|
||||
(def builtin-templates
|
||||
(l/derived :builtin-templates st/state))
|
||||
|
||||
(mf/defc tutorial-project
|
||||
[{:keys [close-tutorial default-project-id] :as props}]
|
||||
(let [state (mf/use-state {:status :waiting
|
||||
:file nil})
|
||||
|
||||
templates (mf/deref builtin-templates)
|
||||
template (d/seek #(= (:id %) "tutorial-for-beginners") templates)
|
||||
|
||||
on-template-cloned-success
|
||||
(mf/use-fn
|
||||
(mf/deps default-project-id)
|
||||
(fn [response]
|
||||
(swap! state #(assoc % :status :success :file (:first response)))
|
||||
(st/emit! (dd/go-to-workspace {:id (first response) :project-id default-project-id :name "tutorial"})
|
||||
(du/update-profile-props {:viewed-tutorial? true}))))
|
||||
|
||||
on-template-cloned-error
|
||||
(mf/use-fn
|
||||
(fn [cause]
|
||||
(swap! state assoc :status :error)
|
||||
(errors/print-error! cause)
|
||||
(st/emit! (msg/error (tr "dashboard.libraries-and-templates.import-error")))))
|
||||
|
||||
download-tutorial
|
||||
(mf/use-fn
|
||||
(mf/deps template default-project-id)
|
||||
(fn []
|
||||
(let [mdata {:on-success on-template-cloned-success
|
||||
:on-error on-template-cloned-error}
|
||||
params {:project-id default-project-id
|
||||
:template-id (:id template)}]
|
||||
(swap! state #(assoc % :status :importing))
|
||||
(st/emit! (with-meta (dd/clone-template (with-meta params mdata))
|
||||
{::ev/origin "get-started-hero-block"})))))]
|
||||
[:article {:class (stl/css :tutorial)}
|
||||
[:div {:class (stl/css :thumbnail)}]
|
||||
[:div {:class (stl/css :text)}
|
||||
[:h2 {:class (stl/css :title)} (tr "dasboard.tutorial-hero.title")]
|
||||
[:p {:class (stl/css :info)} (tr "dasboard.tutorial-hero.info")]
|
||||
[:button {:class (stl/css :btn-primary :action)
|
||||
:on-click download-tutorial}
|
||||
(case (:status @state)
|
||||
:waiting (tr "dasboard.tutorial-hero.start")
|
||||
:importing [:span.loader i/loader-pencil]
|
||||
:success "")]]
|
||||
|
||||
[:button {:class (stl/css :close)
|
||||
:on-click close-tutorial
|
||||
:aria-label (tr "labels.close")}
|
||||
close-icon]]))
|
||||
|
||||
(mf/defc interface-walkthrough
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [close-walkthrough] :as props}]
|
||||
(let [handle-walkthrough-link
|
||||
(fn []
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "show-walkthrough"
|
||||
::ev/origin "get-started-hero-block"
|
||||
:section "dashboard"})))]
|
||||
[:article {:class (stl/css :walkthrough)}
|
||||
[:div {:class (stl/css :thumbnail)}]
|
||||
[:div {:class (stl/css :text)}
|
||||
[:h2 {:class (stl/css :title)} (tr "dasboard.walkthrough-hero.title")]
|
||||
[:p {:class (stl/css :info)} (tr "dasboard.walkthrough-hero.info")]
|
||||
[:a {:class (stl/css :btn-primary :action)
|
||||
:href " https://design.penpot.app/walkthrough"
|
||||
:target "_blank"
|
||||
:on-click handle-walkthrough-link}
|
||||
(tr "dasboard.walkthrough-hero.start")]]
|
||||
[:button {:class (stl/css :close)
|
||||
:on-click close-walkthrough
|
||||
:aria-label (tr "labels.close")}
|
||||
close-icon]]))
|
||||
|
||||
(mf/defc project-item
|
||||
[{:keys [project first? team files] :as props}]
|
||||
(let [locale (mf/deref i18n/locale)
|
||||
@@ -365,7 +287,7 @@
|
||||
(l/derived :dashboard-recent-files st/state))
|
||||
|
||||
(mf/defc projects-section
|
||||
[{:keys [team projects profile default-project-id] :as props}]
|
||||
[{:keys [team projects profile] :as props}]
|
||||
(let [projects (->> (vals projects)
|
||||
(sort-by :modified-at)
|
||||
(reverse))
|
||||
@@ -378,8 +300,6 @@
|
||||
(:team-hero? props true)
|
||||
(not (:is-default team)))
|
||||
|
||||
tutorial-viewed? (:viewed-tutorial? props true)
|
||||
walkthrough-viewed? (:viewed-walkthrough? props true)
|
||||
is-my-penpot (= (:default-team-id profile) (:id team))
|
||||
|
||||
team-id (:id team)
|
||||
@@ -391,28 +311,6 @@
|
||||
(ptk/data-event ::ev/event {::ev/name "dont-show-team-up-hero"
|
||||
::ev/origin "dashboard"}))))
|
||||
|
||||
close-tutorial
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
(st/emit! (du/update-profile-props {:viewed-tutorial? true})
|
||||
(ptk/data-event ::ev/event {::ev/name "dont-show-tutorial"
|
||||
::ev/origin "get-started-hero"
|
||||
:type "tutorial"
|
||||
:section "dashboard"}))))
|
||||
|
||||
close-walkthrough
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
(st/emit! (du/update-profile-props {:viewed-walkthrough? true})
|
||||
(ptk/data-event ::ev/event {::ev/name "dont-show-walkthrough"
|
||||
::ev/origin "get-started-hero"
|
||||
:type "walkthrough"
|
||||
:section "dashboard"}))))
|
||||
|
||||
show-hero? (and is-my-penpot
|
||||
(or (not tutorial-viewed?)
|
||||
(not walkthrough-viewed?)))
|
||||
|
||||
show-team-hero? (and (not is-my-penpot) team-hero?)]
|
||||
|
||||
(mf/with-effect [team]
|
||||
@@ -433,22 +331,9 @@
|
||||
(when team-hero?
|
||||
[:& team-hero {:team team :close-fn close-banner}])
|
||||
|
||||
(when (and (contains? cf/flags :dashboard-templates-section)
|
||||
show-hero?)
|
||||
[:div {:class (stl/css :hero-projects)}
|
||||
(when (and (not tutorial-viewed?) (:is-default team))
|
||||
[:& tutorial-project
|
||||
{:close-tutorial close-tutorial
|
||||
:default-project-id default-project-id}])
|
||||
|
||||
(when (and (not walkthrough-viewed?) (:is-default team))
|
||||
[:& interface-walkthrough
|
||||
{:close-walkthrough close-walkthrough}])])
|
||||
|
||||
[:div {:class (stl/css-case :dashboard-container true
|
||||
:no-bg true
|
||||
:dashboard-projects true
|
||||
:with-hero show-hero?
|
||||
:with-team-hero show-team-hero?)}
|
||||
(for [{:keys [id] :as project} projects]
|
||||
(let [files (when recent-map
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
height: calc(100vh - $s-64);
|
||||
}
|
||||
|
||||
.with-hero,
|
||||
.with-team-hero {
|
||||
height: calc(100vh - $s-280);
|
||||
}
|
||||
@@ -86,8 +85,6 @@
|
||||
color: var(--title-foreground-color-hover);
|
||||
cursor: pointer;
|
||||
height: $s-16;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.info-wrapper {
|
||||
@@ -242,88 +239,3 @@
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.hero-projects {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: $s-32;
|
||||
margin: 0 $s-16 $s-16 $s-20;
|
||||
|
||||
@media (max-width: 1366px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.tutorial,
|
||||
.walkthrough {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
position: relative;
|
||||
border-radius: $br-8;
|
||||
min-height: $s-216;
|
||||
background-color: $db-tertiary;
|
||||
padding: $s-8;
|
||||
|
||||
.thumbnail {
|
||||
width: $s-200;
|
||||
height: $s-200;
|
||||
border-radius: $br-6;
|
||||
padding: $s-32;
|
||||
display: block;
|
||||
background-color: var(--color-canvas);
|
||||
}
|
||||
|
||||
img {
|
||||
border-radius: $br-4;
|
||||
margin-bottom: 0;
|
||||
width: $s-232;
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: $s-32;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: $df-primary;
|
||||
font-size: $fs-24;
|
||||
font-weight: $fw400;
|
||||
margin-bottom: $s-8;
|
||||
}
|
||||
.info {
|
||||
flex: 1;
|
||||
color: $df-secondary;
|
||||
margin-bottom: $s-20;
|
||||
font-size: $fs-16;
|
||||
}
|
||||
.invite {
|
||||
height: $s-32;
|
||||
}
|
||||
.action {
|
||||
width: $s-180;
|
||||
height: $s-40;
|
||||
}
|
||||
}
|
||||
.walkthrough {
|
||||
.thumbnail {
|
||||
background-image: url("/images/walkthrough-cover.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
}
|
||||
.tutorial {
|
||||
.thumbnail {
|
||||
background-image: url("/images/hands-on-tutorial.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.loader {
|
||||
display: flex;
|
||||
svg#loader-pencil {
|
||||
width: $s-32;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
[:div {:class (stl/css :img-container)}
|
||||
[:a {:id id
|
||||
:tab-index (if (or (not is-visible) collapsed) "-1" "0")
|
||||
:href "https://penpot.app/libraries-templates.html"
|
||||
:href "https://penpot.app/libraries-templates"
|
||||
:target "_blank"
|
||||
:on-click on-click
|
||||
:on-key-down on-key-down}
|
||||
|
||||
@@ -142,7 +142,9 @@
|
||||
(modal/show! {:type :onboarding-newsletter})
|
||||
|
||||
(contains? cf/flags :onboarding-team)
|
||||
(modal/show! {:type :onboarding-team}))))]
|
||||
(modal/show! {:type :onboarding-team}))))
|
||||
|
||||
onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
|
||||
(mf/with-effect [@slide]
|
||||
(when (not= :start @slide)
|
||||
@@ -151,8 +153,8 @@
|
||||
(fn []
|
||||
(reset! klass nil)
|
||||
(tm/dispose! sem))))
|
||||
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class (dm/str @klass " " (stl/css :animated))}
|
||||
(case @slide
|
||||
:start [:& onboarding-welcome {:next #(navigate :opensource)}]
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
(ns app.main.ui.onboarding.newsletter
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.config :as cf]
|
||||
[app.main.data.messages :as msg]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.users :as du]
|
||||
@@ -35,9 +36,11 @@
|
||||
(st/emit! (when (or @newsletter-updates @newsletter-news)
|
||||
(msg/success message))
|
||||
(modal/show {:type :onboarding-team})
|
||||
(du/update-profile-props {:newsletter-updates @newsletter-updates :newsletter-news @newsletter-news}))))]
|
||||
(du/update-profile-props {:newsletter-updates @newsletter-updates :newsletter-news @newsletter-news}))))
|
||||
onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated.fadeInDown {:class (stl/css :modal-container)}
|
||||
[:div {:class (stl/css :modal-left)}
|
||||
[:img {:src "images/deco-newsletter.png"
|
||||
|
||||
@@ -287,9 +287,11 @@
|
||||
(modal/show! {:type :onboarding-team})
|
||||
|
||||
:else
|
||||
(modal/hide!)))))]
|
||||
(modal/hide!)))))
|
||||
onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div {:class (stl/css :modal-container)
|
||||
:ref container}
|
||||
(case @step
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
(:require
|
||||
[app.common.data.macros :as dmc]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cf]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.messages :as msg]
|
||||
@@ -84,14 +85,16 @@
|
||||
::ev/origin "onboarding"
|
||||
:step 1}))))
|
||||
|
||||
teams (mf/deref refs/teams)]
|
||||
teams (mf/deref refs/teams)
|
||||
onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
|
||||
(mf/with-effect [teams]
|
||||
(when (> (count teams) 1)
|
||||
(st/emit! (modal/hide))))
|
||||
|
||||
(when (< (count teams) 2)
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated.fadeIn {:class (stl/css :modal-container)}
|
||||
[:& team-modal-left]
|
||||
[:div {:class (stl/css :separator)}]
|
||||
@@ -212,9 +215,11 @@
|
||||
(if (> (count emails) 0)
|
||||
(on-invite-now form)
|
||||
(on-invite-later form))
|
||||
(modal/hide!))))]
|
||||
(modal/hide!))))
|
||||
onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated.fadeIn {:class (stl/css :modal-container)}
|
||||
[:& team-modal-left]
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
[:h2 "Libraries & templates"]]
|
||||
[:div.modal-content
|
||||
[:p "We’ve created a new space on Penpot where you can share your libraries and templates and download the ones you like. Material Design, Cocomaterial or Penpot’s Design System are among them (and a lot more to come!)."]
|
||||
[:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates.html"} "Explore libraries & templates"]]]
|
||||
[:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates"} "Explore libraries & templates"]]]
|
||||
[:div.modal-navigation
|
||||
[:button.btn-secondary {:on-click finish} "Start!"]
|
||||
[:& c/navigation-bullets
|
||||
|
||||
@@ -8,196 +8,203 @@
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.config :as cf]
|
||||
[app.main.ui.releases.common :as c]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
;; TODO: Review all copies and alt text
|
||||
(defmethod c/render-release-notes "2.0"
|
||||
[{:keys [slide klass next finish navigate version]}]
|
||||
(mf/html
|
||||
(case slide
|
||||
:start
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-intro-image.png"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "A graphic illustration with Penpot style"}]
|
||||
(let [onboarding-a-b-test? (cf/external-feature-flag "signup-background" "test")]
|
||||
(mf/html
|
||||
(case slide
|
||||
:start
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-intro-image.png"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "A graphic illustration with Penpot style"}]
|
||||
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"Welcome to Penpot 2.0! "]
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"Welcome to Penpot 2.0! "]
|
||||
|
||||
[:div {:class (stl/css :version-tag)}
|
||||
(dm/str "Version " version)]]
|
||||
[:div {:class (stl/css :version-tag)}
|
||||
(dm/str "Version " version)]]
|
||||
|
||||
[:div {:class (stl/css :features-block)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"CSS Grid Layout: "]
|
||||
"Bring your designs to life, knowing that what you create is what developers code."]
|
||||
[:div {:class (stl/css :features-block)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"CSS Grid Layout: "]
|
||||
"Bring your designs to life, knowing that what you create is what developers code."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"Sleeker UI: "]
|
||||
"We’ve polished Penpot to make your experience smoother and more enjoyable."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"Sleeker UI: "]
|
||||
"We’ve polished Penpot to make your experience smoother and more enjoyable."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"New Components System: "]
|
||||
"Managing and using your design components got a whole lot better."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
[:spam {:class (stl/css :feature-title)}
|
||||
"New Components System: "]
|
||||
"Managing and using your design components got a whole lot better."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"And that’s not all - we’ve fined tuned performance and "
|
||||
"accessibility to give you a better and more fluid design experience."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"And that’s not all - we’ve fined tuned performance and "
|
||||
"accessibility to give you a better and more fluid design experience."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
" Ready to dive in? Let 's get started!"]]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
" Ready to dive in? Let 's get started!"]]
|
||||
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:button {:class (stl/css :next-btn)
|
||||
:on-click next} "Continue"]]]]]]
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:button {:class (stl/css :next-btn)
|
||||
:on-click next} "Continue"]]]]]]
|
||||
|
||||
0
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-css-grid.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's CSS Grid Layout"}]
|
||||
0
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-css-grid.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's CSS Grid Layout"}]
|
||||
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"CSS Grid Layout - Design Meets Development"]]
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"CSS Grid Layout - Design Meets Development"]]
|
||||
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"The much-awaited Grid Layout introduces 2-dimensional"
|
||||
" layout capabilities to Penpot, allowing for the creation"
|
||||
" of adaptive layouts by leveraging the power of CSS properties."]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"The much-awaited Grid Layout introduces 2-dimensional"
|
||||
" layout capabilities to Penpot, allowing for the creation"
|
||||
" of adaptive layouts by leveraging the power of CSS properties."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"It’s a host of new features, including columns and"
|
||||
" rows management, flexible units such as FR (fractions),"
|
||||
" the ability to create and name areas, and tons of new "
|
||||
"and unique possibilities within a design tool."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"It’s a host of new features, including columns and"
|
||||
" rows management, flexible units such as FR (fractions),"
|
||||
" the ability to create and name areas, and tons of new "
|
||||
"and unique possibilities within a design tool."]
|
||||
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"Designers will learn CSS basics while working, "
|
||||
"and as always with Penpot, developers can pick"
|
||||
" up the design as code to take it from there."]]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"Designers will learn CSS basics while working, "
|
||||
"and as always with Penpot, developers can pick"
|
||||
" up the design as code to take it from there."]]
|
||||
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
|
||||
1
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-new-ui.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's UI Makeover"}]
|
||||
1
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-new-ui.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's UI Makeover"}]
|
||||
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"UI Makeover - Smoother, Sharper, and Simply More Fun"]]
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"UI Makeover - Smoother, Sharper, and Simply More Fun"]]
|
||||
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"We've completely overhauled Penpot's user interface. "
|
||||
"The improvements in consistency, the introduction of "
|
||||
"new microinteractions, and attention to countless details"
|
||||
" will significantly enhance the productivity and enjoyment of using Penpot."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"Furthermore, we’ve made several accessibility improvements, "
|
||||
"with better color contrast, keyboard navigation,"
|
||||
" and adherence to other best practices."]]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"We've completely overhauled Penpot's user interface. "
|
||||
"The improvements in consistency, the introduction of "
|
||||
"new microinteractions, and attention to countless details"
|
||||
" will significantly enhance the productivity and enjoyment of using Penpot."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"Furthermore, we’ve made several accessibility improvements, "
|
||||
"with better color contrast, keyboard navigation,"
|
||||
" and adherence to other best practices."]]
|
||||
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
|
||||
2
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-components.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's new components system"}]
|
||||
2
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-components.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt "Penpot's new components system"}]
|
||||
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"New Components System"]]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"The new Penpot components system improves"
|
||||
" control over instances, including their "
|
||||
"inheritances and properties overrides. "
|
||||
"Main components are now accessible as design"
|
||||
" elements, allowing a better updating "
|
||||
"workflow through instant changes synchronization."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"And that’s not all, there are new capabilities "
|
||||
"such as component swapping and annotations "
|
||||
"that will help you to better manage your design systems."]]
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"New Components System"]]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"The new Penpot components system improves"
|
||||
" control over instances, including their "
|
||||
"inheritances and properties overrides. "
|
||||
"Main components are now accessible as design"
|
||||
" elements, allowing a better updating "
|
||||
"workflow through instant changes synchronization."]
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"And that’s not all, there are new capabilities "
|
||||
"such as component swapping and annotations "
|
||||
"that will help you to better manage your design systems."]]
|
||||
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
[:button {:on-click next
|
||||
:class (stl/css :next-btn)} "Continue"]]]]]]
|
||||
|
||||
3
|
||||
[:div {:class (stl/css :modal-overlay)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-html.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt " Penpot's HTML code generator"}]
|
||||
3
|
||||
[:div {:class (stl/css-case :modal-overlay true
|
||||
:onboarding-a-b-test onboarding-a-b-test?)}
|
||||
[:div.animated {:class klass}
|
||||
[:div {:class (stl/css :modal-container)}
|
||||
[:img {:src "images/features/2.0-html.gif"
|
||||
:class (stl/css :start-image)
|
||||
:border "0"
|
||||
:alt " Penpot's HTML code generator"}]
|
||||
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"And much more"]]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"In addition to all of this, we’ve included several other requested improvements:"]
|
||||
[:ul {:class (stl/css :feature-list)}
|
||||
[:li "Access HTML markup code directly in inspect mode"]
|
||||
[:li "Images are now treated as element fills, maintaining their aspect ratio on resize, ideal for flexible designs"]
|
||||
[:li "Enjoy new color themes with options for both dark and light modes"]
|
||||
[:li "Feel the speed boost! Enjoy a smoother experience with a bunch of performance improvements"]]]
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
[:div {:class (stl/css :modal-header)}
|
||||
[:h1 {:class (stl/css :modal-title)}
|
||||
"And much more"]]
|
||||
[:div {:class (stl/css :feature)}
|
||||
[:p {:class (stl/css :feature-content)}
|
||||
"In addition to all of this, we’ve included several other requested improvements:"]
|
||||
[:ul {:class (stl/css :feature-list)}
|
||||
[:li "Access HTML markup code directly in inspect mode"]
|
||||
[:li "Images are now treated as element fills, maintaining their aspect ratio on resize, ideal for flexible designs"]
|
||||
[:li "Enjoy new color themes with options for both dark and light modes"]
|
||||
[:li "Feel the speed boost! Enjoy a smoother experience with a bunch of performance improvements"]]]
|
||||
|
||||
[:div {:class (stl/css :navigation)}
|
||||
[:div {:class (stl/css :navigation)}
|
||||
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
[:& c/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
:total 4}]
|
||||
|
||||
[:button {:on-click finish
|
||||
:class (stl/css :next-btn)} "Let's go"]]]]]])))
|
||||
[:button {:on-click finish
|
||||
:class (stl/css :next-btn)} "Let's go"]]]]]]))))
|
||||
|
||||
|
||||
@@ -122,7 +122,11 @@
|
||||
(add! :stroke-cap-end)))
|
||||
|
||||
(cond-> text?
|
||||
(-> (add! :grow-type)
|
||||
(-> (add! :x)
|
||||
(add! :y)
|
||||
(add! :width)
|
||||
(add! :height)
|
||||
(add! :grow-type)
|
||||
(add! :content (comp json/encode uuid->string))
|
||||
(add! :position-data (comp json/encode uuid->string))))
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
(mf/fnc group-shape
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
|
||||
(let [shape (unchecked-get props "shape")
|
||||
childs (unchecked-get props "childs")
|
||||
render-id (mf/use-ctx muc/render-id)
|
||||
@@ -36,21 +37,31 @@
|
||||
|
||||
mask-props (if ^boolean masked-group?
|
||||
#js {:mask (mask-url render-id mask)}
|
||||
#js {})]
|
||||
#js {})
|
||||
|
||||
current-svg-root-id (mf/use-ctx muc/current-svg-root-id)
|
||||
|
||||
;; We need to create a "scope" for svg classes. The root of the imported SVG (first group) will
|
||||
;; be stored in the context. When rendering the styles we add its id as prefix.
|
||||
[svg-wrapper svg-wrapper-props]
|
||||
(if (and (contains? shape :svg-attrs) (not current-svg-root-id))
|
||||
[(mf/provider muc/current-svg-root-id) #js {:value (:id shape)}]
|
||||
[mf/Fragment #js {}])]
|
||||
|
||||
;; We need to separate mask and clip into two because a bug in
|
||||
;; Firefox breaks when the group has clip+mask+foreignObject
|
||||
;; Clip and mask separated will work in every platform Firefox
|
||||
;; bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1734805
|
||||
[:> wrapper clip-props
|
||||
[:> wrapper mask-props
|
||||
(when ^boolean masked-group?
|
||||
[:& render-mask {:mask mask}])
|
||||
[:> svg-wrapper svg-wrapper-props
|
||||
[:> wrapper clip-props
|
||||
[:> wrapper mask-props
|
||||
(when ^boolean masked-group?
|
||||
[:& render-mask {:mask mask}])
|
||||
|
||||
(for [item childs]
|
||||
[:& shape-wrapper
|
||||
{:shape item
|
||||
:key (dm/str (dm/get-prop item :id))}])]]))))
|
||||
(for [item childs]
|
||||
[:& shape-wrapper
|
||||
{:shape item
|
||||
:key (dm/str (dm/get-prop item :id))}])]]]))))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +94,13 @@
|
||||
(obj/unset! "disable-shadows?")
|
||||
(obj/set! "ref" ref)
|
||||
(obj/set! "id" (dm/fmt "shape-%" shape-id))
|
||||
|
||||
;; TODO: This is added for backward compatibility.
|
||||
(cond-> (and (cfh/text-shape? shape) (empty? (:position-data shape)))
|
||||
(-> (obj/set! "x" (:x shape))
|
||||
(obj/set! "y" (:y shape))
|
||||
(obj/set! "width" (:width shape))
|
||||
(obj/set! "height" (:height shape))))
|
||||
(obj/set! "style" styles))
|
||||
|
||||
wrapper-props
|
||||
|
||||
@@ -104,9 +104,20 @@
|
||||
svg-root? (and (map? content) (= tag :svg))
|
||||
svg-tag? (map? content)
|
||||
svg-leaf? (string? content)
|
||||
valid-tag? (contains? csvg/svg-tags tag)]
|
||||
valid-tag? (contains? csvg/svg-tags tag)
|
||||
|
||||
current-svg-root-id (mf/use-ctx muc/current-svg-root-id)
|
||||
|
||||
;; We need to create a "scope" for svg classes. The root of the imported SVG (first group) will
|
||||
;; be stored in the context and with this we scoped the styles:
|
||||
style-content
|
||||
(when (= tag :style)
|
||||
(dm/str "#shape-" current-svg-root-id "{ " (->> shape :content :content (str/join "\n")) " }"))]
|
||||
|
||||
(cond
|
||||
(= tag :style)
|
||||
[:style style-content]
|
||||
|
||||
^boolean svg-root?
|
||||
[:& svg-root {:shape shape}
|
||||
(for [item childs]
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.pprint :as pp]
|
||||
[app.common.uri :as u]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
@@ -16,6 +18,7 @@
|
||||
[app.util.i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.webapi :as wapi]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc error-container
|
||||
@@ -146,15 +149,19 @@
|
||||
|
||||
(mf/defc exception-page
|
||||
{::mf/props :obj}
|
||||
[{:keys [data] :as props}]
|
||||
(case (:type data)
|
||||
:not-found
|
||||
[:& not-found]
|
||||
[{:keys [data route] :as props}]
|
||||
(let [type (:type data)
|
||||
path (:path route)
|
||||
query-params (u/map->query-string (:query-params route))]
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "exception-page" :type type :path path :query-params query-params}))
|
||||
(case (:type data)
|
||||
:not-found
|
||||
[:& not-found]
|
||||
|
||||
:bad-gateway
|
||||
[:& bad-gateway]
|
||||
:bad-gateway
|
||||
[:& bad-gateway]
|
||||
|
||||
:service-unavailable
|
||||
[:& service-unavailable]
|
||||
:service-unavailable
|
||||
[:& service-unavailable]
|
||||
|
||||
[:> internal-error props]))
|
||||
[:> internal-error props])))
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
:title (tr "viewer.header.comments-section" (sc/get-tooltip :open-comments))}
|
||||
i/comments])
|
||||
|
||||
(when (or (= (:type permissions) :membership)
|
||||
(when (or (:in-team permissions)
|
||||
(and (= (:type permissions) :share-link)
|
||||
(= (:who-inspect permissions) "all")))
|
||||
[:button {:on-click go-to-inspect
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
(ns app.main.ui.workspace.colorpicker.libraries
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.colors :as c]
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.data.events :as ev]
|
||||
@@ -24,7 +25,7 @@
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc libraries
|
||||
[{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}]
|
||||
[{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}]
|
||||
(let [selected (h/use-shared-state mdc/colorpicker-selected-broadcast-key :recent)
|
||||
current-colors (mf/use-state [])
|
||||
|
||||
@@ -43,10 +44,17 @@
|
||||
(parse-uuid event)))))
|
||||
|
||||
check-valid-color?
|
||||
(fn [color]
|
||||
(and (or (not disable-gradient) (not (:gradient color)))
|
||||
(or (not disable-opacity) (= 1 (:opacity color)))
|
||||
(or (not disable-image) (not (:image color)))))
|
||||
(mf/use-fn
|
||||
(fn [color]
|
||||
(and (or (not disable-gradient) (not (:gradient color)))
|
||||
(or (not disable-opacity) (= 1 (:opacity color)))
|
||||
(or (not disable-image) (not (:image color))))))
|
||||
|
||||
;; Sort colors by hue and lightness
|
||||
get-sorted-colors
|
||||
(mf/use-fn
|
||||
(fn [colors]
|
||||
(sort c/sort-colors (into [] (filter check-valid-color?) colors))))
|
||||
|
||||
toggle-palette
|
||||
(mf/use-fn
|
||||
@@ -89,13 +97,15 @@
|
||||
(sort-by :name)
|
||||
(map #(assoc % :file-id file-id)))))]
|
||||
|
||||
(reset! current-colors (into [] (filter check-valid-color?) colors))))
|
||||
(if (not= @selected :recent)
|
||||
(reset! current-colors (get-sorted-colors colors))
|
||||
(reset! current-colors (into [] (filter check-valid-color? colors))))))
|
||||
|
||||
;; If the file colors change and the file option is selected updates the state
|
||||
(mf/with-effect [file-colors]
|
||||
(when (= @selected :file)
|
||||
(let [colors (vals file-colors)]
|
||||
(reset! current-colors (into [] (filter check-valid-color?) colors)))))
|
||||
(reset! current-colors (get-sorted-colors colors)))))
|
||||
|
||||
[:div {:class (stl/css :libraries)}
|
||||
[:div {:class (stl/css :select-wrapper)}
|
||||
|
||||
@@ -272,9 +272,21 @@
|
||||
(def has-position? #{:frame :rect :image :text})
|
||||
|
||||
(defn parse-position
|
||||
[props svg-data]
|
||||
(let [values (->> (select-keys svg-data [:x :y :width :height])
|
||||
(d/mapm (fn [_ val] (d/parse-double val))))]
|
||||
[props node svg-data]
|
||||
(let [x (get-meta node :x d/parse-double)
|
||||
y (get-meta node :y d/parse-double)
|
||||
width (get-meta node :width d/parse-double)
|
||||
height (get-meta node :height d/parse-double)
|
||||
|
||||
values (->> (select-keys svg-data [:x :y :width :height])
|
||||
(d/mapm (fn [_ val] (d/parse-double val))))
|
||||
|
||||
values
|
||||
(cond-> values
|
||||
(some? x) (assoc :x x)
|
||||
(some? y) (assoc :y y)
|
||||
(some? width) (assoc :width width)
|
||||
(some? height) (assoc :height height))]
|
||||
(d/merge props values)))
|
||||
|
||||
(defn parse-circle
|
||||
@@ -392,7 +404,7 @@
|
||||
center (gpt/point center-x center-y)]
|
||||
(cond-> props
|
||||
(has-position? type)
|
||||
(parse-position svg-data)
|
||||
(parse-position node svg-data)
|
||||
|
||||
(= type :svg-raw)
|
||||
(add-svg-position node)
|
||||
|
||||
@@ -352,7 +352,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Lêers wat by biblioteke gevoeg is, sal hier verskyn. Probeer om jou lêers te "
|
||||
"deel of voeg by vanaf ons [Biblioteke en sjablone](https://penpot.app/"
|
||||
"libraries-templates.html)."
|
||||
"libraries-templates)."
|
||||
|
||||
#: src/app/main/ui/auth/login.cljs
|
||||
msgid "auth.login-with-github-submit"
|
||||
|
||||
@@ -306,7 +306,7 @@ msgstr "تكرير %s الملفات"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"أوه لا! ليس لديك ملفات بعد! إذا كنت تريد تجربة بعض القوالب ، فانتقل إلى "
|
||||
"[المكتبات والقوالب] (https://penpot.app/libraries-templates.html)"
|
||||
"[المكتبات والقوالب] (https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "تنزيل ملفات ٪s Penpot (.penpot)"
|
||||
|
||||
@@ -311,7 +311,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Encara no hi ha fitxers. Si voleu provar algunes plantilles, podeu anar a "
|
||||
"la secció [Biblioteques i "
|
||||
"plantilles](https://penpot.app/libraries-templates.html)"
|
||||
"plantilles](https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Baixa %s fitxers Penpot (.penpot)"
|
||||
|
||||
@@ -310,7 +310,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Zde se zobrazí soubory přidané do knihoven. Zkuste své soubory sdílet nebo "
|
||||
"je přidat z našich [Libraries & "
|
||||
"templates](https://penpot.app/libraries-templates.html)."
|
||||
"templates](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Stáhnout soubory %s Penpot (.penpot)"
|
||||
|
||||
@@ -406,7 +406,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Files added to Libraries will appear here. Try sharing your files or add "
|
||||
"from our [Libraries & "
|
||||
"templates](https://penpot.app/libraries-templates.html)."
|
||||
"templates](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Download %s Penpot files (.penpot)"
|
||||
@@ -968,14 +968,6 @@ msgstr "Your profile has emails muted (spam reports or high bounces)."
|
||||
msgid "errors.registration-disabled"
|
||||
msgstr "The registration is currently disabled."
|
||||
|
||||
#: src/app/main/data/users.cljs
|
||||
msgid "errors.auth-provider-not-allowed"
|
||||
msgstr "Auth provider not allowed for this profile"
|
||||
|
||||
#: src/app/main/data/users.cljs
|
||||
msgid "errors.email-domain-not-allowed"
|
||||
msgstr "Domain not allowed"
|
||||
|
||||
msgid "errors.team-leave.insufficient-members"
|
||||
msgstr "Insufficient members to leave team, you probably want to delete it."
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Los archivos agregados a las bibliotecas aparecerán aquí. Si quieres probar "
|
||||
"con alguna plantilla ve a [Bibliotecas y "
|
||||
"plantillas](https://penpot.app/libraries-templates.html)."
|
||||
"plantillas](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Descargar %s archivos Penpot (.penpot)"
|
||||
@@ -991,14 +991,6 @@ msgstr ""
|
||||
msgid "errors.registration-disabled"
|
||||
msgstr "El registro está actualmente desactivado."
|
||||
|
||||
#: src/app/main/data/users.cljs
|
||||
msgid "errors.auth-provider-not-allowed"
|
||||
msgstr "El proveedor de autenticación no permitido para este perfil de usuario"
|
||||
|
||||
#: src/app/main/data/users.cljs
|
||||
msgid "errors.email-domain-not-allowed"
|
||||
msgstr "Dominio no permitido"
|
||||
|
||||
msgid "errors.team-leave.insufficient-members"
|
||||
msgstr ""
|
||||
"No hay miembros suficientes para salir del equipo, probablemente quieras "
|
||||
|
||||
@@ -258,7 +258,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Los archivos agregados a las Bibliotecas aparecerán aquí. Intente compartir "
|
||||
"sus archivos o agréguelos desde nuestras [Libraries & "
|
||||
"templates](https://penpot.app/libraries-templates.html)."
|
||||
"templates](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Descargar %s archivos Penpot (.penpot)"
|
||||
|
||||
@@ -309,7 +309,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Oh ez! Oraindik ez duzu fitxategirik! Txantiloi batekin proba egin nahi "
|
||||
"baduzu joan [Liburutegi eta "
|
||||
"txantiloiak](https://penpot.app/libraries-templates.html) atalera."
|
||||
"txantiloiak](https://penpot.app/libraries-templates) atalera."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Deskargatu %s Penpot fitxategi (.penpot)"
|
||||
|
||||
@@ -308,7 +308,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"وای نه! شما هنوز هیچ فایلی ندارید! اگر میخواهید چند الگو را امتحان کنید، "
|
||||
"به [کتابخانهها و الگوها] بروید "
|
||||
"(https://penpot.app/libraries-templates.html)"
|
||||
"(https://penpot.app/libraries-templates)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "dashboard.export-binary-multi"
|
||||
|
||||
@@ -298,7 +298,7 @@ msgstr "Tvítak %s fílur"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Áh nei! Tú hevur ongar fílur enn! Um tú vilt royna við nøkrum skapilónum, "
|
||||
"vitja [Libraries & templates](https://penpot.app/libraries-templates.html)"
|
||||
"vitja [Libraries & templates](https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Heinta %s Penpot fílur (.penpot)"
|
||||
|
||||
@@ -397,7 +397,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Oh non ! Vous n'avez pas encore de fichiers ! Si vous voulez essayer avec "
|
||||
"des modèles, allez sur [Bibliothèques et modèles] "
|
||||
"(https://penpot.app/libraries-templates.html)."
|
||||
"(https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Télécharger %s fichiers Penpot (.penpot)"
|
||||
|
||||
@@ -306,7 +306,7 @@ msgstr "Duplicar % ficheiros"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Ai non! Ainda non tes ficheiros! Se queres facer a proba con algún modelo "
|
||||
"vai a [Bibliotecas e modelos] (https://penpot.app/libraries-templates.html)"
|
||||
"vai a [Bibliotecas e modelos] (https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Descargar %s ficheiros Penpot (.penpot)"
|
||||
|
||||
@@ -381,7 +381,7 @@ msgstr "שכפול %s קבצים"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"קבצים שנוספו לספריות יתווספו לכאן. כדאי לנסות לשתף את הקבצים שלך או להוסיף "
|
||||
"אותם מ[הספריות והתבניות](https://penpot.app/libraries-templates.html)."
|
||||
"אותם מ[הספריות והתבניות](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "הורדת %s קובצי Penpot (.penpot)"
|
||||
|
||||
@@ -308,7 +308,7 @@ msgstr "Kopiraj %s datoteka"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"O ne! Još nemaš datoteka! Ako želiš isprobati neke predloške, idi na "
|
||||
"[Biblioteke i predlošci](https://penpot.app/libraries-templates.html)"
|
||||
"[Biblioteke i predlošci](https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Preuzmi %s Penpot datoteke (.penpot)"
|
||||
|
||||
@@ -401,7 +401,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Berkas yang ditambahkan ke Pustaka akan muncul di sini. Coba membagikan "
|
||||
"berkas Anda atau menambahkan dari [Pustaka & "
|
||||
"templat](https://penpot.app/libraries-templates.html) kami."
|
||||
"templat](https://penpot.app/libraries-templates) kami."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Unduh %s berkas Penpot (.penpot)"
|
||||
|
||||
@@ -304,7 +304,7 @@ msgstr "Duplicare %s file"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Oh no! Non hai ancora nessun file! Se desideri provare alcuni template vai "
|
||||
"su [Librerie e template](https://penpot.app/libraries-templates.html)"
|
||||
"su [Librerie e template](https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Scarica %s file Penpot (.penpot)"
|
||||
|
||||
@@ -267,7 +267,7 @@ msgstr "%s ファイルを複製"
|
||||
msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"まだファイルがありません。もしいくつかのテンプレートを試してみたいなら、[Libraries & "
|
||||
"templates](https://penpot.app/libraries-templates.html) をチェックしてみてください。"
|
||||
"templates](https://penpot.app/libraries-templates) をチェックしてみてください。"
|
||||
|
||||
msgid "dashboard.export-frames"
|
||||
msgstr "PDFでエクスポート"
|
||||
|
||||
@@ -297,7 +297,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Čia bus rodomi prie bibliotekų pridėti failai. Pabandykite bendrinti failus "
|
||||
"arba pridėti iš mūsų [Bibliotekos ir šablonai] "
|
||||
"(https://penpot.app/libraries-templates.html)"
|
||||
"(https://penpot.app/libraries-templates)"
|
||||
|
||||
msgid "dashboard.export-frames"
|
||||
msgstr "Eksportuokite darbalaukius į PDF"
|
||||
|
||||
@@ -404,7 +404,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Šeit tiks parādītas bibliotēkām pievienotās datnes. Mēģini koplietot datnes "
|
||||
"vai pievienot tās no mūsu [bibliotēkām un veidnēm](https://penpot.app/"
|
||||
"libraries-templates.html)."
|
||||
"libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Lejupielādēt %s Penpot datnes (.penpot)"
|
||||
|
||||
@@ -225,7 +225,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"ഇതുവരെയും ഇവിടെ ഫയലുകളില്ല. നിങ്ങൾക്ക് ചില ടെമ്പ്ലേറ്റുകൾ "
|
||||
"പരീക്ഷിക്കണമെന്നുണ്ടെങ്കിൽ [ലൈബ്രറികളുടെയും ടെമ്പ്ലേറ്റുകളുടെയും "
|
||||
"വിഭാഗത്തിലേക്ക്] (https://penpot.app/libraries-templates.html) പോകാവുന്നതാണ്"
|
||||
"വിഭാഗത്തിലേക്ക്] (https://penpot.app/libraries-templates) പോകാവുന്നതാണ്"
|
||||
|
||||
msgid "dashboard.export-frames"
|
||||
msgstr "ആർട്ട്ബോർഡുകൾ പിഡിഎഫായി എക്സ്പോർട്ട് ചെയ്യുക"
|
||||
|
||||
@@ -336,7 +336,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Fail yang ditambahkan pada Perpustakaan akan dipaparkan di sini. Cuba kongsi "
|
||||
"fail anda atau tambahkan daripada [Perpustakaan & templat](https://penpot."
|
||||
"app/libraries-templates.html) kami."
|
||||
"app/libraries-templates) kami."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Muat turun %s fail Penpot (.penpot)"
|
||||
|
||||
@@ -417,7 +417,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Bestanden die aan bibliotheken zijn toegevoegd, worden hier weergegeven. "
|
||||
"Probeer je bestanden te delen of toe te voegen vanuit onze [Bibliotheken & "
|
||||
"sjablonen] (https://penpot.app/libraries-templates.html)."
|
||||
"sjablonen] (https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "%s Penpot-bestanden downloaden (.penpot)"
|
||||
|
||||
@@ -309,7 +309,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Tutaj pojawią się pliki dodane do Bibliotek. Spróbuj udostępnić swoje pliki "
|
||||
"lub dodać z naszych [Bibliotek i "
|
||||
"szablonów](https://penpot.app/libraries-templates.html)."
|
||||
"szablonów](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Pobierz %s plików Penpot (.penpot)"
|
||||
|
||||
@@ -307,7 +307,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Arquivos adicionados na biblioteca de ativos vão aparecer aqui. Tente "
|
||||
"compartilhar seus arquivos ou adicione das nossas [Bibliotecas & "
|
||||
"modelos](https://penpot.app/libraries-templates.html)."
|
||||
"modelos](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Baixar %s arquivos Penpot (.penpot)"
|
||||
|
||||
@@ -400,7 +400,7 @@ msgid "dashboard.empty-placeholder-drafts"
|
||||
msgstr ""
|
||||
"Oh não! Ainda não tens ficheiros! Se quiseres experimentar podes começar "
|
||||
"com os nossos templates em [Libraries & "
|
||||
"templates](https://penpot.app/libraries-templates.html)."
|
||||
"templates](https://penpot.app/libraries-templates)."
|
||||
|
||||
msgid "dashboard.export-binary-multi"
|
||||
msgstr "Descarrega %s ficheiros Penpot (.penpot)"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user