Skip to content

Commit

Permalink
WIP: add domainname & dns to API, #11.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Oct 1, 2023
1 parent 0c2e56c commit e4486b1
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 3 deletions.
8 changes: 8 additions & 0 deletions OpenApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,14 @@ components:
$ref: '#/components/schemas/RoomMount'
resources:
$ref: '#/components/schemas/RoomResources'
domainname:
type: string
example: server.lan
dns:
type: array
items:
type: string
example: 1.1.1.1
browser_policy:
$ref: '#/components/schemas/BrowserPolicy'

Expand Down
12 changes: 12 additions & 0 deletions client/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,18 @@ export interface RoomSettings {
* @memberof RoomSettings
*/
'resources'?: RoomResources;
/**
*
* @type {string}
* @memberof RoomSettings
*/
'domainname'?: string;
/**
*
* @type {Array<string>}
* @memberof RoomSettings
*/
'dns'?: Array<string>;
/**
*
* @type {BrowserPolicy}
Expand Down
10 changes: 10 additions & 0 deletions client/src/components/RoomInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@
</template>
</v-simple-table>

<div class="my-3 headline">Network</div>
<v-simple-table>
<template v-slot:default>
<tbody>
<tr><th style="width:50%;"> Domainname </th><td>{{ settings.domainname }}</td></tr>
<tr><th> DNS </th><td><span v-if="settings.dns">{{ settings.dns.join(", ") }}</span><i v-else>--system-default--</i></td></tr>
</tbody>
</template>
</v-simple-table>

<div class="my-3 headline">Browser policy</div>
<v-simple-table v-if="settings.browser_policy">
<template v-slot:default>
Expand Down
41 changes: 39 additions & 2 deletions client/src/components/RoomsCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,47 @@
</v-combobox>
</v-col>
</v-row>
<v-row align="center" no-gutters class="my-3">
<h2> Network </h2>
</v-row>
<v-row align="center">
<v-col class="py-0">
<v-text-field
label="Domainname"
v-model="data.domainname"
autocomplete="off"
></v-text-field>
</v-col>
<v-col class="pt-0">
<v-combobox class="pt-0"
label="DNS"
v-model="data.dns"
multiple
hide-details
>
<template v-slot:selection="{ attrs, item, parent, selected }">
<v-chip
v-bind="attrs"
:input-value="selected"
label
small
>
<span class="pr-2">
{{ item }}
</span>
<v-icon
small
@click="parent.selectItem(item)"
>
$delete
</v-icon>
</v-chip>
</template>
</v-combobox>
</v-col>
</v-row>
</template>

<hr />

<v-row align="center" no-gutters class="mt-3">
<h2 class="my-3">
Browser policy
Expand Down
5 changes: 5 additions & 0 deletions client/src/store/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export const state = {
shm_size: 2000000000,
devices: [],
},

// eslint-disable-next-line
domainname: '',
// eslint-disable-next-line
dns: [],
} as RoomSettings,
videoCodecs: [
"VP8",
Expand Down
6 changes: 5 additions & 1 deletion internal/room/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro
Hostname: containerName,
// Domainname is preventing from running container on LXC (Proxmox)
// https://www.gitmemory.com/issue/docker/for-linux/743/524569376
// Domainname: containerName,
Domainname: settings.Domainname,
// List of exposed ports
ExposedPorts: exposedPorts,
// List of environment variable to set in the container
Expand Down Expand Up @@ -605,6 +605,8 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro
DeviceRequests: deviceRequests,
Devices: devices,
},
// DNS
DNS: settings.DNS,
// Privileged
Privileged: isPrivilegedImage,
}
Expand Down Expand Up @@ -803,6 +805,8 @@ func (manager *RoomManagerCtx) GetSettings(id string) (*types.RoomSettings, erro
Labels: labels.UserDefined,
Mounts: mounts,
Resources: roomResources,
Domainname: container.Config.Domainname,
DNS: container.HostConfig.DNS,
BrowserPolicy: browserPolicy,
}

Expand Down
3 changes: 3 additions & 0 deletions internal/types/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ type RoomSettings struct {
Mounts []RoomMount `json:"mounts"`
Resources RoomResources `json:"resources"`

Domainname string `json:"domainname,omitempty"`
DNS []string `json:"dns,omitempty"`

BrowserPolicy *BrowserPolicy `json:"browser_policy,omitempty"`
}

Expand Down

0 comments on commit e4486b1

Please sign in to comment.