Added private and public comments

master
spla 3 months ago
parent c98013f377
commit 1281d4bf8e
  1. 2
      README.md
  2. 16
      blocksoft.py

@ -16,7 +16,7 @@ Within Python Virtual Environment:
2. Run `python peers.py` (or `sqlite-peers.py` for sqlite3 version) to collect and store all needed data from your server peers.
3. Edit `software.txt` file, add the software you want to block, one per line, and save it.
3. Edit `software.txt` file, add the software you want to block and the reason to do it, one pair software and reason per line, separating software and reason with a single space. Then save it.
4. Run `python blocksoft.py` (or `sqlite-bs.py` for sqlite3 version) to block the configured software.

@ -109,13 +109,15 @@ class DomainBlocks():
return (mastodon, self.mastodon_hostname, headers)
def domain_blocks_create(self, server):
def domain_blocks_create(self, server, priv_comment, pub_comment):
data = {
'domain': server,
'severity': 'suspend',
'reject_media': 'true',
'reject_reports': 'true',
'private_comment': priv_comment,
'public_comment': pub_comment,
'obfuscate': 'true',
}
@ -486,9 +488,15 @@ if __name__ == '__main__':
Lines = soft_file.readlines()
for software in Lines:
for softline in Lines:
software = software.replace('\n', '')
split_char = ' '
software = softline.partition(split_char)[0]
private_comment = softline.partition(split_char)[2]
public_comment = softline.partition(split_char)[2]
print(f'checking software {software}...')
@ -496,7 +504,7 @@ if __name__ == '__main__':
for server in servers_list:
blocker.domain_blocks_create(server)
blocker.domain_blocks_create(server, private_comment, public_comment )

Loading…
Cancel
Save