roundabout,
created on Saturday, 2 December 2023, 16:31:31 (1701534691),
received on Wednesday, 31 July 2024, 06:54:38 (1722408878)
Author identity: vlad <vlad.muntoiu@gmail.com>
455e785845618966586e36005c6b618c51cd6e95
app.py
@@ -124,7 +124,7 @@ with app.app_context():
URL = db.Column(db.String(256), nullable=True) creationDate = db.Column(db.DateTime, default=datetime.utcnow) defaultBranch = db.Column(db.String(64), nullable=True, default="master")defaultBranch = db.Column(db.String(64), nullable=True, default="")commits = db.relationship("Commit", back_populates="repo") repoAccess = db.relationship("RepoAccess", back_populates="repo")
@@ -400,16 +400,18 @@ def repositoryTree(username, repository, branch, subpath):
repo = git.Repo(serverRepoLocation) repoData = Repo.query.filter_by(route=f"/{username}/{repository}").first() if not repoData.defaultBranch: return flask.render_template("empty.html", remote=f"http://{config.BASE_DOMAIN}/git/{username}/{repository}"), 200else:if not branch:branch = repoData.defaultBranchreturn flask.redirect(f"./{branch}", code=302)if repo.heads: repoData.defaultBranch = repo.heads[0].nameelse: try:repo.git.checkout("-f", branch)except git.exc.GitCommandError:return flask.render_template("not-found.html"), 404return flask.render_template("empty.html", remote=f"http://{config.BASE_DOMAIN}/git/{username}/{repository}"), 200 if not branch: branch = repoData.defaultBranch return flask.redirect(f"./{branch}", code=302) else: try: repo.git.checkout("-f", branch) except git.exc.GitCommandError: return flask.render_template("not-found.html"), 404branches = repo.heads
gitHTTP.py
@@ -73,6 +73,15 @@ def gitReceivePack(username, repository):
@app.route("/git/<username>/<repository>/info/refs", methods=["GET"]) @auth.login_required(optional=True) def gitInfoRefs(username, repository): serverRepoLocation = os.path.join(config.REPOS_PATH, username, repository, ".git") repo = git.Repo(serverRepoLocation) repoData = Repo.query.filter_by(route=f"/{username}/{repository}").first() if not repoData.defaultBranch: if repo.heads: repoData.defaultBranch = repo.heads[0].name repo.git.checkout("-f", repoData.defaultBranch)if auth.current_user() is None and (not getVisibility(username, repository) or flask.request.args.get("service") == "git-receive-pack"): return authRequired try:
@@ -81,7 +90,6 @@ def gitInfoRefs(username, repository):
except AttributeError: return authRequired serverRepoLocation = os.path.join(config.REPOS_PATH, username, repository, ".git")service = flask.request.args.get("service") if service.startswith("git"):
@@ -90,9 +98,11 @@ def gitInfoRefs(username, repository):
flask.abort(403) if service == "receive-pack": print(getPermissionLevel(flask.g.user, username, repository))if not getPermissionLevel(flask.g.user, username, repository):flask.abort(403)try: if not getPermissionLevel(flask.g.user, username, repository): flask.abort(403) except AttributeError: return authRequiredserviceLine = f"# service=git-{service}\n" serviceLine = (f"{len(serviceLine) + 4:04x}" + serviceLine).encode()
@@ -100,7 +110,8 @@ def gitInfoRefs(username, repository):
if service == "upload-pack": text = serviceLine + b"0000" + gitCommand(serverRepoLocation, None, "upload-pack", "--stateless-rpc", "--advertise-refs", "--http-backend-info-refs", ".") elif service == "receive-pack": text = serviceLine + b"0000" + gitCommand(serverRepoLocation, None, "receive-pack", "--http-backend-info-refs", ".")refs = gitCommand(serverRepoLocation, None, "receive-pack", "--http-backend-info-refs", ".") text = serviceLine + b"0000" + refselse: flask.abort(403)
static/efficient-ui/THEME.css
@@ -1,5 +1,6 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,700;1,300;1,700&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,600;1,600&display=swap');:root, ::backdrop { /* FONTS */
static/style.css
@@ -115,4 +115,42 @@ button, input, .button, select {
#global-nav > x-hbox > a > x-hbox { height: 100%; } body > footer { background: var(--color-callout-1); color: var(--color-callout-1-text); padding: 16px; } body > footer a { color: var(--color-callout-1-text) !important; } body { display: flex; flex-flow: column; } main { flex: 1 0 auto; } body > footer dd ul { padding-left: 0; margin-left: 0 !important; list-style: none; } body > footer dt { font-family: "Roboto Condensed"; text-transform: uppercase; font-weight: 600; } body > footer hr { border-color: #ffffff80; margin: 8px 0; } #footer-lists { flex-flow: row wrap; } #footer-lists > dl { flex: 1 0 0;}
templates/default.html
@@ -67,6 +67,60 @@
<main> {% block content %}{% endblock %} </main> <footer> <x-hbox id="footer-lists"> <dl> <dt>Main</dt> <dd> <ul> <li><a href="/">Home</a></li> <li><a href="/newrepo">New repository</a></li> <li><a href="/notifications">Notifications</a></li> <li><a href="/alerts">Alerts</a></li> </ul> </dd> </dl> <dl> <dt>Explore</dt> <dd> <ul> <li><a href="/hot">Trending</a></li> <li><a href="/search">Search</a></li> </ul> </dd> </dl> <dl> <dt>Information</dt> <dd> <ul> <li><a href="/help">Help</a></li> <li><a href="/about">About</a></li> </ul> </dd> </dl> <dl> <dt>Account</dt> <dd> <ul> <li><a href="/settings">Settings</a></li> <li><a href="/{{ loggedInUser }}">Profile</a></li> <li><a href="/logout">Log out</a></li> </ul> </dd> </dl> </x-hbox> <hr> <p> Alpha testing. Not for production use. </p> <p> Application © 2023 Roundabout developers. Content belongs to the repository contributors, unless otherwise stated. </p> <p> <a href="/about">Powered by Roundabout (alpha testing)</a> </p> </footer>{% with messages = get_flashed_messages(with_categories=true) %} <ol class="toast-container"> {% for category, message in messages %}