Commit Graph
100 Commits
Author SHA1 Message Date
Mythie dc34e81a7e chore: downgrade sharp 2024-06-28 12:12:15 +10:00
Mythie a42fc3cbaa chore: hoist sharp dependency 2024-06-28 11:08:31 +10:00
Lucas Smith b08e153ca2 feat: add public profiles (#1180)
## Description

Add public profiles

## Changes

- Add profiles settings page for users and teams
- Add profiles page `/p/<url>`

## Not completed

- Pending tests
- UI changes to promote public profiles (sign up, etc)
2024-06-27 22:47:20 +10:00
Mythie d85f207d59 fix: add button type 2024-06-27 22:32:48 +10:00
Mythie 22c02aac02 feat: avatar images 2024-06-27 21:50:42 +10:00
Lucas Smith 5b4e6e530b Merge branch 'main' into feat/public-profiles 2024-06-27 12:10:45 +10:00
Lucas Smith 93842ba604 fix: show correct authentication action for account required (#1191)
## Description

When using account required auth for a given document this change now
shows the sign up or sign in button depending on if an account actually
exists within
Documenso.

This change should reduce friction and confusion when a recipient has
been invited to a document.

## Related Issue

<!--- If this pull request is related to a specific issue, reference it
here using #issue_number. -->
<!--- For example, "Fixes #123" or "Addresses #456". -->

## Changes Made

- Updated the ssr for the signing page to fetch whether a user account
exists when document auth is required
- Pass the user exists flag to the document auth required page

## Testing Performed

- Created and sent a document to a user with an account and one without an account in both a logged in and logged out state and confirmed that the dialogs are displayed as expected.
2024-06-26 12:03:01 +10:00
Lucas Smith d6f9c701fc fix: direct links for teams are generated wrong (#1197)
use `NEXT_PUBLIC_WEBAPP_URL()` for the base URL.
2024-06-26 11:50:20 +10:00
Lucas Smith 1f59266e08 Merge branch 'main' into fix/show-sign-in-or-sign-up-for-account-required 2024-06-26 11:48:15 +10:00
Lucas Smith e527058322 Merge branch 'main' into fix/show-sign-in-or-sign-up-for-account-required 2024-06-24 19:44:23 +10:00
Lucas Smith 19d8b4b80d Merge branch 'main' into feat/public-profiles 2024-06-21 20:14:32 +10:00
Lucas Smith 9a48da5270 feat: background tasks (#1160)
## Description

Currently a work in progress but this adds background tasks to Documenso
for handling tasks that take a little longer and aren't part of the
overall critical path.

## Related Issue

N/A

## Changes Made

Added a pluggable jobs provider supporting both a local provider and a
Trigger.dev provider.

## Testing Performed

- Verified job level retries work
- Verified task level retries work without incrementing job retries


![image](https://github.com/documenso/documenso/assets/13398220/3bbfbc7f-28ef-43ab-a539-ae0d4e900b43)

![image](https://github.com/documenso/documenso/assets/13398220/fd012169-4986-4653-b852-ba6e19a5d131)


**This will still have a lot of rough edges but is a perfect MVP for
local _durable_ compute which may accept more providers later on**

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added background job management functionalities to handle email
sending and job processing.
- Introduced support for triggering and managing jobs using various
providers.

- **Chores**
- Updated environment configuration files to support new job management
features.
- Added and updated scripts and dependencies for job management and CLI
commands.
  
- **Refactor**
- Refactored email sending functionalities to utilize the new job queue
mechanism.

- **Documentation**
- Updated documentation to reflect the new environment variables and
configurations related to background jobs.

- **Configuration**
- Updated Docker configurations to support new services for job
management.
- Updated VSCode settings for improved development experience with new
dependencies and formatting rules.
  
- **Database**
- Added new database schemas and migrations to support background job
management and tracking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-21 14:32:29 +10:00
Mythie 2c3c067eb4 chore: add inngest:dev command 2024-06-21 14:25:45 +10:00
Lucas Smith 5d417ee67f Merge branch 'main' into feat/public-profiles 2024-06-21 13:59:13 +10:00
Lucas Smith 1ad64b43db Merge branch 'main' into feat/background-tasks 2024-06-21 13:58:56 +10:00
Mythie ffb890fdf6 chore: force pin turbo to resolve docker issues for now 2024-06-21 13:52:22 +10:00
Mythie 8e19c89fae chore: add packageManager field 2024-06-21 13:07:30 +10:00
Mythie 6b3c0afe25 chore: add prebuild to handle prisma build cache 2024-06-21 12:55:17 +10:00
Mythie 3e5dcca027 fix: remove extra frontmatter from changelog.mdx 2024-06-21 12:34:45 +10:00
Mythie 93ea3e2644 fix: dirty type safe job definitions 2024-06-21 12:18:11 +10:00
Lucas Smith 6f8d8b908d Merge branch 'main' into feat/background-tasks 2024-06-21 10:31:16 +10:00
Mythie cc667233c6 fix: show correct authentication action for account required
When using account required auth for a given document
this change now shows the sign up or sign in button
depending on if an account actually exists within
Documenso.

This change should reduce friction and confusion when a
recipient has been invited to a document.
2024-06-20 10:59:07 +10:00
Mythie 664b9284bd chore: feedback from pull request 2024-06-19 13:28:14 +10:00
Mythie 4077d02ccd fix: use readonly modifiers for generics 2024-06-18 22:38:53 +10:00
Lucas Smith 2516377cbf Merge branch 'main' into feat/background-tasks 2024-06-17 17:12:12 +10:00
Mythie 8bb936aa51 chore: add env vars to example .env 2024-06-17 17:02:00 +10:00
Mythie b8d6484ff0 fix: improve inngest support 2024-06-17 16:59:14 +10:00
Mythie 6977381e00 feat: inngest provider 2024-06-14 13:53:48 +10:00
Mythie 1c5da46335 fix: update signing email job 2024-06-14 13:53:08 +10:00
Mythie f28334bff7 feat: make jobs client type safe 2024-06-13 15:32:56 +10:00
Mythie 002dc0fdae fix: make local provider robust to random input 2024-06-13 15:24:53 +10:00
Mythie 2e41ecf825 fix: remove dummy code from email job 2024-06-13 15:24:53 +10:00
Mythie 991f808890 feat: ghetto durable compute 2024-06-13 15:24:51 +10:00
Mythie 61827ad729 fix: make trigger.dev work properly 2024-06-13 15:23:52 +10:00
Mythie 108054a133 wip: background tasks 2024-06-13 15:23:19 +10:00
Lucas Smith cfb52161d9 Merge branch 'main' into feat/public-profiles 2024-06-13 15:20:26 +10:00
Lucas Smith 1647f7c4a0 fix: correctly insert fields on rotated pages (#1183)
## Description

PDFs can have pages that are rotated, which are correctly rendered in
the frontend. However, when we load the PDF in the backend, the rotation
is applied which causes issues when we want to insert fields.

To account for this, we swap the width and height for pages that are
rotated by 90/270 degrees. This is so we can calculate the virtual
position the field was placed if it was correctly oriented in the
frontend.

Then when we insert the fields, we apply a transformation to the
position of the field so it is rotated correctly.

**Test document with 0/90/180/270 rotated pages**


[rotated_test.pdf](https://github.com/user-attachments/files/15798138/rotated_test.pdf)
2024-06-12 21:54:45 +10:00
Lucas Smith eca66a7c1d fix: add regular plan to price type enum (#1184)
Adds the regular plan to our current plan type enum so we can use it for
user limit calculations.
2024-06-12 21:54:11 +10:00
Lucas Smith 6f2de54640 Merge branch 'main' into fix/regular-plan 2024-06-12 21:49:39 +10:00
Mythie e62fa6cc92 fix: update plans on the billing page 2024-06-12 21:33:17 +10:00
Mythie 8c2f61a004 fix: add regular plan to price type enum 2024-06-12 21:27:05 +10:00
Lucas Smith cc43139573 fix: downloaded files should have _signed (#1149)
Modifies the generated filename for the downloaded PDF by appending
"_signed" to the base title.

## Changes Made

- Update the filename in the downloadFile function call to append
"_signed" to the baseTitle variable.

## Testing Performed

Tested the `downloadPDF` function locally to ensure that the downloaded
PDF file has the correct filename with "_signed" appended.
2024-06-05 14:56:02 +10:00
Lucas Smith c346a3fd6a feat: add oidc support (#1103)
## Description

This PR adds generic OIDC as an authentication provider. This allows
personal users and companies potentially to define whatever IdP they
want as long as it supports the OIDC well known format. (Azure, Zitadel,
Authentik, KeyCloak, Google, etc. all support it)

## Related Issue

Fixes #1090 

## Changes Made

- Adds OIDC buttons to the signin and registration pages
- Adds appropriate environment variables
- Adds migration to add OIDC to the `IdentityProvider` Enum

## Testing Performed

#### Zitadel
- Created application in Zitadel as an web app, with Client auth
- Enabled `User Info inside ID Token` in Token settings
- Copied client id and client secret to the new .ENV variables
- Copied the well-known URL from the URLs section to .ENV
- Created new account with OIDC provider button
- Verified email manually
- Signed into account with OIDC provider
- Logged out
- Signed into accounting again with OIDC provider

#### Authentik
- Created application in Authentik
- Copied client id and client secret to the new .ENV variables
- Copied the well-known URL from the URLs section to .ENV
- Created new account with OIDC provider button
- Verified email manually
- Signed into account with OIDC provider
- Logged out
- Signed into accounting again with OIDC provider

#### Azure AD
- Created application in Azure AD using OAuth2
- Copied client id and client secret to the new .ENV variables
- Copied the well-known URL from the URLs section to .ENV
- Created new account with OIDC provider button
- Verified email manually
- Signed into account with OIDC provider
- Logged out
- Signed into accounting again with OIDC provider
2024-05-31 11:45:17 +10:00
Mythie 70eeb1a746 chore: improve oidc provider support
Adds fields to the Account model to support various pieces
of data returned by OIDC providers such as AzureAD and GitLab.

Additionally passes through the email verification status and handles
retrieving the email for providers such as AzureAD who use a different
claim instead.
2024-05-30 22:15:45 +10:00
Lucas Smith d8d0734680 Merge branch 'main' into mk/oidc-auth 2024-05-30 15:41:36 +10:00
Lucas Smith ede6eea88d feat: add kysely for raw type-safe SQL queries (#1041) 2024-05-29 22:46:20 +10:00
Mythie ebc547684a fix: inline the remember package 2024-05-29 22:25:23 +10:00
Mythie 5724e73d49 chore: revert find-documents change for now
Reverts the change to find-documents to use Kysely. I'd like to gain
confidence by using it in smaller pieces before commiting to doing
what is one of our most complicated queries in Documenso.
2024-05-29 20:54:43 +10:00
Mythie 4a6b5ceaf8 fix: re-add removed types 2024-05-29 20:53:50 +10:00
Mythie ab949afbb6 fix: convert to kysely queries 2024-05-29 20:03:51 +10:00
Mythie 3d81b15d71 chore: tidy code 2024-05-29 14:47:33 +10:00
Lucas Smith 27fe8c7f8f Merge branch 'main' into feat/add-kysely 2024-05-28 14:53:29 +10:00
Lucas Smith 0c18f27b3f feat: remove the existing empty signer if its the only one (#1127)
Removes the existing empty signer if its the only one
2024-05-28 14:15:01 +10:00
Lucas Smith b394e99f7a Merge branch 'main' into feat/start-selfSign 2024-05-28 12:53:57 +10:00
Lucas Smith c21e30d689 chore: tidy code 2024-05-28 02:45:57 +00:00
Lucas Smith ac41086e1a Merge branch 'main' into feat/start-selfSign 2024-05-24 23:48:20 +10:00
Lucas Smith 94cf412f29 fix: show team url in dropdown menu on hover (#1122)
fixes: #943 

<img width="330" alt="Screenshot 2024-02-19 211732"
src="https://github.com/documenso/documenso/assets/75713174/724078ca-e107-4acb-a75d-c7d2cdd29b80">


Video Link:
https://www.loom.com/share/35328504cf3f46e9be78bd485252e8dc?sid=1f309776-8b52-4af4-b86b-652b762fef5b
2024-05-24 23:46:57 +10:00
Mythie 6650a1d72e feat: optional email sending for api users
Introduces the ability to not send an email when sending
(publishing) a document using the API.

Additionally returns the signing link for each recipient
when working with recipient API endpoints and returns
the document object including recipients when sending
documents via API.
2024-05-24 23:36:28 +10:00
Mythie 82848e3d2e fix: animate transition 2024-05-24 18:47:03 +10:00
Lucas Smith 22b8c2044b Merge branch 'main' into fix/show-teams-url-new 2024-05-24 14:58:42 +10:00
Lucas Smith ef5d267e96 fix: Remove document on go back click on step 1 (#910)
 Fixes #903 
 Invoke `onBackStep` on "Go Back" click and conditionally render
Go back label string.
2024-05-24 14:17:53 +10:00
Lucas Smith 518ddea081 feat: pin input component (#936)
https://github.com/documenso/documenso/assets/55143799/fa3d14d6-59e6-4984-9287-7375198fcea0
2024-05-24 14:13:28 +10:00
Lucas Smith 805758f716 Merge branch 'main' into reattach-pdf 2024-05-24 14:07:43 +10:00
Lucas Smith 04ebb26a0b chore: update wording 2024-05-24 04:02:58 +00:00
Lucas Smith 9cb80aa0bc chore: add pin input to all 2FA components
Adds the pin input to the currently used 2FA components sunsetting
the standard input that was previously used.
2024-05-24 03:31:19 +00:00
Lucas Smith 0985206088 Merge branch 'main' into 2fa-input 2024-05-24 12:53:41 +10:00
Lucas Smith aadb22cdbf fix: use shadcn pin input and revert changes 2024-05-24 02:51:25 +00:00
Lucas Smith 3e304b37b2 feat: sealing robustness (#1170)
A series of changes to improve sealing robustness avoiding errors that
have appeared during monitoring.

Additionally handles the recently published CVE affecting the
`pdfjs-dist` library.
2024-05-23 15:35:05 +10:00
Mythie 1f3df51371 fix: update font variable typo 2024-05-23 15:13:12 +10:00
Lucas Smith 6e2363d48c Merge branch 'main' into fix/sealing-robustness 2024-05-23 15:11:23 +10:00
Mythie 64bec5f29c fix: remove console.log statements 2024-05-23 15:10:28 +10:00
Mythie 311328471e fix: bump react-pdf and pdfjs-dist to handle cve
Bumps ReactPDF and pdfjs-dist to avoid the CVE that allows
for code execution in pdf's. This change doesn't specifically
upgrade to the latest pdfjs-dist due to issues with top level
await, instead disabling the evaluation of javascript within
the PDF.
2024-05-23 14:47:32 +10:00
Mythie d58a88196a fix: use noto sans for text insertion on pdfs
Use Noto Sans to gracefully handle inserting custom text
on PDF's. Previously we were using Helvetica which is a
standard PDF font but that would fail for any character
that couldn't be encoded in WinANSI.

Noto Sans was chosen as it has support for a large number
of languages and glyphs with challenges now being adding
support for CJK glyphs.
2024-05-23 13:07:37 +10:00
Mythie 4c0b772fc9 fix: rewrite form flattening handler
Previously we used the form flattening method from PDF-Lib
but unfortunately when it encountered orphaned form items
or other PDF oddities it would throw an error.

Because of this certain documents would fail to seal and
be stuck in a pending state with no recourse available.
This change rewrites the form flattening handler to be
more lenient when coming across the unknown opting to skip
items it can't handle rather than abort.
2024-05-22 21:58:30 +10:00
Lucas Smith d37edc4351 fix: syntax in production compose.yml (#1143) 2024-05-20 12:51:56 +10:00
Lucas Smith 15dee5ef35 fix: enforce users to have stripe account (#1131)
## Description

Currently users who sign in via Google SSO do not get assigned a Stripe
customer account.

This enforces the Stripe customer requirement on sign in.

There might be a better place to put this so it's open to any
suggestions.
2024-05-01 16:48:05 +10:00
Lucas Smith 28d6f6e2e8 fix: improve sealing process (#1133)
## Description

Improves the sealing process by being strict on how long certificate
generation can take, opting to fail generation and continue sealing.

Also changes the ordering of sealing so an error in the process won't
also cause a document to be "COMPLETED" since it hasn't been
cryptographically sealed yet.

The downside to this change is that documents that fail during sealing
will require manual intervention as a signer or owner won't be able to
*complete* the document.

## Testing Performed

- Modified code to force specific failure modes to occur and verified
that documents were either gracefully sealed without a certificate or
not sealed and not completed.
2024-05-01 16:47:11 +10:00
Mythie 78dc57a6eb fix: improvements from review 2024-05-01 16:16:04 +10:00
Mythie d3528f74f0 fix: improve sealing process
Improves the sealing process by being strict on how
long certificate generation can take, opting to fail
generation and continue sealing.

Also changes the ordering of sealing so an error in the
process won't also cause a document to be "COMPLETED"
since it hasn't been cryptographically sealed yet.

The downside to this change is that documents that fail
during sealing will require manual intervention as a signer
or owner won't be able to *complete* the document.
2024-05-01 14:18:01 +10:00
Mythie 345e42537a fix: include all document meta when using the public api 2024-04-29 12:42:22 +10:00
Lucas Smith 8a24ca2065 fix: complete document when all recipients are CC (#1113)
## Description

Automatically marks the document as completed if all the recipients are
CC.

## Changes Made

Added an if statement in the last form step (`onAddSubjectFormSubmit`)
that checks if all the recipients are CC. If so, the document status is
updated to `COMPLETED`.

## Testing Performed

Tested the changes and they work as expected.

## Checklist

<!--- Please check the boxes that apply to this pull request. -->
<!--- You can add or remove items as needed. -->

- [x] I have tested these changes locally and they work as expected.
- [ ] I have added/updated tests that prove the effectiveness of these
changes.
- [ ] I have updated the documentation to reflect these changes, if
applicable.
- [x] I have followed the project's coding style guidelines.
- [ ] I have addressed the code review feedback from the previous
submission, if applicable.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced document sending logic to update document status based on
recipient roles.

- **Bug Fixes**
- Removed redundant form submission handling in the document editing
feature.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-04-27 21:39:25 +10:00
Lucas Smith 06dd8219a5 fix: increase trpc max duration (#1121)
## Description

Increase the max duration of the TRPC API endpoint to 120 seconds.
2024-04-27 21:38:21 +10:00
Lucas Smith 9bc5818d19 fix: use cdp and upgrade playwright again (#1117)
## Description

Upgrade playwright once again and use CDP for remote connections to
avoid version lock-in with `playwright.connect`

Resolves the issue where all CI is failing currently due to downgrading
playwright.
2024-04-26 15:56:55 +10:00
Mythie 481d739c37 chore: update package-lock 2024-04-26 13:25:16 +10:00
Mythie 88dedc9829 fix: use cdp and upgrade playwright again 2024-04-26 13:18:31 +10:00
Lucas Smith 4080806606 fix: minor updates 2024-04-26 02:17:56 +00:00
Lucas Smith e949fb14ae fix: hide team webhooks from users (#1116)
## Description

Currently if you create a team webhook, you can see it in your personal
webhooks.

However, interacting with them will throw errors because there is server
side logic preventing any interaction with them since they are outside
of the correct context.

So the solution is to either:
- Allow the user to edit the team webhooks that they created on their
personal webhooks page
- Hide team webhooks for personal webhooks pages

This PR goes with the second option, but is open to suggestions.
2024-04-26 11:14:52 +10:00
Lucas Smith 0062359977 feat: add visible completed fields (#1109)
## Description

Added the ability for recipients to see fields from other recipients who
have completed the document when they are signing the document

Added the ability for the document owner to see fields from recipients
who have completed the field on the document page view (only visible
when the document is pending)


## 🚨🚨 Migrations🚨🚨

- Drop all `Fields` that do not have a `Recipient` set (not sure how it
was possible in the first place)
- Remove optional `Recipient` field on `Field` which doesn't make sense 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Enhanced document viewing by adding read-only fields based on document
status.
- Improved signing page by fetching and displaying completed fields for
tokens.
- Updated avatar component to show recipient status with tooltips for
better user interaction.

- **Bug Fixes**
- Made `recipientId` a required field in the database to ensure data
consistency.

- **Refactor**
- Optimized popover functionality in UI components for better
performance and user experience.

- **Documentation**
- Added detailed component and function descriptions for new features in
the system.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-04-25 20:53:13 +10:00
Lucas Smith 03727bfad2 fix: disable cert download (#1114)
## Description

Disable the document certificate download button when the document is
not complete

## Changes Made

- Disable UI button
- Disable TRPC API endpoint

## Testing Performed

Tested locally for pending, draft and completed documents
2024-04-25 20:43:52 +10:00
Lucas Smith c4a680caf7 fix: hide account action reauth (#1115)
## Description

Hide the account reauth option

<img width="527" alt="image"
src="https://github.com/documenso/documenso/assets/20962767/ee2169c7-856b-41ae-b756-43f15c2e8f69">

<img width="527" alt="image"
src="https://github.com/documenso/documenso/assets/20962767/42ecc50a-2a7d-461b-9994-1af8f4a147ed">
2024-04-25 20:42:39 +10:00
Mythie 713cd09a06 fix: downgrade playwright 2024-04-24 19:07:18 +10:00
Mythie 87423e240a chore: update foreign key constraints 2024-04-24 17:32:11 +10:00
Mythie 6f3cea52e8 fix: handle older cert data 2024-04-10 22:34:14 +07:00
Mythie bfff1234bb fix: handle older cert data 2024-04-10 22:32:25 +07:00
Mythie 93a149d637 fix: handle older cert data 2024-04-10 22:10:20 +07:00
Lucas Smith 64870f22b9 feat: add certificate and audit log pdfs (#1092) 2024-04-10 20:42:21 +07:00
Mythie 0bc9c590a7 fix: use ts-match 2024-04-10 20:03:01 +07:00
Mythie 4d4dfd3c5f fix: implement review feedback, resolve build errors 2024-04-10 17:39:16 +07:00
Mythie c9b4915fc8 fix: remove hardcoded ids 2024-04-10 15:30:04 +07:00
Mythie 110f9bae12 feat: add certificate and audit log pdfs 2024-04-10 15:13:18 +07:00