adminforth 1.0.74 → 1.0.76
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/dist/modules/codeInjector.js +4 -1
- package/dist/servers/express.js +6 -8
- package/dist/spa/spa/src/main.ts +1 -1
- package/dist/spa/spa/src/views/LoginView.vue +3 -5
- package/modules/codeInjector.ts +5 -1
- package/package.json +3 -1
- package/servers/express.ts +7 -9
- package/spa/src/main.ts +1 -1
- package/spa/src/views/LoginView.vue +3 -5
|
@@ -163,7 +163,10 @@ class CodeInjector {
|
|
|
163
163
|
yield Promise.all(filesUpdated.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
164
164
|
const src = path.join(ADMIN_FORTH_ABSOLUTE_PATH, 'spa', file);
|
|
165
165
|
const dest = path.join(CodeInjector.SPA_TMP_PATH, file);
|
|
166
|
-
yield fsExtra.copy(src, dest
|
|
166
|
+
yield fsExtra.copy(src, dest, {
|
|
167
|
+
overwrite: true,
|
|
168
|
+
dereference: true, // needed to dereference types
|
|
169
|
+
});
|
|
167
170
|
if (process.env.HEAVY_DEBUG) {
|
|
168
171
|
console.log('🪲 await fsExtra.copy filtering', src, dest);
|
|
169
172
|
}
|
package/dist/servers/express.js
CHANGED
|
@@ -11,6 +11,7 @@ import path from 'path';
|
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
12
|
import fs from 'fs';
|
|
13
13
|
import CodeInjector from '../modules/codeInjector.js';
|
|
14
|
+
import fetch from 'node-fetch';
|
|
14
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
16
|
const __dirname = path.dirname(__filename);
|
|
16
17
|
function replaceAtStart(string, substring) {
|
|
@@ -21,13 +22,9 @@ function replaceAtStart(string, substring) {
|
|
|
21
22
|
}
|
|
22
23
|
function proxyTo(url, res) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
r.headers.forEach((value, name) => {
|
|
28
|
-
res.setHeader(name, value);
|
|
29
|
-
});
|
|
30
|
-
res.send(body);
|
|
25
|
+
const actual = yield fetch(url);
|
|
26
|
+
actual.headers.forEach((v, n) => res.setHeader(n, v));
|
|
27
|
+
actual.body.pipe(res);
|
|
31
28
|
});
|
|
32
29
|
}
|
|
33
30
|
function parseExpressCookie(req) {
|
|
@@ -93,11 +90,12 @@ class ExpressServer {
|
|
|
93
90
|
const slashedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;
|
|
94
91
|
if (this.adminforth.runningHotReload) {
|
|
95
92
|
const handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
// proxy using fetch to webpack dev server
|
|
93
|
+
// proxy using fetch to webpack dev server
|
|
97
94
|
try {
|
|
98
95
|
yield proxyTo(`http://localhost:5173${req.url}`, res);
|
|
99
96
|
}
|
|
100
97
|
catch (e) {
|
|
98
|
+
// console.log('Failed to proxy', e);
|
|
101
99
|
res.status(500).send(respondNoServer('AdminForth SPA is not ready yet', 'Vite is still starting up. Please wait a moment...'));
|
|
102
100
|
return;
|
|
103
101
|
}
|
package/dist/spa/spa/src/main.ts
CHANGED
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
}: {}"
|
|
9
9
|
>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
<img
|
|
13
|
-
:src="loadFile('@@/logo2.png')" class="w-40 h-40" alt="logo" />
|
|
14
|
-
<!-- Main modal -->
|
|
11
|
+
<!-- Main modal -->
|
|
15
12
|
<div id="authentication-modal" tabindex="-1" class=" overflow-y-auto overflow-x-hidden z-50 min-w-[400px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
16
13
|
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
17
14
|
<!-- Modal content -->
|
|
@@ -82,13 +79,14 @@
|
|
|
82
79
|
|
|
83
80
|
<script setup>
|
|
84
81
|
|
|
85
|
-
import { onMounted, ref } from 'vue';
|
|
82
|
+
import { onMounted, ref, watchEffect } from 'vue';
|
|
86
83
|
import { useCoreStore } from '@/stores/core';
|
|
87
84
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
88
85
|
import { callAdminForthApi, loadFile } from '@/utils';
|
|
89
86
|
import { useRouter } from 'vue-router';
|
|
90
87
|
import { initFlowbite } from 'flowbite'
|
|
91
88
|
|
|
89
|
+
|
|
92
90
|
const router = useRouter();
|
|
93
91
|
const inProgress = ref(false);
|
|
94
92
|
|
package/modules/codeInjector.ts
CHANGED
|
@@ -176,7 +176,11 @@ class CodeInjector {
|
|
|
176
176
|
await Promise.all(filesUpdated.map(async (file) => {
|
|
177
177
|
const src = path.join(ADMIN_FORTH_ABSOLUTE_PATH, 'spa', file);
|
|
178
178
|
const dest = path.join(CodeInjector.SPA_TMP_PATH, file);
|
|
179
|
-
|
|
179
|
+
|
|
180
|
+
await fsExtra.copy(src, dest, {
|
|
181
|
+
overwrite: true,
|
|
182
|
+
dereference: true, // needed to dereference types
|
|
183
|
+
});
|
|
180
184
|
if (process.env.HEAVY_DEBUG) {
|
|
181
185
|
console.log('🪲 await fsExtra.copy filtering', src, dest);
|
|
182
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminforth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.76",
|
|
4
4
|
"description": "OpenSource Vue3 powered forth-generation admin panel",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"fs-extra": "^11.2.0",
|
|
23
23
|
"jsonwebtoken": "^9.0.2",
|
|
24
24
|
"mongodb": "6.6",
|
|
25
|
+
"node-fetch": "^3.3.2",
|
|
25
26
|
"pg": "^8.11.5",
|
|
27
|
+
"request": "^2.88.2",
|
|
26
28
|
"uuid": "^9.0.1"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
package/servers/express.ts
CHANGED
|
@@ -5,6 +5,7 @@ import fs from 'fs';
|
|
|
5
5
|
import CodeInjector from '../modules/codeInjector.js';
|
|
6
6
|
import AdminForth from '../index.js';
|
|
7
7
|
import { Express } from 'express';
|
|
8
|
+
import fetch from 'node-fetch';
|
|
8
9
|
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
11
|
const __dirname = path.dirname(__filename);
|
|
@@ -19,13 +20,9 @@ function replaceAtStart(string, substring) {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async function proxyTo(url, res) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
r.headers.forEach((value, name) => {
|
|
26
|
-
res.setHeader(name, value);
|
|
27
|
-
});
|
|
28
|
-
res.send(body);
|
|
23
|
+
const actual = await fetch(url);
|
|
24
|
+
actual.headers.forEach((v, n) => res.setHeader(n, v));
|
|
25
|
+
actual.body.pipe(res);
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
async function parseExpressCookie(req) {
|
|
@@ -99,13 +96,14 @@ class ExpressServer {
|
|
|
99
96
|
|
|
100
97
|
if (this.adminforth.runningHotReload) {
|
|
101
98
|
const handler = async (req, res) => {
|
|
102
|
-
// proxy using fetch to webpack dev server
|
|
99
|
+
// proxy using fetch to webpack dev server
|
|
103
100
|
try {
|
|
104
101
|
await proxyTo(`http://localhost:5173${req.url}`, res);
|
|
105
102
|
} catch (e) {
|
|
103
|
+
// console.log('Failed to proxy', e);
|
|
106
104
|
res.status(500).send(respondNoServer('AdminForth SPA is not ready yet', 'Vite is still starting up. Please wait a moment...'));
|
|
107
105
|
return;
|
|
108
|
-
|
|
106
|
+
}
|
|
109
107
|
}
|
|
110
108
|
this.expressApp.get(`${slashedPrefix}assets/*`, handler);
|
|
111
109
|
this.expressApp.get(`${prefix}*`, handler);
|
package/spa/src/main.ts
CHANGED
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
}: {}"
|
|
9
9
|
>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
<img
|
|
13
|
-
:src="loadFile('@@/logo2.png')" class="w-40 h-40" alt="logo" />
|
|
14
|
-
<!-- Main modal -->
|
|
11
|
+
<!-- Main modal -->
|
|
15
12
|
<div id="authentication-modal" tabindex="-1" class=" overflow-y-auto overflow-x-hidden z-50 min-w-[400px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
16
13
|
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
17
14
|
<!-- Modal content -->
|
|
@@ -82,13 +79,14 @@
|
|
|
82
79
|
|
|
83
80
|
<script setup>
|
|
84
81
|
|
|
85
|
-
import { onMounted, ref } from 'vue';
|
|
82
|
+
import { onMounted, ref, watchEffect } from 'vue';
|
|
86
83
|
import { useCoreStore } from '@/stores/core';
|
|
87
84
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
88
85
|
import { callAdminForthApi, loadFile } from '@/utils';
|
|
89
86
|
import { useRouter } from 'vue-router';
|
|
90
87
|
import { initFlowbite } from 'flowbite'
|
|
91
88
|
|
|
89
|
+
|
|
92
90
|
const router = useRouter();
|
|
93
91
|
const inProgress = ref(false);
|
|
94
92
|
|