From 008f43db2c268291f6cfe4fe890dfbb9e79885ac Mon Sep 17 00:00:00 2001 From: kaniini Date: Mon, 3 Dec 2018 21:53:26 +0000 Subject: [PATCH] nodeinfo: add commit hash to version field to prevent scams --- relay/nodeinfo.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/relay/nodeinfo.py b/relay/nodeinfo.py index aa54964..5556e14 100644 --- a/relay/nodeinfo.py +++ b/relay/nodeinfo.py @@ -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,