Skip to content

Commit

Permalink
feat: made api version a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Nov 4, 2024
1 parent eb5ec3d commit 96628bf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion horde/apis/apiv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
from flask_restx import Api

from horde.apis.v2 import api as v2
from horde.consts import HORDE_API_VERSION
from horde.vars import horde_contact_email, horde_title

blueprint = Blueprint("apiv2", __name__, url_prefix="/api")
api = Api(
blueprint,
version="2.0",
version=str(HORDE_API_VERSION),
title=f"{horde_title}",
description=f"The API documentation for the {horde_title}",
contact_email=horde_contact_email,
Expand Down
1 change: 1 addition & 0 deletions horde/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

HORDE_VERSION = "4.44.0"
HORDE_API_VERSION = "2.5"

WHITELISTED_SERVICE_IPS = {
"212.227.227.178", # Turing Bot
Expand Down
4 changes: 2 additions & 2 deletions horde/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from horde.classes.base import settings
from horde.classes.base.news import News
from horde.classes.base.user import User
from horde.consts import HORDE_VERSION
from horde.consts import HORDE_API_VERSION, HORDE_VERSION
from horde.countermeasures import CounterMeasures
from horde.database import functions as database
from horde.flask import HORDE, cache, db
Expand Down Expand Up @@ -410,7 +410,7 @@ def serviceinfo():
"api": {
"aihorde": {
"name": "AI Horde API",
"version": 2.20,
"version": HORDE_API_VERSION,
"base_url": f"{horde_url}/api/v2",
"documentation": f"{horde_url}/api",
},
Expand Down
2 changes: 1 addition & 1 deletion horde/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
horde_noun = os.getenv("HORDE_noun", "horde")
horde_url = os.getenv("HORDE_URL", "https://aihorde.net")
horde_repository = os.getenv("HORDE_REPOSITORY", "https://github.com/Haidra-Org/AI-Horde")
horde_logo = os.getenv("HORDE_logo", "https://aihorde.net/assets/img/logo.png")
horde_logo = os.getenv("HORDE_LOGO", "https://aihorde.net/assets/img/logo.png")
horde_contact_email = os.getenv("HORDE_EMAIL", "aihorde@dbzer0.com")
horde_instance_id = str(uuid4())

0 comments on commit 96628bf

Please sign in to comment.