Skip to content

Commit

Permalink
feat: remove deprecated XHR fallback
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires PeerJS >= 1.0
  • Loading branch information
jonasgloning committed Oct 30, 2022
1 parent 5d882dd commit d900145
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 100 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"semantic-release": "semantic-release"
},
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"ws": "^7.2.3",
Expand Down
6 changes: 0 additions & 6 deletions src/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ Endpoints:
This group of methods uses `:key` option from config:
* GET `/:key/id` - return a new user id. required `:key` from config.
* GET `/:key/peers` - return an array of all connected users. required `:key` from config. **IMPORTANT:** You should set `allow_discovery` to `true` in config to enable this method. It disabled by default.

This group of methods uses `:key` option from config, `:userId` and `:userToken` parameters from user.
* POST `/:key/:userId/:userToken/offer`
* POST `/:key/:userId/:userToken/candidate`
* POST `/:key/:userId/:userToken/answer`
* POST `/:key/:userId/:userToken/leave`
12 changes: 1 addition & 11 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
import bodyParser from "body-parser";
import cors from "cors";
import express from "express";
import publicContent from "../../app.json";
import { IConfig } from "../config";
import { IMessageHandler } from "../messageHandler";
import { IRealm } from "../models/realm";
import { AuthMiddleware } from "./middleware/auth";
import CallsApi from "./v1/calls";
import PublicApi from "./v1/public";

export const Api = ({ config, realm, messageHandler }: {
export const Api = ({ config, realm }: {
config: IConfig;
realm: IRealm;
messageHandler: IMessageHandler;
}): express.Router => {
const authMiddleware = new AuthMiddleware(config, realm);

const app = express.Router();

const jsonParser = bodyParser.json();

app.use(cors());

app.get("/", (_, res) => {
res.send(publicContent);
});

app.use("/:key", PublicApi({ config, realm }));
app.use("/:key/:id/:token", authMiddleware.handle, jsonParser, CallsApi({ realm, messageHandler }));

return app;
};
35 changes: 0 additions & 35 deletions src/api/middleware/auth/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/api/middleware/middleware.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/api/v1/calls/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const createInstance = ({ app, server, options }: {
const realm: IRealm = new Realm();
const messageHandler = new MessageHandler(realm);

const api = Api({ config, realm, messageHandler });
const api = Api({ config, realm });
const messagesExpire: IMessagesExpire = new MessagesExpire({ realm, config, messageHandler });
const checkBrokenConnections = new CheckBrokenConnections({
realm,
Expand Down

0 comments on commit d900145

Please sign in to comment.