diff --git a/.forgejo/workflows/build_release.yml b/.forgejo/workflows/build_release.yml index bc5e10d..0966a21 100644 --- a/.forgejo/workflows/build_release.yml +++ b/.forgejo/workflows/build_release.yml @@ -1,8 +1,6 @@ on: push: tags: - - '[0-9]+\.[0-9]+\.[0-9]+-c\.[0-9]+' - - '[0-9]+\.[0-9]+\.[0-9]+-a\.[0-9]+' - '[0-9]+\.[0-9]+\.[0-9]' jobs: @@ -55,7 +53,7 @@ jobs: build-args: | PACKAGE_VERSION=${{ github.ref_name }} push: true - tags: forgejo.neshweb.net/firq/support-formatter:${{ github.ref_name }} + tags: forgejo.neshweb.net/firq/support-formatter:${{ github.ref_name }}, forgejo.neshweb.net/firq/support-formatter:latest release: needs: [ build-and-push-container, publish-artifacts ] diff --git a/pyproject.toml b/pyproject.toml index d6ea504..a7ddf34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "support_formatter" -version = "0.1.0" +version = "0.2.0" requires-python = ">= 3.10" authors = [{name = "Firq", email = "firelp42@gmail.com"}] maintainers = [{name = "Firq", email = "firelp42@gmail.com"}] diff --git a/support_formatter/config/settings.py b/support_formatter/config/settings.py index b9b4929..8425c95 100644 --- a/support_formatter/config/settings.py +++ b/support_formatter/config/settings.py @@ -33,3 +33,5 @@ class APISettings: ALLOWED_EXTENSIONS = { 'csv', 'txt' } FILE_SAVE_DIRECTORY = Path(__file__).parents[1] / ".temp" + + UI_URL = "https://support-formatter.firq.dev/" diff --git a/support_formatter/routes/__init__.py b/support_formatter/routes/__init__.py index 2af0a36..c414668 100644 --- a/support_formatter/routes/__init__.py +++ b/support_formatter/routes/__init__.py @@ -1,7 +1,8 @@ # pylint: disable=wrong-import-position,cyclic-import from flask_smorest import Blueprint +redirect_routes = Blueprint("redirect", "recirects", url_prefix="/", description="") interface_routes = Blueprint("interface", "interface", url_prefix="/", description="") formatter_routes = Blueprint("formatter", "formatter", url_prefix="/", description="") -from . import interface, upload # avoids circular imports problem +from . import interface, upload, redirects # avoids circular imports problem diff --git a/support_formatter/routes/redirects.py b/support_formatter/routes/redirects.py new file mode 100644 index 0000000..0c264d3 --- /dev/null +++ b/support_formatter/routes/redirects.py @@ -0,0 +1,12 @@ +from flask import redirect + +from ..app import Application +from ..config import APISettings +from . import redirect_routes as blp + +APP = Application.get_instance() + +@blp.route("/", methods=["GET"]) +@blp.doc(summary="This route just exists to redirect any visitor to the root domain to the UI") +def redirect_to_ui(): + return redirect(APISettings.UI_URL) diff --git a/support_formatter/server.py b/support_formatter/server.py index 853e3e4..00192c3 100644 --- a/support_formatter/server.py +++ b/support_formatter/server.py @@ -3,13 +3,15 @@ from gevent.monkey import patch_all; patch_all() from gevent.pywsgi import WSGIServer from .app import Application -from .routes import interface_routes, formatter_routes +from .routes import interface_routes, formatter_routes, redirect_routes from .config import APISettings, ServerSettings APISettings.FILE_SAVE_DIRECTORY.mkdir(parents=True, exist_ok=True) APP = Application.get_instance() app, api = APP.app, APP.api + +api.register_blueprint(redirect_routes) api.register_blueprint(interface_routes) api.register_blueprint(formatter_routes)