@fecommunity/reactpress-server 4.0.0-beta.7 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/bin/reactpress-server.js +36 -0
- package/dist/database/typeorm-options.js +13 -2
- package/dist/database/typeorm-options.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modules/auth/auth.service.js +1 -1
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/extension/extension.module.js +3 -1
- package/dist/modules/extension/extension.module.js.map +1 -1
- package/dist/modules/extension/plugin.controller.d.ts +7 -7
- package/dist/modules/extension/plugin.service.d.ts +3 -1
- package/dist/modules/extension/plugin.service.js +39 -16
- package/dist/modules/extension/plugin.service.js.map +1 -1
- package/dist/modules/extension/preview-draft.store.d.ts +1 -1
- package/dist/modules/extension/preview-draft.store.js +1 -1
- package/dist/modules/extension/preview-draft.store.js.map +1 -1
- package/dist/modules/extension/theme-registry.bridge.js +23 -1
- package/dist/modules/extension/theme-registry.bridge.js.map +1 -1
- package/dist/modules/extension/theme.controller.d.ts +8 -8
- package/dist/modules/extension/theme.service.d.ts +1 -1
- package/dist/modules/extension/theme.service.js +19 -19
- package/dist/modules/extension/theme.service.js.map +1 -1
- package/dist/modules/file/content-image-scan.util.d.ts +52 -0
- package/dist/modules/file/content-image-scan.util.js +222 -0
- package/dist/modules/file/content-image-scan.util.js.map +1 -0
- package/dist/modules/file/file-optimization.service.js +7 -5
- package/dist/modules/file/file-optimization.service.js.map +1 -1
- package/dist/modules/file/file.service.d.ts +1 -0
- package/dist/modules/file/file.service.js +22 -18
- package/dist/modules/file/file.service.js.map +1 -1
- package/dist/modules/setting/setting.constant.d.ts +1 -1
- package/dist/modules/setting/setting.constant.js +3 -3
- package/dist/modules/setting/setting.constant.js.map +1 -1
- package/dist/modules/setting/setting.service.js +9 -9
- package/dist/modules/setting/setting.service.js.map +1 -1
- package/dist/modules/user/user.service.js +2 -2
- package/dist/modules/user/user.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/theme-placeholder-cover.d.ts +7 -0
- package/dist/utils/theme-placeholder-cover.js +94 -0
- package/dist/utils/theme-placeholder-cover.js.map +1 -0
- package/dist/utils/upload-url.util.d.ts +4 -0
- package/dist/utils/upload-url.util.js +34 -0
- package/dist/utils/upload-url.util.js.map +1 -0
- package/package.json +19 -8
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildThemePlaceholderCoverSvg = void 0;
|
|
4
|
+
function escapeXml(text) {
|
|
5
|
+
return String(text).replace(/[<>&"']/g, (ch) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const map = {
|
|
8
|
+
'<': '<',
|
|
9
|
+
'>': '>',
|
|
10
|
+
'&': '&',
|
|
11
|
+
'"': '"',
|
|
12
|
+
"'": ''',
|
|
13
|
+
};
|
|
14
|
+
return (_a = map[ch]) !== null && _a !== void 0 ? _a : ch;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function sanitizeColor(color, fallback) {
|
|
18
|
+
if (!color)
|
|
19
|
+
return fallback;
|
|
20
|
+
const trimmed = String(color).trim();
|
|
21
|
+
if (/^#[0-9a-fA-F]{3,8}$/.test(trimmed))
|
|
22
|
+
return trimmed;
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
function safeSvgId(id) {
|
|
26
|
+
return String(id).replace(/[^a-zA-Z0-9_-]/g, '') || 'theme';
|
|
27
|
+
}
|
|
28
|
+
function buildThemePlaceholderCoverSvg(options) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const svgId = safeSvgId(options.id);
|
|
31
|
+
const primary = sanitizeColor(options.primary, '#2563eb');
|
|
32
|
+
const accent = sanitizeColor(options.accent, '#7c3aed');
|
|
33
|
+
const rawName = String((_b = (_a = options.name) !== null && _a !== void 0 ? _a : options.id) !== null && _b !== void 0 ? _b : 'Theme');
|
|
34
|
+
const safeName = escapeXml(rawName.length > 48 ? `${rawName.slice(0, 45)}…` : rawName);
|
|
35
|
+
const version = options.version ? escapeXml(String(options.version)) : '';
|
|
36
|
+
const versionBadge = version
|
|
37
|
+
? `<rect x="656" y="28" width="112" height="26" rx="13" fill="#ffffff" fill-opacity="0.08"/>
|
|
38
|
+
<text x="712" y="45" text-anchor="middle" fill="#ffffff" fill-opacity="0.65" font-family="system-ui,-apple-system,sans-serif" font-size="11" font-weight="500">v${version}</text>`
|
|
39
|
+
: '';
|
|
40
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="800" height="500" viewBox="0 0 800 500" role="img" aria-label="${safeName}">
|
|
41
|
+
<defs>
|
|
42
|
+
<linearGradient id="${svgId}-bg" x1="0" y1="0" x2="800" y2="500" gradientUnits="userSpaceOnUse">
|
|
43
|
+
<stop offset="0%" stop-color="#0b1220"/>
|
|
44
|
+
<stop offset="100%" stop-color="#151b2b"/>
|
|
45
|
+
</linearGradient>
|
|
46
|
+
<linearGradient id="${svgId}-hero" x1="0" y1="0" x2="512" y2="0" gradientUnits="userSpaceOnUse">
|
|
47
|
+
<stop offset="0%" stop-color="${primary}"/>
|
|
48
|
+
<stop offset="100%" stop-color="${accent}"/>
|
|
49
|
+
</linearGradient>
|
|
50
|
+
<radialGradient id="${svgId}-glow1" cx="0" cy="0" r="1" gradientTransform="translate(96 48) rotate(90) scale(220 220)">
|
|
51
|
+
<stop offset="0%" stop-color="${primary}" stop-opacity="0.38"/>
|
|
52
|
+
<stop offset="100%" stop-color="${primary}" stop-opacity="0"/>
|
|
53
|
+
</radialGradient>
|
|
54
|
+
<radialGradient id="${svgId}-glow2" cx="0" cy="0" r="1" gradientTransform="translate(704 432) rotate(90) scale(260 260)">
|
|
55
|
+
<stop offset="0%" stop-color="${accent}" stop-opacity="0.3"/>
|
|
56
|
+
<stop offset="100%" stop-color="${accent}" stop-opacity="0"/>
|
|
57
|
+
</radialGradient>
|
|
58
|
+
<pattern id="${svgId}-grid" width="32" height="32" patternUnits="userSpaceOnUse">
|
|
59
|
+
<path d="M32 0H0V32" fill="none" stroke="#ffffff" stroke-opacity="0.045" stroke-width="1"/>
|
|
60
|
+
</pattern>
|
|
61
|
+
<filter id="${svgId}-shadow" x="-16%" y="-16%" width="132%" height="132%">
|
|
62
|
+
<feDropShadow dx="0" dy="18" stdDeviation="22" flood-color="#000000" flood-opacity="0.38"/>
|
|
63
|
+
</filter>
|
|
64
|
+
</defs>
|
|
65
|
+
<rect width="800" height="500" fill="url(#${svgId}-bg)"/>
|
|
66
|
+
<rect width="800" height="500" fill="url(#${svgId}-glow1)"/>
|
|
67
|
+
<rect width="800" height="500" fill="url(#${svgId}-glow2)"/>
|
|
68
|
+
<rect width="800" height="500" fill="url(#${svgId}-grid)"/>
|
|
69
|
+
<rect x="32" y="28" width="112" height="26" rx="13" fill="#ffffff" fill-opacity="0.08"/>
|
|
70
|
+
<text x="74" y="45" text-anchor="middle" fill="#ffffff" fill-opacity="0.75" font-family="system-ui,-apple-system,sans-serif" font-size="11" font-weight="600" letter-spacing="0.08em">REACTPRESS</text>
|
|
71
|
+
${versionBadge}
|
|
72
|
+
<g transform="translate(120 68)" filter="url(#${svgId}-shadow)">
|
|
73
|
+
<rect width="560" height="328" rx="14" fill="#ffffff"/>
|
|
74
|
+
<path d="M0 14C0 6.268 6.268 0 14 0h532c7.732 0 14 6.268 14 14v38H0V14z" fill="#f8fafc"/>
|
|
75
|
+
<circle cx="28" cy="19" r="5.5" fill="#ff5f57" fill-opacity="0.88"/>
|
|
76
|
+
<circle cx="48" cy="19" r="5.5" fill="#febc2e" fill-opacity="0.88"/>
|
|
77
|
+
<circle cx="68" cy="19" r="5.5" fill="#28c840" fill-opacity="0.88"/>
|
|
78
|
+
<rect x="120" y="12" width="320" height="14" rx="7" fill="#e2e8f0"/>
|
|
79
|
+
<rect x="24" y="62" width="512" height="108" rx="10" fill="url(#${svgId}-hero)"/>
|
|
80
|
+
<rect x="40" y="86" width="196" height="14" rx="7" fill="#ffffff" fill-opacity="0.92"/>
|
|
81
|
+
<rect x="40" y="108" width="272" height="10" rx="5" fill="#ffffff" fill-opacity="0.55"/>
|
|
82
|
+
<rect x="24" y="194" width="340" height="10" rx="5" fill="#e2e8f0"/>
|
|
83
|
+
<rect x="24" y="214" width="420" height="8" rx="4" fill="#f1f5f9"/>
|
|
84
|
+
<rect x="24" y="228" width="380" height="8" rx="4" fill="#f1f5f9"/>
|
|
85
|
+
<rect x="24" y="252" width="160" height="52" rx="8" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1"/>
|
|
86
|
+
<rect x="200" y="252" width="160" height="52" rx="8" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1"/>
|
|
87
|
+
<rect x="376" y="252" width="136" height="52" rx="8" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1"/>
|
|
88
|
+
</g>
|
|
89
|
+
<text x="400" y="456" text-anchor="middle" fill="#ffffff" font-family="system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif" font-size="24" font-weight="600">${safeName}</text>
|
|
90
|
+
<text x="400" y="478" text-anchor="middle" fill="#ffffff" fill-opacity="0.5" font-family="system-ui,-apple-system,sans-serif" font-size="12" font-weight="500">Theme Preview</text>
|
|
91
|
+
</svg>`;
|
|
92
|
+
}
|
|
93
|
+
exports.buildThemePlaceholderCoverSvg = buildThemePlaceholderCoverSvg;
|
|
94
|
+
//# sourceMappingURL=theme-placeholder-cover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-placeholder-cover.js","sourceRoot":"","sources":["../../src/utils/theme-placeholder-cover.ts"],"names":[],"mappings":";;;AAEA,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,E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,CAAC,CAAC;IACvF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,YAAY,GAAG,OAAO;QAC1B,CAAC,CAAC;oKAC8J,OAAO,SAAS;QAChL,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,iHAAiH,QAAQ;;0BAExG,KAAK;;;;0BAIL,KAAK;sCACO,OAAO;wCACL,MAAM;;0BAEpB,KAAK;sCACO,OAAO;wCACL,OAAO;;0BAErB,KAAK;sCACO,MAAM;wCACJ,MAAM;;mBAE3B,KAAK;;;kBAGN,KAAK;;;;8CAIuB,KAAK;8CACL,KAAK;8CACL,KAAK;8CACL,KAAK;;;IAG/C,YAAY;kDACkC,KAAK;;;;;;;sEAOe,KAAK;;;;;;;;;;qLAU0G,QAAQ;;OAEtL,CAAC;AACR,CAAC;AAtED,sEAsEC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ConfigService } from '@nestjs/config';
|
|
2
|
+
export declare function resolveServerSiteUrl(config: ConfigService): string;
|
|
3
|
+
export declare function resolveUploadBaseUrl(config: ConfigService): string;
|
|
4
|
+
export declare function rewriteBrokenUploadUrl(url: string | undefined | null, uploadBaseUrl: string): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteBrokenUploadUrl = exports.resolveUploadBaseUrl = exports.resolveServerSiteUrl = void 0;
|
|
4
|
+
const DEFAULT_SERVER_SITE_URL = 'http://localhost:3002';
|
|
5
|
+
function resolveServerSiteUrl(config) {
|
|
6
|
+
var _a;
|
|
7
|
+
const raw = (_a = config.get('SERVER_SITE_URL')) === null || _a === void 0 ? void 0 : _a.trim();
|
|
8
|
+
if (raw)
|
|
9
|
+
return raw.replace(/\/$/, '');
|
|
10
|
+
return DEFAULT_SERVER_SITE_URL;
|
|
11
|
+
}
|
|
12
|
+
exports.resolveServerSiteUrl = resolveServerSiteUrl;
|
|
13
|
+
function resolveUploadBaseUrl(config) {
|
|
14
|
+
var _a;
|
|
15
|
+
const explicit = (_a = config.get('SERVER_PUBLIC_UPLOAD_URL')) === null || _a === void 0 ? void 0 : _a.trim();
|
|
16
|
+
if (explicit)
|
|
17
|
+
return explicit.replace(/\/$/, '');
|
|
18
|
+
return `${resolveServerSiteUrl(config)}/public/uploads`;
|
|
19
|
+
}
|
|
20
|
+
exports.resolveUploadBaseUrl = resolveUploadBaseUrl;
|
|
21
|
+
function rewriteBrokenUploadUrl(url, uploadBaseUrl) {
|
|
22
|
+
if (!url)
|
|
23
|
+
return url !== null && url !== void 0 ? url : '';
|
|
24
|
+
if (url.startsWith('undefined/public/uploads')) {
|
|
25
|
+
return `${uploadBaseUrl}${url.slice('undefined/public/uploads'.length)}`;
|
|
26
|
+
}
|
|
27
|
+
if (url.startsWith('undefined/')) {
|
|
28
|
+
const site = uploadBaseUrl.replace(/\/public\/uploads\/?$/, '');
|
|
29
|
+
return `${site}${url.slice('undefined'.length)}`;
|
|
30
|
+
}
|
|
31
|
+
return url;
|
|
32
|
+
}
|
|
33
|
+
exports.rewriteBrokenUploadUrl = rewriteBrokenUploadUrl;
|
|
34
|
+
//# sourceMappingURL=upload-url.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url.util.js","sourceRoot":"","sources":["../../src/utils/upload-url.util.ts"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAMxD,SAAgB,oBAAoB,CAAC,MAAqB;;IACxD,MAAM,GAAG,GAAG,MAAA,MAAM,CAAC,GAAG,CAAS,iBAAiB,CAAC,0CAAE,IAAI,EAAE,CAAC;IAC1D,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAJD,oDAIC;AAMD,SAAgB,oBAAoB,CAAC,MAAqB;;IACxD,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,GAAG,CAAS,0BAA0B,CAAC,0CAAE,IAAI,EAAE,CAAC;IACxE,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,iBAAiB,CAAC;AAC1D,CAAC;AAJD,oDAIC;AAGD,SAAgB,sBAAsB,CAAC,GAA8B,EAAE,aAAqB;IAC1F,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC;IAC3B,IAAI,GAAG,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE;QAC9C,OAAO,GAAG,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1E;IACD,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAChC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;QAChE,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;KAClD;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,wDAUC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fecommunity/reactpress-server",
|
|
3
|
-
"version": "4.0.0
|
|
4
|
-
"deprecated": "
|
|
5
|
-
"description": "ReactPress NestJS
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"deprecated": "Bundled in @fecommunity/reactpress CLI from v3.1. Run `npx @fecommunity/reactpress init` for new projects.",
|
|
5
|
+
"description": "ReactPress NestJS REST API (deprecated). Bundled in @fecommunity/reactpress CLI from v3.1. Headless CMS for articles, media, plugins, and themes",
|
|
6
6
|
"author": "fecommunity",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"homepage": "https://docs.gaoredu.com/",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/fecommunity/reactpress/issues"
|
|
11
|
+
},
|
|
8
12
|
"main": "dist/main.js",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
10
13
|
"bin": {
|
|
11
14
|
"reactpress-server": "./bin/reactpress-server.js"
|
|
12
15
|
},
|
|
@@ -19,23 +22,31 @@
|
|
|
19
22
|
],
|
|
20
23
|
"keywords": [
|
|
21
24
|
"reactpress",
|
|
22
|
-
"server",
|
|
23
25
|
"nestjs",
|
|
26
|
+
"headless-cms",
|
|
24
27
|
"cms",
|
|
25
28
|
"blog",
|
|
29
|
+
"rest-api",
|
|
26
30
|
"api",
|
|
27
|
-
"
|
|
31
|
+
"openapi",
|
|
32
|
+
"swagger",
|
|
33
|
+
"typescript",
|
|
34
|
+
"self-hosted"
|
|
28
35
|
],
|
|
29
36
|
"repository": {
|
|
30
37
|
"type": "git",
|
|
31
38
|
"url": "git+https://github.com/fecommunity/reactpress.git",
|
|
32
39
|
"directory": "server"
|
|
33
40
|
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"registry": "https://registry.npmjs.org/"
|
|
44
|
+
},
|
|
34
45
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
46
|
+
"node": ">=18"
|
|
36
47
|
},
|
|
37
48
|
"dependencies": {
|
|
38
|
-
"@fecommunity/reactpress-toolkit": "4.0.0
|
|
49
|
+
"@fecommunity/reactpress-toolkit": "4.0.0",
|
|
39
50
|
"@nestjs/cli": "^6.9.0",
|
|
40
51
|
"@nestjs/common": "^6.7.2",
|
|
41
52
|
"@nestjs/config": "^0.6.3",
|