mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-19 05:55:34 +09:00
feat(desktop): bundled renderer, modules and instance accounts (#3254)
This commit is contained in:
1 parent
c748c8af4e
commit
7c5fa2180a
1275 files changed
+215074
-81246
No files matched your search
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Routes} from '@app/app/Routes';
|
||||
import * as AuthRouteRedirectPolicy from '@app/app/router/policy/AuthRouteRedirectPolicy';
|
||||
import {Redirect, type RouteContext} from '@app/features/platform/components/router/RouterTypes';
|
||||
|
||||
export interface ShortLinkRouteEnterHandlers {
|
||||
readonly onRegisterEnter: AuthRouteRedirectPolicy.AuthRouteEnterHandler;
|
||||
readonly onLoginEnter: AuthRouteRedirectPolicy.AuthRouteEnterHandler;
|
||||
}
|
||||
|
||||
interface ShortLinkRouteEnterRequest {
|
||||
readonly paramName: string;
|
||||
readonly openAcceptModal: (value: string) => void;
|
||||
}
|
||||
|
||||
interface AcceptShortLinkRequest {
|
||||
readonly context: RouteContext;
|
||||
readonly paramName: string;
|
||||
readonly openAcceptModal: (value: string) => void;
|
||||
}
|
||||
|
||||
function acceptShortLink({context, paramName, openAcceptModal}: AcceptShortLinkRequest): Redirect {
|
||||
const value = context.params[paramName];
|
||||
if (value != null && value !== '') {
|
||||
openAcceptModal(value);
|
||||
}
|
||||
return new Redirect(AuthRouteRedirectPolicy.resolveCurrentRedirectTarget(Routes.ME));
|
||||
}
|
||||
|
||||
function acceptShortLinkUnlessDesktopHandoff(request: AcceptShortLinkRequest): Redirect | undefined {
|
||||
if (AuthRouteRedirectPolicy.isDesktopHandoffLocation()) {
|
||||
return undefined;
|
||||
}
|
||||
return acceptShortLink(request);
|
||||
}
|
||||
|
||||
export function createHandlers({paramName, openAcceptModal}: ShortLinkRouteEnterRequest): ShortLinkRouteEnterHandlers {
|
||||
return {
|
||||
onRegisterEnter: AuthRouteRedirectPolicy.whenAuthenticated((context) =>
|
||||
acceptShortLink({context, paramName, openAcceptModal}),
|
||||
),
|
||||
onLoginEnter: AuthRouteRedirectPolicy.whenAuthenticated((context) =>
|
||||
acceptShortLinkUnlessDesktopHandoff({context, paramName, openAcceptModal}),
|
||||
),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user