roundabout,
created on Tuesday, 30 January 2024, 20:18:18 (1706645898),
received on Wednesday, 31 July 2024, 06:54:41 (1722408881)
Author identity: vlad <vlad.muntoiu@gmail.com>
56f0844075413175df403303f432265f7c08f398
app.py
@@ -8,6 +8,7 @@ import mimetypes
import magic import flask import cairosvg import celeryfrom functools import wraps from datetime import datetime from enum import Enum
@@ -18,9 +19,7 @@ from markupsafe import escape, Markup
from flask_migrate import Migrate from PIL import Image from flask_httpauth import HTTPBasicAuth from celery import Celery, Taskimport config import celery_integrationapp = flask.Flask(__name__) app.config.from_mapping(
@@ -30,7 +29,6 @@ app.config.from_mapping(
task_ignore_result=True, ), ) worker = celery_integration.init_celery_app(app)auth = HTTPBasicAuth()
@@ -41,94 +39,15 @@ db = SQLAlchemy(app)
bcrypt = Bcrypt(app) migrate = Migrate(app, db) from models import * import celery_tasksdef git_command(repo, data, *args):if not os.path.isdir(repo):raise FileNotFoundError("Repo not found")env = os.environ.copy()command = ["git", *args]proc = subprocess.Popen(" ".join(command), cwd=repo, env=env, shell=True, stdout=subprocess.PIPE,stdin=subprocess.PIPE)print(command)if data:proc.stdin.write(data)out, err = proc.communicate()return outdef only_chars(string, chars):for i in string:if i not in chars:return Falsereturn Truedef get_permission_level(logged_in, username, repository):user = User.query.filter_by(username=logged_in).first()repo = Repo.query.filter_by(route=f"/{username}/{repository}").first()if user and repo:permission = RepoAccess.query.filter_by(user=user, repo=repo).first()if permission:return permission.access_levelreturn Nonedef get_visibility(username, repository):repo = Repo.query.filter_by(route=f"/{username}/{repository}").first()if repo:return repo.visibilityreturn Nonedef get_favourite(logged_in, username, repository):print(logged_in, username, repository)relationship = RepoFavourite.query.filter_by(user_username=logged_in,repo_route=f"/{username}/{repository}").first()return relationshipfrom misc_utils import *import git_http import jinja_utils import celery_tasks from celery import Celery, Task import celery_integrationdef human_size(value, decimals=2, scale=1024,units=("B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", "RiB", "QiB")):for unit in units:if value < scale:breakvalue /= scaleif int(value) == value:# do not return decimals if the value is already roundreturn int(value), unitreturn round(value * 10 ** decimals) / 10 ** decimals, unitdef guess_mime(path):if os.path.isdir(path):mimetype = "inode/directory"elif magic.from_file(path, mime=True):mimetype = magic.from_file(path, mime=True)else:mimetype = "application/octet-stream"return mimetypedef convert_to_html(path):with open(path, "r") as f:contents = f.read()return contentsworker = celery_integration.init_celery_app(app)repositories = flask.Blueprint("repository", __name__, template_folder="templates/repository/")
@@ -144,13 +63,17 @@ def default():
"user_object": user_object, "Notification": Notification, "unread": UserNotification.query.filter_by(user_username=username).filter( UserNotification.attention_level > 0).count()UserNotification.attention_level > 0).count(), "config": config,} @app.route("/") def main(): return flask.render_template("home.html")if flask.session.get("username"): return flask.render_template("home.html") else: return flask.render_template("no-home.html")@app.route("/about/")
@@ -158,6 +81,11 @@ def about():
return flask.render_template("about.html", platform=platform) @app.route("/help/") def help_index(): return flask.render_template("help.html") @app.route("/settings/", methods=["GET", "POST"]) def settings(): if not flask.session.get("username"):
@@ -634,66 +562,34 @@ def repository_forum_topic(username, repository, id):
) @repositories.route("/<username>/<repository>/forum/create-topic", methods=["POST", "GET"])def repository_forum_create_topic(username, repository):@repositories.route("/<username>/<repository>/forum/new", methods=["POST", "GET"]) def repository_forum_new(username, repository):if not (get_visibility(username, repository) or get_permission_level(flask.session.get("username"), username, repository) is not None):repository) is not None):flask.abort(403) server_repo_location = os.path.join(config.REPOS_PATH, username, repository)serverRepoLocation = os.path.join(config.REPOS_PATH, username, repository)app.logger.info(f"Loading {server_repo_location}")app.logger.info(f"Loading {serverRepoLocation}")if not os.path.exists(server_repo_location):app.logger.error(f"Cannot load {server_repo_location}")if not os.path.exists(serverRepoLocation): app.logger.error(f"Cannot load {serverRepoLocation}")return flask.render_template("not-found.html"), 404 repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first()repo = git.Repo(serverRepoLocation) repoData = 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=repo_data)user_relationship = RepoAccess.query.filter_by(repo=repo_data, user=user).first()if flask.request.method == "POST":# Check if the user has permission to create a topicif not user_relationship or not user_relationship.permissionCreateTopic:flask.abort(403)# Get form datatitle = flask.request.form.get("title")content = flask.request.form.get("content")# Validate form dataif not title or not content:flask.flash("Title and content are required", "error")return flask.redirect(flask.url_for("repository_forum_create_topic", username=username, repository=repository))# Create a new topicnew_topic = Post(title=title,content=content,author=user,repo=repo_data)relationships = RepoAccess.query.filter_by(repo=repoData) userRelationship = RepoAccess.query.filter_by(repo=repoData, user=user).first()db.session.add(new_topic)db.session.commit()post = Post(user, repoData, None, flask.request.form["subject"], flask.request.form["message"])flask.flash("Topic created successfully!", "success")return flask.redirect(flask.url_for("repository_forum_topic", username=username, repository=repository, id=new_topic.id))db.session.add(post) db.session.commit()return flask.render_template("repo-create-topic.html",username=username,repository=repository,repo_data=repo_data,relationships=relationships,user_relationship=user_relationship,remote=f"http{'s' if config.suggest_https else ''}://{config.BASE_DOMAIN}/git/{username}/{repository}",is_favourite=get_favourite(flask.session.get("username"), username, repository),default_branch=repo_data.default_branch)return flask.redirect( flask.url_for(".repository_forum_thread", username=username, repository=repository, post_id=post.number), code=303)@repositories.route("/<username>/<repository>/forum/<int:post_id>")
@@ -723,6 +619,7 @@ def repository_forum_thread(username, repository, post_id):
repo_data=repo_data, relationships=relationships, repo=repo, Post=Post,user_relationship=user_relationship, post_id=post_id, max_post_nesting=4,
@@ -1000,6 +897,115 @@ def repository_log(username, repository, branch):
) @repositories.route("/<username>/<repository>/prs/", methods=["GET", "POST"]) def repository_prs(username, repository): 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"), 404 if flask.request.method == "GET": 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() return flask.render_template( "repo-prs.html", username=username, repository=repository, repo_data=repo_data, repo=repo, PullRequest=PullRequest, remote=f"http{'s' if config.suggest_https else ''}://{config.BASE_DOMAIN}/git/{username}/{repository}", is_favourite=get_favourite(flask.session.get("username"), username, repository), default_branch=repo_data.default_branch, branches=repo.branches ) else: repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() head = flask.request.form.get("head") base = flask.request.form.get("base") if not head and base: flask.abort(400) pull_request = PullRequest(repo_data, head, repo_data, base, db.session.get(User, flask.session["username"])) db.session.add(pull_request) db.session.commit() return flask.redirect(".", 303) @repositories.route("/<username>/<repository>/prs/merge", methods=["POST"]) def repository_prs_merge(username, repository): 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") pull_request = db.session.get(PullRequest, id) if pull_request: if pull_request.base != pull_request.head: flask.abort(400) result = celery_tasks.merge_heads.delay( pull_request.head_route, pull_request.head_branch, pull_request.base_route, pull_request.base_branch, ) flask.flash(Markup(f"Merging PR in task <a href='/task/{ result.id }'>{result.id}</a>"), f"task {result.id}") db.session.delete(pull_request) db.session.commit() else: flask.abort(400) return flask.redirect(".", 303) @repositories.route("/task/<task_id>") def task_monitor(task_id): result = celery_tasks.merge_heads.AsyncResult(task_id) return flask.render_template("task-monitor.html", result=result) @repositories.route("/<username>/<repository>/prs/delete", methods=["POST"]) def repository_prs_delete(username, repository): 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") pull_request = db.session.get(PullRequest, id) if pull_request: if pull_request.base != pull_request.head: flask.abort(400) db.session.delete(pull_request) db.session.commit() return flask.redirect(".", 303) @repositories.route("/<username>/<repository>/settings/") def repository_settings(username, repository): if get_permission_level(flask.session.get("username"), username, repository) != 2:
celery_tasks.py
@@ -1,9 +1,11 @@
import time import os import configfrom celery import shared_task from app import db from misc_utils import *from models import * from smtplib import SMTP import config@shared_task(ignore_result=False)
@@ -14,4 +16,16 @@ def send_notification(notification_id, users, level):
db.session.add(UserNotification(db.session.get(User, user), notification, level)) db.session.commit() return 0 # notification sent successfullyreturn 0 # notification sent successfully @shared_task(ignore_result=False) def merge_heads(head_route, head_branch, base_route, base_branch): server_repo_location = os.path.join(config.REPOS_PATH, base_route.lstrip("/")) if not os.path.isdir(server_repo_location): raise FileNotFoundError(f"Repo {server_repo_location} not found, cannot merge.") git_command(server_repo_location, b"", "checkout", "-f", f"heads/{base_branch}") out, err = git_command(server_repo_location, b"", "merge", f"heads/{head_branch}", return_err=True) return out, err
config.py
@@ -6,6 +6,7 @@ DB_PASSWORD: str = os.environ.get("DB_PASSWORD")
DB_URI: str = f"postgresql://root:{DB_PASSWORD}@localhost/roundabout" REDIS_URI: str = "redis://localhost" MAIL_SERVER: str = "localhost" CONTACT_EMAIL: str = "root@roundabout-host.com"REPOS_PATH: str = "./repos" USERDATA_PATH: str = "./userdata"
git_http.py
@@ -22,7 +22,7 @@ auth_required = flask.Response("Unauthorized Access", 401, {"WWW-Authenticate":
def verify_password(username, password): user = User.query.filter_by(username=username).first() if user and bcrypt.check_password_hash(user.passwordHashed, password):if user and bcrypt.check_password_hash(user.password_hashed, password):flask.g.user = username return True
@@ -83,10 +83,10 @@ def git_info_refs(username, repository):
repo = git.Repo(server_repo_location) repo_data = Repo.query.filter_by(route=f"/{username}/{repository}").first() if not repo_data.defaultBranch:if not repo_data.default_branch:if repo.heads: repo_data.defaultBranch = repo.heads[0].namerepo.git.checkout("-f", repo_data.defaultBranch)repo_data.default_branch = repo.heads[0].name repo.git.checkout("-f", repo_data.default_branch)if auth.current_user() is None and ( not get_visibility(username, repository) or flask.request.args.get("service") == "git-receive-pack"):
misc_utils.py
@@ -0,0 +1,87 @@
import subprocess import os import magic from models import * def git_command(repo, data, *args, return_err=False): print(repo) if not os.path.isdir(repo): raise FileNotFoundError(f"Repo {repo} not found") env = os.environ.copy() command = ["git", *args] proc = subprocess.Popen(" ".join(command), cwd=repo, env=env, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) if data: proc.stdin.write(data) out, err = proc.communicate() if return_err: return out, err return out def only_chars(string, chars): for i in string: if i not in chars: return False return True def get_permission_level(logged_in, username, repository): user = User.query.filter_by(username=logged_in).first() repo = Repo.query.filter_by(route=f"/{username}/{repository}").first() if user and repo: permission = RepoAccess.query.filter_by(user=user, repo=repo).first() if permission: return permission.access_level return None def get_visibility(username, repository): repo = Repo.query.filter_by(route=f"/{username}/{repository}").first() if repo: return repo.visibility return None def get_favourite(logged_in, username, repository): print(logged_in, username, repository) relationship = RepoFavourite.query.filter_by(user_username=logged_in, repo_route=f"/{username}/{repository}").first() return relationship def human_size(value, decimals=2, scale=1024, units=("B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB", "RiB", "QiB")): for unit in units: if value < scale: break value /= scale if int(value) == value: # do not return decimals if the value is already round return int(value), unit return round(value * 10 ** decimals) / 10 ** decimals, unit def guess_mime(path): if os.path.isdir(path): mimetype = "inode/directory" elif magic.from_file(path, mime=True): mimetype = magic.from_file(path, mime=True) else: mimetype = "application/octet-stream" return mimetype def convert_to_html(path): with open(path, "r") as f: contents = f.read() return contents
models.py
@@ -21,9 +21,10 @@ __all__ = [
"PostVote", "Post", "Commit", "PullRequest",] with app.app_context():with (app.app_context()):class RepoAccess(db.Model): id = db.Column(db.Integer, primary_key=True) user_username = db.Column(db.String(32), db.ForeignKey("user.username"), nullable=False)
@@ -46,6 +47,8 @@ with app.app_context():
user_username = db.Column(db.String(32), db.ForeignKey("user.username"), nullable=False) repo_route = db.Column(db.String(98), db.ForeignKey("repo.route"), nullable=False) notify_commit = db.Column(db.Boolean) user = db.relationship("User", back_populates="favourites") repo = db.relationship("Repo", back_populates="favourites")
@@ -95,6 +98,7 @@ with app.app_context():
commits = db.relationship("Commit", back_populates="owner") posts = db.relationship("Post", back_populates="owner") prs = db.relationship("PullRequest", back_populates="owner")notifications = db.relationship("UserNotification", back_populates="user") def __init__(self, username, password, email=None, display_name=None):
@@ -136,6 +140,8 @@ with app.app_context():
posts = db.relationship("Post", back_populates="repo") repo_access = db.relationship("RepoAccess", back_populates="repo") favourites = db.relationship("RepoFavourite", back_populates="repo") heads = db.relationship("PullRequest", back_populates="head", foreign_keys="[PullRequest.head_route]") bases = db.relationship("PullRequest", back_populates="base", foreign_keys="[PullRequest.base_route]")last_post_id = db.Column(db.Integer, nullable=False, default=0)
@@ -241,8 +247,8 @@ with app.app_context():
follower_username = db.Column(db.String(32), db.ForeignKey("user.username", ondelete="CASCADE"), nullable=False) followed_username = db.Column(db.String(32), db.ForeignKey("user.username", ondelete="CASCADE"), nullable=False) follower = db.relationship("User", back_populates="follows", foreign_keys=[followed_username])followed = db.relationship("User", back_populates="followers", foreign_keys=[follower_username])follower = db.relationship("User", back_populates="followers", foreign_keys=[follower_username]) followed = db.relationship("User", back_populates="follows", foreign_keys=[followed_username])def __init__(self, follower_username, followed_username): self.follower_username = follower_username
@@ -257,3 +263,26 @@ with app.app_context():
def __init__(self, json): self.data = json class PullRequest(db.Model): id = db.Column(db.BigInteger, primary_key=True, autoincrement=True) head_route = db.Column(db.String(98), db.ForeignKey("repo.route", ondelete="CASCADE"), nullable=False) base_route = db.Column(db.String(98), db.ForeignKey("repo.route", ondelete="CASCADE"), nullable=False) owner_name = db.Column(db.String(32), db.ForeignKey("user.username"), nullable=False) head = db.relationship("Repo", back_populates="heads", foreign_keys=[head_route]) base = db.relationship("Repo", back_populates="bases", foreign_keys=[base_route]) head_branch = db.Column(db.String(64), nullable=False) base_branch = db.Column(db.String(64), nullable=False) owner = db.relationship("User", back_populates="prs") timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now) def __init__(self, head, head_branch, base, base_branch, owner): self.head = head self.base = base self.head_branch = head_branch self.base_branch = base_branch self.owner = owner
static/efficient-ui/cards.css
@@ -43,7 +43,7 @@ figcaption {
max-width: var(--figure-max-size-horizontal-card); } .card-horizontal > :is(figure, .card-top) ~ :is(section, header, footer) {.card-horizontal > :is(figure, .card-top) + :is(section, header, footer) {/* Beside figure */ padding-top: var(--padding-card-top); }
templates/default.html
@@ -69,8 +69,8 @@
</main> <footer> <x-hbox> <a href="/about">About</a><a href="/help">Help</a> <a href="mailto:{{ config.CONTACT_EMAIL }}">Contact Us</a></x-hbox> <hr> <p>
@@ -87,7 +87,8 @@
{% with messages = get_flashed_messages(with_categories=true) %} <ol class="toast-container"> {% for category, message in messages %} <li style="<li style="{% if category %} background-color: {% if category == 'error' %}var(--color-error)
@@ -103,7 +104,11 @@
{% endif %}; {% endif %}" > {{ message }}{% if category | split | first == "task" %} {{ message }} {% else %} {{ message }} {% endif %}<x-buttonbox> <button class="button-flat" onclick="removeToast()" style="color: inherit !important;">Close</button> </x-buttonbox>
templates/help.html
@@ -0,0 +1,165 @@
{% extends "home.html" %} {% block title %} FAQs {% endblock %} {% block content %} <x-frame style="--width: 768px;"> <h1>FAQs and rules</h1> <dl> <dt><h2>How do I add my project?</h2></dt> <dd> <p> It's easy. Click the sign-up button, then click Create in the corner, give it a name, and you're all set. </p> </dd> <dt><h2>Do I need to have an account?</h2></dt> <dd> <p> No, using the service is allowed without registering. However, to post your own material, as well as to contribute to other projects, you need an account to identify you. </p> </dd> <dt><h2>Do you collect personal information?</h2></dt> <dd> <p> Not at all. We do not log analytics or actions, and all you need to make an account is a username (which can be fictional) and a password. </p> </dd> <dt><h2>Who is the service targeted at?</h2></dt> <dd> <p> The service is primarily targeted at enthusiasts (the modern version of <a href="//en.wikipedia.org/wiki/Hacker_culture">hackers</a> but not security breakers!), and while we will optimise for corporate use, large free software projects and even just personal file storage as well, as an enthusiast myself I try to make it better for my use. </p> </dd> <dt><h2>What projects do you host?</h2></dt> <dd> <p> Anything, as long as it's free software. <i>Free</i> means all users should have the <a href="https://www.gnu.org/philosophy/free-sw.html.en#four-freedoms">Four Freedoms</a>. It does not mean everyone has to be a user, so private projects are <strong>allowed</strong>, but if it's private you may not share it without giving these Four Freedoms. </p> <p> <b>In short — either you share freely, or you don't share.</b> </p> <p> Additionally, projects designed to operate with nonfree programs or that depend on nonfree libraries are generally allowed, but keep in mind they are useless in the Free World. However, it is advisable to share them, so others could change them to remove the nonfree dependency. It is recommended to add a disclaimer to the top of an important document, just so others won't get too excited about it and realise it's not for them. </p> <p> “Source-available” projects that don't respect the Four Freedoms are considered nonfree and banned from this site. </p> <p> Using this site as a discussion forum for nonfree software is also not allowed, unless it's for a collaborative effort to reverse-engineer it. Forums for more general topics, as well as free software, are allowed though. </p> <p> Moreover, all <em>public</em> material shared here must be appropriate for all ages and not contain any illegal, pornographic, sexual, political, terrorist or other inappropriate material. Mild swearing is allowed, but it must not be used to refer to sex. </p> <p> For private material though, we have no business as long as you're not abusing the site by hosting illegal content or overloading the server. </p> <p> Nonfree <em>artistic, non-functional</em> works are also fine, but due to the nature of the service, the nonfree terms will not be enforced. </p> </dd> <dt><h2>What does it cost?</h2></dt> <dd> <p> Currently, it is zero-price, besides being free software. However, we may start charging for some features in the future, but <strong>only for those that cost us</strong>, and not for the features we already have, assuming a normal usage. We will not put stupid limits such as three collaborators per repository for free accounts, as more doesn't cost us anything. </p> <p> Advertisements may also get added, but they will be only for logged-out users, and won't use JavaScript or animation, most importantly they won't track you either. </p> </dd> <dt><h2>What stack does this instance use?</h2></dt> <dd> <p> Currently, it's a Raspberry Pi 4 (8GB) running Debian, Nginx, Gunicorn and Python with Flask, on top of Postgres and Redis. </p> </dd> <dt><h2>Is email integration supported?</h2></dt> <dd> <p> Mailing lists aren't currently supported, but it would be a nice feature, so we're working on it. </p> </dd> <dt><h2>Is SSH supported?</h2></dt> <dd> <p> Not currently. While SSH is used in many workflows, we currently only support the Git Smart HTTP protocol including with SSL. It does everything Git SSH does. We encourage you to try it, and let us know if SSH is still important to you. </p> <p> We also do not support the <code>git://</code> or Dumb HTTP protocols as they are insecure and don't have any authentication. </p> <p> For credential memory, GitHub's <a href="https://github.com/git-ecosystem/git-credential-manager">Git Credential Manager</a> also works with our app without extra setup. </p> </dd> <dt><h2>Is some form of CI or workflow, or robots supported?</h2></dt> <dd> <p> No, but we are working on it. </p> </dd> <dt><h2>What licence does the app have?</h2></dt> <dd> <p> <a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3.0</a>, or any later version. </p> </dd> <dt><h2>Where does the name come from?</h2></dt> <dd> <p> The name is a play on the word <i>branch</i>, because a roundabout connects many branching roads. It also aligns with our goals to become federated and support collaboration across instances, which we'll call roundabouts. </p> <p> The name is to always be treated like a common noun, so it uses regular capitalisation, articles and plurals. </p> </dd> <dt><h2>What about that logo?</h2></dt> <dd> <p> That is a roundabout sign design commonly used in Europe; it may not be familiar if you live on the other side of the Atlantic. </p> <p> It can also take other meanings, with blue being associated with stability and purity, the arrows could also represent collaboration, a cycle of development and even code reuse and remixing due to the resemblance to the recycling logo. </p> <p> The logo is to be treated as public domain. </p> </dd> </dl> </x-frame> {% endblock %}
templates/no-home.html
@@ -0,0 +1,124 @@
{% extends "default.html" %} {% block title %} Welcome {% endblock %} {% block breadcrumbs %} {% endblock %} {% block nav %} <nav id="home-nav" class="navbar"> <ul id="home-tabs"> <li><a href="/">Home</a></li> <li><a href="/hot">Trending</a></li> <li><a href="/search">Search</a></li> <li><a href="/help">Help</a></li> </ul> </nav> {% endblock %} {% block content %} <style> @import url('https://fonts.googleapis.com/css2?family=League+Gothic&display=swap'); #home-banner { background-image: radial-gradient(circle, #2196F3 0%, #1976D2 50%, #0D47A1 100%); color: #ffffff; height: 320px; } #home-banner .button { background-color: var(--color-accent); color: var(--color-accent-text); border: none; } #home-banner a { color: inherit; } </style> <x-hbox id="home-banner" style="justify-content: center; align-items: stretch;"> <x-frame class="inner" style="--width: 768px; padding: 24px; margin: 0; justify-content: center; display: flex; flex-direction: column;"> <x-vbox style="justify-content: center; align-items: stretch;"> <div> <h1 class="headline" style="font-family: 'League Gothic'; text-transform: uppercase;">The roundabout to all your code</h1> <p>Git repository hosting, made simple. Powered by free software.</p> </div> <x-buttonbox class="box-center"> <a class="button" href="/accounts">Log in or sign up</a> <a class="button" href="/download">Download</a> <p style="opacity: 0.75;">for setting up your own instance</p> </x-buttonbox> <x-hbox> <a href="/about">System Info</a> <a href="/help">Help & FAQ</a> <a href="mailto:{{ config.CONTACT_EMAIL }}">Contact Us</a> </x-hbox> </x-vbox> </x-frame> <x-frame style="--width: 384px; margin: 0;"> <x-vbox style="justify-content: center; align-items: center; height: 100%; align-self: stretch;"> <video controls style="box-shadow: var(--shadow-navbar); width: 100%; display: block;"> <source src="https://upload.wikimedia.org/wikipedia/commons/c/cd/All4sounds_-_Cloud_Time_lapse.webm"> </video> </x-vbox> </x-frame> </x-hbox> <x-vbox> <x-frame style="--width: 768px;"> <x-rows style="--preferred-width: 40%;" class="homogenous"> <article class="card"> <figure> <img src="//placekitten.com/1280/720"> </figure> <section class="card-main" role="main"> <h2 style="font-family: 'League Gothic'; font-size: 3em;">Git Repository Hosting</h2> <ul> <li>Public, unlisted (public, but not indexed) and private repositories</li> <li>Access and permission control</li> <li>Use with the Git Smart HTTPS protocol for easy collaboration</li> </ul> </section> </article> <article class="card"> <figure> <img src="//placekitten.com/1024/576"> </figure> <section class="card-main"> <h2 style="font-family: 'League Gothic'; font-size: 3em;">Discussions and Collaboration</h2> <ul> <li>Flexible pull requests and patch system, even nested</li> <li>A powerful forum for issues, code review, discussions, questions, announcements and more</li> </ul> </section> </article> <article class="card"> <figure> <img src="//placekitten.com/1920/1080"> </figure> <section class="card-main"> <h2 style="font-family: 'League Gothic'; font-size: 3em;">Social</h2> <ul> <li>Follow your favourite projects and receive updates</li> <li>Discover new, popular and useful projects</li> </ul> </section> </article> <article class="card"> <figure> <img src="//placekitten.com/960/540"> </figure> <section class="card-main"> <h2 style="font-family: 'League Gothic'; font-size: 3em;">Free</h2> <ul> <li>100% free/libre software, running on GNU/Linux</li> <li>Host your own instance</li> <li>No more vendor lock-in</li> </ul> </section> </article> </x-rows> </x-frame> </x-vbox> {% endblock %}
templates/repo.html
@@ -35,6 +35,7 @@
<li><a href="/{{ username }}/{{ repository }}/tree">Tree</a></li> <li><a href="/{{ username }}/{{ repository }}/branches">Branches</a></li> <li><a href="/{{ username }}/{{ repository }}/log">History</a></li> <li><a href="/{{ username }}/{{ repository }}/prs">PRs</a></li><li><a href="/{{ username }}/{{ repository }}/forum">Forum</a></li> <li><a href="/{{ username }}/{{ repository }}/users">Users</a></li> <li><a href="/{{ username }}/{{ repository }}/settings">Settings</a></li>
templates/repository/repo-forum-thread.html
@@ -1,5 +1,5 @@
{% extends "repo.html" %} {% set parent = Post.query.filter_by(repo=repoData, number=postID).first() %}{% set parent = Post.query.filter_by(repo=repo_data, number=post_id).first() %}{% block title %} {{ parent.subject }} in {{ username }}/{{ repository }} {% endblock %}
templates/repository/repo-prs.html
@@ -0,0 +1,56 @@
{% extends "repo.html" %} {% block title %} PRs of {{ username }}/{{ repository }} {% endblock %} {% block content %} <x-vbox> {% if logged_in_user %} <x-frame style="--width: 896px;" class="flexible-space"> <form method="post"> <x-hbox> <select name="head" style="flex: 0 1 auto;" required> <option value="" selected>===Head branch===</option> {% for branch in branches %} <option value="{{ branch }}">{{ branch }}</option> {% endfor %} </select> <iconify-icon icon="mdi-light:arrow-right" style="font-size: 2em;"></iconify-icon> <select name="base" style="flex: 0 1 auto;" required> <option value="" selected>===Base branch===</option> {% for branch in branches %} <option value="{{ branch }}">{{ branch }}</option> {% endfor %} </select> <button type="submit">Send PR</button> </x-hbox> </form> </x-frame> {% endif %} <x-frame style="--width: 896px;" class="flexible-space"> <x-vbox> {% for pr in repo_data.bases %} <article class="card card-horizontal"> <section class="card-main flexible-space"> <h3>{{ pr.head_route }} ({{ pr.head_branch }})<br>{{ pr.base_route }} ({{ pr.base_branch }})</h3> <p>Requested by <a href="/{{ pr.owner.username }}">{{ pr.owner.username }}</a> • {{ pr.timestamp | strftime("%A, %e %B %Y, %H:%M:%S") }}</p> </section> <section> <x-hbox> <form action="delete" method="post"> <input type="hidden" name="id" value="{{ pr.id }}"> <button type="submit" class="button-flat">Deny</button> </form> <form action="merge" method="post"> <input type="hidden" name="id" value="{{ pr.id }}"> <button type="submit">Merge</button> </form> </x-hbox> </section> </article> {% endfor %} </x-vbox> </x-frame> </x-vbox> {% endblock %}
templates/task-monitor.html
@@ -0,0 +1,11 @@
{% extends "default.html" %} {% block title %} Task monitor for {{ result.id }} {% endblock %} {% block breadcrumbs %} <li><a href="/task/{{ result.id }}">Task {{ result.id }}</a></li> {% endblock %} <h1>Task results</h1> <pre> {{ result.collect() }} </pre>
templates/user-profile-followers.html
@@ -6,10 +6,10 @@
<x-frame style="flex-basis: 96px; --width: 96px;"> <article class="card" style="flex: 0 1 auto;"> <section class="card-main"> <a href="/{{ follower.followed.username }}"><img class="avatar" src="/info/{{ follower.followed.username }}/avatar" style="width: 100%;"><a href="/{{ follower.follower.username }}"> <img class="avatar" src="/info/{{ follower.follower.username }}/avatar" style="width: 100%;"><div class="thumbnail-marquee"> <span class="inner-thumbnail-marquee" style="animation-play-state: paused;">{{ follower.followed.username }}</span><span class="inner-thumbnail-marquee" style="animation-play-state: paused;">{{ follower.follower.username }}</span></div> </a> </section>
templates/user-profile-follows.html
@@ -6,10 +6,10 @@
<x-frame style="flex-basis: 96px; --width: 96px;"> <article class="card" style="flex: 0 1 auto;"> <section class="card-main"> <a href="/{{ followed.follower.username }}"><img class="avatar" src="/info/{{ followed.follower.username }}/avatar" style="width: 100%;"><a href="/{{ followed.followed.username }}"> <img class="avatar" src="/info/{{ followed.followed.username }}/avatar" style="width: 100%;"><div class="thumbnail-marquee"> <span class="inner-thumbnail-marquee" style="animation-play-state: paused;">{{ followed.follower.username }}</span><span class="inner-thumbnail-marquee" style="animation-play-state: paused;">{{ followed.followed.username }}</span></div> </a> </section>