Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): user and server license endpoints #10682

Merged
merged 6 commits into from
Jul 1, 2024

Conversation

zackpollard
Copy link
Contributor

@zackpollard zackpollard commented Jun 28, 2024

This is the initial server side work to get ready for accepting optional payments for Immich. These endpoints simply allow us to store the client and server license keys on the server and retrieve whether the server is licensed or not so we know if someone has paid for Immich. The upcoming work to add an optional payments system will use these endpoints.

@zackpollard zackpollard force-pushed the feat/license-endpoints branch 3 times, most recently from 8978175 to 2c1dd2c Compare June 28, 2024 16:26
@zackpollard zackpollard force-pushed the feat/license-endpoints branch 2 times, most recently from 82d730f to 5ae0205 Compare June 28, 2024 16:29
@mmomjian
Copy link
Contributor

I think a lot of people are going to ask these questions, so I'll get started:

  • What does adding a license key do/change in the app and/or web?
  • Is any of this information transmitted outside the user's PC, either with or without a license?

@alextran1502
Copy link
Contributor

alextran1502 commented Jun 28, 2024

@mmomjian

What does adding a license key do/change in the app and/or web?

There will be a text that says your instance is either licensed or unlicensed

Is any of this information transmitted outside the user's PC, either with or without a license?

None

@zackpollard
Copy link
Contributor Author

zackpollard commented Jun 28, 2024

I think a lot of people are going to ask these questions, so I'll get started:

* What does adding a license key do/change in the app and/or web?

* Is any of this information transmitted outside the user's PC, either with or without a license?

We will have a dedicated blog post to announce this stuff, I would prefer we keep the questions until then, I will answer these questions though. It's important to remember what we initially announced though, no features will ever be locked behind a paywall, these payments will be totally optional.

What does adding a license key do/change in the app and/or web?

It doesn't change anything, the most we have discussed currently is just showing "Unlicensed" in the bottom left of the web app.

Is any of this information transmitted outside the user's PC, either with or without a license?

The payments platform will be an external website hosted by Futo, you will pay, receive an email and then you enter that key into the app or web to appear as "licensed". As you can see from this code there are no external checks, all validation is done locally using signing and verification of the keys.

@zackpollard zackpollard force-pushed the feat/license-endpoints branch from 5ae0205 to 0192416 Compare June 28, 2024 16:47
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice. Looks really good, just a few small things to clean up.

server/src/services/server.service.ts Outdated Show resolved Hide resolved
server/src/services/server.service.ts Outdated Show resolved Hide resolved
server/src/services/user.service.ts Outdated Show resolved Hide resolved
server/src/services/user.service.ts Outdated Show resolved Hide resolved
e2e/src/api/specs/server.e2e-spec.ts Outdated Show resolved Hide resolved
e2e/src/api/specs/server.e2e-spec.ts Show resolved Hide resolved
server/src/config.ts Outdated Show resolved Hide resolved
server/src/controllers/user.controller.ts Outdated Show resolved Hide resolved
server/src/dtos/license.dto.ts Show resolved Hide resolved
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks pretty good to me!

server/src/dtos/user.dto.ts Outdated Show resolved Hide resolved
server/src/services/server.service.ts Outdated Show resolved Hide resolved
server/src/services/server.service.ts Outdated Show resolved Hide resolved
server/src/services/user.service.ts Outdated Show resolved Hide resolved
@zackpollard zackpollard force-pushed the feat/license-endpoints branch from 7282e0b to a6f7ac9 Compare July 1, 2024 10:22
@zackpollard zackpollard force-pushed the feat/license-endpoints branch 4 times, most recently from 918cbfe to 5ebf31b Compare July 1, 2024 12:44
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

e2e/src/api/specs/server.e2e-spec.ts Outdated Show resolved Hide resolved
@zackpollard zackpollard force-pushed the feat/license-endpoints branch from 09d561f to 7779f2c Compare July 1, 2024 14:22
const serverLicense = {
licenseKey: 'IMSV-6ECZ-91TE-WZRM-Q7AQ-MBN4-UW48-2CPT-71X9',
activationKey:
'4kJUNUWMq13J14zqPFm1NodRcI6MV6DeOGvQNIgrM8Sc9nv669wyEVvFw1Nz4Kb1W7zLWblOtXEQzpRRqC4r4fKjewJxfbpeo9sEsqAVIfl4Ero-Vp1Dg21-sVdDGZEAy2oeTCXAyCT5d1JqrqR6N1qTAm4xOx9ujXQRFYhjRG8uwudw7_Q49pF18Tj5OEv9qCqElxztoNck4i6O_azsmsoOQrLIENIWPh3EynBN3ESpYERdCgXO8MlWeuG14_V1HbNjnJPZDuvYg__YfMzoOEtfm1sCqEaJ2Ww-BaX7yGfuCL4XsuZlCQQNHjfscy_WywVfIZPKCiW8QR74i0cSzQ ',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to have the white space at the very end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, but it doesn't actually matter it seems as all the tests pass 😆

@@ -123,6 +125,47 @@ export class UserService {
});
}

getLicense({ user }: AuthDto): LicenseResponseDto {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should we put in the mechanism that if the server license is set, we will return the valid status for each user license?

@zackpollard zackpollard force-pushed the feat/license-endpoints branch from 7779f2c to 0f95199 Compare July 1, 2024 17:37
@zackpollard zackpollard enabled auto-merge (squash) July 1, 2024 17:41
@zackpollard zackpollard disabled auto-merge July 1, 2024 17:41
@zackpollard zackpollard changed the title feat: user and server license endpoints feat(server): user and server license endpoints Jul 1, 2024
@zackpollard zackpollard enabled auto-merge (squash) July 1, 2024 17:42
@zackpollard zackpollard merged commit 3b37b70 into main Jul 1, 2024
24 checks passed
@zackpollard zackpollard deleted the feat/license-endpoints branch July 1, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants