mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-30 20:50:57 +02:00
added extension handling
This commit is contained in:
parent
89dae6ca0e
commit
f9f1a1708c
@ -65,13 +65,13 @@ const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <AuthenticatedRoute />,
|
||||
loader: getServerSettings,
|
||||
children: [
|
||||
{
|
||||
path: "/",
|
||||
element: <OverviewRoute />,
|
||||
},
|
||||
{
|
||||
loader: getServerSettings,
|
||||
path: "/aliases",
|
||||
element: <AliasesRoute />,
|
||||
},
|
||||
@ -88,7 +88,6 @@ const router = createBrowserRouter([
|
||||
element: <ReportsRoute />,
|
||||
},
|
||||
{
|
||||
loader: getServerSettings,
|
||||
path: "/reports/:id",
|
||||
element: <ReportDetailRoute />,
|
||||
},
|
||||
|
18
src/components/ExtensionalSignalHandler.tsx
Normal file
18
src/components/ExtensionalSignalHandler.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import {ReactElement, useContext} from "react"
|
||||
|
||||
import AuthContext from "~/AuthContext/AuthContext"
|
||||
|
||||
export default function ExtensionSignalHandler(): ReactElement {
|
||||
const {user} = useContext(AuthContext)
|
||||
const appDomain = import.meta.env.VITE_SERVER_BASE_URL
|
||||
const instanceData = {
|
||||
appDomain,
|
||||
isAuthenticated: Boolean(user),
|
||||
}
|
||||
|
||||
return (
|
||||
<script id="_#kleckrelay-instance-data" type="application/json">
|
||||
{JSON.stringify(instanceData)}
|
||||
</script>
|
||||
)
|
||||
}
|
@ -42,5 +42,6 @@ export * from "./ExpandableListItem"
|
||||
export {default as ExpandableListItem} from "./ExpandableListItem"
|
||||
export * from "./ExternalLinkIndication"
|
||||
export {default as ExternalLinkIndication} from "./ExternalLinkIndication"
|
||||
export {default as ExtensionSignalHandler} from "./ExtensionalSignalHandler"
|
||||
|
||||
export * as SimplePageBuilder from "./simple-page-builder"
|
||||
|
@ -1,12 +1,16 @@
|
||||
import {Outlet} from "react-router-dom"
|
||||
import React, {ReactElement} from "react"
|
||||
|
||||
import {ExtensionSignalHandler} from "~/components"
|
||||
import AppLoadingScreen from "~/AppLoadingScreen/AppLoadingScreen"
|
||||
|
||||
export default function RootRoute(): ReactElement {
|
||||
return (
|
||||
<AppLoadingScreen>
|
||||
<Outlet />
|
||||
</AppLoadingScreen>
|
||||
<>
|
||||
<AppLoadingScreen>
|
||||
<Outlet />
|
||||
</AppLoadingScreen>
|
||||
<ExtensionSignalHandler />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ export interface AuthenticationDetails extends SimpleDetailResponse {
|
||||
|
||||
export interface ServerSettings {
|
||||
mailDomain: string
|
||||
appDomain: string
|
||||
randomEmailIdMinLength: number
|
||||
RandomEmailIdChars: string
|
||||
imageProxyEnabled: boolean
|
||||
|
Loading…
x
Reference in New Issue
Block a user