diff --git a/assets/.env.example b/assets/.env.example new file mode 100644 index 00000000..38454e5d --- /dev/null +++ b/assets/.env.example @@ -0,0 +1 @@ +API_URL="https://room-manager.fishjam.com" diff --git a/assets/.tool-versions b/assets/.tool-versions index fb4d1620..24d36fbc 100644 --- a/assets/.tool-versions +++ b/assets/.tool-versions @@ -1 +1 @@ -nodejs 18.14.2 +nodejs v20.12.2 diff --git a/assets/package.json b/assets/package.json index 6bd48509..d7985813 100644 --- a/assets/package.json +++ b/assets/package.json @@ -8,7 +8,7 @@ "dev": "vite", "build": "tsc && vite build", "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" + "preview": "vite preview --port 5005" }, "dependencies": { "@jellyfish-dev/react-client-sdk": "github:jellyfish-dev/react-client-sdk#RC1-event-emitter", diff --git a/assets/public/favicon.ico b/assets/public/favicon.ico new file mode 100644 index 00000000..c967734c Binary files /dev/null and b/assets/public/favicon.ico differ diff --git a/assets/readme.md b/assets/readme.md new file mode 100644 index 00000000..ddabcb39 --- /dev/null +++ b/assets/readme.md @@ -0,0 +1,16 @@ +# Videroom Frontend + +## Development + +1. Start the Jellyfish Media Server +2. Start the Room Manger +3. Start this app + +```shell +npm install +npm run dev # connects to localhost +API_URL="https://roommanager.com" npm run dev # connect to external sever +``` + +## Deployment + diff --git a/assets/src/api/api.ts b/assets/src/api/api.ts index f27f43ec..a9a6c679 100644 --- a/assets/src/api/api.ts +++ b/assets/src/api/api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Videoroom + * Room manager * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 @@ -23,6 +23,25 @@ import type { RequestArgs } from './base'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; +/** + * + * @export + * @interface ConnectionData + */ +export interface ConnectionData { + /** + * + * @type {string} + * @memberof ConnectionData + */ + 'url': string; + /** + * + * @type {string} + * @memberof ConnectionData + */ + 'token': string; +} /** * RoomApi - axios parameter creator @@ -33,16 +52,20 @@ export const RoomApiAxiosParamCreator = function (configuration?: Configuration) /** * Create a new peer in a room and get its token * @summary Join a room - * @param {string} roomName Room name + * @param {string} roomId Room ID + * @param {string} userId User ID * @param {any} [body] Room params * @param {*} [options] Override http request option. * @throws {RequiredError} */ - videoroomWebRoomControllerShow: async (roomName: string, body?: any, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomName' is not null or undefined - assertParamExists('videoroomWebRoomControllerShow', 'roomName', roomName) - const localVarPath = `/api/room/{room_name}` - .replace(`{${"room_name"}}`, encodeURIComponent(String(roomName))); + apiRoomsRoomIdUsersUserIdGet: async (roomId: string, userId: string, body?: any, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'roomId' is not null or undefined + assertParamExists('apiRoomsRoomIdUsersUserIdGet', 'roomId', roomId) + // verify required parameter 'userId' is not null or undefined + assertParamExists('apiRoomsRoomIdUsersUserIdGet', 'userId', userId) + const localVarPath = `/api/rooms/{roomId}/users/{userId}` + .replace(`{${"roomId"}}`, encodeURIComponent(String(roomId))) + .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -115,15 +138,16 @@ export const RoomApiFp = function(configuration?: Configuration) { /** * Create a new peer in a room and get its token * @summary Join a room - * @param {string} roomName Room name + * @param {string} roomId Room ID + * @param {string} userId User ID * @param {any} [body] Room params * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async videoroomWebRoomControllerShow(roomName: string, body?: any, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.videoroomWebRoomControllerShow(roomName, body, options); + async apiRoomsRoomIdUsersUserIdGet(roomId: string, userId: string, body?: any, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiRoomsRoomIdUsersUserIdGet(roomId, userId, body, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomApi.videoroomWebRoomControllerShow']?.[localVarOperationServerIndex]?.url; + const localVarOperationServerBasePath = operationServerMap['RoomApi.apiRoomsRoomIdUsersUserIdGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** @@ -133,7 +157,7 @@ export const RoomApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async videoroomWebRoomControllerStartRecording(roomName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async videoroomWebRoomControllerStartRecording(roomName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.videoroomWebRoomControllerStartRecording(roomName, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['RoomApi.videoroomWebRoomControllerStartRecording']?.[localVarOperationServerIndex]?.url; @@ -152,13 +176,14 @@ export const RoomApiFactory = function (configuration?: Configuration, basePath? /** * Create a new peer in a room and get its token * @summary Join a room - * @param {string} roomName Room name + * @param {string} roomId Room ID + * @param {string} userId User ID * @param {any} [body] Room params * @param {*} [options] Override http request option. * @throws {RequiredError} */ - videoroomWebRoomControllerShow(roomName: string, body?: any, options?: any): AxiosPromise { - return localVarFp.videoroomWebRoomControllerShow(roomName, body, options).then((request) => request(axios, basePath)); + apiRoomsRoomIdUsersUserIdGet(roomId: string, userId: string, body?: any, options?: any): AxiosPromise { + return localVarFp.apiRoomsRoomIdUsersUserIdGet(roomId, userId, body, options).then((request) => request(axios, basePath)); }, /** * Starts recording in the specified room @@ -167,7 +192,7 @@ export const RoomApiFactory = function (configuration?: Configuration, basePath? * @param {*} [options] Override http request option. * @throws {RequiredError} */ - videoroomWebRoomControllerStartRecording(roomName: string, options?: any): AxiosPromise { + videoroomWebRoomControllerStartRecording(roomName: string, options?: any): AxiosPromise { return localVarFp.videoroomWebRoomControllerStartRecording(roomName, options).then((request) => request(axios, basePath)); }, }; @@ -183,14 +208,15 @@ export class RoomApi extends BaseAPI { /** * Create a new peer in a room and get its token * @summary Join a room - * @param {string} roomName Room name + * @param {string} roomId Room ID + * @param {string} userId User ID * @param {any} [body] Room params * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RoomApi */ - public videoroomWebRoomControllerShow(roomName: string, body?: any, options?: RawAxiosRequestConfig) { - return RoomApiFp(this.configuration).videoroomWebRoomControllerShow(roomName, body, options).then((request) => request(this.axios, this.basePath)); + public apiRoomsRoomIdUsersUserIdGet(roomId: string, userId: string, body?: any, options?: RawAxiosRequestConfig) { + return RoomApiFp(this.configuration).apiRoomsRoomIdUsersUserIdGet(roomId, userId, body, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/assets/src/api/base.ts b/assets/src/api/base.ts index d4ae188a..e6a7abd0 100644 --- a/assets/src/api/base.ts +++ b/assets/src/api/base.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Videoroom + * Room manager * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 @@ -19,7 +19,7 @@ import type { Configuration } from './configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; -export const BASE_PATH = "http://localhost:5004".replace(/\/+$/, ""); +export const BASE_PATH = "http://localhost:8080".replace(/\/+$/, ""); /** * diff --git a/assets/src/api/common.ts b/assets/src/api/common.ts index 7027cf39..043d5214 100644 --- a/assets/src/api/common.ts +++ b/assets/src/api/common.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Videoroom + * Room manager * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 diff --git a/assets/src/api/configuration.ts b/assets/src/api/configuration.ts index dc87fb67..8735e119 100644 --- a/assets/src/api/configuration.ts +++ b/assets/src/api/configuration.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Videoroom + * Room manager * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 diff --git a/assets/src/api/index.ts b/assets/src/api/index.ts index d805b6ba..1942702f 100644 --- a/assets/src/api/index.ts +++ b/assets/src/api/index.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Videoroom + * Room manager * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 diff --git a/assets/src/pages/room/RoomPage.tsx b/assets/src/pages/room/RoomPage.tsx index eb64b188..0f7610f7 100644 --- a/assets/src/pages/room/RoomPage.tsx +++ b/assets/src/pages/room/RoomPage.tsx @@ -19,6 +19,8 @@ type ConnectComponentProps = { roomId: string; }; +const userId = crypto.randomUUID() + const ConnectComponent: FC = ( { username, @@ -138,12 +140,13 @@ const ConnectComponent: FC = ( const disconnect = useDisconnect(); useEffect(() => { - getTokenAndAddress(roomId) - .then((tokenAndAddress) => { + getTokenAndAddress(roomId, userId) + .then(({ token, url }) => { + return connect({ peerMetadata: { name: username }, - token: tokenAndAddress.token, - signaling: getSignalingAddress(tokenAndAddress.serverAddress) + token: token, + signaling: getSignalingAddress(url) }); }); diff --git a/assets/src/pages/room/consts.ts b/assets/src/pages/room/consts.ts index 09492e10..a93616c1 100644 --- a/assets/src/pages/room/consts.ts +++ b/assets/src/pages/room/consts.ts @@ -1,28 +1,28 @@ export const AUDIO_TRACK_CONSTRAINTS: MediaTrackConstraints = { - advanced: [{ autoGainControl: true }, { noiseSuppression: true }, { echoCancellation: true }], + advanced: [{ autoGainControl: true }, { noiseSuppression: true }, { echoCancellation: true }] }; export const VIDEO_TRACK_CONSTRAINTS: MediaTrackConstraints = { width: { max: 1280, ideal: 1280, - min: 640, + min: 640 }, height: { max: 720, ideal: 720, - min: 320, + min: 320 }, frameRate: { max: 30, - ideal: 24, - }, + ideal: 24 + } } as const; export const SCREENSHARING_TRACK_CONSTRAINTS: MediaTrackConstraints = { frameRate: { ideal: 20, max: 25 }, width: { max: 1920, ideal: 1920 }, - height: { max: 1080, ideal: 1080 }, + height: { max: 1080, ideal: 1080 } }; export const LOCAL_PEER_NAME = "You"; @@ -34,36 +34,20 @@ export const DEFAULT_AUTOSTART_MICROPHONE_VALUE = true; export const DEFAULT_MANUAL_MODE_CHECKBOX_VALUE = false; export const DEFAULT_SMART_LAYER_SWITCHING_CHECKBOX_VALUE = true; -const isSecure = new URL(window.location.origin).protocol === "https:"; -// @ts-ignore -const isDevEnv = import.meta.env.MODE === "development"; - -const protocol = isSecure ? "https" : "http" - // @ts-ignore -export const BACKEND_URL = isDevEnv ? - new URL(window.location.origin) : - new URL(`${protocol}://${import.meta.env.VITE_BE_HOST}`) - - // @ts-ignore -export const JELLYFISH_VERSION = import.meta.env.VITE_JELLYFISH_VERSION +export const JELLYFISH_VERSION = import.meta.env.VITE_JELLYFISH_VERSION; // @ts-ignore -export const JELLYROOM_VERSION = import.meta.env.VITE_JELLYROOM_VERSION +export const JELLYROOM_VERSION = import.meta.env.VITE_JELLYROOM_VERSION; -// videoroom_backend should return this address (host and port) -// @ts-ignore -const origin_websocket_url = new URL(window.location.origin) -origin_websocket_url.protocol = isSecure ? "wss:" : "ws:"; +export const getSignalingAddress = (url: string) => { + const jellyfishUrl = new URL(url); -export const getSignalingAddress = (serverAddress: String) => { - return { - host: serverAddress.toString(), - path: "/socket/peer/websocket", - protocol: isSecure ? "wss" : "ws" - } -} - -export const JELLYFISH_WEBSOCKET_PROTOCOL = isSecure ? "wss" : "ws"; + return ({ + protocol: jellyfishUrl.protocol.replace(":", ""), + path: jellyfishUrl.pathname, + host: jellyfishUrl.host + }); +}; export const MAX_TILE_HEIGHT_FOR_MEDIUM_ENCODING = 600; export const MAX_TILE_HEIGHT_FOR_LOW_ENCODING = 250; diff --git a/assets/src/room.api.tsx b/assets/src/room.api.tsx index c7eb4546..81516c3b 100644 --- a/assets/src/room.api.tsx +++ b/assets/src/room.api.tsx @@ -1,19 +1,16 @@ import axios from "axios"; -import { RoomApi } from "./api"; -import { BACKEND_URL } from "./pages/room/consts"; +import { ConnectionData, RoomApi } from "./api"; -const API = new RoomApi(undefined, BACKEND_URL.origin, axios); +const API = new RoomApi(undefined, window.location.origin, axios); -export const getTokenAndAddress = (roomId: string) => - API.videoroomWebRoomControllerShow(roomId).then((resp) => { - // @ts-ignore - const address = resp?.data?.data?.jellyfish_address || ""; +export const getTokenAndAddress = (roomId: string, username: string): Promise => + API.apiRoomsRoomIdUsersUserIdGet(roomId, username).then((resp) => { + if (!resp) throw Error("Empty response"); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const token = resp?.data?.data?.token || ""; - return { token: token, serverAddress: address }; + console.log({ name: "Response", result: resp.data }); + + return resp.data; }); export const startRecording = (roomId: string) => - API.videoroomWebRoomControllerStartRecording(roomId); \ No newline at end of file + API.videoroomWebRoomControllerStartRecording(roomId); diff --git a/assets/src/server-sdk/.gitignore b/assets/src/server-sdk/.gitignore deleted file mode 100644 index 149b5765..00000000 --- a/assets/src/server-sdk/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/assets/src/server-sdk/.npmignore b/assets/src/server-sdk/.npmignore deleted file mode 100644 index 849dbba8..00000000 --- a/assets/src/server-sdk/.npmignore +++ /dev/null @@ -1 +0,0 @@ -# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm diff --git a/assets/src/server-sdk/.openapi-generator-ignore b/assets/src/server-sdk/.openapi-generator-ignore deleted file mode 100644 index 7484ee59..00000000 --- a/assets/src/server-sdk/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/assets/src/server-sdk/.openapi-generator/FILES b/assets/src/server-sdk/.openapi-generator/FILES deleted file mode 100644 index a80cd4f0..00000000 --- a/assets/src/server-sdk/.openapi-generator/FILES +++ /dev/null @@ -1,8 +0,0 @@ -.gitignore -.npmignore -api.ts -base.ts -common.ts -configuration.ts -git_push.sh -index.ts diff --git a/assets/src/server-sdk/.openapi-generator/VERSION b/assets/src/server-sdk/.openapi-generator/VERSION deleted file mode 100644 index f22d756d..00000000 --- a/assets/src/server-sdk/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -6.5.0 diff --git a/assets/src/server-sdk/api.ts b/assets/src/server-sdk/api.ts deleted file mode 100644 index bdaa02a0..00000000 --- a/assets/src/server-sdk/api.ts +++ /dev/null @@ -1,1044 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Jellyfish Media Server - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import type { Configuration } from "./configuration"; -import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from "axios"; -import globalAxios from "axios"; -// Some imports not used depending on template conditions -// @ts-ignore -import { - DUMMY_BASE_URL, - assertParamExists, - setApiKeyToObject, - setBasicAuthToObject, - setBearerAuthToObject, - setOAuthToObject, - setSearchParams, - serializeDataIfNeeded, - toPathString, - createRequestFunction, -} from "./common"; -import type { RequestArgs } from "./base"; -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from "./base"; - -/** - * Describes component - * @export - * @interface Component - */ -export interface Component { - /** - * Assigned component id - * @type {string} - * @memberof Component - */ - id: string; - /** - * Component type - * @type {string} - * @memberof Component - */ - type: string; -} -/** - * Response containing component details - * @export - * @interface ComponentDetailsResponse - */ -export interface ComponentDetailsResponse { - /** - * - * @type {Component} - * @memberof ComponentDetailsResponse - */ - data: Component; -} -/** - * - * @export - * @interface JellyfishWebComponentControllerCreateRequest - */ -export interface JellyfishWebComponentControllerCreateRequest { - /** - * Component-specific options - * @type {object} - * @memberof JellyfishWebComponentControllerCreateRequest - */ - options?: object; - /** - * Component type - * @type {string} - * @memberof JellyfishWebComponentControllerCreateRequest - */ - type: string; -} -/** - * - * @export - * @interface JellyfishWebPeerControllerCreateRequest - */ -export interface JellyfishWebPeerControllerCreateRequest { - /** - * Peer type - * @type {string} - * @memberof JellyfishWebPeerControllerCreateRequest - */ - type: string; -} -/** - * Error message - * @export - * @interface ModelError - */ -export interface ModelError { - /** - * Error details - * @type {string} - * @memberof ModelError - */ - errors: string; -} -/** - * Describes peer status - * @export - * @interface Peer - */ -export interface Peer { - /** - * Assigned peer id - * @type {string} - * @memberof Peer - */ - id: string; - /** - * - * @type {PeerStatus} - * @memberof Peer - */ - status: PeerStatus; - /** - * Peer type - * @type {string} - * @memberof Peer - */ - type: string; -} - -/** - * Response containing peer details and their token - * @export - * @interface PeerDetailsResponse - */ -export interface PeerDetailsResponse { - /** - * - * @type {PeerDetailsResponseData} - * @memberof PeerDetailsResponse - */ - data: PeerDetailsResponseData; -} -/** - * - * @export - * @interface PeerDetailsResponseData - */ -export interface PeerDetailsResponseData { - /** - * - * @type {Peer} - * @memberof PeerDetailsResponseData - */ - peer: Peer; - /** - * Token for authorizing websocket connection - * @type {string} - * @memberof PeerDetailsResponseData - */ - token: string; -} -/** - * Informs about the peer status - * @export - * @enum {string} - */ - -export const PeerStatus = { - Connected: "connected", - Disconnected: "disconnected", -} as const; - -export type PeerStatus = (typeof PeerStatus)[keyof typeof PeerStatus]; - -/** - * Description of the room state - * @export - * @interface Room - */ -export interface Room { - /** - * - * @type {Array} - * @memberof Room - */ - components: Array; - /** - * - * @type {RoomConfig} - * @memberof Room - */ - config: RoomConfig; - /** - * Room ID - * @type {string} - * @memberof Room - */ - id: string; - /** - * - * @type {Array} - * @memberof Room - */ - peers: Array; -} -/** - * Room configuration - * @export - * @interface RoomConfig - */ -export interface RoomConfig { - /** - * Maximum amount of peers allowed into the room - * @type {number} - * @memberof RoomConfig - */ - maxPeers?: number | null; -} -/** - * Response containing room details - * @export - * @interface RoomDetailsResponse - */ -export interface RoomDetailsResponse { - /** - * - * @type {Room} - * @memberof RoomDetailsResponse - */ - data: Room; -} -/** - * Response containing list of all rooms - * @export - * @interface RoomsListingResponse - */ -export interface RoomsListingResponse { - /** - * - * @type {Array} - * @memberof RoomsListingResponse - */ - data: Array; -} - -/** - * ComponentApi - axios parameter creator - * @export - */ -export const ComponentApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Creates the component and adds it to the room - * @param {string} roomId Room ID - * @param {JellyfishWebComponentControllerCreateRequest} [jellyfishWebComponentControllerCreateRequest] Component config - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebComponentControllerCreate: async ( - roomId: string, - jellyfishWebComponentControllerCreateRequest?: JellyfishWebComponentControllerCreateRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebComponentControllerCreate", "roomId", roomId); - const localVarPath = `/room/{room_id}/component`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "POST", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - localVarHeaderParameter["Content-Type"] = "application/json"; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - localVarRequestOptions.data = serializeDataIfNeeded( - jellyfishWebComponentControllerCreateRequest, - localVarRequestOptions, - configuration - ); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete the component from the room - * @param {string} roomId Room ID - * @param {string} id Component ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebComponentControllerDelete: async ( - roomId: string, - id: string, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebComponentControllerDelete", "roomId", roomId); - // verify required parameter 'id' is not null or undefined - assertParamExists("jellyfishWebComponentControllerDelete", "id", id); - const localVarPath = `/room/{room_id}/component/{id}` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ComponentApi - functional programming interface - * @export - */ -export const ComponentApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = ComponentApiAxiosParamCreator(configuration); - return { - /** - * - * @summary Creates the component and adds it to the room - * @param {string} roomId Room ID - * @param {JellyfishWebComponentControllerCreateRequest} [jellyfishWebComponentControllerCreateRequest] Component config - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebComponentControllerCreate( - roomId: string, - jellyfishWebComponentControllerCreateRequest?: JellyfishWebComponentControllerCreateRequest, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebComponentControllerCreate( - roomId, - jellyfishWebComponentControllerCreateRequest, - options - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Delete the component from the room - * @param {string} roomId Room ID - * @param {string} id Component ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebComponentControllerDelete( - roomId: string, - id: string, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebComponentControllerDelete( - roomId, - id, - options - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - }; -}; - -/** - * ComponentApi - factory interface - * @export - */ -export const ComponentApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = ComponentApiFp(configuration); - return { - /** - * - * @summary Creates the component and adds it to the room - * @param {string} roomId Room ID - * @param {JellyfishWebComponentControllerCreateRequest} [jellyfishWebComponentControllerCreateRequest] Component config - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebComponentControllerCreate( - roomId: string, - jellyfishWebComponentControllerCreateRequest?: JellyfishWebComponentControllerCreateRequest, - options?: any - ): AxiosPromise { - return localVarFp - .jellyfishWebComponentControllerCreate(roomId, jellyfishWebComponentControllerCreateRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary Delete the component from the room - * @param {string} roomId Room ID - * @param {string} id Component ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebComponentControllerDelete(roomId: string, id: string, options?: any): AxiosPromise { - return localVarFp - .jellyfishWebComponentControllerDelete(roomId, id, options) - .then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * ComponentApi - object-oriented interface - * @export - * @class ComponentApi - * @extends {BaseAPI} - */ -export class ComponentApi extends BaseAPI { - /** - * - * @summary Creates the component and adds it to the room - * @param {string} roomId Room ID - * @param {JellyfishWebComponentControllerCreateRequest} [jellyfishWebComponentControllerCreateRequest] Component config - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ComponentApi - */ - public jellyfishWebComponentControllerCreate( - roomId: string, - jellyfishWebComponentControllerCreateRequest?: JellyfishWebComponentControllerCreateRequest, - options?: AxiosRequestConfig - ) { - return ComponentApiFp(this.configuration) - .jellyfishWebComponentControllerCreate(roomId, jellyfishWebComponentControllerCreateRequest, options) - .then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Delete the component from the room - * @param {string} roomId Room ID - * @param {string} id Component ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ComponentApi - */ - public jellyfishWebComponentControllerDelete(roomId: string, id: string, options?: AxiosRequestConfig) { - return ComponentApiFp(this.configuration) - .jellyfishWebComponentControllerDelete(roomId, id, options) - .then((request) => request(this.axios, this.basePath)); - } -} - -/** - * PeerApi - axios parameter creator - * @export - */ -export const PeerApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Create peer - * @param {string} roomId Room id - * @param {JellyfishWebPeerControllerCreateRequest} [jellyfishWebPeerControllerCreateRequest] Peer specification - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebPeerControllerCreate: async ( - roomId: string, - jellyfishWebPeerControllerCreateRequest?: JellyfishWebPeerControllerCreateRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebPeerControllerCreate", "roomId", roomId); - const localVarPath = `/room/{room_id}/peer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "POST", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - localVarHeaderParameter["Content-Type"] = "application/json"; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - localVarRequestOptions.data = serializeDataIfNeeded( - jellyfishWebPeerControllerCreateRequest, - localVarRequestOptions, - configuration - ); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete peer - * @param {string} roomId Room ID - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebPeerControllerDelete: async ( - roomId: string, - id: string, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebPeerControllerDelete", "roomId", roomId); - // verify required parameter 'id' is not null or undefined - assertParamExists("jellyfishWebPeerControllerDelete", "id", id); - const localVarPath = `/room/{room_id}/peer/{id}` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * PeerApi - functional programming interface - * @export - */ -export const PeerApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = PeerApiAxiosParamCreator(configuration); - return { - /** - * - * @summary Create peer - * @param {string} roomId Room id - * @param {JellyfishWebPeerControllerCreateRequest} [jellyfishWebPeerControllerCreateRequest] Peer specification - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebPeerControllerCreate( - roomId: string, - jellyfishWebPeerControllerCreateRequest?: JellyfishWebPeerControllerCreateRequest, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebPeerControllerCreate( - roomId, - jellyfishWebPeerControllerCreateRequest, - options - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Delete peer - * @param {string} roomId Room ID - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebPeerControllerDelete( - roomId: string, - id: string, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebPeerControllerDelete(roomId, id, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - }; -}; - -/** - * PeerApi - factory interface - * @export - */ -export const PeerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = PeerApiFp(configuration); - return { - /** - * - * @summary Create peer - * @param {string} roomId Room id - * @param {JellyfishWebPeerControllerCreateRequest} [jellyfishWebPeerControllerCreateRequest] Peer specification - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebPeerControllerCreate( - roomId: string, - jellyfishWebPeerControllerCreateRequest?: JellyfishWebPeerControllerCreateRequest, - options?: any - ): AxiosPromise { - return localVarFp - .jellyfishWebPeerControllerCreate(roomId, jellyfishWebPeerControllerCreateRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary Delete peer - * @param {string} roomId Room ID - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebPeerControllerDelete(roomId: string, id: string, options?: any): AxiosPromise { - return localVarFp - .jellyfishWebPeerControllerDelete(roomId, id, options) - .then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * PeerApi - object-oriented interface - * @export - * @class PeerApi - * @extends {BaseAPI} - */ -export class PeerApi extends BaseAPI { - /** - * - * @summary Create peer - * @param {string} roomId Room id - * @param {JellyfishWebPeerControllerCreateRequest} [jellyfishWebPeerControllerCreateRequest] Peer specification - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof PeerApi - */ - public jellyfishWebPeerControllerCreate( - roomId: string, - jellyfishWebPeerControllerCreateRequest?: JellyfishWebPeerControllerCreateRequest, - options?: AxiosRequestConfig - ) { - return PeerApiFp(this.configuration) - .jellyfishWebPeerControllerCreate(roomId, jellyfishWebPeerControllerCreateRequest, options) - .then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Delete peer - * @param {string} roomId Room ID - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof PeerApi - */ - public jellyfishWebPeerControllerDelete(roomId: string, id: string, options?: AxiosRequestConfig) { - return PeerApiFp(this.configuration) - .jellyfishWebPeerControllerDelete(roomId, id, options) - .then((request) => request(this.axios, this.basePath)); - } -} - -/** - * RoomApi - axios parameter creator - * @export - */ -export const RoomApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Creates a room - * @param {RoomConfig} [roomConfig] Room configuration - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerCreate: async ( - roomConfig?: RoomConfig, - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/room`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "POST", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - localVarHeaderParameter["Content-Type"] = "application/json"; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - localVarRequestOptions.data = serializeDataIfNeeded(roomConfig, localVarRequestOptions, configuration); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete the room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerDelete: async ( - roomId: string, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebRoomControllerDelete", "roomId", roomId); - const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Show information about all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerIndex: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/room`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "GET", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Shows information about the room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerShow: async (roomId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists("jellyfishWebRoomControllerShow", "roomId", roomId); - const localVarPath = `/room/{room_id}`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: "GET", ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication authorization required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * RoomApi - functional programming interface - * @export - */ -export const RoomApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = RoomApiAxiosParamCreator(configuration); - return { - /** - * - * @summary Creates a room - * @param {RoomConfig} [roomConfig] Room configuration - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebRoomControllerCreate( - roomConfig?: RoomConfig, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebRoomControllerCreate(roomConfig, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Delete the room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebRoomControllerDelete( - roomId: string, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebRoomControllerDelete(roomId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Show information about all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebRoomControllerIndex( - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebRoomControllerIndex(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Shows information about the room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async jellyfishWebRoomControllerShow( - roomId: string, - options?: AxiosRequestConfig - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.jellyfishWebRoomControllerShow(roomId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - }; -}; - -/** - * RoomApi - factory interface - * @export - */ -export const RoomApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = RoomApiFp(configuration); - return { - /** - * - * @summary Creates a room - * @param {RoomConfig} [roomConfig] Room configuration - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerCreate(roomConfig?: RoomConfig, options?: any): AxiosPromise { - return localVarFp - .jellyfishWebRoomControllerCreate(roomConfig, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary Delete the room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerDelete(roomId: string, options?: any): AxiosPromise { - return localVarFp.jellyfishWebRoomControllerDelete(roomId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Show information about all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerIndex(options?: any): AxiosPromise { - return localVarFp.jellyfishWebRoomControllerIndex(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Shows information about the room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - jellyfishWebRoomControllerShow(roomId: string, options?: any): AxiosPromise { - return localVarFp.jellyfishWebRoomControllerShow(roomId, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * RoomApi - object-oriented interface - * @export - * @class RoomApi - * @extends {BaseAPI} - */ -export class RoomApi extends BaseAPI { - /** - * - * @summary Creates a room - * @param {RoomConfig} [roomConfig] Room configuration - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomApi - */ - public jellyfishWebRoomControllerCreate(roomConfig?: RoomConfig, options?: AxiosRequestConfig) { - return RoomApiFp(this.configuration) - .jellyfishWebRoomControllerCreate(roomConfig, options) - .then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Delete the room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomApi - */ - public jellyfishWebRoomControllerDelete(roomId: string, options?: AxiosRequestConfig) { - return RoomApiFp(this.configuration) - .jellyfishWebRoomControllerDelete(roomId, options) - .then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Show information about all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomApi - */ - public jellyfishWebRoomControllerIndex(options?: AxiosRequestConfig) { - return RoomApiFp(this.configuration) - .jellyfishWebRoomControllerIndex(options) - .then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Shows information about the room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomApi - */ - public jellyfishWebRoomControllerShow(roomId: string, options?: AxiosRequestConfig) { - return RoomApiFp(this.configuration) - .jellyfishWebRoomControllerShow(roomId, options) - .then((request) => request(this.axios, this.basePath)); - } -} diff --git a/assets/src/server-sdk/base.ts b/assets/src/server-sdk/base.ts deleted file mode 100644 index 506b8044..00000000 --- a/assets/src/server-sdk/base.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Jellyfish Media Server - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import type { Configuration } from "./configuration"; -// Some imports not used depending on template conditions -// @ts-ignore -import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from "axios"; -import globalAxios from "axios"; - -export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -/** - * - * @export - * @interface RequestArgs - */ -export interface RequestArgs { - url: string; - options: AxiosRequestConfig; -} - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPI { - protected configuration: Configuration | undefined; - - constructor( - configuration?: Configuration, - protected basePath: string = BASE_PATH, - protected axios: AxiosInstance = globalAxios - ) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } - } -} - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - constructor(public field: string, msg?: string) { - super(msg); - this.name = "RequiredError"; - } -} diff --git a/assets/src/server-sdk/common.ts b/assets/src/server-sdk/common.ts deleted file mode 100644 index a28fd284..00000000 --- a/assets/src/server-sdk/common.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Jellyfish Media Server - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import type { Configuration } from "./configuration"; -import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from "axios"; -import { RequiredError } from "./base"; - -/** - * - * @export - */ -export const DUMMY_BASE_URL = "https://example.com"; - -/** - * - * @throws {RequiredError} - * @export - */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { - if (paramValue === null || paramValue === undefined) { - throw new RequiredError( - paramName, - `Required parameter ${paramName} was null or undefined when calling ${functionName}.` - ); - } -}; - -/** - * - * @export - */ -export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === "function" - ? await configuration.apiKey(keyParamName) - : await configuration.apiKey; - object[keyParamName] = localVarApiKeyValue; - } -}; - -/** - * - * @export - */ -export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { - if (configuration && (configuration.username || configuration.password)) { - object["auth"] = { username: configuration.username, password: configuration.password }; - } -}; - -/** - * - * @export - */ -export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const accessToken = - typeof configuration.accessToken === "function" - ? await configuration.accessToken() - : await configuration.accessToken; - object["Authorization"] = "Bearer " + accessToken; - } -}; - -/** - * - * @export - */ -export const setOAuthToObject = async function ( - object: any, - name: string, - scopes: string[], - configuration?: Configuration -) { - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = - typeof configuration.accessToken === "function" - ? await configuration.accessToken(name, scopes) - : await configuration.accessToken; - object["Authorization"] = "Bearer " + localVarAccessTokenValue; - } -}; - -function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { - if (parameter == null) return; - if (typeof parameter === "object") { - if (Array.isArray(parameter)) { - (parameter as any[]).forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key)); - } else { - Object.keys(parameter).forEach((currentKey) => - setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`) - ); - } - } else { - if (urlSearchParams.has(key)) { - urlSearchParams.append(key, parameter); - } else { - urlSearchParams.set(key, parameter); - } - } -} - -/** - * - * @export - */ -export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); - url.search = searchParams.toString(); -}; - -/** - * - * @export - */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { - const nonString = typeof value !== "string"; - const needsSerialization = - nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) - : nonString; - return needsSerialization ? JSON.stringify(value !== undefined ? value : {}) : value || ""; -}; - -/** - * - * @export - */ -export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash; -}; - -/** - * - * @export - */ -export const createRequestFunction = function ( - axiosArgs: RequestArgs, - globalAxios: AxiosInstance, - BASE_PATH: string, - configuration?: Configuration -) { - return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url }; - return axios.request(axiosRequestArgs); - }; -}; diff --git a/assets/src/server-sdk/configuration.ts b/assets/src/server-sdk/configuration.ts deleted file mode 100644 index 1c32f824..00000000 --- a/assets/src/server-sdk/configuration.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Jellyfish Media Server - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -export interface ConfigurationParameters { - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - username?: string; - password?: string; - accessToken?: - | string - | Promise - | ((name?: string, scopes?: string[]) => string) - | ((name?: string, scopes?: string[]) => Promise); - basePath?: string; - baseOptions?: any; - formDataCtor?: new () => any; -} - -export class Configuration { - /** - * parameter for apiKey security - * @param name security name - * @memberof Configuration - */ - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - username?: string; - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - password?: string; - /** - * parameter for oauth2 security - * @param name security name - * @param scopes oauth2 scope - * @memberof Configuration - */ - accessToken?: - | string - | Promise - | ((name?: string, scopes?: string[]) => string) - | ((name?: string, scopes?: string[]) => Promise); - /** - * override base path - * - * @type {string} - * @memberof Configuration - */ - basePath?: string; - /** - * base options for axios calls - * - * @type {any} - * @memberof Configuration - */ - baseOptions?: any; - /** - * The FormData constructor that will be used to create multipart form data - * requests. You can inject this here so that execution environments that - * do not support the FormData class can still run the generated client. - * - * @type {new () => FormData} - */ - formDataCtor?: new () => any; - - constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.baseOptions = param.baseOptions; - this.formDataCtor = param.formDataCtor; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$", "i"); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === "application/json-patch+json"); - } -} diff --git a/assets/src/server-sdk/git_push.sh b/assets/src/server-sdk/git_push.sh deleted file mode 100644 index f53a75d4..00000000 --- a/assets/src/server-sdk/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/assets/src/server-sdk/index.ts b/assets/src/server-sdk/index.ts deleted file mode 100644 index 58cae48b..00000000 --- a/assets/src/server-sdk/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Jellyfish Media Server - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -export * from "./api"; -export * from "./configuration"; diff --git a/assets/vite.config.ts b/assets/vite.config.ts index d433594a..05433634 100644 --- a/assets/vite.config.ts +++ b/assets/vite.config.ts @@ -1,35 +1,39 @@ -import { defineConfig } from "vite"; +import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; import checker from "vite-plugin-checker"; // https://vitejs.dev/config/ -export default defineConfig({ - server: { - // https://vitejs.dev/config/server-options.html#server-host - // true - listen on all addresses, including LAN and public addresses - host: false, - // https: true, - port: 5005, - strictPort: true, - proxy: { - "/api": { - target: "http://127.0.0.1:5004", - changeOrigin: false, - }, - "/socket/peer/websocket": { - ws: true, - target: "ws://127.0.0.1:5002", - changeOrigin: false, - }, +export default defineConfig((configEnv) => { + const env = loadEnv(configEnv.mode, process.cwd(), ""); + + return ({ + server: { + // https://vitejs.dev/config/server-options.html#server-host + // true - listen on all addresses, including LAN and public addresses + host: false, + // https: true, + port: 5005, + strictPort: true, + proxy: { + "/api": { + target: env.API_URL ?? "http://0.0.0.0:5004", + changeOrigin: !!env.API_URL + }, + "/socket/peer/websocket": { + ws: true, + target: "ws://127.0.0.1:5002", + changeOrigin: false + } + } }, - }, - plugins: [ - react(), - checker({ - typescript: true, - eslint: { - lintCommand: "eslint --ext .ts,.tsx", - }, - }), - ], + plugins: [ + react(), + checker({ + typescript: true, + eslint: { + lintCommand: "eslint --ext .ts,.tsx" + } + }) + ] + }); });