-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
refactor(server): auth route metadata #9344
Conversation
Deploying immich with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you haven't missed a single one, nice!
|
||
if (options.isShared) { | ||
decorators.push(SharedLinkRoute()); | ||
if ((options as SharedLinkRoute)?.sharedLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't pretty lol. I feel like checking the type first would be cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add an isSharedRoute
method or something that basically has the type (options: AuthenticatedOptions) options is SharedLinkRoute => boolean
? (and then a similar thing for AdminRoute)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only place it is used though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to check the type besides doing exactly this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh because it's just a type, yeah you're right. It is used a couple of lines below as well though
SharedLinkRoute
,PublicRoute
, andAdminRoute
into a singleAuthenticated
decoratorAuthenticated
to be applied per route in preparation for fine-grained permissions