adminizer 4.2.0-build.71 → 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.
@@ -173,9 +173,6 @@ export interface AdminpanelConfig {
173
173
  /** Default ORM adapter for system models */
174
174
  defaultORM: string;
175
175
  };
176
- bind?: {
177
- public: boolean;
178
- };
179
176
  }
180
177
  export interface ModelConfig {
181
178
  adapter?: string;
@@ -1,4 +1,4 @@
1
- import express, { Express } from "express";
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: express.Request, res: express.Response, next: () => void) => void;
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, next) => {
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-build.71",
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",
@@ -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
- if (adminizer.config.bind?.public)
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
  }
@@ -134,9 +134,6 @@ let adminpanelConfig = {
134
134
  auth: {
135
135
  enable: false,
136
136
  captcha: true
137
- },
138
- bind: {
139
- public: true
140
137
  }
141
138
  };
142
139
  export function setDefaultConfig(config) {