Initial commit

This commit is contained in:
Micha Albert 2024-07-26 08:54:39 -07:00
commit 5ad56fac3f
No known key found for this signature in database
GPG key ID: 33149159A417BBCE
21 changed files with 808 additions and 0 deletions

30
stream/keygen/main.py Normal file
View file

@ -0,0 +1,30 @@
import secrets
import requests
import pickle
users = {}
with open('users.dat', 'rb') as f:
users = pickle.load(f)
def add_stream(stream):
requests.post('http://127.0.0.1:9997/v3/config/paths/add/' + stream, json={'name': stream})
def main():
print(users)
for user in users.values():
add_stream(user)
while True:
new_user = input('Enter new user\'s Slack ID: ')
if new_user in users:
print('User already exists.')
continue
users[new_user] = secrets.token_hex(32)
print(users[new_user])
add_stream(users[new_user])
with open('users.dat', 'wb') as f:
pickle.dump(users, f)
if __name__ == '__main__':
main()