mirror of
https://github.com/docmost/docmost.git
synced 2026-05-08 07:13:06 +08:00
add docmost app version
This commit is contained in:
@@ -7,8 +7,8 @@ export type ExportPageMetadata = {
|
||||
};
|
||||
|
||||
export type ExportMetadata = {
|
||||
version: number;
|
||||
exportedAt: string;
|
||||
source: 'docmost';
|
||||
version: string;
|
||||
pages: Record<string, ExportPageMetadata>;
|
||||
};
|
||||
|
||||
@@ -29,6 +29,8 @@ import { Node } from '@tiptap/pm/model';
|
||||
import { EditorState } from '@tiptap/pm/state';
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import slugify = require('@sindresorhus/slugify');
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const packageJson = require('../../../package.json');
|
||||
import { EnvironmentService } from '../environment/environment.service';
|
||||
import {
|
||||
getAttachmentIds,
|
||||
@@ -261,9 +263,9 @@ export class ExportService {
|
||||
}
|
||||
|
||||
const metadata: ExportMetadata = {
|
||||
version: 1,
|
||||
exportedAt: new Date().toISOString(),
|
||||
source: 'docmost',
|
||||
version: packageJson.version,
|
||||
pages: pagesMetadata,
|
||||
};
|
||||
|
||||
|
||||
@@ -98,11 +98,7 @@ export async function readDocmostMetadata(
|
||||
try {
|
||||
const content = await fs.readFile(metadataPath, 'utf-8');
|
||||
const metadata = JSON.parse(content) as ExportMetadata;
|
||||
if (
|
||||
metadata.source === 'docmost' &&
|
||||
metadata.version === 1 &&
|
||||
metadata.pages
|
||||
) {
|
||||
if (metadata.source === 'docmost' && metadata.pages) {
|
||||
return metadata;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user