@blocklet/pages-kit-block-studio 0.4.23 → 0.4.25
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/lib/cjs/constants/new-block-template/@metadata.json +17 -0
- package/lib/cjs/middlewares/init-uploader-router.js +2 -21
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/constants/new-block-template/@metadata.json +17 -0
- package/lib/esm/middlewares/init-uploader-router.js +2 -18
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -5
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
"key": "title",
|
|
8
8
|
"locales": {
|
|
9
9
|
"zh": {
|
|
10
|
+
"name": "标题"
|
|
11
|
+
},
|
|
12
|
+
"en": {
|
|
10
13
|
"name": "Title"
|
|
11
14
|
}
|
|
12
15
|
}
|
|
@@ -19,6 +22,10 @@
|
|
|
19
22
|
"key": "description",
|
|
20
23
|
"locales": {
|
|
21
24
|
"zh": {
|
|
25
|
+
"name": "描述",
|
|
26
|
+
"defaultValue": "欢迎来到 Pages Kit Block Studio"
|
|
27
|
+
},
|
|
28
|
+
"en": {
|
|
22
29
|
"name": "Description",
|
|
23
30
|
"defaultValue": "Welcome to Pages Kit Block Studio"
|
|
24
31
|
}
|
|
@@ -38,6 +45,13 @@
|
|
|
38
45
|
"mediaKitUrl": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80"
|
|
39
46
|
},
|
|
40
47
|
"name": "Logo"
|
|
48
|
+
},
|
|
49
|
+
"en": {
|
|
50
|
+
"defaultValue": {
|
|
51
|
+
"url": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80",
|
|
52
|
+
"mediaKitUrl": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80"
|
|
53
|
+
},
|
|
54
|
+
"name": "Logo"
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
57
|
}
|
|
@@ -49,6 +63,9 @@
|
|
|
49
63
|
"key": "copyright",
|
|
50
64
|
"locales": {
|
|
51
65
|
"zh": {
|
|
66
|
+
"defaultValue": "由 Pages Kit Block Studio 提供支持"
|
|
67
|
+
},
|
|
68
|
+
"en": {
|
|
52
69
|
"defaultValue": "Powered by Pages Kit Block Studio"
|
|
53
70
|
}
|
|
54
71
|
},
|
|
@@ -32,30 +32,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.initUploaderRouter = void 0;
|
|
40
37
|
const uploader_server_1 = require("@blocklet/uploader-server");
|
|
41
|
-
const compression_1 = __importDefault(require("compression"));
|
|
42
38
|
const express_1 = __importStar(require("express"));
|
|
43
39
|
const constants_1 = require("../constants");
|
|
44
|
-
// compression options
|
|
45
|
-
const compressionOptions = {
|
|
46
|
-
level: 6, // gzip compression level
|
|
47
|
-
threshold: 1024, // only compress responses larger than 1KB
|
|
48
|
-
filter: (req) => {
|
|
49
|
-
var _a;
|
|
50
|
-
const path = req.path || '';
|
|
51
|
-
const extension = (_a = path.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
52
|
-
// compressible file types
|
|
53
|
-
const compressibleExtensions = ['json', 'js', 'css', 'html', 'txt', 'svg', 'xml'];
|
|
54
|
-
return extension ? compressibleExtensions.includes(extension) : false;
|
|
55
|
-
},
|
|
56
|
-
// enable brotli support
|
|
57
|
-
brotli: {},
|
|
58
|
-
};
|
|
59
40
|
// init uploader router
|
|
60
41
|
exports.initUploaderRouter = (0, express_1.Router)();
|
|
61
42
|
const staticResourceMiddleware = (0, uploader_server_1.initStaticResourceMiddleware)({
|
|
@@ -82,12 +63,12 @@ const staticResourceMiddleware = (0, uploader_server_1.initStaticResourceMiddlew
|
|
|
82
63
|
},
|
|
83
64
|
],
|
|
84
65
|
});
|
|
85
|
-
exports.initUploaderRouter.use('/uploads', (0,
|
|
66
|
+
exports.initUploaderRouter.use('/uploads', (0, uploader_server_1.initProxyToMediaKitUploadsMiddleware)({
|
|
86
67
|
express: express_1.default,
|
|
87
68
|
}), staticResourceMiddleware, (_req, res) => {
|
|
88
69
|
res.status(404).send('404 NOT FOUND').end();
|
|
89
70
|
});
|
|
90
|
-
exports.initUploaderRouter.use('/chunks',
|
|
71
|
+
exports.initUploaderRouter.use('/chunks', staticResourceMiddleware, (_req, res) => {
|
|
91
72
|
res.status(404).send('CHUNK NOT FOUND').end();
|
|
92
73
|
});
|
|
93
74
|
exports.default = exports.initUploaderRouter;
|