nodeinfo: add commit hash to version field to prevent scams

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