From bc5e6008ae36320c1e89a3d7bc8f40e3819d0cd8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 12 Oct 2021 12:09:04 +0100 Subject: [PATCH] Extract instance metadata rules from tos --- default_tos.md | 2 +- metadata.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/default_tos.md b/default_tos.md index eb28005c6..aba3c464e 100644 --- a/default_tos.md +++ b/default_tos.md @@ -24,7 +24,7 @@ Moderators rely upon your reports. Don't assume that something of concern has al Content found to be non-compliant with this policy will be removed and any accounts on this instance producing, repeating or linking to such content will be deleted typically without prior notification. ### Federation Policy -In a proactive effort to avoid the classic fate of *"embrace, extend, extinguish"* this system will block any instance launched, acquired or funded by Alphabet, Facebook, Twitter, Microsoft, Apple, Amazon, Elsevier or other monopolistic Silicon Valley companies. +In a proactive effort to avoid the classic fate of *"embrace, extend, extinguish"* this system will block any instance launched, acquired or funded by Alphabet/Google, Facebook, Twitter, Microsoft, Apple, Amazon, Elsevier or other monopolistic Silicon Valley companies. This system will not federate with instances whose moderation policy is incompatible with the content policy described above. If an instance lacks a moderation policy, or refuses to enforce one, it will be assumed to be incompatible. diff --git a/metadata.py b/metadata.py index 130505b80..33167b7a2 100644 --- a/metadata.py +++ b/metadata.py @@ -101,6 +101,25 @@ def metaDataInstance(showAccounts: bool, print('WARN: json load exception metaDataInstance') return {} + rulesList = [] + rulesFilename = \ + baseDir + '/accounts/tos.md' + if os.path.isfile(rulesFilename): + with open(rulesFilename, 'r') as fp: + rulesLines = fp.readlines() + ruleCtr = 1 + for line in rulesLines: + line = line.strip() + if not line: + continue + if line.startswith('#'): + continue + rulesList.append({ + 'id': str(ruleCtr), + 'text': line + }) + ruleCtr += 1 + isBot = False isGroup = False if adminActor['type'] == 'Group': @@ -123,8 +142,6 @@ def metaDataInstance(showAccounts: bool, if adminActor.get('published'): createdAt = adminActor['published'] - rulesList = [] - instance = { 'approval_required': False, 'invites_enabled': False,