Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ envvar:

ci: envvar test

trust:
@command -v mkcert || (echo "mkcert command not found. Please install first, see https://github.com/FiloSottile/mkcert" && exit 1)
mkcert -install

cert: trust
cd certs && mkcert jazzband.local "*.jazzband.local" jazzband.local localhost 127.0.0.1 ::1 && cd ..

generate-securitytxt:
rm jazzband/static/security.txt
gpg --clearsign -u 02DE8F842900411ADD70B1374D87558AF652A00F -o jazzband/static/security.txt jazzband/static/security.txt.tpl
Expand Down
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: flask run -h 0.0.0.0 -p 5000 --cert=certs/jazzband.local+5.pem --key=certs/jazzband.local+5-key.pem
web: flask run -h 0.0.0.0 -p 5000
worker: flask spinach
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ Install Docker and NPM.
Run `make build`. This will create a set of Docker containers with all backends
and dependencies.

The Jazzband site uses a self-signed TLS certificate for development to be able
to reproduce the production environment as close as possible. To that effect
it's required to install [`mkcert`](https://github.com/FiloSottile/mkcert)
in your system's certificate trust store (once). To do that install `mkcert`
by following the installation instructions and then run `make trust`.

In case the embedded self-signed certificates are outdated you can recreate
them by running `make cert`.

## Running

Get [Orbstack](https://orbstack.dev/).

Run `make run` to run the development server and worker. The website will be available
at https://localhost:5000.
at https://jazzband.local.

## License

Expand Down
28 changes: 0 additions & 28 deletions certs/jazzband.local+5-key.pem

This file was deleted.

27 changes: 0 additions & 27 deletions certs/jazzband.local+5.pem

This file was deleted.

5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.2"
services:
db:
image: postgres
Expand All @@ -22,6 +21,8 @@ services:
# but also response the .env file for the rest
FLASK_APP: jazzband/app.py
FLASK_DEBUG: 1
# Force HTTP for OAuth
OAUTHLIB_INSECURE_TRANSPORT: '1'
env_file:
- .env
ports:
Expand All @@ -30,6 +31,8 @@ services:
- db
- redis
- email
labels:
- dev.orbstack.domains=jazzband.local

worker:
<<: *app
Expand Down
3 changes: 1 addition & 2 deletions jazzband/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def callback(blueprint, token):
user_response = blueprint.session.get("/user")
except RateLimit:
flash(
"Access to the GitHub API has been rate-limited, "
"please try again later.",
"Access to the GitHub API has been rate-limited, please try again later.",
category="error",
)
return False
Expand Down
12 changes: 9 additions & 3 deletions jazzband/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class UserAdmin(JazzbandModelView):
"cookies_consent",
"age_consent",
)
inline_models = (OAuth, EmailAddress, ProjectMembership)
# Explicitly exclude problematic columns from forms
form_excluded_columns = ["oauths", "email_addresses", "projects_memberships"]
inline_models = [
(OAuth, {"form_columns": ["provider", "token"]}),
EmailAddress,
ProjectMembership,
]


class OAuthAdmin(JazzbandModelView):
Expand All @@ -66,7 +72,8 @@ class EmailAddressAdmin(JazzbandModelView):
class ProjectAdmin(JazzbandModelView):
column_searchable_list = ("name", "description")
column_filters = ("is_active", "created_at", "updated_at", "pushed_at")
inline_models = (ProjectCredential, ProjectUpload, ProjectMembership)

inline_models = [ProjectCredential, ProjectUpload, ProjectMembership]


class ProjectUploadAdmin(JazzbandModelView):
Expand All @@ -83,7 +90,6 @@ def init_app(app):
admin = Admin(
app,
name="jazzband",
template_mode="bootstrap4",
index_view=JazzbandAdminIndexView(),
)

Expand Down
6 changes: 4 additions & 2 deletions jazzband/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

SECRET_KEY = config("SECRET_KEY", "dev key")
DEBUG = config("DEBUG", True, cast=bool)
SERVER_NAME = config("SERVER_NAME", "localhost:5000")
SERVER_NAME = config("SERVER_NAME", "jazzband.local")

HOSTNAMES = config("HOSTNAMES", "localhost:5000,0.0.0.0:5000", cast=Csv())
HOSTNAMES = config(
"HOSTNAMES", "localhost:5000,0.0.0.0:5000,jazzband.local", cast=Csv()
)
REDIS_URL = config("REDIS_URL", "redis://redis:6379/0")
QUEUE_URL = config("QUEUE_URL", REDIS_URL)
CACHE_REDIS_URL = config("CACHE_REDIS_URL", REDIS_URL)
Expand Down
2 changes: 1 addition & 1 deletion jazzband/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def validate_upload(self):
logger.error(error, extra={"stack": True})

else:
error = f"No released files found for upload " f"{self.upload.filename}"
error = f"No released files found for upload {self.upload.filename}"
errors.append(error)
logger.error(error, extra={"stack": True})
return errors
Expand Down
2 changes: 1 addition & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def process_revision_directives(context, revision, directives):
connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions["migrate"].configure_args
**current_app.extensions["migrate"].configure_args,
)

try:
Expand Down
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"loading-attribute-polyfill": "^2.1.1"
},
"devDependencies": {
"@parcel/transformer-sass": "^2.12.0",
"parcel": "^2.12.0",
"sass": "^1.89.0"
},
Expand Down
7 changes: 5 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
alembic
babel
backports.tarfile
blinker
brotli
certifi
Expand All @@ -11,7 +12,7 @@ delegator.py
exceptiongroup
feedgen
flask
flask-admin
flask-admin==2.0.0a4
flask-caching
flask-compress
Flask-Dance[sqla]
Expand All @@ -27,7 +28,9 @@ flask-wtf
greenlet
gunicorn
honcho
importlib_metadata
itsdangerous
jaraco-context
jeepney
jinja2
lxml
Expand All @@ -50,7 +53,7 @@ requests-toolbelt
SecretStorage
sentry-sdk[flask]
spinach
sqlalchemy<2.0
sqlalchemy<3.0
sqlalchemy-utils
tomli
twine
Expand Down
Loading