@scalio-cloud/ui 0.95.0 → 0.97.0
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/README.md +1 -0
- package/nginx/access-limit.sh +9 -1
- package/package.json +1 -1
- package/react/audit.js +11 -1
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ server {
|
|
|
78
78
|
| `ALLOWED_CLIENT_IPS` | Addresses and networks, comma separated (`198.51.100.7, 203.0.113.0/24, 2001:db8::/32`) |
|
|
79
79
|
| `ALLOWED_COUNTRIES` | ISO country codes (`CH, LI, DE`); needs the geoip2 module and a country database |
|
|
80
80
|
| `TRUSTED_PROXIES` | Proxies whose `X-Forwarded-For` counts (Caddy, Azure front end); the last entry is used |
|
|
81
|
+
| `ALLOWED_API_OPEN` | `1` = the public API (`/api/public/v1`) and the MCP server (`/mcp`, ADR 0084) stay open for every address (switch «API und MCP von überall», from 0.96.0); any other value or no list: no effect |
|
|
81
82
|
| `SCALIO_APP` | App name (`nexus`, …) for the app-specific machine paths |
|
|
82
83
|
| `SCALIO_GEOIP_DB` | Country database, default `/etc/nginx/geoip/dbip-country.mmdb` |
|
|
83
84
|
| `SCALIO_ACCESS_STATUS` | Public status file, default `/usr/share/nginx/html/access-status.json` (from 0.93.0) |
|
package/nginx/access-limit.sh
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
# ALLOWED_COUNTRIES ISO country codes, comma separated ("CH,DE,AT"); needs SCALIO_GEOIP_DB and the geoip2 module
|
|
8
8
|
# loaded in nginx.conf (load_module, or modules/*.conf as in the Alpine package)
|
|
9
9
|
# TRUSTED_PROXIES CIDR list of the proxy in front (Caddy network, Azure ingress); its X-Forwarded-For counts
|
|
10
|
+
# ALLOWED_API_OPEN "1" = the public API (/api/public/v1) and the MCP server (/mcp) of ADR 0084 stay open for every
|
|
11
|
+
# address (switch «API und MCP von überall», zugang/Z4); they have their own keys and tokens.
|
|
12
|
+
# Any other value: they are limited like the rest. Without a list it changes nothing.
|
|
10
13
|
# SCALIO_APP nexus, citadel, … : picks the app's machine paths (machine-paths.txt)
|
|
11
14
|
# SCALIO_ACCESS_STATUS public status file for the settings page, default /usr/share/nginx/html/access-status.json
|
|
12
15
|
# (active yes/no, number of IP ranges, countries; never an address); cannot be written: only a log line
|
|
@@ -68,6 +71,7 @@ write_status() {
|
|
|
68
71
|
IPS=$(words "${ALLOWED_CLIENT_IPS:-}")
|
|
69
72
|
COUNTRIES=$(words "${ALLOWED_COUNTRIES:-}" | tr 'a-z' 'A-Z')
|
|
70
73
|
PROXIES=$(words "${TRUSTED_PROXIES:-}")
|
|
74
|
+
API_OPEN="${ALLOWED_API_OPEN:-}"
|
|
71
75
|
mkdir -p "$(dirname "$HTTP_CONF")" "$(dirname "$SERVER_CONF")"
|
|
72
76
|
|
|
73
77
|
if [ -z "$IPS" ] && [ -z "$COUNTRIES" ]; then
|
|
@@ -136,6 +140,10 @@ write_status true "$(echo "$IPS" | wc -w | tr -d ' ')" "$COUNTRIES_SHOWN" "$geo_
|
|
|
136
140
|
esac
|
|
137
141
|
fi
|
|
138
142
|
done
|
|
143
|
+
if [ "$API_OPEN" = "1" ]; then
|
|
144
|
+
echo " /api/public/v1 1;"; echo " ~^/api/public/v1/ 1;"
|
|
145
|
+
echo " /mcp 1;"; echo " ~^/mcp/ 1;"
|
|
146
|
+
fi
|
|
139
147
|
echo "}"
|
|
140
148
|
echo "map \"\$scalio_ip_allowed\$scalio_country_allowed\$scalio_machine_path\" \$scalio_access_denied {"
|
|
141
149
|
echo " default 0;"
|
|
@@ -155,4 +163,4 @@ location @scalio_access_denied {
|
|
|
155
163
|
return 200 '<!doctype html><html lang="de"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Zugriff nicht freigegeben</title><body style="font-family:system-ui,sans-serif;max-width:36rem;margin:4rem auto;padding:0 1rem;line-height:1.5"><h1 style="font-size:1.4rem">Zugriff nicht freigegeben</h1><p>Der Zugriff von Ihrer Adresse <b>$remote_addr</b> $scalio_country ist für diese Instanz nicht freigegeben. Bitten Sie Ihre Administration, die Adresse in Scalio Compass unter «Zugriff eingrenzen» einzutragen.</p><p lang="en" style="color:#666">Access from your address <b>$remote_addr</b> $scalio_country is not allowed for this instance. Ask your administrator to add it in Scalio Compass under «Restrict access».</p></body></html>';
|
|
156
164
|
}
|
|
157
165
|
CONF
|
|
158
|
-
log "access limited: $(echo "$IPS" | wc -w | tr -d ' ') IP range(s), countries: ${COUNTRIES:-none}, trusted proxies: ${PROXIES:-none}"
|
|
166
|
+
log "access limited: $(echo "$IPS" | wc -w | tr -d ' ') IP range(s), countries: ${COUNTRIES:-none}, trusted proxies: ${PROXIES:-none}, API and MCP open: $([ "$API_OPEN" = 1 ] && echo yes || echo no)"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"private": false,
|
package/react/audit.js
CHANGED
|
@@ -6,6 +6,7 @@ const React = require("react");
|
|
|
6
6
|
const h = React.createElement;
|
|
7
7
|
const Icons = require("./icons");
|
|
8
8
|
const { SubNav } = require("./nav");
|
|
9
|
+
const { trapTab } = require("./wizard");
|
|
9
10
|
|
|
10
11
|
const LABELS = {
|
|
11
12
|
de: {
|
|
@@ -231,9 +232,18 @@ function Dialog({ title, onClose, children, testId, closeLabel }) {
|
|
|
231
232
|
document.addEventListener("keydown", key);
|
|
232
233
|
return () => document.removeEventListener("keydown", key);
|
|
233
234
|
}, [onClose]);
|
|
235
|
+
// Like askConfirm (dialog.js): focus goes in on open, Tab stays inside, focus returns to the trigger on close.
|
|
236
|
+
const panel = React.useRef(null);
|
|
237
|
+
React.useEffect(() => {
|
|
238
|
+
const before = document.activeElement;
|
|
239
|
+
const close = panel.current && panel.current.querySelector('[data-testid="dialog-close"]');
|
|
240
|
+
if (close) close.focus();
|
|
241
|
+
else if (panel.current) panel.current.focus();
|
|
242
|
+
return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
|
|
243
|
+
}, []);
|
|
234
244
|
return h("div", { className: "scalio-dialog-root" },
|
|
235
245
|
h("div", { className: "scalio-dialog-backdrop", onClick: onClose }),
|
|
236
|
-
h("div", { className: "scalio-dialog scalio-audit-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, "data-testid": testId },
|
|
246
|
+
h("div", { ref: panel, tabIndex: -1, onKeyDown: (e) => { if (e.key === "Tab") trapTab(e, panel.current); }, className: "scalio-dialog scalio-audit-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, "data-testid": testId },
|
|
237
247
|
h("div", { className: "scalio-dialog-head" },
|
|
238
248
|
h("div", { className: "scalio-dialog-title" }, title),
|
|
239
249
|
h("button", { type: "button", className: "scalio-btn is-ghost scalio-btn-icon", onClick: onClose, "aria-label": closeLabel || "×", "data-testid": "dialog-close" },
|