mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 00:23:12 +09:00
Merge pull request #830 from Cooldude2606/webui/better-host-tokens
Improve the generate host token modal
This commit is contained in:
2 files changed
+22
-10
No files matched your search
@@ -57,7 +57,7 @@ function GenerateHostTokenButton() {
|
|||||||
|
|
||||||
let newToken = await control.send(new lib.HostGenerateTokenRequest(id));
|
let newToken = await control.send(new lib.HostGenerateTokenRequest(id));
|
||||||
setToken(newToken);
|
setToken(newToken);
|
||||||
setHostId(id??null);
|
setHostId(id ?? null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a new random
|
// Generate a new random
|
||||||
@@ -90,13 +90,24 @@ function GenerateHostTokenButton() {
|
|||||||
}} />
|
}} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
<Typography.Paragraph>
|
||||||
|
Host IDs are randomly generated and unique, leave blank to use a new ID,
|
||||||
|
otherwise the ID of an existing host can be found using:
|
||||||
|
</Typography.Paragraph>
|
||||||
|
<div className="codeblock">
|
||||||
|
<CopyButton
|
||||||
|
message="Copied get host id to clipboard"
|
||||||
|
text="npx clusteriohost config get host.id"
|
||||||
|
/>
|
||||||
|
npx clusteriohost config get host.id
|
||||||
|
</div>
|
||||||
{token !== null && <>
|
{token !== null && <>
|
||||||
<Typography.Paragraph>
|
<Typography.Paragraph>
|
||||||
Host auth token:
|
Host auth token:
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
<div className="codeblock">
|
<div className="codeblock">
|
||||||
<CopyButton
|
<CopyButton
|
||||||
message={"Copied auth token to clipboard"}
|
message="Copied host token to clipboard"
|
||||||
text={token}
|
text={token}
|
||||||
/>
|
/>
|
||||||
{token}
|
{token}
|
||||||
@@ -106,15 +117,13 @@ function GenerateHostTokenButton() {
|
|||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
<div className="codeblock">
|
<div className="codeblock">
|
||||||
<CopyButton
|
<CopyButton
|
||||||
message={"Copied configuration commands to clipboard"}
|
message="Copied set host id to clipboard"
|
||||||
text={`npx clusteriohost config set host.controller_token ${token}
|
text={`npx clusteriohost config set host.id ${token}`}
|
||||||
npx clusteriohost config set host.id ${hostId}`}
|
|
||||||
/>
|
/>
|
||||||
<p>npx clusteriohost config set host.controller_token <token></p>
|
npx clusteriohost config set host.id {token}
|
||||||
<p>npx clusteriohost config set host.id <hostId></p>
|
|
||||||
</div>
|
</div>
|
||||||
<Typography.Paragraph>
|
<Typography.Paragraph>
|
||||||
Example host setup commands:
|
A new host can be setup using the following commands:
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
<div className="codeblock">
|
<div className="codeblock">
|
||||||
<CopyButton
|
<CopyButton
|
||||||
@@ -123,7 +132,7 @@ function GenerateHostTokenButton() {
|
|||||||
mkdir clusterio
|
mkdir clusterio
|
||||||
cd clusterio
|
cd clusterio
|
||||||
npm init "@clusterio" -- --controller-token ${token} --mode "host" --download-headless \
|
npm init "@clusterio" -- --controller-token ${token} --mode "host" --download-headless \
|
||||||
--controller-url ${document.location.origin}/ --host-name "Host ${hostId || "?"}" \
|
--controller-url ${document.location.origin}/ --host-name "${hostId ? `Host ${hostId}` : "Host"}" \
|
||||||
--public-address localhost ${pluginString.length ? "--plugins" : ""} ${pluginString}`
|
--public-address localhost ${pluginString.length ? "--plugins" : ""} ${pluginString}`
|
||||||
}/>
|
}/>
|
||||||
<p>> mkdir clusterio</p>
|
<p>> mkdir clusterio</p>
|
||||||
@@ -134,7 +143,7 @@ npm init "@clusterio" -- --controller-token ${token} --mode "host" --download-he
|
|||||||
--mode "host"
|
--mode "host"
|
||||||
--download-headless
|
--download-headless
|
||||||
--controller-url <span className="highlight">{document.location.origin}/ </span>
|
--controller-url <span className="highlight">{document.location.origin}/ </span>
|
||||||
--host-name <span className="highlight">"Host {hostId || "?"}" </span>
|
--host-name <span className="highlight">{hostId ? `Host ${hostId}` : "Host"} </span>
|
||||||
--public-address <span className="highlight">localhost </span>
|
--public-address <span className="highlight">localhost </span>
|
||||||
{pluginString.length ? "--plugins" : ""} <span className="highlight">{pluginString}</span>
|
{pluginString.length ? "--plugins" : ""} <span className="highlight">{pluginString}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -331,6 +331,9 @@ body {
|
|||||||
.codeblock {
|
.codeblock {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
padding-right: 5em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
min-height: 2.5em;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
font-family: Courier;
|
font-family: Courier;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
Reference in new issue
Block a user