@stacksjs/actions 0.72.20 → 0.72.21
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/serve/dashboard.js +1 -1
- package/package.json +20 -20
package/dist/serve/dashboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{projectPath,publicPath}from"@stacksjs/path";import{resolveDefaultsRoot}from"../dev/defaults-resources";import{decideDashboardAccess}from"./dashboard-gate";process.env.APP_ENV||="production";process.env.NODE_ENV||="production";const port=Number(process.env.PORT_DASHBOARD||process.env.PORT)||3002,defaultsRoot=resolveDefaultsRoot(),frameworkDashboard=join(defaultsRoot,"views/dashboard"),appDashboard=projectPath("resources/views/dashboard"),{authCookieName}=await import("@stacksjs/auth"),authCookie=authCookieName();function readCookie(header,name){if(!header)return;for(const part of header.split(";")){const raw=part.trim(),eq=raw.indexOf("=");if(eq<1)continue;if(raw.slice(0,eq)===name)return decodeURIComponent(raw.slice(eq+1))}return}const
|
|
1
|
+
import{existsSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{config}from"@stacksjs/config";import{log}from"@stacksjs/logging";import{projectPath,publicPath}from"@stacksjs/path";import{resolveDefaultsRoot}from"../dev/defaults-resources";import{decideDashboardAccess}from"./dashboard-gate";process.env.APP_ENV||="production";process.env.NODE_ENV||="production";const port=Number(process.env.PORT_DASHBOARD||process.env.PORT)||3002,defaultsRoot=resolveDefaultsRoot(),frameworkDashboard=join(defaultsRoot,"views/dashboard"),appDashboard=projectPath("resources/views/dashboard"),{authCookieName}=await import("@stacksjs/auth"),authCookie=authCookieName();function readCookie(header,name){if(!header)return;for(const part of header.split(";")){const raw=part.trim(),eq=raw.indexOf("=");if(eq<1)continue;if(raw.slice(0,eq)===name)return decodeURIComponent(raw.slice(eq+1))}return}const{isApiBoundRequest,proxyToBackend,resolveApiBase,resolveApiProxyRules}=await import("@stacksjs/server"),apiBase=resolveApiBase(config.ports?.api),apiProxyRules=resolveApiProxyRules(config.server?.proxy),{Auth}=await import("@stacksjs/auth"),{serve}=await import("bun-plugin-stx/serve");await serve({patterns:[appDashboard,frameworkDashboard].filter((dir)=>existsSync(dir)),port,layoutsDir:frameworkDashboard,partialsDir:frameworkDashboard,componentsDir:join(defaultsRoot,"resources/components/Dashboard"),publicDir:publicPath(),quiet:!0,onRequest:async(req)=>{const url=new URL(req.url);if((await decideDashboardAccess({method:req.method,pathname:url.pathname,token:readCookie(req.headers.get("cookie"),authCookie)},(token)=>Auth.getUserFromToken(token))).allow){if(isApiBoundRequest(req,url.pathname,apiProxyRules)){if(!apiBase){log.error(`No API target configured for ${url.pathname}. This dashboard shares its host with other `+"deployments, so there is no safe default port to guess \u2014 refusing to proxy. Set PORT_API "+"(or API_URL) for this site.");return new Response("Bad Gateway",{status:502})}try{return await proxyToBackend(req,apiBase)}catch(error){log.error(`API proxy to ${apiBase} failed: ${error.message}`);return new Response("Bad Gateway",{status:502})}}return null}const next=encodeURIComponent(url.pathname+url.search);return new Response(null,{status:302,headers:{location:`/login?next=${next}`,"cache-control":"no-store, private"}})}});console.log(`Dashboard server listening on port ${port}`);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.72.
|
|
5
|
+
"version": "0.72.21",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -59,35 +59,35 @@
|
|
|
59
59
|
"prepublishOnly": "bun run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@stacksjs/config": "0.72.
|
|
62
|
+
"@stacksjs/config": "0.72.21",
|
|
63
63
|
"@stacksjs/bumpx": "^0.2.6",
|
|
64
64
|
"@stacksjs/bunpress": "^0.2.6",
|
|
65
65
|
"@stacksjs/logsmith": "^0.2.3",
|
|
66
|
-
"@stacksjs/registry": "0.72.
|
|
66
|
+
"@stacksjs/registry": "0.72.21",
|
|
67
67
|
"@stacksjs/stx": "^0.2.184",
|
|
68
68
|
"@stacksjs/ts-cloud": "^0.8.3",
|
|
69
69
|
"@stacksjs/ts-md": "^0.1.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@stacksjs/api": "0.72.
|
|
73
|
-
"@stacksjs/cli": "0.72.
|
|
74
|
-
"@stacksjs/database": "0.72.
|
|
72
|
+
"@stacksjs/api": "0.72.21",
|
|
73
|
+
"@stacksjs/cli": "0.72.21",
|
|
74
|
+
"@stacksjs/database": "0.72.21",
|
|
75
75
|
"@stacksjs/tlsx": "^0.13.2",
|
|
76
76
|
"better-dx": "^0.2.23",
|
|
77
|
-
"@stacksjs/dns": "0.72.
|
|
78
|
-
"@stacksjs/enums": "0.72.
|
|
79
|
-
"@stacksjs/env": "0.72.
|
|
80
|
-
"@stacksjs/error-handling": "0.72.
|
|
81
|
-
"@stacksjs/image": "0.72.
|
|
82
|
-
"@stacksjs/logging": "0.72.
|
|
83
|
-
"@stacksjs/path": "0.72.
|
|
84
|
-
"@stacksjs/security": "0.72.
|
|
85
|
-
"@stacksjs/cms": "0.72.
|
|
86
|
-
"@stacksjs/sites": "0.72.
|
|
87
|
-
"@stacksjs/storage": "0.72.
|
|
88
|
-
"@stacksjs/strings": "0.72.
|
|
89
|
-
"@stacksjs/utils": "0.72.
|
|
90
|
-
"@stacksjs/validation": "0.72.
|
|
77
|
+
"@stacksjs/dns": "0.72.21",
|
|
78
|
+
"@stacksjs/enums": "0.72.21",
|
|
79
|
+
"@stacksjs/env": "0.72.21",
|
|
80
|
+
"@stacksjs/error-handling": "0.72.21",
|
|
81
|
+
"@stacksjs/image": "0.72.21",
|
|
82
|
+
"@stacksjs/logging": "0.72.21",
|
|
83
|
+
"@stacksjs/path": "0.72.21",
|
|
84
|
+
"@stacksjs/security": "0.72.21",
|
|
85
|
+
"@stacksjs/cms": "0.72.21",
|
|
86
|
+
"@stacksjs/sites": "0.72.21",
|
|
87
|
+
"@stacksjs/storage": "0.72.21",
|
|
88
|
+
"@stacksjs/strings": "0.72.21",
|
|
89
|
+
"@stacksjs/utils": "0.72.21",
|
|
90
|
+
"@stacksjs/validation": "0.72.21"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"pickier": "^0.1.35",
|