parent
3e677afebc
commit
cde57f2604
2 changed files with 18 additions and 2 deletions
|
@ -4,6 +4,8 @@ import tomli
|
||||||
import pydantic
|
import pydantic
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
MAIN_VERSION = "0.0.1"
|
||||||
|
|
||||||
ROOT_DIR = Path().parent.resolve()
|
ROOT_DIR = Path().parent.resolve()
|
||||||
DB_PATH = ROOT_DIR / "data" / "database.db"
|
DB_PATH = ROOT_DIR / "data" / "database.db"
|
||||||
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_PATH}"
|
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_PATH}"
|
||||||
|
@ -39,6 +41,18 @@ def load_config() -> Config:
|
||||||
f"{_CONFIG_FILE} is missing"
|
f"{_CONFIG_FILE} is missing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_version_commit() -> str:
|
||||||
|
import subprocess
|
||||||
|
try:
|
||||||
|
return (
|
||||||
|
'+' +
|
||||||
|
subprocess.check_output(["git", "rev-parse", "--short=8", "HEAD"])
|
||||||
|
.split()[0]
|
||||||
|
.decode()
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
return "+dev"
|
||||||
|
|
||||||
CONFIG = load_config()
|
CONFIG = load_config()
|
||||||
DOMAIN = CONFIG.domain
|
DOMAIN = CONFIG.domain
|
||||||
_SCHEME = "https" if CONFIG.https else "http"
|
_SCHEME = "https" if CONFIG.https else "http"
|
||||||
|
@ -47,7 +61,8 @@ BASE_URL = ID
|
||||||
USERNAME = CONFIG.username
|
USERNAME = CONFIG.username
|
||||||
KEY_PATH = (ROOT_DIR / "data" / "key.pem")
|
KEY_PATH = (ROOT_DIR / "data" / "key.pem")
|
||||||
|
|
||||||
USER_AGENT = "Fediverse Application/Foxhole-0.0.1"
|
VERSION = "Foxhole-"+ MAIN_VERSION + get_version_commit()
|
||||||
|
USER_AGENT = "Fediverse Application/" + VERSION
|
||||||
AP_CONTENT_TYPE = "application/activity+json"
|
AP_CONTENT_TYPE = "application/activity+json"
|
||||||
|
|
||||||
MANUALLY_APPROVES_FOLLOWERS = CONFIG.manually_approves_followers
|
MANUALLY_APPROVES_FOLLOWERS = CONFIG.manually_approves_followers
|
||||||
|
|
|
@ -24,6 +24,7 @@ from app.config import BASE_URL
|
||||||
from app.config import DOMAIN
|
from app.config import DOMAIN
|
||||||
from app.config import ID
|
from app.config import ID
|
||||||
from app.config import USERNAME
|
from app.config import USERNAME
|
||||||
|
from app.config import VERSION
|
||||||
from app.database import AsyncSession
|
from app.database import AsyncSession
|
||||||
from app.database import get_db_session
|
from app.database import get_db_session
|
||||||
from app.boxes import save_incoming
|
from app.boxes import save_incoming
|
||||||
|
@ -109,7 +110,7 @@ async def nodeinfo(
|
||||||
"version": "2.0",
|
"version": "2.0",
|
||||||
"software": {
|
"software": {
|
||||||
"name": "foxhole",
|
"name": "foxhole",
|
||||||
"version": "0.0.1",
|
"version": VERSION,
|
||||||
},
|
},
|
||||||
"protocols": ["activitypub"],
|
"protocols": ["activitypub"],
|
||||||
"services": {"inbound": [], "outbound": []},
|
"services": {"inbound": [], "outbound": []},
|
||||||
|
|
Loading…
Reference in a new issue