diff --git a/web/b3desk/endpoints/join.py b/web/b3desk/endpoints/join.py index 262b726d..ee5fe876 100644 --- a/web/b3desk/endpoints/join.py +++ b/web/b3desk/endpoints/join.py @@ -17,6 +17,7 @@ from b3desk.models.meetings import get_mail_meeting from b3desk.models.meetings import get_meeting_from_meeting_id_and_user_id from b3desk.models.roles import Role +from b3desk.models.users import User from .. import auth from ..session import get_authenticated_attendee_fullname @@ -66,7 +67,7 @@ def signin_mail_meeting(meeting_fake_id, expiration, h): @bp.route("/meeting/signin//creator//hash/") -def signin_meeting(meeting_fake_id, creator, h): +def signin_meeting(meeting_fake_id, creator: User, h): meeting = get_meeting_from_meeting_id_and_user_id(meeting_fake_id, creator.id) wordings = current_app.config["WORDINGS"] if meeting is None: @@ -101,7 +102,7 @@ def signin_meeting(meeting_fake_id, creator, h): @bp.route("/meeting/auth//creator//hash/") @auth.oidc_auth("default") -def authenticate_then_signin_meeting(meeting_fake_id, creator, h): +def authenticate_then_signin_meeting(meeting_fake_id, creator: User, h): return redirect( url_for( "join.signin_meeting", @@ -124,7 +125,7 @@ def authenticate_then_signin_meeting(meeting_fake_id, creator, h): @bp.route( "/meeting/wait//creator//hash//fullname//fullname_suffix/", ) -def waiting_meeting(meeting_fake_id, creator, h, fullname="", fullname_suffix=""): +def waiting_meeting(meeting_fake_id, creator: User, h, fullname="", fullname_suffix=""): meeting = get_meeting_from_meeting_id_and_user_id(meeting_fake_id, creator.id) if meeting is None: return redirect(url_for("public.index")) @@ -235,5 +236,5 @@ def join_meeting_as_authenticated(meeting_id): @bp.route("/meeting/join//") @auth.oidc_auth("default") @meeting_owner_needed -def join_meeting_as_role(meeting, role: Role, owner): +def join_meeting_as_role(meeting: Meeting, role: Role, owner: User): return redirect(meeting.get_join_url(role, owner.fullname, create=True)) diff --git a/web/b3desk/endpoints/meeting_files.py b/web/b3desk/endpoints/meeting_files.py index 7e3879f4..4ac10e90 100644 --- a/web/b3desk/endpoints/meeting_files.py +++ b/web/b3desk/endpoints/meeting_files.py @@ -30,6 +30,7 @@ from b3desk.models.meetings import Meeting from b3desk.models.meetings import MeetingFiles from b3desk.models.meetings import MeetingFilesExternal +from b3desk.models.users import User from .. import auth from ..session import get_current_user @@ -41,7 +42,7 @@ @bp.route("/meeting/files/") @auth.oidc_auth("default") @meeting_owner_needed -def edit_meeting_files(meeting, owner): +def edit_meeting_files(meeting: Meeting, owner: User): form = MeetingFilesForm() if not current_app.config["FILE_SHARING"]: @@ -75,7 +76,7 @@ def edit_meeting_files(meeting, owner): @bp.route("/meeting/files/", methods=["POST"]) @auth.oidc_auth("default") @meeting_owner_needed -def add_meeting_files(meeting, owner): +def add_meeting_files(meeting: Meeting, owner: User): data = request.get_json() is_default = False if len(meeting.files) == 0: @@ -101,7 +102,7 @@ def add_meeting_files(meeting, owner): @bp.route("/meeting/files//") @auth.oidc_auth("default") @meeting_owner_needed -def download_meeting_files(meeting, owner, file_id=None): +def download_meeting_files(meeting: Meeting, owner: User, file_id=None): TMP_DOWNLOAD_DIR = current_app.config["TMP_DOWNLOAD_DIR"] Path(TMP_DOWNLOAD_DIR).mkdir(parents=True, exist_ok=True) tmp_name = f'{current_app.config["TMP_DOWNLOAD_DIR"]}{secrets.token_urlsafe(32)}' @@ -153,7 +154,7 @@ def download_meeting_files(meeting, owner, file_id=None): # called by NextcloudfilePicker when documents should be added to a running room: @bp.route("/meeting/files//insertDocuments", methods=["POST"]) @auth.oidc_auth("default") -def insertDocuments(meeting): +def insertDocuments(meeting: Meeting): from flask import request files_title = request.get_json() @@ -206,7 +207,7 @@ def insertDocuments(meeting): @bp.route("/meeting/files//toggledownload", methods=["POST"]) @auth.oidc_auth("default") @meeting_owner_needed -def toggledownload(meeting, owner): +def toggledownload(meeting: Meeting, owner: User): data = request.get_json() meeting_file = db.session.get(MeetingFiles, data["id"]) if not meeting_file: @@ -221,7 +222,7 @@ def toggledownload(meeting, owner): @bp.route("/meeting/files//default", methods=["POST"]) @auth.oidc_auth("default") @meeting_owner_needed -def set_meeting_default_file(meeting, owner): +def set_meeting_default_file(meeting: Meeting, owner: User): data = request.get_json() actual_default_file = meeting.default_file @@ -429,7 +430,7 @@ def add_external_meeting_file_nextcloud(path, meeting_id): @bp.route("/meeting/files//dropzone", methods=["POST"]) @auth.oidc_auth("default") @meeting_owner_needed -def add_dropzone_files(meeting, owner): +def add_dropzone_files(meeting: Meeting, owner: User): file = request.files["dropzoneFiles"] # for dropzone chunk file by file validation # shamelessly taken from https://stackoverflow.com/questions/44727052/handling-large-file-uploads-with-flask diff --git a/web/b3desk/endpoints/meetings.py b/web/b3desk/endpoints/meetings.py index 33c81353..a36e367a 100644 --- a/web/b3desk/endpoints/meetings.py +++ b/web/b3desk/endpoints/meetings.py @@ -39,7 +39,7 @@ bp = Blueprint("meetings", __name__) -def meeting_mailto_params(meeting, role: Role): +def meeting_mailto_params(meeting: Meeting, role: Role): if role == Role.moderator: return render_template( "meeting/mailto/mail_href.txt", meeting=meeting, role=role @@ -90,7 +90,7 @@ def quick_meeting(): @bp.route("/meeting/show/") @auth.oidc_auth("default") @meeting_owner_needed -def show_meeting(meeting, owner): +def show_meeting(meeting: Meeting, owner: User): # TODO: appears unused form = ShowMeetingForm(data={"meeting_id": meeting.id}) @@ -111,7 +111,7 @@ def show_meeting(meeting, owner): @bp.route("/meeting/recordings/") @auth.oidc_auth("default") @meeting_owner_needed -def show_meeting_recording(meeting, owner): +def show_meeting_recording(meeting: Meeting, owner: User): form = RecordingForm() return render_template( "meeting/recordings.html", @@ -124,7 +124,7 @@ def show_meeting_recording(meeting, owner): @bp.route("/meeting//recordings/", methods=["POST"]) @auth.oidc_auth("default") @meeting_owner_needed -def update_recording_name(meeting, recording_id, owner): +def update_recording_name(meeting: Meeting, recording_id, owner: User): form = RecordingForm(request.form) if not form.validate(): abort(403) @@ -164,7 +164,7 @@ def new_meeting(): @bp.route("/meeting/edit/") @auth.oidc_auth("default") @meeting_owner_needed -def edit_meeting(meeting, owner): +def edit_meeting(meeting: Meeting, owner: User): form = ( MeetingWithRecordForm(obj=meeting) if current_app.config["RECORDING"] @@ -250,7 +250,7 @@ def end_meeting(): @bp.route("/meeting/create/") @auth.oidc_auth("default") @meeting_owner_needed -def create_meeting(meeting, owner): +def create_meeting(meeting: Meeting, owner: User): meeting.create_bbb() meeting.save() return redirect(url_for("public.welcome")) @@ -259,7 +259,7 @@ def create_meeting(meeting, owner): @bp.route("/meeting//externalUpload") @auth.oidc_auth("default") @meeting_owner_needed -def externalUpload(meeting, owner): +def externalUpload(meeting: Meeting, owner: User): if meeting.is_running(): return render_template("meeting/externalUpload.html", meeting=meeting) return redirect(url_for("public.welcome"))