diff --git a/.env.example b/.env.example index e7d2fe9f..62d43c04 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ JF_SERVER_API_TOKEN="development" # SSL DOMAIN=localhost -# BE_JF_ADDRESSES= +# BE_JF_ADDRESSES= # BE_HOST= # BE_JF_SECURE_CONNECTION=false # JF_CHECK_ORIGIN=false diff --git a/.github/workflows/debug_build_and_deploy.yml b/.github/workflows/debug_build_and_deploy.yml new file mode 100644 index 00000000..2fbbd91a --- /dev/null +++ b/.github/workflows/debug_build_and_deploy.yml @@ -0,0 +1,26 @@ +name: Staging Build and Deploy +on: + push: + branches: + - "debug-staging" + paths: + - "**" + +env: + DOMAIN: room.fishjam.work + BE_HOST: server.room.fishjam.work + PROJECT: staging + COMPOSE_FILE_NAME: docker-compose-deploy.yaml + +jobs: + deploy1: + runs-on: ubuntu-latest + steps: + - name: Debug staging + uses: JimCronqvist/action-ssh@master + with: + hosts: ${{ secrets.STAGING_HOST }} + privateKey: ${{ secrets.SSH_PRIV_KEY }} + command: | + cat test.txt + diff --git a/.github/workflows/production_build_and_deploy.yml b/.github/workflows/production_build_and_deploy.yml index fd55ffb8..6b04b370 100644 --- a/.github/workflows/production_build_and_deploy.yml +++ b/.github/workflows/production_build_and_deploy.yml @@ -20,16 +20,16 @@ jobs: id: versions run: | cat << EOF >> $GITHUB_OUTPUT - jellyroom=${GITHUB_REF#refs/*/} - jellyfish=$(cat .jellyfish-version) + fishjam_room=${GITHUB_REF#refs/*/} + fishjam=$(cat .fishjam-version) EOF - name: Prepare .env file for the deployment id: variables_population run: | echo "DOMAIN=${{env.DOMAIN}} - JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }} - JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }} + FISHJAM_ROOM_VERSION=${{ steps.versions.outputs.fishjam_room }} + JELLYFISH_VERSION=${{ steps.versions.outputs.fishjam }} JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_PRODUCTION}} BE_HOST=${{env.BE_HOST}} BE_JF_SECURE_CONNECTION=true diff --git a/.github/workflows/sandbox_build_and_deploy.yml b/.github/workflows/sandbox_build_and_deploy.yml index e26035e5..9482bd27 100644 --- a/.github/workflows/sandbox_build_and_deploy.yml +++ b/.github/workflows/sandbox_build_and_deploy.yml @@ -22,16 +22,16 @@ jobs: id: versions run: | cat << EOF >> $GITHUB_OUTPUT - jellyroom=${GITHUB_SHA:0:7} - jellyfish=$(cat .jellyfish-version) + fishjam_room=${GITHUB_SHA:0:7} + fishjam=$(cat .fishjam-version) EOF - name: Prepare .env file for the deployment id: variables_population run: | echo "DOMAIN=${{env.DOMAIN}} - JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }} - JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }} + FISHJAM_ROOM_VERSION=${{ steps.versions.outputs.fishjam_room }} + JELLYFISH_VERSION=${{ steps.versions.outputs.fishjam }} JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_SANDBOX}} BE_HOST=${{env.BE_HOST}} BE_JF_SECURE_CONNECTION=true diff --git a/.github/workflows/staging_build_and_deploy.yml b/.github/workflows/staging_build_and_deploy.yml index fdd003c7..55454554 100644 --- a/.github/workflows/staging_build_and_deploy.yml +++ b/.github/workflows/staging_build_and_deploy.yml @@ -20,16 +20,16 @@ jobs: id: versions run: | cat << EOF >> $GITHUB_OUTPUT - jellyroom=${GITHUB_SHA:0:7} - jellyfish=$(cat .jellyfish-version) + fishjam_room=${GITHUB_SHA:0:7} + fishjam=$(cat .fishjam-version) EOF - name: Prepare .env file for the deployment id: variables_population run: | echo "DOMAIN=${{env.DOMAIN}} - JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }} - JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }} + FISHJAM_ROOM_VERSION=${{ steps.versions.outputs.fishjam_room }} + JELLYFISH_VERSION=${{ steps.versions.outputs.fishjam }} JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_STAGING}} BE_HOST=${{env.BE_HOST}} BE_JF_SECURE_CONNECTION=true diff --git a/.gitmodules b/.gitmodules index b2e4ed50..19b48491 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "protos"] path = protos - url = https://github.com/jellyfish-dev/protos.git + url = https://github.com/fishjam-dev/protos.git diff --git a/README.md b/README.md index 308396d4..30c1d3f0 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Videoroom Videoroom is an open-source, basic video conferencing platform using WebRTC. -It is based on [jellyfish](https://github.com/jellyfish-dev/jellyfish), a general-purpose media server. -Videoroom may be a good starting point for building your own real-time communication solution using Elixir and Jellyfish. +It is based on [fishjam](https://github.com/fishjam-dev/fishjam), a general-purpose media server. +Videoroom may be a good starting point for building your own real-time communication solution using Elixir and Fishjam. ## Running with Docker The simplest way to run videoroom is with use of Docker. @@ -15,9 +15,9 @@ docker compose --env-file .env.example up Make sure to have installed [Elixir](https://elixir-lang.org/install.html) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) first. -Running the Videoroom requires connecting to an instance of [Jellyfish Server](https://github.com/jellyfish-dev/jellyfish). +Running the Videoroom requires connecting to an instance of [Fishjam Server](https://github.com/fishjam-dev/fishjam). -When running locally, you can start an instance of Jellyfish inside docker using docker compose. +When running locally, you can start an instance of Fishjam inside docker using docker compose. ```sh EXTERNAL_IP= docker compose -f docker-compose-dev.yaml up @@ -27,26 +27,26 @@ Now you can start the Videoroom backend: - Run `mix setup` to install and setup dependencies - Start Phoenix server with `mix phx.server` -When running the build version of the Phoenix app, you must specify the addresses of the Jellyfish and backend service. +When running the build version of the Phoenix app, you must specify the addresses of the Fishjam and backend service. As well as the authentication token via the environment variables: ```sh -BE_JF_ADDRESSES=: OR : OR #Example of using two jellyfishes: `127.0.0.1:5002 room.fishjam.ovh`, if not provided in dev environment `localhost:5002 localhost:5003` is used. -BE_JF_SERVER_API_TOKEN= #This must be the same token that was setup in jellyfish. In `docker-compose-dev.yaml` we setup `development` and this variable is used by default in `dev` environment +BE_JF_ADDRESSES=: OR : OR #Example of using two fishjams: `127.0.0.1:5002 room.fishjam.ovh`, if not provided in dev environment `localhost:5002 localhost:5003` is used. +BE_JF_SERVER_API_TOKEN= #This must be the same token that was setup in fishjam. In `docker-compose-dev.yaml` we setup `development` and this variable is used by default in `dev` environment ``` Optionally, in production, these variables can be set: * `BE_PEER_JOIN_TIMEOUT` - can be used to limit the period in which a new peer must join the meeting, -* `BE_JF_SECURE_CONNECTION` - enforces connecting the backend to jellyfish through `wss` protocol, +* `BE_JF_SECURE_CONNECTION` - enforces connecting the backend to fishjam through `wss` protocol, * `BE_HOST` - address of backend -* `JF_CHECK_ORIGIN` - define whether jellyfish should check origin of incoming requests +* `JF_CHECK_ORIGIN` - define whether fishjam should check origin of incoming requests Next you have to start a Videoroom frontend: - Run `npm ci --prefix=assets` to install and setup dependencies - Start vite server with `npm run dev --prefix=assets` -Now you have all needed components to use jellyfish videoroom. +Now you have all needed components to use fishjam videoroom. ## Production @@ -56,21 +56,21 @@ You can copy the `.env.example` file to `.env` and adjust it to your needs. ## Deployment with load-balancing -`docker-compose.yaml` allows to run a jellyfish videoroom with multiple jellyfishes but all of that runs on the same machine. +`docker-compose.yaml` allows to run a fishjam videoroom with multiple fishjams but all of that runs on the same machine. For properly using load-balancing two machines will be needed and `docker-compose-deploy.yaml` will be used. You can see our deployment workflow [here](.github/workflows/test_build_and_deploy.yml). This deployment is pretty simple. -All containers besides `jellyfish2` are started on node1 and `jellyfish2` is started on node2. +All containers besides `fishjam2` are started on node1 and `fishjam2` is started on node2. All environment variables used in our deployment are presented below: ```sh DOMAIN= -JF1_IP= # IP address of first node on which jellyfish will be run -JF2_IP= # IP address of second node on which jellyfish will be run -JF_SERVER_API_TOKEN= #The same API token is used for all jellyfishes -JF1_HOST= OR : # Value passed to jellyfish and returns by it when creating a room on this speicific jellyfish +JF1_IP= # IP address of first node on which fishjam will be run +JF2_IP= # IP address of second node on which fishjam will be run +JF_SERVER_API_TOKEN= #The same API token is used for all fishjams +JF1_HOST= OR : # Value passed to fishjam and returns by it when creating a room on this speicific fishjam JF2_HOST= OR : -BE_JF_ADDRESSES= #Used by backend to create a notifier to one of jellyfishes +BE_JF_ADDRESSES= #Used by backend to create a notifier to one of fishjams PROMETHEUS_TARGETS=:9568,:9568 #Addresses on which prometheus will query for data BE_HOST= GF_SECURITY_ADMIN_PASSWORD= @@ -83,9 +83,9 @@ JF_CHECK_ORIGIN=false We use [Divo](https://hexdocs.pm/divo/readme.html) in tests, which is responsible for starting docker containers. -When running locally run tests using `mix test`, which starts Jellyfish in a container. +When running locally run tests using `mix test`, which starts Fishjam in a container. -On CI both Jellyfish and the tests are run inside docker. If needed, e.g. when the tests are failing on the CI, but not locally you can simulate those conditions with `mix integration_test`. +On CI both Fishjam and the tests are run inside docker. If needed, e.g. when the tests are failing on the CI, but not locally you can simulate those conditions with `mix integration_test`. ## Copyright and License diff --git a/assets/Dockerfile b/assets/Dockerfile index 27f86585..bf9d1f4a 100644 --- a/assets/Dockerfile +++ b/assets/Dockerfile @@ -4,10 +4,10 @@ FROM alpine:3.18 as builder WORKDIR '/app' ARG FE_BE_HOST -ARG JELLYROOM_VERSION +ARG FISHJAM_ROOM_VERSION ARG JELLYFISH_VERSION ENV VITE_BE_HOST=$FE_BE_HOST -ENV VITE_JELLYROOM_VERSION=$JELLYROOM_VERSION +ENV VITE_FISHJAM_ROOM_VERSION=$FISHJAM_ROOM_VERSION ENV VITE_JELLYFISH_VERSION=$JELLYFISH_VERSION # Install nodejs and npm @@ -19,7 +19,7 @@ RUN adduser --disabled-password --gecos "" node # Own the app directory RUN chown node:node ./ -# It's adviced to run the container as non-root user +# It's adviced to run the container as non-root user # for added security if the base image has the user USER node @@ -29,7 +29,7 @@ COPY package*.json ./ # Install dependencies RUN npm ci -# Copy application files +# Copy application files COPY . . # Build the app diff --git a/assets/package-lock.json b/assets/package-lock.json index 31d4a016..61a39e79 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -1,11 +1,11 @@ { - "name": "jellyfish-videoroom", + "name": "fishjam-videoroom", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "jellyfish-videoroom", + "name": "fishjam-videoroom", "version": "0.0.0", "license": "Apache-2.0", "dependencies": { diff --git a/assets/package.json b/assets/package.json index 123b089d..1f4867ac 100644 --- a/assets/package.json +++ b/assets/package.json @@ -1,5 +1,5 @@ { - "name": "jellyfish-videoroom", + "name": "fishjam-videoroom", "private": true, "version": "0.0.0", "type": "module", diff --git a/assets/src/features/home-page/components/HomePageLayout.tsx b/assets/src/features/home-page/components/HomePageLayout.tsx index 6447eb06..9676d4ca 100644 --- a/assets/src/features/home-page/components/HomePageLayout.tsx +++ b/assets/src/features/home-page/components/HomePageLayout.tsx @@ -4,7 +4,7 @@ import BlockingScreen from "../../shared/components/BlockingScreen"; import Navbar from "./Navbar"; import useSmartphoneViewport from "../../shared/hooks/useSmartphoneViewport"; -import { JELLYFISH_VERSION, JELLYROOM_VERSION } from "../../../pages/room/consts"; +import { JELLYFISH_VERSION, FISHJAM_ROOM_VERSION } from "../../../pages/room/consts"; const HomePageLayout: FC = ({ children }) => { const { isSmartphone, isHorizontal } = useSmartphoneViewport(); @@ -25,7 +25,7 @@ const HomePageLayout: FC = ({ children }) => {
- {`${JELLYROOM_VERSION} (jellyfish ${JELLYFISH_VERSION})`} + {`${FISHJAM_ROOM_VERSION} (jellyfish ${JELLYFISH_VERSION})`}
diff --git a/assets/src/pages/room/consts.ts b/assets/src/pages/room/consts.ts index 09492e10..b383e359 100644 --- a/assets/src/pages/room/consts.ts +++ b/assets/src/pages/room/consts.ts @@ -48,7 +48,7 @@ export const BACKEND_URL = isDevEnv ? // @ts-ignore export const JELLYFISH_VERSION = import.meta.env.VITE_JELLYFISH_VERSION // @ts-ignore -export const JELLYROOM_VERSION = import.meta.env.VITE_JELLYROOM_VERSION +export const FISHJAM_ROOM_VERSION = import.meta.env.VITE_FISHJAM_ROOM_VERSION // videoroom_backend should return this address (host and port) // @ts-ignore diff --git a/assets/src/room.api.tsx b/assets/src/room.api.tsx index c7eb4546..cb30d254 100644 --- a/assets/src/room.api.tsx +++ b/assets/src/room.api.tsx @@ -6,8 +6,8 @@ const API = new RoomApi(undefined, BACKEND_URL.origin, axios); export const getTokenAndAddress = (roomId: string) => API.videoroomWebRoomControllerShow(roomId).then((resp) => { - // @ts-ignore - const address = resp?.data?.data?.jellyfish_address || ""; + // @ts-ignore + const address = resp?.data?.data?.fishjam_address || ""; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -16,4 +16,4 @@ export const getTokenAndAddress = (roomId: string) => }); export const startRecording = (roomId: string) => - API.videoroomWebRoomControllerStartRecording(roomId); \ No newline at end of file + API.videoroomWebRoomControllerStartRecording(roomId); diff --git a/assets/src/server-sdk/.npmignore b/assets/src/server-sdk/.npmignore index 849dbba8..999d88df 100644 --- a/assets/src/server-sdk/.npmignore +++ b/assets/src/server-sdk/.npmignore @@ -1 +1 @@ -# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/assets/src/server-sdk/.openapi-generator/VERSION b/assets/src/server-sdk/.openapi-generator/VERSION index f22d756d..ba7f754d 100644 --- a/assets/src/server-sdk/.openapi-generator/VERSION +++ b/assets/src/server-sdk/.openapi-generator/VERSION @@ -1 +1 @@ -6.5.0 +7.4.0 diff --git a/assets/src/server-sdk/api.ts b/assets/src/server-sdk/api.ts index bdaa02a0..f27f43ec 100644 --- a/assets/src/server-sdk/api.ts +++ b/assets/src/server-sdk/api.ts @@ -1,1044 +1,210 @@ /* tslint:disable */ /* eslint-disable */ /** - * Jellyfish Media Server + * Videoroom * 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"; + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } 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"; +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"; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } 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 + * RoomApi - 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, - }; - }, - }; +export const RoomApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Create a new peer in a room and get its token + * @summary Join a room + * @param {string} roomName Room name + * @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))); + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Starts recording in the specified room + * @summary Start recording in a room + * @param {string} roomName Room name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + videoroomWebRoomControllerStartRecording: async (roomName: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'roomName' is not null or undefined + assertParamExists('videoroomWebRoomControllerStartRecording', 'roomName', roomName) + const localVarPath = `/api/room/{room_name}/start_recording` + .replace(`{${"room_name"}}`, encodeURIComponent(String(roomName))); + // 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; + + + + 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 + * RoomApi - 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); - }, - }; +export const RoomApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = RoomApiAxiosParamCreator(configuration) + return { + /** + * Create a new peer in a room and get its token + * @summary Join a room + * @param {string} roomName Room name + * @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); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['RoomApi.videoroomWebRoomControllerShow']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Starts recording in the specified room + * @summary Start recording in a room + * @param {string} roomName Room name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + 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; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } }; /** - * ComponentApi - factory interface + * RoomApi - 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)); - }, - }; +export const RoomApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = RoomApiFp(configuration) + return { + /** + * Create a new peer in a room and get its token + * @summary Join a room + * @param {string} roomName Room name + * @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)); + }, + /** + * Starts recording in the specified room + * @summary Start recording in a room + * @param {string} roomName Room name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + videoroomWebRoomControllerStartRecording(roomName: string, options?: any): AxiosPromise { + return localVarFp.videoroomWebRoomControllerStartRecording(roomName, options).then((request) => request(axios, basePath)); + }, + }; }; /** - * ComponentApi - object-oriented interface + * RoomApi - object-oriented interface * @export - * @class ComponentApi + * @class RoomApi * @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); - }, +export class RoomApi extends BaseAPI { /** - * - * @summary Delete peer - * @param {string} roomId Room ID - * @param {string} id Peer id + * Create a new peer in a room and get its token + * @summary Join a room + * @param {string} roomName Room name + * @param {any} [body] Room params * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RoomApi */ - 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); - }, - }; -}; + public videoroomWebRoomControllerShow(roomName: string, body?: any, options?: RawAxiosRequestConfig) { + return RoomApiFp(this.configuration).videoroomWebRoomControllerShow(roomName, body, options).then((request) => request(this.axios, this.basePath)); + } -/** - * 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 + * Starts recording in the specified room + * @summary Start recording in a room + * @param {string} roomName Room name * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RoomApi */ - 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)); - } + public videoroomWebRoomControllerStartRecording(roomName: string, options?: RawAxiosRequestConfig) { + return RoomApiFp(this.configuration).videoroomWebRoomControllerStartRecording(roomName, 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 index 506b8044..d4ae188a 100644 --- a/assets/src/server-sdk/base.ts +++ b/assets/src/server-sdk/base.ts @@ -1,34 +1,35 @@ /* tslint:disable */ /* eslint-disable */ /** - * Jellyfish Media Server + * Videoroom * 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 { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from "axios"; -import globalAxios from "axios"; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; -export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); +export const BASE_PATH = "http://localhost:5004".replace(/\/+$/, ""); /** * * @export */ export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", }; /** @@ -37,8 +38,8 @@ export const COLLECTION_FORMATS = { * @interface RequestArgs */ export interface RequestArgs { - url: string; - options: AxiosRequestConfig; + url: string; + options: RawAxiosRequestConfig; } /** @@ -47,19 +48,15 @@ export interface RequestArgs { * @class BaseAPI */ export class BaseAPI { - protected configuration: Configuration | undefined; + 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; + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; + } } - } -} +}; /** * @@ -68,8 +65,22 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - constructor(public field: string, msg?: string) { - super(msg); - this.name = "RequiredError"; - } + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} + +interface ServerMap { + [key: string]: { + url: string, + description: string, + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = { } diff --git a/assets/src/server-sdk/common.ts b/assets/src/server-sdk/common.ts index a28fd284..7027cf39 100644 --- a/assets/src/server-sdk/common.ts +++ b/assets/src/server-sdk/common.ts @@ -1,27 +1,28 @@ /* tslint:disable */ /* eslint-disable */ /** - * Jellyfish Media Server + * Videoroom * 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 type { AxiosInstance, AxiosResponse } from 'axios'; import { RequiredError } from "./base"; /** * * @export */ -export const DUMMY_BASE_URL = "https://example.com"; +export const DUMMY_BASE_URL = 'https://example.com' /** * @@ -29,88 +30,80 @@ export const DUMMY_BASE_URL = "https://example.com"; * @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}.` - ); - } -}; + 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; - } -}; + 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 }; - } -}; + 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; - } -}; + 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; - } -}; +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); + 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); + } } - } } /** @@ -118,44 +111,40 @@ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: an * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); - url.search = searchParams.toString(); -}; + 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 || ""; -}; + 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; -}; + 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); - }; -}; +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: (axios.defaults.baseURL ? '' : 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 index 1c32f824..dc87fb67 100644 --- a/assets/src/server-sdk/configuration.ts +++ b/assets/src/server-sdk/configuration.ts @@ -1,108 +1,110 @@ /* tslint:disable */ /* eslint-disable */ /** - * Jellyfish Media Server + * Videoroom * 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; + 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; + serverIndex?: number; + 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; + /** + * 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; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * 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; - } + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + 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"); - } + /** + * 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/index.ts b/assets/src/server-sdk/index.ts index 58cae48b..d805b6ba 100644 --- a/assets/src/server-sdk/index.ts +++ b/assets/src/server-sdk/index.ts @@ -1,16 +1,18 @@ /* tslint:disable */ /* eslint-disable */ /** - * Jellyfish Media Server + * Videoroom * 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/config/dev.exs b/config/dev.exs index 464eabc3..0215e2b2 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -16,7 +16,7 @@ config :videoroom, VideoroomWeb.Endpoint, secret_key_base: "Ovvgkm2prqt9EuqBAuHVGRtJj35AcVVnwSkk3dcTmZYZ9Gfigrg1bOSokrung9aT", watchers: [] -config :jellyfish_server_sdk, +config :fishjam_server_sdk, server_address: "localhost:5002", server_api_token: System.get_env("BE_JF_SERVER_API_TOKEN", "development") @@ -43,16 +43,16 @@ config :jellyfish_server_sdk, # configured to run both http and https servers on # different ports. -jellyfish_addresses = System.get_env("BE_JF_ADDRESSES", "localhost:5002 localhost:5003") +fishjam_addresses = System.get_env("BE_JF_ADDRESSES", "localhost:5002 localhost:5003") -jellyfish_addresses = String.split(jellyfish_addresses, " ") +fishjam_addresses = String.split(fishjam_addresses, " ") # Enable dev routes for dashboard and mailbox config :videoroom, dev_routes: true, peer_disconnected_timeout: 60, peerless_purge_timeout: 120, - jellyfish_addresses: jellyfish_addresses + fishjam_addresses: fishjam_addresses # Do not include metadata nor timestamps in development logs config :logger, :console, format: "[$level] $message\n" diff --git a/config/integration_test.exs b/config/integration_test.exs index 4f3d60ee..677939b2 100644 --- a/config/integration_test.exs +++ b/config/integration_test.exs @@ -1,10 +1,10 @@ import Config -config :jellyfish_server_sdk, - server_address: "jellyfish:5002", +config :fishjam_server_sdk, + server_address: "fishjam:5002", server_api_token: "development" config :videoroom, - jellyfish_addresses: ["jellyfish:5002"], + fishjam_addresses: ["fishjam:5002"], peer_disconnected_timeout: 1, peerless_purge_timeout: 3 diff --git a/config/runtime.exs b/config/runtime.exs index d49edcfd..2a81c730 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -25,7 +25,7 @@ if config_env() == :test do # before RoomService exits, which results in a bunch of error # logs at the end of tests - RoomService is linked to the # Notifier and Notifier to the WS connection to the JF - Divo.Suite.start(services: [:jellyfish], auto_start: false) + Divo.Suite.start(services: [:fishjam], auto_start: false) end if config_env() == :prod do @@ -52,14 +52,14 @@ if config_env() == :prod do ], secret_key_base: secret_key_base - jellyfish_addresses = + fishjam_addresses = System.get_env("BE_JF_ADDRESSES") || raise "Environment variable BE_JF_ADDRESSES is missing." - jellyfish_addresses = String.split(jellyfish_addresses, " ") + fishjam_addresses = String.split(fishjam_addresses, " ") secure_connection? = System.get_env("BE_JF_SECURE_CONNECTION", "false") == "true" - config :jellyfish_server_sdk, + config :fishjam_server_sdk, secure?: secure_connection?, server_api_token: System.get_env("BE_JF_SERVER_API_TOKEN") || @@ -68,7 +68,7 @@ if config_env() == :prod do """) config :videoroom, - jellyfish_addresses: jellyfish_addresses, + fishjam_addresses: fishjam_addresses, peer_disconnected_timeout: String.to_integer(System.get_env("PEER_DISCONNECTED_TIMEOUT") || "30"), peerless_purge_timeout: String.to_integer(System.get_env("PEERLESS_PURGE_TIMEOUT") || "60") diff --git a/config/test.exs b/config/test.exs index 084bf0ab..9d3ac3d8 100644 --- a/config/test.exs +++ b/config/test.exs @@ -7,14 +7,14 @@ config :videoroom, VideoroomWeb.Endpoint, secret_key_base: "ZARcyCI5SXpckH0BXnmeifEvUBnxxyqIR6PZDcmHKOUH3EbUHCeep0pdjXLYYdSq", server: false -config :jellyfish_server_sdk, +config :fishjam_server_sdk, server_address: "localhost:5002", server_api_token: "development" config :videoroom, divo: "docker-compose-dev.yaml", divo_wait: [dwell: 1500, max_tries: 50], - jellyfish_addresses: ["localhost:5002"], + fishjam_addresses: ["localhost:5002"], peer_disconnected_timeout: 1, peerless_purge_timeout: 3 diff --git a/docker-compose-deploy.yaml b/docker-compose-deploy.yaml index eed4b578..d83c0c35 100644 --- a/docker-compose-deploy.yaml +++ b/docker-compose-deploy.yaml @@ -1,9 +1,9 @@ version: '2.2' -x-jellyfish-template: &jellyfish-template - image: "ghcr.io/fishjam-dev/jellyfish:${JELLYFISH_VERSION}" +x-fishjam-template: &fishjam-template + image: "ghcr.io/fishjam-dev/fishjam:${JELLYFISH_VERSION}" restart: unless-stopped - environment: &jellyfish-environment + environment: &fishjam-environment JF_PORT: $JF_PORT JF_CHECK_ORIGIN: "${JF_CHECK_ORIGIN:-true}" JF_SERVER_API_TOKEN: ${JF_SERVER_API_TOKEN} @@ -31,20 +31,20 @@ x-node-exporter: &node-exporter-template - /:/host:ro,rslave services: - jellyfish1: - <<: *jellyfish-template - container_name: jellyfish1 + fishjam1: + <<: *fishjam-template + container_name: fishjam1 environment: - <<: *jellyfish-environment + <<: *fishjam-environment JF_HOST: "${JF1_HOST:-$JF1_IP:$JF_PORT}" JF_DIST_NODE_NAME: app@$JF1_IP JF_WEBRTC_TURN_IP: "${JF1_IP}" - jellyfish2: - <<: *jellyfish-template - container_name: jellyfish2 + fishjam2: + <<: *fishjam-template + container_name: fishjam2 environment: - <<: *jellyfish-environment + <<: *fishjam-environment JF_HOST: "${JF2_HOST:-$JF2_IP:$JF_PORT}" JF_DIST_NODE_NAME: app@$JF2_IP JF_WEBRTC_TURN_IP: "${JF2_IP}" @@ -55,13 +55,13 @@ services: dockerfile: ./Dockerfile args: FE_BE_HOST: ${BE_HOST:-$DOMAIN:5004} - JELLYROOM_VERSION: ${JELLYROOM_VERSION} + FISHJAM_ROOM_VERSION: ${FISHJAM_ROOM_VERSION} JELLYFISH_VERSION: ${JELLYFISH_VERSION} container_name: frontend restart: unless-stopped depends_on: - backend - - jellyfish1 + - fishjam1 ports: - "5005:5005" @@ -79,7 +79,7 @@ services: BE_JF_ADDRESSES: ${BE_JF_ADDRESSES:-$JF1_IP:$JF_PORT $JF2_IP:$JF_PORT} restart: unless-stopped depends_on: - - jellyfish1 + - fishjam1 ports: - "5004:5004" @@ -88,7 +88,7 @@ services: context: ./prometheus dockerfile: Dockerfile args: - PROM_JELLYFISH_TARGETS: ${PROM_JELLYFISH_TARGETS:-jellyfish1:9568,jellyfish2:9568} + PROM_JELLYFISH_TARGETS: ${PROM_JELLYFISH_TARGETS:-fishjam1:9568,fishjam2:9568} PROM_NODE_TARGETS: ${PROM_NODE_TARGETS:-node_exporter:9100} container_name: prometheus restart: on-failure @@ -100,7 +100,7 @@ services: volumes: - prometheus_data:/prometheus depends_on: - - jellyfish1 + - fishjam1 grafana: build: diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml index e6fbd85a..201e6350 100644 --- a/docker-compose-dev.yaml +++ b/docker-compose-dev.yaml @@ -1,9 +1,9 @@ version: "3" services: - jellyfish: - image: "ghcr.io/fishjam-dev/jellyfish:${JELLYFISH_VERSION:-edge}" - container_name: jellyfish + fishjam: + image: "ghcr.io/fishjam-dev/fishjam:${JELLYFISH_VERSION:-edge}" + container_name: fishjam restart: on-failure healthcheck: test: > diff --git a/docker-compose-integration.yaml b/docker-compose-integration.yaml index 1e5773c7..2e58f353 100644 --- a/docker-compose-integration.yaml +++ b/docker-compose-integration.yaml @@ -6,18 +6,18 @@ services: command: sh -c "cd app/ && apk add git && mix local.hex --force && mix local.rebar --force && mix deps.get && mix test --warnings-as-errors" environment: MIX_ENV: integration_test - BE_JF_ADDRESSES: jellyfish:5002 + BE_JF_ADDRESSES: fishjam:5002 BE_JF_SECURE_CONNECTION: false volumes: - .:/app depends_on: - jellyfish: + fishjam: condition: service_healthy - jellyfish: + fishjam: extends: file: docker-compose-dev.yaml - service: jellyfish + service: fishjam environment: - - JF_HOST=jellyfish:5002 + - JF_HOST=fishjam:5002 diff --git a/docker-compose.yaml b/docker-compose.yaml index 26394a6d..4d0c8035 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,25 +1,25 @@ version: '3.8' -x-jellyfish-template: &jellyfish-template - image: "ghcr.io/fishjam-dev/jellyfish:${JELLYFISH_VERSION:-edge}" +x-fishjam-template: &fishjam-template + image: "ghcr.io/fishjam-dev/fishjam:${JELLYFISH_VERSION:-edge}" restart: unless-stopped - environment: &jellyfish-environment + environment: &fishjam-environment JF_SERVER_API_TOKEN: ${JF_SERVER_API_TOKEN:-development} JF_CHECK_ORIGIN: "${JF_CHECK_ORIGIN:-false}" JF_DIST_ENABLED: "${JF_DIST_ENABLED:-true}" - JF_DIST_NODES: "app@jellyfish1 app@jellyfish2" + JF_DIST_NODES: "app@fishjam1 app@fishjam2" JF_WEBRTC_TURN_IP: $EXTERNAL_IP JF_WEBRTC_TURN_LISTEN_IP: "0.0.0.0" services: - jellyfish1: - <<: *jellyfish-template - container_name: jellyfish1 + fishjam1: + <<: *fishjam-template + container_name: fishjam1 environment: - <<: *jellyfish-environment + <<: *fishjam-environment JF_HOST: "${JF1_HOST:-${JF1_IP:-$EXTERNAL_IP}:5002}" JF_PORT: 5002 - JF_DIST_NODE_NAME: app@jellyfish1 + JF_DIST_NODE_NAME: app@fishjam1 JF_WEBRTC_TURN_PORT_RANGE: "50000-50100" JF_WEBRTC_TURN_TCP_PORT: "49999" ports: @@ -27,15 +27,15 @@ services: - "49999:49999" - "50000-50100:50000-50100/udp" - jellyfish2: - <<: *jellyfish-template + fishjam2: + <<: *fishjam-template restart: unless-stopped - container_name: jellyfish2 + container_name: fishjam2 environment: - <<: *jellyfish-environment + <<: *fishjam-environment JF_HOST: "${JF2_HOST:-${JF2_IP:-$EXTERNAL_IP}:5003}" JF_PORT: 5003 - JF_DIST_NODE_NAME: app@jellyfish2 + JF_DIST_NODE_NAME: app@fishjam2 JF_WEBRTC_TURN_PORT_RANGE: "50101-50200" JF_WEBRTC_TURN_TCP_PORT: "49998" ports: @@ -50,13 +50,13 @@ services: args: FE_BE_HOST: ${BE_HOST:-$DOMAIN:5004} JELLYFISH_VERSION: ${JELLYFISH_VERSION:-0.3.0} - JELLYROOM_VERSION: ${JELLYROOM_VERSION:-build} + FISHJAM_ROOM_VERSION: ${FISHJAM_ROOM_VERSION:-build} container_name: frontend restart: unless-stopped depends_on: - backend - - jellyfish1 - - jellyfish2 + - fishjam1 + - fishjam2 ports: - "5005:5005" @@ -69,13 +69,13 @@ services: BE_PORT: 5004 BE_HOST: ${BE_HOST:-$DOMAIN} BE_PHX_SERVER: "true" - BE_JF_ADDRESSES: ${BE_JF_ADDRESSES:-jellyfish1:5002 jellyfish2:5003} + BE_JF_ADDRESSES: ${BE_JF_ADDRESSES:-fishjam1:5002 fishjam2:5003} BE_JF_SECURE_CONNECTION: ${BE_JF_SECURE_CONNECTION:-false} BE_JF_SERVER_API_TOKEN: ${JF_SERVER_API_TOKEN:-development} restart: unless-stopped depends_on: - - jellyfish1 - - jellyfish2 + - fishjam1 + - fishjam2 ports: - "5004:5004" @@ -84,7 +84,7 @@ services: context: ./prometheus dockerfile: Dockerfile args: - PROM_JELLYFISH_TARGETS: ${PROM_JELLYFISH_TARGETS:-jellyfish1:9568,jellyfish2:9568} + PROM_JELLYFISH_TARGETS: ${PROM_JELLYFISH_TARGETS:-fishjam1:9568,fishjam2:9568} # Through 172.17.0.1 address docker containers (not running in network mode host) can access # services running on host OS (localhost). In this example through this address prometheus could access # node-exporter which is running in network mode host. @@ -99,8 +99,8 @@ services: volumes: - prometheus_data:/prometheus depends_on: - - jellyfish1 - - jellyfish2 + - fishjam1 + - fishjam2 grafana: build: diff --git a/grafana/provisioning/dashboards/metrics.json b/grafana/provisioning/dashboards/metrics.json index e23bd369..30907001 100644 --- a/grafana/provisioning/dashboards/metrics.json +++ b/grafana/provisioning/dashboards/metrics.json @@ -84,7 +84,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "sum(jellyfish_rooms{instance=~\"$instance\"}) by(instance)", + "expr": "sum(fishjam_rooms{instance=~\"$instance\"}) by(instance)", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -99,7 +99,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Present the current number of rooms by jellyfish instance.", + "description": "Present the current number of rooms by fishjam instance.", "fieldConfig": { "defaults": { "color": { @@ -181,7 +181,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "sum(jellyfish_rooms{instance=~\"$instance\"}) by(instance)", + "expr": "sum(fishjam_rooms{instance=~\"$instance\"}) by(instance)", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -210,7 +210,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Ingress throughput from each of the jellyfish instances", + "description": "Ingress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -293,7 +293,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+ \nirate(jellyfish_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+ \nirate(fishjam_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -308,7 +308,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Egress throughput from each of the jellyfish instances", + "description": "Egress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -391,7 +391,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -406,7 +406,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Ingress and Egress throughput from each of the jellyfish instances", + "description": "Ingress and Egress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -505,7 +505,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}} ingress", "range": true, @@ -517,7 +517,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "hide": false, "instant": false, "legendFormat": "{{instance}} egress", @@ -547,7 +547,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "VM usage from each of the jellyfish instances", + "description": "VM usage from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -644,7 +644,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "VM queue lengths from each of the jellyfish instances", + "description": "VM queue lengths from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -736,7 +736,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "VM queue lengths from each of the jellyfish instances", + "description": "VM queue lengths from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -828,7 +828,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "VM queue lengths from each of the jellyfish instances", + "description": "VM queue lengths from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -1487,7 +1487,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "definition": "label_values(jellyfish_rooms,instance)", + "definition": "label_values(fishjam_rooms,instance)", "description": "Allows you limit graphs only to selected instances", "hide": 0, "includeAll": true, @@ -1496,7 +1496,7 @@ "name": "instance", "options": [], "query": { - "query": "label_values(jellyfish_rooms,instance)", + "query": "label_values(fishjam_rooms,instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, @@ -1562,13 +1562,13 @@ "selected": true, "text": [ "backend", - "jellyfish1", - "jellyfish2" + "fishjam1", + "fishjam2" ], "value": [ "backend", - "jellyfish1", - "jellyfish2" + "fishjam1", + "fishjam2" ] }, "datasource": { @@ -1606,4 +1606,4 @@ "uid": "ef7bdb94-c912-49ac-a273-e7a31598001a", "version": 22, "weekStart": "" -} \ No newline at end of file +} diff --git a/lib/videoroom/meeting.ex b/lib/videoroom/meeting.ex index fac438c8..b963aefa 100644 --- a/lib/videoroom/meeting.ex +++ b/lib/videoroom/meeting.ex @@ -6,9 +6,9 @@ defmodule Videoroom.Meeting do require Logger - alias Jellyfish.Component - alias Jellyfish.Room - alias Jellyfish.Notification.{PeerCrashed, RoomCrashed, RoomDeleted} + alias Fishjam.Component + alias Fishjam.Room + alias Fishjam.Notification.{PeerCrashed, RoomCrashed, RoomDeleted} alias Videoroom.RoomRegistry @@ -19,7 +19,7 @@ defmodule Videoroom.Meeting do :name, :client, :room_id, - :jellyfish_address + :fishjam_address ] defstruct @enforce_keys @@ -54,11 +54,11 @@ defmodule Videoroom.Meeting do :exit, {:room_not_exist, _} -> Logger.error( - "Failed to call add peer because room created by #{meeting_name} doesn't exist on jellyfish" + "Failed to call add peer because room created by #{meeting_name} doesn't exist on fishjam" ) {:error, - "Failed to call add peer because room created by #{meeting_name} doesn't exist on jellyfish"} + "Failed to call add peer because room created by #{meeting_name} doesn't exist on fishjam"} :exit, {:normal, _} -> Logger.error("Failed to call add peer because meeting is removed") @@ -98,21 +98,21 @@ defmodule Videoroom.Meeting do # Callbacks @impl true - def init(%{name: name, jellyfish_address: jellyfish_address}) do + def init(%{name: name, fishjam_address: fishjam_address}) do Logger.metadata(room_name: name) - client = Jellyfish.Client.new(server_address: jellyfish_address) + client = Fishjam.Client.new(server_address: fishjam_address) peer_disconnected_timeout = Application.fetch_env!(:videoroom, :peer_disconnected_timeout) peerless_purge_timeout = Application.fetch_env!(:videoroom, :peerless_purge_timeout) - with {:ok, room, jellyfish_address} <- + with {:ok, room, fishjam_address} <- create_new_room(client, name, video_codec: :h264, peer_disconnected_timeout: peer_disconnected_timeout, peerless_purge_timeout: peerless_purge_timeout ) do - client = Jellyfish.Client.update_address(client, jellyfish_address) + client = Fishjam.Client.update_address(client, fishjam_address) Logger.info("Created meeting room id: #{room.id}") @@ -121,7 +121,7 @@ defmodule Videoroom.Meeting do client: client, name: name, room_id: room.id, - jellyfish_address: jellyfish_address + fishjam_address: fishjam_address }} else {:error, reason} -> @@ -131,10 +131,10 @@ defmodule Videoroom.Meeting do end defp create_new_room(client, name, opts) do - with {:ok, room, jellyfish_address} <- Room.create(client, opts), - client <- Jellyfish.Client.update_address(client, jellyfish_address), + with {:ok, room, fishjam_address} <- Room.create(client, opts), + client <- Fishjam.Client.update_address(client, fishjam_address), :ok <- add_room_to_registry(client, name, room) do - {:ok, room, jellyfish_address} + {:ok, room, fishjam_address} end end @@ -152,22 +152,22 @@ defmodule Videoroom.Meeting do def handle_call(:add_peer, _from, state) do text = "Request failed: Room #{state.room_id} does not exist" - case Room.add_peer(state.client, state.room_id, Jellyfish.Peer.WebRTC) do + case Room.add_peer(state.client, state.room_id, Fishjam.Peer.WebRTC) do {:ok, %{peer: peer, token: token}} -> Logger.info("Added peer #{peer.id}") - {:reply, {:ok, token, state.jellyfish_address}, state} + {:reply, {:ok, token, state.fishjam_address}, state} {:error, ^text} -> Logger.error( - "Failed to add peer, because of room #{state.room_id} does not exist on jellyfish: #{state.jellyfish_address}" + "Failed to add peer, because of room #{state.room_id} does not exist on fishjam: #{state.fishjam_address}" ) {:stop, :room_not_exist, {:error, "Failed to add peer"}, state} error -> Logger.error( - "Failed to add peer, because of error: #{inspect(error)} on jellyfish: #{state.jellyfish_address}" + "Failed to add peer, because of error: #{inspect(error)} on fishjam: #{state.fishjam_address}" ) {:reply, {:error, "Failed to add peer"}, state} @@ -189,8 +189,8 @@ defmodule Videoroom.Meeting do end @impl true - def handle_info({:jellyfish, notification}, state) do - Logger.info("Jellyfish notification: #{inspect(notification)}") + def handle_info({:fishjam, notification}, state) do + Logger.info("Fishjam notification: #{inspect(notification)}") handle_notification(notification, state) end diff --git a/lib/videoroom/room_registry.ex b/lib/videoroom/room_registry.ex index 18b546c4..75dd5730 100644 --- a/lib/videoroom/room_registry.ex +++ b/lib/videoroom/room_registry.ex @@ -10,10 +10,10 @@ defmodule Videoroom.RoomRegistry do :ets.new(@room_table, [:named_table, :set, :public]) end - @spec lookup_meeting(Meeting.name()) :: {:ok, Jellyfish.Room.id()} | {:error, :unregistered} + @spec lookup_meeting(Meeting.name()) :: {:ok, Fishjam.Room.id()} | {:error, :unregistered} def lookup_meeting(name), do: lookup(name) - @spec lookup_room(Jellyfish.Room.id()) :: {:ok, Meeting.name()} | {:error, :unregistered} + @spec lookup_room(Fishjam.Room.id()) :: {:ok, Meeting.name()} | {:error, :unregistered} def lookup_room(id), do: lookup(id) defp lookup(name_or_id) do @@ -26,7 +26,7 @@ defmodule Videoroom.RoomRegistry do end end - @spec insert_new(Meeting.name(), Jellyfish.Room.id()) :: boolean() + @spec insert_new(Meeting.name(), Fishjam.Room.id()) :: boolean() def insert_new(name, room_id) do :ets.insert_new(@room_table, [{name, room_id}, {room_id, name}]) end diff --git a/lib/videoroom/room_service.ex b/lib/videoroom/room_service.ex index 9d23124e..aacc25ab 100644 --- a/lib/videoroom/room_service.ex +++ b/lib/videoroom/room_service.ex @@ -3,13 +3,13 @@ defmodule Videoroom.RoomService do use GenServer require Logger - alias Jellyfish.Component - alias Jellyfish.WSNotifier + alias Fishjam.Component + alias Fishjam.WSNotifier alias Videoroom.Meeting alias Videoroom.RoomRegistry - @type jellyfish_address :: String.t() + @type fishjam_address :: String.t() @spec start_link(any) :: GenServer.on_start() def start_link(_opts) do @@ -17,7 +17,7 @@ defmodule Videoroom.RoomService do end @spec add_peer(Meeting.name()) :: - {:ok, Jellyfish.Room.peer_token(), jellyfish_address()} | {:error, binary()} + {:ok, Fishjam.Room.peer_token(), fishjam_address()} | {:error, binary()} def add_peer(meeting_name) do GenServer.call(__MODULE__, {:add_peer, meeting_name}) end @@ -44,11 +44,11 @@ defmodule Videoroom.RoomService do @impl true def handle_call({:add_peer, room_name}, _from, state) do - {jellyfish_address, _pid} = state.notifier + {fishjam_address, _pid} = state.notifier case DynamicSupervisor.start_child( state.supervisor, - {Videoroom.Meeting, %{name: room_name, jellyfish_address: jellyfish_address}} + {Videoroom.Meeting, %{name: room_name, fishjam_address: fishjam_address}} ) do {:error, {:already_started, _}} -> Logger.debug("Room with name #{room_name} is already started") @@ -69,10 +69,10 @@ defmodule Videoroom.RoomService do end @impl true - def handle_info({:jellyfish, %{room_id: room_id} = notification}, state) do + def handle_info({:fishjam, %{room_id: room_id} = notification}, state) do with {:ok, room_name} <- RoomRegistry.lookup_room(room_id), [{pid, _value}] <- Registry.lookup(Videoroom.Registry, room_name) do - send(pid, {:jellyfish, notification}) + send(pid, {:fishjam, notification}) else _error -> Logger.warning( @@ -85,7 +85,7 @@ defmodule Videoroom.RoomService do @impl true def handle_info({:DOWN, _ref, :process, _object, _reason}, state) do - Logger.warning("Jellyfish WSNotifier exited. Starting new notifier") + Logger.warning("Fishjam WSNotifier exited. Starting new notifier") notifier = start_notifier() @@ -102,18 +102,18 @@ defmodule Videoroom.RoomService do defp start_notifier() do notifier = :videoroom - |> Application.fetch_env!(:jellyfish_addresses) - |> Enum.reduce_while(nil, fn jellyfish_address, nil -> - case WSNotifier.start(server_address: jellyfish_address) do + |> Application.fetch_env!(:fishjam_addresses) + |> Enum.reduce_while(nil, fn fishjam_address, nil -> + case WSNotifier.start(server_address: fishjam_address) do {:ok, notifier} -> - Logger.info("Successfully connected to #{jellyfish_address}") + Logger.info("Successfully connected to #{fishjam_address}") WSNotifier.subscribe_server_notifications(notifier) Process.monitor(notifier) - {:halt, {jellyfish_address, notifier}} + {:halt, {fishjam_address, notifier}} {:error, reason} -> Logger.warning( - "Unable to connect to #{jellyfish_address}, reason: #{inspect(reason)}" + "Unable to connect to #{fishjam_address}, reason: #{inspect(reason)}" ) {:cont, nil} @@ -121,7 +121,7 @@ defmodule Videoroom.RoomService do end) if notifier == nil do - raise("Unable to connect to any jellyfish") + raise("Unable to connect to any fishjam") else notifier end diff --git a/lib/videoroom_web/api_spec/token.ex b/lib/videoroom_web/api_spec/token.ex index 8b3fff3d..116dcbc1 100644 --- a/lib/videoroom_web/api_spec/token.ex +++ b/lib/videoroom_web/api_spec/token.ex @@ -5,7 +5,7 @@ defmodule VideoroomWeb.ApiSpec.Token do OpenApiSpex.schema(%{ title: "PeerToken", - description: "Peer token used for authorizing websocket connection to the Jellyfish Server", + description: "Peer token used for authorizing websocket connection to the Fishjam Server", type: :string, example: "SFMyNTY.g2gDdAAhiOL4CdsaboT9-jtMzhoI" }) diff --git a/lib/videoroom_web/controllers/room_controler.ex b/lib/videoroom_web/controllers/room_controler.ex index 84049ee7..2053378f 100644 --- a/lib/videoroom_web/controllers/room_controler.ex +++ b/lib/videoroom_web/controllers/room_controler.ex @@ -49,9 +49,9 @@ defmodule VideoroomWeb.RoomController do @spec show(Plug.Conn.t(), map) :: Plug.Conn.t() def show(conn, %{"room_name" => name}) do case RoomService.add_peer(name) do - {:ok, token, jellyfish_address} -> + {:ok, token, fishjam_address} -> conn - |> render("show.json", token: token, jellyfish_address: jellyfish_address) + |> render("show.json", token: token, fishjam_address: fishjam_address) {:error, reason} when is_binary(reason) -> conn diff --git a/lib/videoroom_web/controllers/room_json.ex b/lib/videoroom_web/controllers/room_json.ex index c3173eb7..f50b900e 100644 --- a/lib/videoroom_web/controllers/room_json.ex +++ b/lib/videoroom_web/controllers/room_json.ex @@ -2,7 +2,7 @@ defmodule VideoroomWeb.RoomJSON do @moduledoc false @spec show(map()) :: %{data: map()} - def show(%{token: token, jellyfish_address: jellyfish_address}) do - %{data: %{token: token, jellyfish_address: jellyfish_address}} + def show(%{token: token, fishjam_address: fishjam_address}) do + %{data: %{token: token, fishjam_address: fishjam_address}} end end diff --git a/mix.exs b/mix.exs index fa6314e2..30735442 100644 --- a/mix.exs +++ b/mix.exs @@ -42,8 +42,7 @@ defmodule Videoroom.MixProject do {:cors_plug, "~> 2.0"}, # Jellyfish deps - # {:jellyfish_server_sdk, "~> 0.3.0"}, - {:jellyfish_server_sdk, github: "jellyfish-dev/elixir_server_sdk"}, + {:fishjam_server_sdk, "~> 0.6.0"}, # Dev {:credo, ">= 0.0.0", only: :dev, runtime: false}, diff --git a/mix.lock b/mix.lock index 6acdb072..40c79cee 100644 --- a/mix.lock +++ b/mix.lock @@ -11,9 +11,9 @@ "elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, + "fishjam_server_sdk": {:hex, :fishjam_server_sdk, "0.6.0", "b7e6b5b8232c8b0cdd413f3b40b06e732bc722fe77cba17e0240f9a2d8455a4f", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: false]}, {:protobuf, "~> 0.12.0", [hex: :protobuf, repo: "hexpm", optional: false]}, {:tesla, "~> 1.5", [hex: :tesla, repo: "hexpm", optional: false]}, {:websockex, "~> 0.4.3", [hex: :websockex, repo: "hexpm", optional: false]}], "hexpm", "16847f33f11a8f79cec59de6b7ad7ed57e4241e65efb28ba82fc93819988461b"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, - "jellyfish_server_sdk": {:git, "https://github.com/jellyfish-dev/elixir_server_sdk.git", "5d9d457b46e3b0f034f3052eaae6cb251c254b64", []}, "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, "mint": {:hex, :mint, "1.5.2", "4805e059f96028948870d23d7783613b7e6b0e2fb4e98d720383852a760067fd", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "d77d9e9ce4eb35941907f1d3df38d8f750c357865353e21d335bdcdf6d892a02"}, "open_api_spex": {:hex, :open_api_spex, "3.18.3", "fefb84fe323cacfc92afdd0ecb9e89bc0261ae00b7e3167ffc2028ce3944de42", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :poison, repo: "hexpm", optional: true]}, {:ymlr, "~> 2.0 or ~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :ymlr, repo: "hexpm", optional: true]}], "hexpm", "c0cfc31570199ce7e7520b494a591027da609af45f6bf9adce51e2469b1609fb"}, diff --git a/prometheus/prometheus.yaml b/prometheus/prometheus.yaml index 51c2eaa8..00063a4e 100644 --- a/prometheus/prometheus.yaml +++ b/prometheus/prometheus.yaml @@ -5,10 +5,10 @@ global: monitor: 'codelab-monitor' scrape_configs: - - job_name: 'jellyfishes' + - job_name: 'fishjams' static_configs: - targets: [$PROM_JELLYFISH_TARGETS] - + - job_name: 'nodes' static_configs: - targets: [$PROM_NODE_TARGETS] diff --git a/promtail/promtail-config.yaml b/promtail/promtail-config.yaml index 1e3e87fe..25a636d1 100644 --- a/promtail/promtail-config.yaml +++ b/promtail/promtail-config.yaml @@ -4,8 +4,8 @@ server: clients: - url: http://$LOKI_ADDRESS:3100/loki/api/v1/push - external_labels: - project: jellyroom + external_labels: + project: fishjam_room scrape_configs: - job_name: docker @@ -17,4 +17,4 @@ scrape_configs: relabel_configs: - source_labels: ['__meta_docker_container_name'] regex: '/(.*)' - target_label: 'container' \ No newline at end of file + target_label: 'container' diff --git a/test/support/peer.ex b/test/support/peer.ex index 9c3d441d..0276eacc 100644 --- a/test/support/peer.ex +++ b/test/support/peer.ex @@ -5,8 +5,8 @@ defmodule Videoroom.Test.Peer do use WebSockex - alias Jellyfish.PeerMessage - alias Jellyfish.PeerMessage.AuthRequest + alias Fishjam.PeerMessage + alias Fishjam.PeerMessage.AuthRequest @spec start_link(binary | WebSockex.Conn.t(), any) :: {:ok, pid} def start_link(url, token) do diff --git a/test/support/protos/jellyfish/peer_notifications.pb.ex b/test/support/protos/jellyfish/peer_notifications.pb.ex index b49a2ae1..32963581 100644 --- a/test/support/protos/jellyfish/peer_notifications.pb.ex +++ b/test/support/protos/jellyfish/peer_notifications.pb.ex @@ -1,10 +1,10 @@ -defmodule Jellyfish.PeerMessage.Authenticated do +defmodule Fishjam.PeerMessage.Authenticated do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 end -defmodule Jellyfish.PeerMessage.AuthRequest do +defmodule Fishjam.PeerMessage.AuthRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 @@ -12,7 +12,7 @@ defmodule Jellyfish.PeerMessage.AuthRequest do field :token, 1, type: :string end -defmodule Jellyfish.PeerMessage.MediaEvent do +defmodule Fishjam.PeerMessage.MediaEvent do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 @@ -20,19 +20,19 @@ defmodule Jellyfish.PeerMessage.MediaEvent do field :data, 1, type: :string end -defmodule Jellyfish.PeerMessage do +defmodule Fishjam.PeerMessage do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 oneof :content, 0 - field :authenticated, 1, type: Jellyfish.PeerMessage.Authenticated, oneof: 0 + field :authenticated, 1, type: Fishjam.PeerMessage.Authenticated, oneof: 0 field :auth_request, 2, - type: Jellyfish.PeerMessage.AuthRequest, + type: Fishjam.PeerMessage.AuthRequest, json_name: "authRequest", oneof: 0 - field :media_event, 3, type: Jellyfish.PeerMessage.MediaEvent, json_name: "mediaEvent", oneof: 0 + field :media_event, 3, type: Fishjam.PeerMessage.MediaEvent, json_name: "mediaEvent", oneof: 0 end diff --git a/test/videoroom_web/controllers/room_json_test.exs b/test/videoroom_web/controllers/room_json_test.exs index 6f2364d8..f6f28698 100644 --- a/test/videoroom_web/controllers/room_json_test.exs +++ b/test/videoroom_web/controllers/room_json_test.exs @@ -5,7 +5,7 @@ defmodule VideoroomWeb.RoomJsonTest do alias Videoroom.Test.Peer alias Jellyfish.Notification.{PeerConnected, PeerDisconnected, RoomCreated, RoomDeleted} - @url Application.compile_env!(:jellyfish_server_sdk, :server_address) + @url Application.compile_env!(:fishjam_server_sdk, :server_address) @peer_url "ws://#{@url}/socket/peer/websocket" @timeout 5000 @@ -39,7 +39,7 @@ defmodule VideoroomWeb.RoomJsonTest do assert length(peers) == 1 leave_room(peer) - assert_receive {:jellyfish, %RoomDeleted{room_id: ^jf_room_id}}, @timeout + assert_receive {:fishjam, %RoomDeleted{room_id: ^jf_room_id}}, @timeout end test "Two peers join the same room", %{conn: conn, client: client} do @@ -55,7 +55,7 @@ defmodule VideoroomWeb.RoomJsonTest do leave_room(peer1) leave_room(peer2) - assert_receive {:jellyfish, %RoomDeleted{room_id: ^jf_room_id}}, @timeout + assert_receive {:fishjam, %RoomDeleted{room_id: ^jf_room_id}}, @timeout end test "Two rooms at the same time", %{conn: conn, client: client} do @@ -70,7 +70,7 @@ defmodule VideoroomWeb.RoomJsonTest do leave_room(peer2) - assert_receive {:jellyfish, %RoomDeleted{}}, @timeout + assert_receive {:fishjam, %RoomDeleted{}}, @timeout {_name, token3} = add_peer(conn, first_meeting) peer3 = join_room(token3) @@ -81,7 +81,7 @@ defmodule VideoroomWeb.RoomJsonTest do leave_room(peer1) leave_room(peer3) - assert_receive {:jellyfish, %RoomDeleted{}}, @timeout + assert_receive {:fishjam, %RoomDeleted{}}, @timeout end test "Peer joins and leaves in quick succession - the same room", %{conn: conn} do @@ -92,10 +92,10 @@ defmodule VideoroomWeb.RoomJsonTest do leave_room(peer1, async: true) peer2 = join_room(token2) - assert_receive {:jellyfish, %PeerDisconnected{}}, @timeout + assert_receive {:fishjam, %PeerDisconnected{}}, @timeout leave_room(peer2) - assert_receive {:jellyfish, %RoomDeleted{}}, @timeout + assert_receive {:fishjam, %RoomDeleted{}}, @timeout end describe "Peer timeout" do @@ -103,7 +103,7 @@ defmodule VideoroomWeb.RoomJsonTest do {_name, _token} = add_peer(conn) assert {:ok, [%Room{id: jf_room_id}]} = Room.get_all(client) - assert_receive {:jellyfish, %RoomDeleted{room_id: ^jf_room_id}}, @timeout + assert_receive {:fishjam, %RoomDeleted{room_id: ^jf_room_id}}, @timeout end test "Room closes when all peers leave or time out", %{conn: conn, client: client} do @@ -116,7 +116,7 @@ defmodule VideoroomWeb.RoomJsonTest do peer = join_room(token) leave_room(peer) - assert_receive {:jellyfish, %RoomDeleted{room_id: ^jf_room_id}}, @timeout + assert_receive {:fishjam, %RoomDeleted{room_id: ^jf_room_id}}, @timeout end test "Meeting is deleted if room doesn't exist", %{conn: conn, client: client} do @@ -128,7 +128,7 @@ defmodule VideoroomWeb.RoomJsonTest do assert :ok = Room.delete(client, jf_room_id) - assert_receive {:jellyfish, %RoomDeleted{room_id: ^jf_room_id}}, @timeout + assert_receive {:fishjam, %RoomDeleted{room_id: ^jf_room_id}}, @timeout conn = get(conn, ~p"/api/room/#{meeting_name}") assert json_response(conn, 503)["errors"] == "Meeting is being removed" @@ -146,7 +146,7 @@ defmodule VideoroomWeb.RoomJsonTest do state = :sys.get_state(room_service_pid) - {_jellyfish_address, notifier} = state.notifier + {_fishjam_address, notifier} = state.notifier _ws_caller = :sys.get_state(notifier)[:caller_pid] @@ -161,12 +161,12 @@ defmodule VideoroomWeb.RoomJsonTest do notification = %RoomCreated{room_id: jf_room_id} - assert_receive {:jellyfish, ^notification}, @timeout + assert_receive {:fishjam, ^notification}, @timeout - assert_receive {:trace, _pid, :receive, {:jellyfish, ^notification}}, + assert_receive {:trace, _pid, :receive, {:fishjam, ^notification}}, @timeout - assert_receive {:jellyfish, %RoomDeleted{}}, @timeout + assert_receive {:fishjam, %RoomDeleted{}}, @timeout end end @@ -181,7 +181,7 @@ defmodule VideoroomWeb.RoomJsonTest do defp join_room(token) do {:ok, peer} = Peer.start_link(@peer_url, token) - assert_receive({:jellyfish, %PeerConnected{}}, @timeout) + assert_receive({:fishjam, %PeerConnected{}}, @timeout) peer end @@ -190,7 +190,7 @@ defmodule VideoroomWeb.RoomJsonTest do send(peer, :terminate) unless async?, - do: assert_receive({:jellyfish, %PeerDisconnected{}}, @timeout) + do: assert_receive({:fishjam, %PeerDisconnected{}}, @timeout) end defp delete_all_rooms() do