Tweak version and nodeinfo

This commit is contained in:
Thomas Sileo 2019-07-07 21:09:04 +02:00
parent ffdc6e781b
commit e333089895
2 changed files with 6 additions and 4 deletions

5
app.py
View file

@ -82,6 +82,7 @@ from config import PASS
from config import USER_AGENT from config import USER_AGENT
from config import USERNAME from config import USERNAME
from config import VERSION from config import VERSION
from config import VERSION_DATE
from config import _drop_db from config import _drop_db
from poussetaches import PousseTaches from poussetaches import PousseTaches
from tasks import Tasks from tasks import Tasks
@ -1069,7 +1070,7 @@ def nodeinfo():
"version": "2.0", "version": "2.0",
"software": { "software": {
"name": "microblogpub", "name": "microblogpub",
"version": f"Microblog.pub {VERSION}", "version": f"Microblog.pub {VERSION} ({VERSION_DATE})",
}, },
"protocols": ["activitypub"], "protocols": ["activitypub"],
"services": {"inbound": [], "outbound": []}, "services": {"inbound": [], "outbound": []},
@ -1078,6 +1079,8 @@ def nodeinfo():
"metadata": { "metadata": {
"sourceCode": "https://github.com/tsileo/microblog.pub", "sourceCode": "https://github.com/tsileo/microblog.pub",
"nodeName": f"@{USERNAME}@{DOMAIN}", "nodeName": f"@{USERNAME}@{DOMAIN}",
"version": VERSION,
"version_date": VERSION_DATE,
}, },
} }
) )

View file

@ -45,14 +45,13 @@ except ModuleNotFoundError:
VERSION = ( VERSION = (
subprocess.check_output(["git", "describe", "--always"]).split()[0].decode("utf-8") subprocess.check_output(["git", "describe", "--always"]).split()[0].decode("utf-8")
) )
_version_date = ( VERSION_DATE = (
subprocess.check_output(["git", "show", "6daf8d6"]) subprocess.check_output(["git", "show", VERSION])
.decode() .decode()
.splitlines()[2] .splitlines()[2]
.split("Date:")[-1] .split("Date:")[-1]
.strip() .strip()
) )
VERSION = f"{VERSION} ({_version_date})"
DEBUG_MODE = strtobool(os.getenv("MICROBLOGPUB_DEBUG", "false")) DEBUG_MODE = strtobool(os.getenv("MICROBLOGPUB_DEBUG", "false"))