roundabout,
created on Sunday, 31 March 2024, 07:38:54 (1711870734),
received on Wednesday, 31 July 2024, 06:54:43 (1722408883)
Author identity: vlad <vlad.muntoiu@gmail.com>
c6a2f6fff4295348a92c182cea4b5a95cadd80d9
app.py
@@ -301,10 +301,6 @@ def new_repo():
db.session.add(repo) db.session.commit() if not os.path.exists(os.path.join(config.REPOS_PATH, repo.route)):subprocess.run(["git", "init", repo.name],cwd=os.path.join(config.REPOS_PATH, flask.session.get("username")))flask.flash(Markup(_("Successfully created repository {name}").format(name=name)), category="success") return flask.redirect(repo.route, code=303)
@@ -434,19 +430,17 @@ def repository_raw(username, repository, branch, subpath):
@repositories.route("/<username>/<repository>/tree/<branch>/", defaults={"subpath": ""}) @repositories.route("/<username>/<repository>/tree/<branch>/<path:subpath>") def repository_tree(username, repository, branch, subpath): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):app.logger.error(f"Cannot load {server_repo_location}")return flask.render_template("not-found.html"), 404repo = git.Repo(server_repo_location) repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() if not repo_data.default_branch:
@@ -587,13 +581,15 @@ def repository_tree(username, repository, branch, subpath):
@repositories.route("/<username>/<repository>/commit/<sha>") def repository_commit(username, repository, sha): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -620,13 +616,15 @@ def repository_commit(username, repository, sha):
@repositories.route("/<username>/<repository>/forum/") def repository_forum(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -656,13 +654,15 @@ def repository_forum(username, repository):
@repositories.route("/<username>/<repository>/forum/topic/<int:id>") def repository_forum_topic(username, repository, id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -692,26 +692,28 @@ def repository_forum_topic(username, repository, id):
@repositories.route("/<username>/<repository>/forum/new", methods=["POST", "GET"]) def repository_forum_new(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) serverRepoLocation = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {serverRepoLocation}")app.logger.info(f"Loading {server_repo_location}")if not os.path.exists(serverRepoLocation):app.logger.error(f"Cannot load {serverRepoLocation}")if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}")return flask.render_template("not-found.html"), 404 repo = git.Repo(serverRepoLocation)repoData = Repo.query.filter_by(route=f"/{username}/{repository}").first()repo = git.Repo(server_repo_location) repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first()user = User.query.filter_by(username=flask.session.get("username")).first() relationships = RepoAccess.query.filter_by(repo=repoData)userRelationship = RepoAccess.query.filter_by(repo=repoData, user=user).first()relationships = RepoAccess.query.filter_by(repo=repo_data) user_relationship = RepoAccess.query.filter_by(repo=repo_data, user=user).first()post = Post(user, repoData, None, flask.request.form["subject"],post = Post(user, repo_data, None, flask.request.form["subject"],flask.request.form["message"]) db.session.add(post)
@@ -725,13 +727,15 @@ def repository_forum_new(username, repository):
@repositories.route("/<username>/<repository>/forum/<int:post_id>") def repository_forum_thread(username, repository, post_id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -763,13 +767,15 @@ def repository_forum_thread(username, repository, post_id):
@repositories.route("/<username>/<repository>/forum/<int:post_id>/reply", methods=["POST"]) def repository_forum_reply(username, repository, post_id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -804,13 +810,15 @@ def repository_forum_reply(username, repository, post_id):
defaults={"score": -1}) @repositories.route("/<username>/<repository>/forum/<int:post_id>/votes", defaults={"score": 0}) def repository_forum_vote(username, repository, post_id, score): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -856,13 +864,15 @@ def repository_forum_vote(username, repository, post_id, score):
@repositories.route("/<username>/<repository>/favourite") def repository_favourite(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -892,13 +902,15 @@ def repository_favourite(username, repository):
@repositories.route("/<username>/<repository>/users/", methods=["GET", "POST"]) def repository_users(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -951,13 +963,15 @@ def repository_users(username, repository):
@repositories.route("/<username>/<repository>/branches/") def repository_branches(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -981,13 +995,15 @@ def repository_branches(username, repository):
@repositories.route("/<username>/<repository>/log/", defaults={"branch": None}) @repositories.route("/<username>/<repository>/log/<branch>/") def repository_log(username, repository, branch): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -1050,13 +1066,15 @@ def repository_log(username, repository, branch):
@repositories.route("/<username>/<repository>/prs/", methods=["GET", "POST"]) def repository_prs(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404)if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}") if not os.path.exists(server_repo_location):
@@ -1119,10 +1137,18 @@ def repository_prs(username, repository):
@repositories.route("/<username>/<repository>/prs/merge", methods=["POST"]) def repository_prs_merge(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404) if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403)if not get_permission_level(flask.session.get("username"), username, repository): flask.abort(401) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() repo = git.Repo(server_repo_location) id = flask.request.form.get("id")
@@ -1148,10 +1174,18 @@ def repository_prs_merge(username, repository):
@repositories.route("/<username>/<repository>/prs/<int:id>/merge") def repository_prs_merge_stage_two(username, repository, id): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404) if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403)if not get_permission_level(flask.session.get("username"), username, repository): flask.abort(401) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() repo = git.Repo(server_repo_location)
@@ -1184,10 +1218,18 @@ def task_monitor(task_id):
@repositories.route("/<username>/<repository>/prs/delete", methods=["POST"]) def repository_prs_delete(username, repository): server_repo_location = os.path.join(config.REPOS_PATH, username, repository) if not os.path.exists(server_repo_location): app.logger.error(f"Cannot load {server_repo_location}") flask.abort(404) if not (get_visibility(username, repository) or get_permission_level( flask.session.get("username"), username, repository) is not None): flask.abort(403)if not get_permission_level(flask.session.get("username"), username, repository): flask.abort(401) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() repo = git.Repo(server_repo_location) id = flask.request.form.get("id")