@xenon-device-management/xenon 1.1.15 → 1.1.16
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/package.json +1 -1
- package/lib/src/app/index.js +21 -11
- package/package.json +1 -1
package/lib/package.json
CHANGED
package/lib/src/app/index.js
CHANGED
|
@@ -132,17 +132,27 @@ apiRouter.get('/metrics', (req, res) => __awaiter(void 0, void 0, void 0, functi
|
|
|
132
132
|
res.set('Content-Type', 'text/plain');
|
|
133
133
|
res.send(metrics);
|
|
134
134
|
}));
|
|
135
|
-
const
|
|
136
|
-
path_1.default.resolve(__dirname, '..', '
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
const findPublicPath = () => {
|
|
136
|
+
const rootDir = path_1.default.resolve(__dirname, '..', '..');
|
|
137
|
+
const searchPaths = [
|
|
138
|
+
path_1.default.join(rootDir, 'public'), // Production (lib/public)
|
|
139
|
+
path_1.default.join(rootDir, 'src', 'public'), // Development (src/public)
|
|
140
|
+
path_1.default.resolve(__dirname, '../public'), // Alternative structure
|
|
141
|
+
path_1.default.resolve(__dirname, '../../public'),
|
|
142
|
+
path_1.default.resolve(__dirname, '../../../public'),
|
|
143
|
+
];
|
|
144
|
+
for (const p of searchPaths) {
|
|
145
|
+
if (fs_1.default.existsSync(path_1.default.join(p, 'index.html'))) {
|
|
146
|
+
logger_1.default.info(`[Xenon] Dashboard assets found at: ${p}`);
|
|
147
|
+
return p;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Last resort fallback
|
|
151
|
+
const fallback = path_1.default.resolve(__dirname, '../../public');
|
|
152
|
+
logger_1.default.warn(`[Xenon] Could not find dashboard index.html in standard paths. Falling back to: ${fallback}`);
|
|
153
|
+
return fallback;
|
|
154
|
+
};
|
|
155
|
+
const publicPath = findPublicPath();
|
|
146
156
|
logger_1.default.info(`[Xenon] Public assets path resolved to: ${publicPath}`);
|
|
147
157
|
staticFilesRouter.use(express_1.default.static(publicPath));
|
|
148
158
|
router.use('/api', apiRouter);
|
package/package.json
CHANGED