diff --git a/web/b3desk/models/bbb.py b/web/b3desk/models/bbb.py
index 0eb01225..ddf78478 100644
--- a/web/b3desk/models/bbb.py
+++ b/web/b3desk/models/bbb.py
@@ -190,76 +190,74 @@ def create(self):
)
params = self.get_params_with_checksum(action, params)
- if current_app.config["FILE_SHARING"]:
- # ADDING DEFAULT FILE TO MEETING
- SECRET_KEY = current_app.config["SECRET_KEY"]
- xml_beg = " "
- xml_end = " "
- xml_mid = ""
+ if not current_app.config["FILE_SHARING"]:
+ response = requests.post(self.get_url(action), params=params)
+ data = {c.tag: c.text for c in ElementTree.fromstring(response.content)}
+ return data
- if self.meeting.default_file:
- meeting_file = self.meeting.default_file
- if meeting_file.url:
- xml_mid += f""
- else: # file is not URL nor NC hence it was uploaded
- filehash = hashlib.sha1(
- f"{SECRET_KEY}-0-{meeting_file.id}-{SECRET_KEY}".encode()
- ).hexdigest()
- xml_mid += f""
- xml = xml_beg + xml_mid + xml_end
- response = requests.post(
- self.get_url(action),
- params=params,
- headers={"Content-Type": "application/xml"},
- data=xml,
- )
- ## BEGINNING OF TASK CELERY - aka background_upload for meeting_files
- params = {}
- xml = ""
- # ADDING ALL FILES EXCEPT DEFAULT
- SERVER_FQDN = current_app.config["SERVER_FQDN"]
- BIGBLUEBUTTON_ENDPOINT = current_app.config["BIGBLUEBUTTON_ENDPOINT"]
- BIGBLUEBUTTON_SECRET = current_app.config["BIGBLUEBUTTON_SECRET"]
+ # ADDING DEFAULT FILE TO MEETING
+ SECRET_KEY = current_app.config["SECRET_KEY"]
+ xml_beg = " "
+ xml_end = " "
+ xml_mid = ""
- insertAction = "insertDocument"
- xml_beg = " "
- xml_end = " "
- xml_mid = ""
- for meeting_file in self.meeting.files:
- if meeting_file.is_default:
- continue
- elif meeting_file.url:
- xml_mid += f""
- else: # file is not URL nor NC hence it was uploaded
- filehash = hashlib.sha1(
- f"{SECRET_KEY}-0-{meeting_file.id}-{SECRET_KEY}".encode()
- ).hexdigest()
- xml_mid += f""
+ if self.meeting.default_file:
+ meeting_file = self.meeting.default_file
+ if meeting_file.url:
+ xml_mid += f""
+ else: # file is not URL nor NC hence it was uploaded
+ filehash = hashlib.sha1(
+ f"{SECRET_KEY}-0-{meeting_file.id}-{SECRET_KEY}".encode()
+ ).hexdigest()
+ xml_mid += f""
+ xml = xml_beg + xml_mid + xml_end
+ response = requests.post(
+ self.get_url(action),
+ params=params,
+ headers={"Content-Type": "application/xml"},
+ data=xml,
+ )
+ ## BEGINNING OF TASK CELERY - aka background_upload for meeting_files
+ params = {}
+ xml = ""
+ # ADDING ALL FILES EXCEPT DEFAULT
+ SERVER_FQDN = current_app.config["SERVER_FQDN"]
+ BIGBLUEBUTTON_ENDPOINT = current_app.config["BIGBLUEBUTTON_ENDPOINT"]
+ BIGBLUEBUTTON_SECRET = current_app.config["BIGBLUEBUTTON_SECRET"]
- xml = xml_beg + xml_mid + xml_end
- params = {"meetingID": self.meeting.meetingID}
- request = requests.Request(
- "POST",
- f"{BIGBLUEBUTTON_ENDPOINT}/{insertAction}",
- params=params,
- )
- pr = request.prepare()
- bigbluebutton_secret = BIGBLUEBUTTON_SECRET
- secret = "{}{}".format(
- pr.url.replace("?", "").replace(f"{BIGBLUEBUTTON_ENDPOINT}/", ""),
- bigbluebutton_secret,
- )
- params["checksum"] = hashlib.sha1(secret.encode("utf-8")).hexdigest()
- background_upload.delay(
- f"{BIGBLUEBUTTON_ENDPOINT}/{insertAction}", xml, params
- )
+ insertAction = "insertDocument"
+ xml_beg = " "
+ xml_end = " "
+ xml_mid = ""
+ for meeting_file in self.meeting.files:
+ if meeting_file.is_default:
+ continue
+ elif meeting_file.url:
+ xml_mid += f""
+ else: # file is not URL nor NC hence it was uploaded
+ filehash = hashlib.sha1(
+ f"{SECRET_KEY}-0-{meeting_file.id}-{SECRET_KEY}".encode()
+ ).hexdigest()
+ xml_mid += f""
- data = {c.tag: c.text for c in ElementTree.fromstring(response.content)}
- return data
- else:
- response = requests.post(self.get_url(action), params=params)
- data = {c.tag: c.text for c in ElementTree.fromstring(response.content)}
- return data
+ xml = xml_beg + xml_mid + xml_end
+ params = {"meetingID": self.meeting.meetingID}
+ request = requests.Request(
+ "POST",
+ f"{BIGBLUEBUTTON_ENDPOINT}/{insertAction}",
+ params=params,
+ )
+ pr = request.prepare()
+ bigbluebutton_secret = BIGBLUEBUTTON_SECRET
+ secret = "{}{}".format(
+ pr.url.replace("?", "").replace(f"{BIGBLUEBUTTON_ENDPOINT}/", ""),
+ bigbluebutton_secret,
+ )
+ params["checksum"] = hashlib.sha1(secret.encode("utf-8")).hexdigest()
+ background_upload.delay(f"{BIGBLUEBUTTON_ENDPOINT}/{insertAction}", xml, params)
+
+ data = {c.tag: c.text for c in ElementTree.fromstring(response.content)}
+ return data
def delete_recordings(self, recording_ids):
"""DeleteRecordings BBB API: https://docs.bigbluebutton.org/dev/api.html#deleterecordings"""