adminizer 4.2.0-build.72 → 4.2.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/assets/{add-CYZwY0d_.js → add-DOaZgoTz.js} +1 -1
- package/assets/{add-form-u6CCTy3n.js → add-form-BjackXJe.js} +1 -1
- package/assets/app.js +2 -2
- package/assets/{catalog-BpAw4095.js → catalog-DVyrGTNR.js} +1 -1
- package/assets/{field-renderer-CFBp-IrC.js → field-renderer-BHo944Cn.js} +2 -2
- package/assets/{form-COsFQmSc.js → form-BXfnz6h5.js} +1 -1
- package/assets/{form-D7o1HNUE.js → form-hP8sjbND.js} +1 -1
- package/assets/{home-DFu_vF7z.js → home-BD4MWmm9.js} +2 -2
- package/assets/manifest.json +16 -16
- package/assets/{media-manager-C_Ql2aiI.js → media-manager-CSB_XRcE.js} +3 -3
- package/interfaces/adminpanelConfig.d.ts +0 -3
- package/lib/Adminizer.d.ts +2 -2
- package/lib/Adminizer.js +1 -24
- package/package.json +2 -2
- package/system/bindInertia.js +0 -4
- package/system/bindMediaManager.js +1 -2
- package/system/defaults.js +0 -3
package/lib/Adminizer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Express } from "express";
|
|
2
2
|
import winston from "winston";
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import { AdminpanelConfig } from "../interfaces/adminpanelConfig";
|
|
@@ -34,7 +34,7 @@ export declare class Adminizer {
|
|
|
34
34
|
jwtSecret: string;
|
|
35
35
|
static logger: winston.Logger;
|
|
36
36
|
constructor(ormAdapters: AbstractAdapter[]);
|
|
37
|
-
getMiddleware(): (req:
|
|
37
|
+
getMiddleware(): (req: any, res: any) => void;
|
|
38
38
|
/**
|
|
39
39
|
* Vite middleware
|
|
40
40
|
* @protected
|
package/lib/Adminizer.js
CHANGED
|
@@ -69,27 +69,7 @@ export class Adminizer {
|
|
|
69
69
|
this.ormAdapters = ormAdapters;
|
|
70
70
|
}
|
|
71
71
|
getMiddleware() {
|
|
72
|
-
return (req, res
|
|
73
|
-
try {
|
|
74
|
-
const prefix = (this.config && this.config.routePrefix) ? String(this.config.routePrefix) : '';
|
|
75
|
-
const normalizedPrefix = prefix.replace(/\/+/g, '/').replace(/\/+$/g, '');
|
|
76
|
-
if (normalizedPrefix) {
|
|
77
|
-
const url = req.url || req.originalUrl || '';
|
|
78
|
-
const conditions = [
|
|
79
|
-
url === normalizedPrefix,
|
|
80
|
-
url.startsWith(normalizedPrefix + '/')
|
|
81
|
-
];
|
|
82
|
-
if (process.env.IS_SAILS === undefined) {
|
|
83
|
-
conditions.push(url.startsWith('/public'));
|
|
84
|
-
}
|
|
85
|
-
if (!conditions.some(condition => condition)) {
|
|
86
|
-
return typeof next === 'function' ? next() : undefined;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
// fall back to handling the request
|
|
92
|
-
}
|
|
72
|
+
return (req, res) => {
|
|
93
73
|
this.app(req, res, (err) => {
|
|
94
74
|
if (err) {
|
|
95
75
|
console.error("Error in Adminizer", err);
|
|
@@ -97,9 +77,6 @@ export class Adminizer {
|
|
|
97
77
|
res.end('Internal Server Error');
|
|
98
78
|
}
|
|
99
79
|
else {
|
|
100
|
-
if (typeof next === 'function') {
|
|
101
|
-
return next();
|
|
102
|
-
}
|
|
103
80
|
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
104
81
|
res.end('Route Not Found in Adminizer');
|
|
105
82
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.2.0
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.js",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"waterline": "^0.15.2",
|
|
64
64
|
"winston": "^3.17.0",
|
|
65
65
|
"image-size": "^2.0.2",
|
|
66
|
-
"sprintf-js": "^1.1.3",
|
|
67
66
|
"sequelize": "^6.37.7"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
@@ -141,6 +140,7 @@
|
|
|
141
140
|
"sequelize-typescript": "^2.1.6",
|
|
142
141
|
"shelljs": "^0.9.2",
|
|
143
142
|
"sonner": "^2.0.3",
|
|
143
|
+
"sprintf-js": "^1.1.3",
|
|
144
144
|
"sqlite3": "^5.1.7",
|
|
145
145
|
"tailwind-merge": "^3.0.2",
|
|
146
146
|
"tailwindcss": "^4.0.15",
|
package/system/bindInertia.js
CHANGED
|
@@ -17,7 +17,6 @@ export function bindInertia(adminizer) {
|
|
|
17
17
|
<script type="module" src="/@vite/client"></script>
|
|
18
18
|
<script type="module" src="/src/assets/js/app.tsx"></script>
|
|
19
19
|
<script>window.routePrefix = "${adminizer.config.routePrefix}"</script>
|
|
20
|
-
<script>window.bindPublic = ${adminizer.config.bind?.public}</script>
|
|
21
20
|
`;
|
|
22
21
|
}
|
|
23
22
|
else {
|
|
@@ -58,14 +57,11 @@ export function bindInertia(adminizer) {
|
|
|
58
57
|
});
|
|
59
58
|
// Route prefix script
|
|
60
59
|
const routePrefixScript = `<script>window.routePrefix = "${adminizer.config.routePrefix}";</script>`;
|
|
61
|
-
// For Sails JS
|
|
62
|
-
const bindPublic = `<script>window.bindPublic = ${adminizer.config.bind?.public}</script>`;
|
|
63
60
|
return `
|
|
64
61
|
${preloadLinks.join('\n')}
|
|
65
62
|
${stylesheets.join('\n')}
|
|
66
63
|
${scripts.join('\n')}
|
|
67
64
|
${routePrefixScript}
|
|
68
|
-
${bindPublic}
|
|
69
65
|
`;
|
|
70
66
|
}
|
|
71
67
|
};
|
|
@@ -15,8 +15,7 @@ export default function bindMediaManager(adminizer) {
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
// Bind media manager public folder
|
|
18
|
-
|
|
19
|
-
adminizer.app.use(`/public`, serveStatic(adminizer.config.mediamanager.fileStoragePath));
|
|
18
|
+
adminizer.app.use(`/public`, serveStatic(adminizer.config.mediamanager.fileStoragePath));
|
|
20
19
|
// Bind file icons
|
|
21
20
|
adminizer.app.use(`${adminizer.config.routePrefix}/fileicons`, serveStatic(path.join(import.meta.dirname, '../fileicons')));
|
|
22
21
|
}
|