GithubHelp home page GithubHelp logo

mconf / api-mate Goto Github PK

View Code? Open in Web Editor NEW
39.0 24.0 54.0 1.04 MB

A tool to access the API of BigBlueButton and Mconf

Home Page: http://mconf.github.io/api-mate

License: Other

CoffeeScript 41.94% JavaScript 6.36% Ruby 1.64% SCSS 12.64% Pug 37.42%

api-mate's Introduction

API Mate

API Mate is a web application (a simple web page) to access the APIs of BigBlueButton and Mconf.

Usage

Passing parameters in the URL

The API Mate HTML page accepts parameters in the URL to pre-configure all the inputs available in the menu, that will define the links generated. You can, for instance, generate a link in your application to redirect to the API Mate and automatically fill the server and the shared secret fields in the API Mate so that it points to the server you want to use.

The URL below shows a few of the parameters that can be passed in the URL:

api_mate.html#server=http://my-server.com/bigbluebutton/api&sharedSecret=lsk8df74e400365b55e0987&meetingID=meeting-1234567&custom-calls=getMyData

The parameters should be passed in the hash part of the URL, so they are not submitted to the server. This means the application at http://mconf.github.io/api-mate will not receive your server's URL and shared secret. You can also pass these parameters in the search string part of the URL, but that means the server will have access to your parameters (might be useful if you're hosting your own API Mate).

The server address and shared secret are defined in the URL parameters server and sharedSecret (you can also use salt), respectively.

All the other parameters are matched by an HTML data-api-mate-param attribute that is defined in all inputs in the API Mate. The input to define the meeting ID, for example, has this attribute set as data-api-mate-param='meetingID,recordindID', so you can use both meetingID=something or recordingID=something in the URL and it will automatically fill the meeting ID input. The input to define custom API calls has the attribute set as data-api-mate-param='custom-calls', and this is why in the URL above we used custom-calls=getMyData.

Allow cross-domain requests

The API Mate runs on your web browser and most of the API methods are accesssed through HTTP GET calls, so you can simply click on a link in the API Mate and you'll access the API method.

However, for some other methods (such as API methods accessed via POST) or some more advanced features, we need to run API calls from the javascript using ajax. This will result in a cross-domain request, since a web page (the API Mate) is making requests directly to another server (your web conference server). Since cross-domain requests are by default disabled in the browser, they will all fail.

We offer two solutions:

  1. Change your BigBlueButton/Mconf-Live server to accept cross-domain requests (ok, but only recommended for development and testing); or
  2. Use a local proxy that will receive the calls and proxy them to your web conference server.

1. Change your server to accept cross-domain requests

With this option you will enable cross-origin requests using CORS on your BigBlueButton/Mconf-Live server.

In BigBlueButton/Mconf-Live with Nginx

Copy to following block of code to the bottom of the file /etc/bigbluebutton/nginx/web.nginx, inside the block location /bigbluebutton:

location /bigbluebutton {
    ...

    # add this block!
    if ($http_origin) {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods "GET,POST,OPTIONS";
        add_header Access-Control-Allow-Headers  Content-Type;
        add_header Access-Control-Max-Age        86400;
    }
}

Notice that it will allow cross-domain requests from any host, which is not recommended! Use it only for test and development.

Save it and restart Nginx to apply the changes:

$ sudo /etc/init.d/nginx restart

If you need a more detailed and controlled example, try this one.

If you're not accessing your web conference server directly, but through an application written in Node.js, you can use the following code to enable cross-domain requests:

app.all '*', (req, res, next) ->
  res.header("Access-Control-Allow-Origin", "*")
  res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type")
  next()

Source.

2. Use a local proxy

There's an application that can be used as a local proxy called api-mate-proxy available in this repository, in the folder proxy.

It is a very simple Node.js application that you can run locally to receive all requests from the API Mate and proxy them to your web conference server.

Usage

See api-mate-proxy's README file.

Development

At first, install Node.js (see package.json for the specific version required).

Install the dependencies with:

npm install

Then compile the source files with:

[./node_modules/.bin/]cake build

This will compile all files inside src/ to formats that can be opened in the browser and place them into /lib.

To watch for changes and compile the files automatically, run:

[./node_modules/.bin/]cake watch

License

Distributed under The MIT License (MIT), see LICENSE.

api-mate's People

Contributors

daronco avatar dependabot[bot] avatar fcecagno avatar germanocaumo avatar jfederico avatar joshua-arts avatar kepstin avatar lfzawacki avatar mariogasparoni avatar tainan404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-mate's Issues

POST for all API calls


Author Name: Leonardo Daronco (Leonardo Daronco)
Original Redmine Issue: 540, http://dev.mconf.org/redmine/issues/540

Original Assignee: Leonardo Daronco


Add a button that sends a POST to an API call. Should be available for all API calls.
Also add a textarea where the user can define the data to be sent in the requests.

Send POST request is being sent as an OPTIONS HTTP method

Sending a POST request for the "create" API is sent as an OPTIONS instead. Please find HTTP headers below:

Status Complete
Response Code 200 OK
Protocol HTTP/1.1
SSL -
Method OPTIONS
Kept Alive Yes
Content-Type text/xml;charset=utf-8
Client Address /127.0.0.1

Lack of XML Response when Attempting to Re-Join a Meeting Following Forced Termination.

I would like to bring to your attention an issue related to re-joining a meeting using the join API. Specifically, when a meeting has already ended and a user attempts to join again using the API, only an error message is displayed in the URL. There is no response indicating the meeting is ended.

Please take note of this issue.

Thank you for your attention.

Expand the links in the API Mate


Author Name: Leonardo Daronco (Leonardo Daronco)
Original Redmine Issue: 534, http://dev.mconf.org/redmine/issues/534

Original Assignee: Leonardo Daronco


The links in the API Mate are only displayed partially because they are usually very long. We could add a button next to each link that would expand the it to show the entire url. The url could also be shown in a textarea, where it can be edited/copied.

Add joinViaHtml5=true

Add a checkbox for joinViaHtml5 to make it even easier to choose the HTML5 client.

Use a simple local proxy to prevent problems with cross-domain requests


Author Name: Leonardo Daronco (Leonardo Daronco)
Original Redmine Issue: 1111, http://dev.mconf.org/redmine/issues/1111

Original Assignee: Leonardo Daronco


In the current API Mate, all requests that are made via javascript to a server are considered as cross-domain requests. Cross-domain requests will only work if the server allows it, which is not what happens by default on BigBlueButton/Mconf-Live. So any kind of POST request or GET requests made via javascript end up being blocked if the server is not modified.

One way to solve this is to have a local HTTP proxy that will receive the calls from the API Mate and proxy them to the target server.

Node.js is a good framework to do such a proxy, and there is even already a package called "node-http-proxy":https://github.com/nodejitsu/node-http-proxy that might do everything we need. We just need to set it up properly, provide an easy way for the users to run and configure it and add docs about it to the API Mate as well.

Add support for SHA512

Is your feature request related to a problem? Please describe.
We want to add support for SHA512 checksums in BigBlueButton and need to be able to generate them from APIMate for development and testing.

Make the recordID

API mate should have recordID blank by default. Currently, with it filled in, the getRecordings API call resolves to use the recordID by default, but this recordID is generated internally for each recording.

Currently, the getRecordings API call passes

?meetingID=random-4001679&recordID=random-4001679

By having the recordID blank by default, it would pass

?meetingID=random-4001679

which would resolve to the correct recording.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.