Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGPLv3+ license #34

Merged
merged 6 commits into from
Aug 19, 2023
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
661 changes: 661 additions & 0 deletions COPYING

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions LICENSE

This file was deleted.

14 changes: 14 additions & 0 deletions src/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
"""
Link shortener API.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
16 changes: 16 additions & 0 deletions src/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
"""
URL shortener API Flask application.
Used to be run with Gunicorn or externally with Docker.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

import logging
Expand Down Expand Up @@ -43,11 +57,13 @@ def _create_app(for_testing: bool = False) -> Flask:
from app.views.urls import bp_urls
from app.views.pastes import bp_pastes
from app.exception_handlers import bp_handlers
from app.views.source import bp_source

PROXY_PREFIX = _app.config["PROXY_PREFIX"]
_app.register_blueprint(bp_utils, url_prefix=f"{PROXY_PREFIX}/utils")
_app.register_blueprint(bp_urls, url_prefix=f"{PROXY_PREFIX}/urls")
_app.register_blueprint(bp_pastes, url_prefix=f"{PROXY_PREFIX}/pastes")
_app.register_blueprint(bp_source, url_prefix=f"{PROXY_PREFIX}/source")
_app.register_blueprint(bp_handlers)

if _app.config["GATEY_IS_ENABLED"]:
Expand Down
14 changes: 14 additions & 0 deletions src/app/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
Config files.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

import os
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
Database package for working with DBMS and ORM models.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

from app.database.core import db
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
Database core sessions / sessionmakers and migrations.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

from flask_sqlalchemy import SQLAlchemy
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
CRUD ORM (database) utils for the app.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from . import redirect_url, url_view, user_agent, referer, user, paste_url

Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/paste_url.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
PasteUrl CRUD urils for the database.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from hashids import Hashids
from flask_sqlalchemy import SQLAlchemy
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/redirect_url.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
RedirectUrl CRUD utils for the database.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from flask import current_app
from flask_sqlalchemy import SQLAlchemy
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/referer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
CRUD for Referer database model.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from flask_sqlalchemy import SQLAlchemy

Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/url_view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
CRUD for UrlView model.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

from flask_sqlalchemy import SQLAlchemy
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
CRUD for User database model.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from flask_sqlalchemy import SQLAlchemy
from app.database.models.user import User
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/crud/user_agent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
CRUD for UserAgent database model.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""


Expand Down
14 changes: 14 additions & 0 deletions src/app/database/mixins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
Mixins for database tables.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import re
from datetime import datetime, timedelta
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!env/bin/python
"""
ORM models.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

__all__ = []
14 changes: 14 additions & 0 deletions src/app/database/models/referer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
"""
Referer database model.
Provides data about Referers after url opening.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from app.database import db
from app.database.mixins import CommonMixin
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/models/url/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
"""
URL database models.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from .paste_url import PasteUrl
from .redirect_url import RedirectUrl
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/models/url/paste_url.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
"""
URL Database model.
Provides PasteUrl database model.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from app.database.mixins import UrlMixin, TimestampMixin, CommonMixin
from app.database import db
Expand Down
14 changes: 14 additions & 0 deletions src/app/database/models/url/redirect_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
"""
URL Database model.
Provides RedirectUrl class that contains where to redirect and other stuff.
Copyright (C) 2022-2023 Stepan Zubkov <stepanzubkov@florgon.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from app.database import db
from app.database.mixins import CommonMixin, TimestampMixin, UrlMixin
Expand Down
Loading