mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Tidy up web interface buttons and labels
Rename save Copy to Duplicate, shorten the save buttons, move Load scenario into the instance control button and Create template into More, square off the online players table, show the bind address and public URL on the controller page, restyle the user settings like the role page, add a favicon with a controller.favicon_url override, and put the page name in the tab title. Closes #1260 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8865038af5
commit
a6b44e78d6
19 files changed
+455
-391
No files matched your search
@@ -48,6 +48,11 @@ const logSizeGauge = new Gauge(
|
||||
|
||||
type InstanceId = { instanceId: number };
|
||||
|
||||
const htmlEscapes: Record<string, string> = { "&": "&", "<": "<", ">": ">", "\"": """, "'": "'" };
|
||||
function escapeHtml(text: string) {
|
||||
return text.replace(/[&<>"']/g, char => htmlEscapes[char]);
|
||||
}
|
||||
|
||||
type ControllerDebugEvents = {
|
||||
"message": [ { direction: "in" | "out", content: string } ],
|
||||
};
|
||||
@@ -1720,8 +1725,16 @@ export default class Controller {
|
||||
path.join(import.meta.dirname, "..", "..", "..", "web", "index.html"),
|
||||
"utf8",
|
||||
).then(async (content) => {
|
||||
const config: lib.ControllerConfig = res.app.locals.controller.config;
|
||||
let faviconUrl = config.get("controller.favicon_url");
|
||||
// Relative to the web root rather than the page
|
||||
if (faviconUrl && !/^([a-z][a-z0-9+.-]*:|\/)/i.test(faviconUrl)) {
|
||||
faviconUrl = webRoot + faviconUrl;
|
||||
}
|
||||
const favicon = faviconUrl ? `<link rel="icon" href="${escapeHtml(faviconUrl)}" />` : "";
|
||||
content = content
|
||||
.replace(/__CLUSTER_NAME__/g, res.app.locals.controller.config.get("controller.name"))
|
||||
.replace(/__CLUSTER_NAME__/g, () => escapeHtml(config.get("controller.name")))
|
||||
.replace(/__FAVICON__/g, () => favicon)
|
||||
.replace(/__WEB_ROOT__/g, webRoot)
|
||||
.replace(/__STATIC_ROOT__/g, staticRoot)
|
||||
.replace(/__IMPORT_MAP__/g, () => importMap)
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#2a2a2a" />
|
||||
<meta name="application-name" content="__CLUSTER_NAME__" />
|
||||
<title>__CLUSTER_NAME__</title>
|
||||
__FAVICON__
|
||||
<script type="importmap">__IMPORT_MAP__</script>
|
||||
<style>
|
||||
html {
|
||||
|
||||
Reference in new issue
Block a user