Skip to content

Commit 3e8beb3

Browse files
author
GitHub Workflow
committed
Update guide to version 336
1 parent b6eb023 commit 3e8beb3

File tree

2 files changed

+96
-11
lines changed

2 files changed

+96
-11
lines changed

guide/latest/cockpit-util.html

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,113 @@ <h2>cockpit.js: Utilities</h2>
9393
<code class="code">options</code>.</p>
9494
</div>
9595
<div class="refsection">
96+
<a name="cockpit-init"></a><h2>cockpit.init()</h2>
97+
<pre class="programlisting">
98+
await cockpit.init();
99+
100+
cockpit.init().then(() =&gt; { ... });
101+
</pre>
102+
<p>Requests initialization of the Cockpit client library. This will ensure that the transport is
103+
connected and we are ready to create channels. It also populates the <code class="code">cockpit.info</code>
104+
field.</p>
105+
<p>This function returns a promise. Initialization isn't complete until the promise has resolved. You
106+
can either <code class="code">await</code> it or call <code class="code">.then()</code> on it.</p>
107+
</div>
108+
<div class="refsection">
96109
<a name="cockpit-info"></a><h2>cockpit.info</h2>
97110
<pre class="programlisting">
98-
cockpit.info["version"]
99-
cockpit.info["build"]
111+
cockpit.info.channels[payload]
112+
113+
cockpit.info.os_release[field]
114+
115+
cockpit.info.user
116+
117+
cockpit.info.ws.version
100118
</pre>
101-
<p>This object contains information about cockpit itself. Note that when cockpit is
102-
running on multiple servers, this only reflects the server that was connected to.
103-
The following fields are defined:</p>
119+
<p>This object contains information about Cockpit itself. It is only available after cockpit.init() has
120+
been called and awaited.</p>
121+
<div class="variablelist"><table border="0" class="variablelist">
122+
<colgroup>
123+
<col align="left" valign="top">
124+
<col>
125+
</colgroup>
126+
<tbody>
127+
<tr>
128+
<td><p><span class="term"><code class="code">channels</code></span></p></td>
129+
<td><p>This is a mapping of channel payload types (keys, strings) supported by the bridge to
130+
capabilities advertised by those channels (values, lists of strings). Channels are listed even if they
131+
don't advertise any capabilities, making this useful as a way to determine which channel types are
132+
supported by the bridge.</p></td>
133+
</tr>
134+
<tr>
135+
<td><p><span class="term"><code class="code">os_release</code></span></p></td>
136+
<td><p>This is the data from the <code class="filename">/etc/os-release</code> or
137+
<code class="filename">/usr/lib/os-release</code> on the system that the bridge is running on. It is a mapping
138+
from the key names to their values. See the <a class="ulink" href="https://www.freedesktop.org/software/systemd/man/latest/os-release.html" target="_top">os-release
139+
Specification</a> for information about the available keys.</p></td>
140+
</tr>
141+
<tr>
142+
<td><p><span class="term"><code class="code">user</code></span></p></td>
143+
<td>
144+
<p>Contains information about the user we're logged in as.</p>
104145
<div class="variablelist"><table border="0" class="variablelist">
105146
<colgroup>
106147
<col align="left" valign="top">
107148
<col>
108149
</colgroup>
109150
<tbody>
110151
<tr>
111-
<td><p><span class="term"><code class="code">"build"</code></span></p></td>
112-
<td><p>A string containing build details.</p></td>
152+
<td><p><span class="term"><code class="code">uid</code></span></p></td>
153+
<td><p>This is unix user id as an integer.</p></td>
154+
</tr>
155+
<tr>
156+
<td><p><span class="term"><code class="code">gid</code></span></p></td>
157+
<td><p>This is unix user group id as an integer.</p></td>
158+
</tr>
159+
<tr>
160+
<td><p><span class="term"><code class="code">name</code></span></p></td>
161+
<td><p>This is the unix user name like <code class="code">"root"</code>.</p></td>
162+
</tr>
163+
<tr>
164+
<td><p><span class="term"><code class="code">fullname</code></span></p></td>
165+
<td><p>This is a readable name for the user, from the GECOS field.</p></td>
166+
</tr>
167+
<tr>
168+
<td><p><span class="term"><code class="code">group</code></span></p></td>
169+
<td><p>This is the primary group name of the user.</p></td>
170+
</tr>
171+
<tr>
172+
<td><p><span class="term"><code class="code">groups</code></span></p></td>
173+
<td><p>This is an array of group names to which the user belongs. The first item in this
174+
list is the primary group.</p></td>
175+
</tr>
176+
<tr>
177+
<td><p><span class="term"><code class="code">home</code></span></p></td>
178+
<td><p>This is user's home directory.</p></td>
179+
</tr>
180+
<tr>
181+
<td><p><span class="term"><code class="code">shell</code></span></p></td>
182+
<td><p>This is unix user shell.</p></td>
183+
</tr>
184+
</tbody>
185+
</table></div>
186+
</td>
113187
</tr>
114188
<tr>
115-
<td><p><span class="term"><code class="code">"version"</code></span></p></td>
116-
<td><p>A string containing the cockpit version number. It is almost always
117-
incorrect to use this to make a decision in code.</p></td>
189+
<td><p><span class="term"><code class="code">ws</code></span></p></td>
190+
<td>
191+
<p>Contains information about the webserver Cockpit is being served with.</p>
192+
<div class="variablelist"><table border="0" class="variablelist">
193+
<colgroup>
194+
<col align="left" valign="top">
195+
<col>
196+
</colgroup>
197+
<tbody><tr>
198+
<td><p><span class="term"><code class="code">version</code></span></p></td>
199+
<td><p>The version of the webserver.</p></td>
200+
</tr></tbody>
201+
</table></div>
202+
</td>
118203
</tr>
119204
</tbody>
120205
</table></div>

guide/latest/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="titlepage">
1717
<div>
1818
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Cockpit Guide</p></th></tr></table></div>
19-
<div><p class="releaseinfo">Documentation for Cockpit 335
19+
<div><p class="releaseinfo">Documentation for Cockpit 336
2020
--
2121
latest version available at:
2222
<a class="ulink" href="https://cockpit-project.org/guide/latest" target="_top">https://cockpit-project.org/guide/latest/</a></p></div>

0 commit comments

Comments
 (0)