fixed security bug

main
Nicholas Hope 2022-11-25 19:58:19 -05:00
parent 4e4c836705
commit c8d8bd7a64
1 changed files with 8 additions and 5 deletions

View File

@ -21,11 +21,12 @@ class Tooter(Mastodon):
hostname: str = '' hostname: str = ''
def __init__(self, name: str): def __init__(self, name: str):
cred_dict = self.credentials[name] self.name = name
cred_dict = self.credentials[self.name]
self.username = cred_dict['addr'] self.username = cred_dict['addr']
self.password = cred_dict['pass'] self.password = cred_dict['pass']
self.client_id = f'.toota-palooza.env' self.client_id = f'.toota-palooza.env'
self.cred_file = f'.toota-palooza-usercred-{name}.env' self.cred_file = f'.toota-palooza-usercred-{self.name}.env'
super().__init__(client_id=self.client_id, api_base_url=self.hostname) super().__init__(client_id=self.client_id, api_base_url=self.hostname)
@ -104,7 +105,8 @@ def daemon_main(tooter: Tooter):
def once(tooter: Tooter): def once(tooter: Tooter):
"""Run from a command line.""" """Run from a command line."""
message = check_public_timeline(tooter) # message = check_public_timeline(tooter)
message = f'{tooter.name} says hi!'
tooter.toot(message) tooter.toot(message)
return 0 return 0
@ -122,8 +124,9 @@ def main():
Tooter.load_credentials(args.file) Tooter.load_credentials(args.file)
if args.once: if args.once:
t = Tooter('nick') for name in Tooter.credentials:
once(t) t = Tooter(name)
once(t)
return 0 return 0
daemon_main(t) daemon_main(t)