adminforth 1.0.74 → 1.0.75

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.
@@ -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
  }
@@ -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 r = yield fetch(url);
25
- const body = yield r.text();
26
- res.status(r.status);
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
  }
@@ -9,7 +9,7 @@ import router from './router'
9
9
  const app = createApp(App)
10
10
  /* IMPORTANT:ADMINFORTH COMPONENT REGISTRATIONS */
11
11
 
12
-
12
+
13
13
  app.use(createPinia())
14
14
  app.use(router)
15
15
 
@@ -8,10 +8,7 @@
8
8
  }: {}"
9
9
  >
10
10
 
11
- {{ coreStore.config?.brandLogo }}
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
 
@@ -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
- await fsExtra.copy(src, dest);
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.74",
3
+ "version": "1.0.75",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,6 +23,7 @@
23
23
  "jsonwebtoken": "^9.0.2",
24
24
  "mongodb": "6.6",
25
25
  "pg": "^8.11.5",
26
+ "request": "^2.88.2",
26
27
  "uuid": "^9.0.1"
27
28
  },
28
29
  "devDependencies": {
@@ -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 r = await fetch(url);
23
- const body = await r.text();
24
- res.status(r.status);
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
@@ -9,7 +9,7 @@ import router from './router'
9
9
  const app = createApp(App)
10
10
  /* IMPORTANT:ADMINFORTH COMPONENT REGISTRATIONS */
11
11
 
12
-
12
+
13
13
  app.use(createPinia())
14
14
  app.use(router)
15
15
 
@@ -8,10 +8,7 @@
8
8
  }: {}"
9
9
  >
10
10
 
11
- {{ coreStore.config?.brandLogo }}
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