Skip to content

Commit 5fad487

Browse files
committed
replace all instances of namespace with user
1 parent 913ef22 commit 5fad487

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/lib/common/apiFunctions.svelte

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || '';
1111
1212
// endpoint url for getting users
13-
let endpointURL = '/api/v1/namespace';
13+
let endpointURL = '/api/v1/user';
1414
1515
//returning variables
1616
let headscaleUsers = [new User()];
@@ -40,7 +40,7 @@
4040
});
4141
4242
await headscaleUsersResponse.json().then((data) => {
43-
headscaleUsers = data.namespaces
43+
headscaleUsers = data.users
4444
// sort the users
4545
headscaleUsers = sortUsers(headscaleUsers);
4646
});
@@ -57,7 +57,7 @@
5757
let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || '';
5858
5959
// endpoint url for editing users
60-
let endpointURL = '/api/v1/namespace/' + currentUsername + '/rename/' + newUsername;
60+
let endpointURL = '/api/v1/user/' + currentUsername + '/rename/' + newUsername;
6161
6262
await fetch(headscaleURL + endpointURL, {
6363
method: 'POST',
@@ -189,7 +189,7 @@
189189
let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || '';
190190
191191
// endpoint url for editing users
192-
let endpointURL = '/api/v1/namespace/' + currentUsername;
192+
let endpointURL = '/api/v1/user/' + currentUsername;
193193
194194
await fetch(headscaleURL + endpointURL, {
195195
method: 'DELETE',
@@ -218,7 +218,7 @@
218218
let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || '';
219219
220220
// endpoint url for editing users
221-
let endpointURL = '/api/v1/namespace';
221+
let endpointURL = '/api/v1/user';
222222
223223
await fetch(headscaleURL + endpointURL, {
224224
method: 'POST',
@@ -281,8 +281,8 @@
281281
});
282282
283283
await headscaleDeviceResponse.json().then((data) => {
284-
headscaleDevices = data.machines
285-
headscaleDevices = sortDevices(headscaleDevices)
284+
headscaleDevices = data.machines;
285+
headscaleDevices = sortDevices(headscaleDevices);
286286
});
287287
// set the stores
288288
apiTestStore.set('succeeded');
@@ -341,7 +341,7 @@
341341
let headscalePreAuthKey = [new PreAuthKey()];
342342
let headscalePreAuthKeyResponse: Response = new Response();
343343
344-
await fetch(headscaleURL + endpointURL + '?namespace=' + userName, {
344+
await fetch(headscaleURL + endpointURL + '?user=' + userName, {
345345
method: 'GET',
346346
headers: {
347347
Accept: 'application/json',
@@ -381,7 +381,7 @@
381381
Authorization: `Bearer ${headscaleAPIKey}`
382382
},
383383
body: JSON.stringify({
384-
namespace: userName,
384+
user: userName,
385385
expiration: expiry,
386386
reusable: reusable,
387387
ephemeral: ephemeral
@@ -416,7 +416,7 @@
416416
Authorization: `Bearer ${headscaleAPIKey}`
417417
},
418418
body: JSON.stringify({
419-
namespace: userName,
419+
user: userName,
420420
key: preAuthKey
421421
})
422422
})
@@ -442,7 +442,7 @@
442442
// endpoint url for editing users
443443
let endpointURL = '/api/v1/machine/register';
444444
445-
await fetch(headscaleURL + endpointURL + '?namespace=' + userName + '&key=' + key, {
445+
await fetch(headscaleURL + endpointURL + '?user=' + userName + '&key=' + key, {
446446
method: 'POST',
447447
headers: {
448448
Accept: 'application/json',
@@ -469,7 +469,7 @@
469469
let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || '';
470470
471471
// endpoint url for editing users
472-
let endpointURL = '/api/v1/machine/' + deviceID + '/namespace?namespace=' + user;
472+
let endpointURL = '/api/v1/machine/' + deviceID + '/user?user=' + user;
473473
474474
await fetch(headscaleURL + endpointURL, {
475475
method: 'POST',

src/lib/common/classes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class Device {
77
public forcedTags: string[] = []
88
public validTags: string[] = []
99
public invalidTags: string[] = []
10-
public namespace: { name: string } = { name: '' }
10+
public user: { name: string } = { name: '' }
1111

1212
public constructor(init?: Partial<Device>) {
1313
Object.assign(this, init);
@@ -47,7 +47,7 @@ export class APIKey {
4747
}
4848

4949
export class PreAuthKey {
50-
public namespace: string = '';
50+
public user: string = '';
5151
public id: string = '';
5252
public key: string = '';
5353
public createdAt: string = '';

src/lib/common/searching.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// only run if we have search contents set
2525
if (get(deviceSearchStore)) {
2626
let options: Fuse.IFuseOptions<Device> = {
27-
keys: ['id', 'givenName', 'name', 'forcedTags', 'validTags', 'namespace.name']
27+
keys: ['id', 'givenName', 'name', 'forcedTags', 'validTags', 'user.name']
2828
};
2929
let searcher = new Fuse(get(deviceStore), options);
3030

src/lib/devices/CreateDevice.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{#if activeTab == 0}
4646
<div in:fade class="m-2">
4747
<p>Install Tailscale with the client pointing to your domain (see <a target="_blank" rel="noreferrer" class="link link-primary" href="https://github.com/juanfont/headscale/tree/main/docs">headscale client documentation</a>). Log in using the tray icon, and your browser should give you instructions with a key.</p>
48-
<div class="m-2"><code>headscale -n NAMESPACE nodes register --key &lt;your device key&gt;</code></div>
48+
<div class="m-2"><code>headscale -u USER nodes register --key &lt;your device key&gt;</code></div>
4949
<div class="my-2"><p>Copy the key below:</p></div>
5050
<form class="flex flex-wrap" bind:this={newDeviceForm} on:submit|preventDefault={newDeviceAction}>
5151
<div class="flex-none mr-4">

src/lib/devices/DeviceCard/MoveDevice.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
export let device = new Device();
88
let deviceMoving = false;
9-
let selectedUser = device.namespace.name;
9+
let selectedUser = device.user.name;
1010
1111
function moveDeviceAction() {
1212
moveDevice(device.id, selectedUser)
@@ -23,7 +23,7 @@
2323

2424
<td>
2525
{#if !deviceMoving}
26-
{device.namespace.name}
26+
{device.user.name}
2727
<!-- edit symbol -->
2828
<button
2929
on:click={() => {

0 commit comments

Comments
 (0)