nodeinfo: add commit hash to version field to prevent scams

develop
kaniini 2018-12-03 21:53:26 +00:00
parent e44544d22e
commit 008f43db2c
1 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import subprocess
import urllib.parse
import aiohttp.web
@ -6,6 +7,12 @@ from . import app
from .database import DATABASE
try:
commit_label = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode('ascii')
except:
commit_label = '???'
nodeinfo_template = {
# XXX - is this valid for a relay?
'openRegistrations': True,
@ -16,7 +23,7 @@ nodeinfo_template = {
},
'software': {
'name': 'activityrelay',
'version': '0.1'
'version': '0.1 {}'.format(commit_label)
},
'usage': {
'localPosts': 0,