diff --git a/README.md b/README.md index 0108923..cc32fa9 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/blocksoft.py b/blocksoft.py index 9606718..4608c31 100644 --- a/blocksoft.py +++ b/blocksoft.py @@ -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 )