diff --git a/OpenApi.yml b/OpenApi.yml index 57b3846..791984d 100644 --- a/OpenApi.yml +++ b/OpenApi.yml @@ -243,6 +243,16 @@ components: format: datetime example: "2021-03-07T21:56:34Z" + RoomMount: + type: object + properties: + host_path: + type: string + example: /profile + container_path: + type: string + example: /home/neko/.config/chromium + RoomSettings: type: object properties: @@ -291,6 +301,10 @@ components: type: string example: CUSTOM_ENV: custom value + mounts: + type: array + items: + $ref: '#/components/schemas/RoomMount' RoomStats: type: object diff --git a/client/src/api/.openapi-generator/VERSION b/client/src/api/.openapi-generator/VERSION index d509cc9..6555596 100644 --- a/client/src/api/.openapi-generator/VERSION +++ b/client/src/api/.openapi-generator/VERSION @@ -1 +1 @@ -5.1.1-SNAPSHOT \ No newline at end of file +5.2.0-SNAPSHOT \ No newline at end of file diff --git a/client/src/api/api.ts b/client/src/api/api.ts index da882f9..f2f1246 100644 --- a/client/src/api/api.ts +++ b/client/src/api/api.ts @@ -107,6 +107,25 @@ export interface RoomMember { */ muted?: boolean; } +/** + * + * @export + * @interface RoomMount + */ +export interface RoomMount { + /** + * + * @type {string} + * @memberof RoomMount + */ + host_path?: string; + /** + * + * @type {string} + * @memberof RoomMount + */ + container_path?: string; +} /** * * @export @@ -203,6 +222,12 @@ export interface RoomSettings { * @memberof RoomSettings */ envs?: { [key: string]: string; }; + /** + * + * @type {Array} + * @memberof RoomSettings + */ + mounts?: Array; } /** * diff --git a/internal/room/manager.go b/internal/room/manager.go index 6c68afb..1d43ce6 100644 --- a/internal/room/manager.go +++ b/internal/room/manager.go @@ -179,11 +179,11 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro } binds := []string{} - for hostPath, containerPath := range settings.Mounts { + for _, mount := range settings.Mounts { binds = append( binds, // TODO: Check for invalid paths. - path.Join(manager.config.InstanceData, roomName, hostPath)+":"+containerPath, + path.Join(manager.config.InstanceData, roomName, mount.HostPath)+":"+mount.ContainerPath, ) } diff --git a/internal/types/room.go b/internal/types/room.go index 80e3560..bfcbdb9 100644 --- a/internal/types/room.go +++ b/internal/types/room.go @@ -39,6 +39,11 @@ type RoomEntry struct { Created time.Time `json:"created"` } +type RoomMount struct { + HostPath string `json:"host_path"` + ContainerPath string `json:"container_path"` +} + type RoomSettings struct { Name string `json:"name"` NekoImage string `json:"neko_image"` @@ -60,7 +65,7 @@ type RoomSettings struct { BroadcastPipeline string `json:"broadcast_pipeline,omitempty"` Envs map[string]string `json:"envs"` - Mounts map[string]string `json:"mounts"` + Mounts []RoomMount `json:"mounts"` } func (settings *RoomSettings) ToEnv() []string {