mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 01:42:37 +10:00
Compare commits
1 Commits
69447fc375
...
poc/server
| Author | SHA1 | Date | |
|---|---|---|---|
| 5506fe5e73 |
@ -6,6 +6,7 @@
|
|||||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Docmost</title>
|
<title>Docmost</title>
|
||||||
|
<!--meta-tags-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@ -62,6 +62,13 @@ export default function App() {
|
|||||||
<>
|
<>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route index element={<Navigate to="/home" />} />
|
<Route index element={<Navigate to="/home" />} />
|
||||||
|
<Route path={"/share/:id"} element={
|
||||||
|
<ErrorBoundary
|
||||||
|
fallback={<>Failed to load home. An error occurred.</>}
|
||||||
|
>
|
||||||
|
<Home />
|
||||||
|
</ErrorBoundary>
|
||||||
|
}/>
|
||||||
<Route path={"/login"} element={<LoginPage />} />
|
<Route path={"/login"} element={<LoginPage />} />
|
||||||
<Route path={"/invites/:invitationId"} element={<InviteSignup />} />
|
<Route path={"/invites/:invitationId"} element={<InviteSignup />} />
|
||||||
<Route path={"/setup/register"} element={<SetupWorkspace />} />
|
<Route path={"/setup/register"} element={<SetupWorkspace />} />
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get, Param, Res } from '@nestjs/common';
|
||||||
import { AppService } from './app.service';
|
import { AppService } from './app.service';
|
||||||
|
import { FastifyReply } from "fastify";
|
||||||
|
import { join } from 'path';
|
||||||
|
import * as fs from 'node:fs';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
@ -9,4 +12,27 @@ export class AppController {
|
|||||||
getHello(): string {
|
getHello(): string {
|
||||||
return this.appService.getHello();
|
return this.appService.getHello();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('/share/:id')
|
||||||
|
getShare(@Res({ passthrough: false}) res: FastifyReply, @Param() params: any): string {
|
||||||
|
const clientDistPath = join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'client/dist',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fs.existsSync(clientDistPath)) {
|
||||||
|
console.log('exists')
|
||||||
|
const indexFilePath = join(clientDistPath, 'index.html');
|
||||||
|
const stream = fs.createReadStream(indexFilePath);
|
||||||
|
|
||||||
|
console.log(params.id)
|
||||||
|
res.type('text/html').send(stream);
|
||||||
|
console.log('found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('end')
|
||||||
|
return this.appService.getHello();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ async function bootstrap() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.setGlobalPrefix('api');
|
app.setGlobalPrefix('api', { exclude: ['share/:id']});
|
||||||
|
|
||||||
const redisIoAdapter = new WsRedisIoAdapter(app);
|
const redisIoAdapter = new WsRedisIoAdapter(app);
|
||||||
await redisIoAdapter.connectToRedis();
|
await redisIoAdapter.connectToRedis();
|
||||||
|
|||||||
Reference in New Issue
Block a user