Added private and public comments

This commit is contained in:
spla 2022-08-31 08:12:27 +02:00
pare c98013f377
commit 1281d4bf8e
S'han modificat 2 arxius amb 13 adicions i 5 eliminacions

Veure arxiu

@ -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. 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. 4. Run `python blocksoft.py` (or `sqlite-bs.py` for sqlite3 version) to block the configured software.

Veure arxiu

@ -109,13 +109,15 @@ class DomainBlocks():
return (mastodon, self.mastodon_hostname, headers) return (mastodon, self.mastodon_hostname, headers)
def domain_blocks_create(self, server): def domain_blocks_create(self, server, priv_comment, pub_comment):
data = { data = {
'domain': server, 'domain': server,
'severity': 'suspend', 'severity': 'suspend',
'reject_media': 'true', 'reject_media': 'true',
'reject_reports': 'true', 'reject_reports': 'true',
'private_comment': priv_comment,
'public_comment': pub_comment,
'obfuscate': 'true', 'obfuscate': 'true',
} }
@ -486,9 +488,15 @@ if __name__ == '__main__':
Lines = soft_file.readlines() 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}...') print(f'checking software {software}...')
@ -496,7 +504,7 @@ if __name__ == '__main__':
for server in servers_list: for server in servers_list:
blocker.domain_blocks_create(server) blocker.domain_blocks_create(server, private_comment, public_comment )