Skip to content

Commit 0999bda

Browse files
authored
Merge branch 'master' into dependabot/bundler/rake-12.3.3
2 parents 06566be + 4e701c7 commit 0999bda

13 files changed

Lines changed: 86 additions & 921 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish gem on tag push
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
- '!v**-mconf*'
7+
# Tags that will trigger: v1.9.0; v1.9.0-beta1
8+
# Tags excluded (with the '!'): v1.9.0-mconf; v1.9.0-mconf-beta1
9+
10+
jobs:
11+
publish-gem:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: Publish
17+
uses: dawidd6/action-publish-gem@v1.2.0
18+
with:
19+
# Optional, will publish to RubyGems if specified
20+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
21+
# Optional, will publish to GitHub Packages if specified
22+
github_token: ${{secrets.GITHUB_TOKEN}}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## [1.9.1] - 2023-03-31
4+
* [#60] Prevent problems with double slashes on API calls [thanks to [@farhatahmad](https://github.com/farhatahmad)]
5+
6+
[#60]: https://github.com/mconf/bigbluebutton-api-ruby/pull/60
7+
[1.9.1]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.9.0...v1.9.1
8+
9+
## [1.9.0] - 2022-05-03
10+
* [#56] Add support for checksum using SHA256
11+
12+
[#56]: https://github.com/mconf/bigbluebutton-api-ruby/pull/56
13+
[1.9.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.8.0...v1.9.0
14+
315
## [1.8.0] - 2021-12-06
416
* [#43] Add keys to every `BigBlueButtonException`, to better identify them.
517
* [#42] Change `BigBlueButtonException` to inherit from `StandardError` instead of `Exception`.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ gemspec
44

55
group :developement do
66
gem 'rake', '>= 0.9'
7-
gem 'rdoc', '3.12.1'
7+
gem 'rdoc', '6.1.2.1'
88
end
99

1010
group :development, :test do

Gemfile.lock

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GIT
77
PATH
88
remote: .
99
specs:
10-
bigbluebutton-api-ruby (1.8.0)
10+
bigbluebutton-api-ruby (1.9.1)
1111
childprocess (>= 1.0.1)
1212
ffi (>= 1.9.24)
1313
json (>= 1.8.6)
@@ -45,20 +45,21 @@ GEM
4545
forgery (0.5.0)
4646
gherkin (2.9.3)
4747
json (>= 1.4.6)
48-
json (1.8.6)
48+
json (2.6.3)
4949
libwebsocket (0.1.3)
5050
addressable
5151
mime-types (1.18)
52-
mini_portile2 (2.4.0)
52+
mini_portile2 (2.8.1)
5353
multi_json (1.3.4)
54-
nokogiri (1.10.4)
55-
mini_portile2 (~> 2.4.0)
56-
rack (1.6.11)
54+
nokogiri (1.14.3)
55+
mini_portile2 (~> 2.8.0)
56+
racc (~> 1.4)
57+
racc (1.6.2)
58+
rack (2.2.3)
5759
rack-test (0.6.1)
5860
rack (>= 1.0)
5961
rake (12.3.3)
60-
rdoc (3.12.1)
61-
json (~> 1.4)
62+
rdoc (6.1.2.1)
6263
rexml (3.2.5)
6364
rspec (2.10.0)
6465
rspec-core (~> 2.10.0)
@@ -90,7 +91,7 @@ DEPENDENCIES
9091
cucumber-rails
9192
forgery
9293
rake (>= 0.9)
93-
rdoc (= 3.12.1)
94+
rdoc (= 6.1.2.1)
9495
rspec (~> 2.10)
9596

9697
BUNDLED WITH

bigbluebutton-api-ruby.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
22

33
Gem::Specification.new do |s|
44
s.name = "bigbluebutton-api-ruby"
5-
s.version = "1.8.0"
5+
s.version = "1.9.1"
66
s.licenses = ["MIT"]
77
s.extra_rdoc_files = ["README.md", "LICENSE", "LICENSE_003", "CHANGELOG.md"]
88
s.summary = "BigBlueButton integration for ruby"

examples/config_xml.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

lib/bigbluebutton_api.rb

Lines changed: 12 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
require 'cgi'
33
require 'rexml/document'
44
require 'digest/sha1'
5+
require 'digest/sha2'
56
require 'rubygems'
67
require 'bigbluebutton_hash_to_xml'
78
require 'bigbluebutton_exception'
89
require 'bigbluebutton_formatter'
910
require 'bigbluebutton_modules'
10-
require 'bigbluebutton_config_xml'
11-
require 'bigbluebutton_config_layout'
1211
require 'logger'
1312

1413
module BigBlueButton
@@ -68,13 +67,17 @@ class BigBlueButtonApi
6867
# url:: URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
6968
# secret:: Shared secret for this server
7069
# version:: API version e.g. 0.81
71-
def initialize(url, secret, version=nil, logger=nil)
70+
# logger:: Logger object to log actions (so apps can use their own loggers)
71+
# sha256:: Flag to use sha256 when hashing url contents for checksum
72+
def initialize(url, secret, version=nil, logger=nil, sha256=false)
7273
@supported_versions = ['0.8', '0.81', '0.9', '1.0']
73-
@url = url
74+
@url = url.chomp('/')
7475
@secret = secret
7576
@timeout = 10 # default timeout for api requests
7677
@request_headers = {} # http headers sent in all requests
7778
@logger = logger
79+
@sha256 = sha256
80+
# If logger is not informed, it defaults to STDOUT with INFO level
7881
if logger.nil?
7982
@logger = Logger.new(STDOUT)
8083
@logger.level = Logger::INFO
@@ -545,88 +548,10 @@ def delete_recordings(recordIDs, options={})
545548
send_api_request(:deleteRecordings, params)
546549
end
547550

548-
549-
#
550-
# API calls since 0.81
551-
#
552-
553-
# Retrieves the default config.xml file from the server.
554-
# Returns the XML as a string by default, but if `asObject` is set to true, returns the XML
555-
# parsed as an XmlSimple object ().
556-
# asObject (Hash):: If true, returns the XML parsed as an XmlSimple object, using:
557-
# data = XmlSimple.xml_in(response, { 'ForceArray' => false, 'KeepRoot' => true })
558-
# You can then parse it back into an XML string using:
559-
# XmlSimple.xml_out(data, { 'RootName' => nil, 'XmlDeclaration' => true })
560-
# If set to false, returns the XML as a string.
561-
# options (Hash):: Hash with additional parameters. This method doesn't accept additional
562-
# parameters, but if you have a custom API with more parameters, you
563-
# can simply pass them in this hash and they will be added to the API call.
564-
def get_default_config_xml(asObject=false, options={})
565-
response = send_api_request(:getDefaultConfigXML, options, nil, true)
566-
if asObject
567-
XmlSimple.xml_in(response, { 'ForceArray' => false, 'KeepRoot' => true })
568-
else
569-
response
570-
end
571-
end
572-
573-
# Sets a config.xml file in the server.
574-
# Returns the token returned by the server (that can be later used in a 'join' call) in case
575-
# of success.
576-
# meeting_id (string):: The ID of the meeting where this config.xml will be used.
577-
# xml (string|BigBlueButtonConfigXml):: The XML that should be sent as a config.xml.
578-
# It will usually be an edited output of the default config.xml:
579-
# xml = api.get_default_config_xml
580-
# Or you can use directly a BigBlueButtonConfigXml object:
581-
# BigBlueButtonConfigXml.new(xml)
582-
# options (Hash):: Hash with additional parameters. This method doesn't accept additional
583-
# parameters, but if you have a custom API with more parameters, you
584-
# can simply pass them in this hash and they will be added to the API call.
585-
# TODO: Right now we are sending the configXML parameters in the URL and in the body of the POST
586-
# request. It works if left only in the URL, but the documentation of the API claims that it has
587-
# to be in the body of the request. So it's no clear yet and this might change in the future.
588-
def set_config_xml(meeting_id, xml, options={})
589-
if xml.instance_of?(BigBlueButton::BigBlueButtonConfigXml)
590-
data = xml.as_string
591-
else
592-
data = xml
593-
end
594-
params = { :meetingID => meeting_id, :configXML => data }.merge(options)
595-
response = send_api_request(:setConfigXML, params, data)
596-
response[:configToken]
597-
end
598-
599-
600551
#
601552
# Helper functions
602553
#
603554

604-
# Returns an array with the name of all layouts available in the server.
605-
# Will fetch the config.xml file (unless passed in the arguments), fetch the
606-
# layout definition file, and return the layouts.
607-
# If something goes wrong, returns nil. Otherwise returns the list of layout
608-
# names or an empty array if there's no layout defined.
609-
def get_available_layouts(config_xml=nil)
610-
config_xml = get_default_config_xml if config_xml.nil?
611-
config_xml = BigBlueButton::BigBlueButtonConfigXml.new(config_xml)
612-
layout_config = config_xml.get_attribute("LayoutModule", "layoutConfig", true)
613-
unless layout_config.nil?
614-
response = send_request(layout_config)
615-
layout_config = BigBlueButton::BigBlueButtonConfigLayout.new(response.body)
616-
layout_config.get_available_layouts
617-
else
618-
nil
619-
end
620-
end
621-
622-
# Returns an array with the layouts that exist by default in a BigBlueButton
623-
# server. If you want to query the server to get a real list of layouts, use
624-
# <tt>get_available_layouts</tt>.
625-
def get_default_layouts
626-
# this is the list for BigBlueButton 0.81
627-
["Default", "Video Chat", "Meeting", "Webinar", "Lecture assistant", "Lecture"]
628-
end
629-
630555
# Make a simple request to the server to test the connection.
631556
def test_connection
632557
response = send_api_request(:index)
@@ -680,17 +605,12 @@ def get_url(method, params={})
680605
# checksum calc
681606
checksum_param = params_string + @secret
682607
checksum_param = method.to_s + checksum_param
683-
checksum = Digest::SHA1.hexdigest(checksum_param)
608+
checksum = @sha256 ? Digest::SHA256.hexdigest(checksum_param) : Digest::SHA1.hexdigest(checksum_param)
684609

685-
if method == :setConfigXML
686-
params_string = "checksum=#{checksum}&#{params_string}"
687-
return "#{@url}/#{method}", params_string
688-
else
689-
url = "#{@url}/#{method}?"
690-
url += "#{params_string}&" unless params_string.empty?
691-
url += "checksum=#{checksum}"
692-
return url, nil
693-
end
610+
url = "#{@url}/#{method}?"
611+
url += "#{params_string}&" unless params_string.empty?
612+
url += "checksum=#{checksum}"
613+
return url, nil
694614
end
695615

696616
# Performs an API call.

lib/bigbluebutton_config_layout.rb

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)