Compare commits

..

8 Commits

Author SHA1 Message Date
c6bca6a602 fix deprecated kysely usage 2025-05-09 16:44:33 +01:00
55d1a2c932 Fix typo in enforce-sso.tsx (#1145) 2025-05-09 11:11:02 +01:00
bc3cb2d63f fix: increase random subdomain suffix 2025-05-07 15:10:58 +01:00
7adbf85030 v0.20.4 2025-04-30 14:44:58 +01:00
de7982fe30 feat: copy page to different space (#1118)
* Add copy page to space endpoint
* copy storage function
* copy function
* feat: copy attachments too
* Copy page - WIP
* fix type
* sync
* cleanup
2025-04-30 14:43:16 +01:00
0402f7efb5 sync 2025-04-30 14:33:01 +01:00
8327251ab6 fix typo 2025-04-29 23:30:12 +01:00
e8847bd9cd fix: handle unhandled exceptions (#1116)
* Handle unhandled exceptions
* cleanup
2025-04-29 23:29:00 +01:00
10 changed files with 28 additions and 16 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "client", "name": "client",
"private": true, "private": true,
"version": "0.20.3", "version": "0.20.4",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",

View File

@ -15,7 +15,7 @@ export default function EnforceSso() {
<Text size="md">{t("Enforce SSO")}</Text> <Text size="md">{t("Enforce SSO")}</Text>
<Text size="sm" c="dimmed"> <Text size="sm" c="dimmed">
{t( {t(
"Once enforced, members will not able able to login with email and password.", "Once enforced, members will not be able to login with email and password.",
)} )}
</Text> </Text>
</div> </div>

View File

@ -1,6 +1,6 @@
{ {
"name": "server", "name": "server",
"version": "0.20.3", "version": "0.20.4",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,

View File

@ -1,4 +1,4 @@
import { Module, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; import { Logger, Module, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { AuthenticationExtension } from './extensions/authentication.extension'; import { AuthenticationExtension } from './extensions/authentication.extension';
import { PersistenceExtension } from './extensions/persistence.extension'; import { PersistenceExtension } from './extensions/persistence.extension';
import { CollaborationGateway } from './collaboration.gateway'; import { CollaborationGateway } from './collaboration.gateway';
@ -22,6 +22,7 @@ import { LoggerExtension } from './extensions/logger.extension';
imports: [TokenModule], imports: [TokenModule],
}) })
export class CollaborationModule implements OnModuleInit, OnModuleDestroy { export class CollaborationModule implements OnModuleInit, OnModuleDestroy {
private readonly logger = new Logger(CollaborationModule.name);
private collabWsAdapter: CollabWsAdapter; private collabWsAdapter: CollabWsAdapter;
private path = '/collab'; private path = '/collab';
@ -38,7 +39,15 @@ export class CollaborationModule implements OnModuleInit, OnModuleDestroy {
wss.on('connection', (client: WebSocket, request: IncomingMessage) => { wss.on('connection', (client: WebSocket, request: IncomingMessage) => {
this.collaborationGateway.handleConnection(client, request); this.collaborationGateway.handleConnection(client, request);
client.on('error', (error) => {
this.logger.error('WebSocket client error:', error);
}); });
});
wss.on('error', (error) =>
this.logger.log('WebSocket server error:', error),
);
} }
async onModuleDestroy(): Promise<void> { async onModuleDestroy(): Promise<void> {

View File

@ -130,7 +130,7 @@ export class PersistenceExtension implements Extension {
); );
this.contributors.delete(documentName); this.contributors.delete(documentName);
} catch (err) { } catch (err) {
this.logger.log('Contributors error:' + err?.['message']); this.logger.debug('Contributors error:' + err?.['message']);
} }
await this.pageRepo.updatePage( await this.pageRepo.updatePage(

View File

@ -387,14 +387,14 @@ export class WorkspaceService {
.replace(/[^a-z0-9]/g, '') .replace(/[^a-z0-9]/g, '')
.substring(0, 20); .substring(0, 20);
// Ensure we leave room for a random suffix. // Ensure we leave room for a random suffix.
const maxSuffixLength = 3; const maxSuffixLength = 6;
if (subdomain.length < 4) { if (subdomain.length < 4) {
subdomain = `${subdomain}-${generateRandomSuffix(maxSuffixLength)}`; subdomain = `${subdomain}-${generateRandomSuffix(maxSuffixLength)}`;
} }
if (DISALLOWED_HOSTNAMES.includes(subdomain)) { if (DISALLOWED_HOSTNAMES.includes(subdomain)) {
subdomain = `myworkspace-${generateRandomSuffix(maxSuffixLength)}`; subdomain = `workspace-${generateRandomSuffix(maxSuffixLength)}`;
} }
let uniqueHostname = subdomain; let uniqueHostname = subdomain;

View File

@ -70,7 +70,7 @@ export class UserTokenRepo {
.where('userId', '=', userId) .where('userId', '=', userId)
.where('workspaceId', '=', workspaceId) .where('workspaceId', '=', workspaceId)
.where('type', '=', tokenType) .where('type', '=', tokenType)
.orderBy('expiresAt desc') .orderBy('expiresAt', 'desc')
.execute(); .execute();
} }

View File

@ -70,7 +70,7 @@ export class WorkspaceRepo {
return await this.db return await this.db
.selectFrom('workspaces') .selectFrom('workspaces')
.selectAll() .selectAll()
.orderBy('createdAt asc') .orderBy('createdAt', 'asc')
.limit(1) .limit(1)
.executeTakeFirst(); .executeTakeFirst();
} }

View File

@ -4,12 +4,7 @@ import {
FastifyAdapter, FastifyAdapter,
NestFastifyApplication, NestFastifyApplication,
} from '@nestjs/platform-fastify'; } from '@nestjs/platform-fastify';
import { import { Logger, NotFoundException, ValidationPipe } from '@nestjs/common';
Logger,
NotFoundException,
RequestMethod,
ValidationPipe,
} from '@nestjs/common';
import { TransformHttpResponseInterceptor } from './common/interceptors/http-response.interceptor'; import { TransformHttpResponseInterceptor } from './common/interceptors/http-response.interceptor';
import { WsRedisIoAdapter } from './ws/adapter/ws-redis.adapter'; import { WsRedisIoAdapter } from './ws/adapter/ws-redis.adapter';
import { InternalLogFilter } from './common/logger/internal-log-filter'; import { InternalLogFilter } from './common/logger/internal-log-filter';
@ -92,6 +87,14 @@ async function bootstrap() {
const logger = new Logger('NestApplication'); const logger = new Logger('NestApplication');
process.on('unhandledRejection', (reason, promise) => {
logger.error(`UnhandledRejection: ${promise}, reason: ${reason}`);
});
process.on('uncaughtException', (error) => {
logger.error('UncaughtException:', error);
});
const port = process.env.PORT || 3000; const port = process.env.PORT || 3000;
await app.listen(port, '0.0.0.0', () => { await app.listen(port, '0.0.0.0', () => {
logger.log( logger.log(

View File

@ -1,7 +1,7 @@
{ {
"name": "docmost", "name": "docmost",
"homepage": "https://docmost.com", "homepage": "https://docmost.com",
"version": "0.20.3", "version": "0.20.4",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "nx run-many -t build", "build": "nx run-many -t build",