@olenbetong/appframe-vite 5.1.21 → 5.1.23

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.
Files changed (2) hide show
  1. package/lib/devServer.js +7 -4
  2. package/package.json +3 -3
package/lib/devServer.js CHANGED
@@ -124,8 +124,9 @@ async function getArticleHtml() {
124
124
  let article = appframe.article?.id;
125
125
  let client = new Client(hostname);
126
126
  let re = await client.login(username, password);
127
- let response = await client.afFetch(`/${article}`, {
127
+ let response = await client.fetch(`/${article}`, {
128
128
  timeout: 30000,
129
+ method: "GET",
129
130
  });
130
131
  if (response.ok) {
131
132
  return await response.text();
@@ -167,8 +168,10 @@ async function getCachedOrArticleHtml(skipCache = false) {
167
168
  }
168
169
  export function createDevMiddleware(vite) {
169
170
  return async (req, res, next) => {
170
- const url = req.originalUrl;
171
- let isRootArticle = url?.startsWith("/" + appPkg.appframe.article.id);
171
+ let url = req.originalUrl;
172
+ let article = appPkg.appframe.article.id;
173
+ let isLogin = article === "login";
174
+ let isRootArticle = isLogin ? url === "/" : url?.startsWith("/" + appPkg.appframe.article.id);
172
175
  if (!isRootArticle && Array.isArray(appPkg.appframe.article.altNames)) {
173
176
  for (let name of appPkg.appframe.article.altNames) {
174
177
  if (url?.startsWith("/" + name)) {
@@ -177,7 +180,7 @@ export function createDevMiddleware(vite) {
177
180
  }
178
181
  }
179
182
  }
180
- if (url === "/") {
183
+ if (url === "/" && !isLogin) {
181
184
  res.statusCode = 302;
182
185
  res.setHeader("Location", `/${appPkg.appframe.article.id}`);
183
186
  res.end("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-vite",
3
- "version": "5.1.21",
3
+ "version": "5.1.23",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@olenbetong/appframe-data": "1.0.7",
22
+ "@olenbetong/appframe-data": "1.0.9",
23
23
  "body-parser": "^1.20.2",
24
24
  "chalk": "^5.3.0",
25
25
  "chokidar": "^3.6.0",
@@ -40,5 +40,5 @@
40
40
  "open": "^10.0.3",
41
41
  "tcp-port-used": "^1.0.2"
42
42
  },
43
- "gitHead": "a7d5b0c4e073390043351c2027a3b2e7193aed37"
43
+ "gitHead": "958c2d186b477c03643e17a94948182ee022c4c4"
44
44
  }