diff --git a/call2api.py.py b/call2api.py.py index 6d8ef79..fa0ec6b 100644 --- a/call2api.py.py +++ b/call2api.py.py @@ -1,5 +1,3 @@ -from typing import Optional - import requests @@ -79,7 +77,6 @@ def delete_account(api_url: str, api_token: str, username: str) -> dict: return {"status_code": -1, "message": f"Request failed: {str(e)}"} -# print(set_quota("http://127.0.0.1:8000", "test", "test", 1000)) -# print(delete_account("http://127.0.0.1:8000", "test", "test")) +# print(set_quota("http://proxy.del.pw:50020", "test", "test", 1000)) +# print(delete_account("http://proxy.del.pw:50020", "test", "test")) # print(create_account("http://proxy.del.pw:50020", "test", "test", "test", 100)) -print(create_account("http://proxy.del.pw:50020", "test", "ritmas", "ritmas", 100)) diff --git a/config.py b/config.py index 592fd43..1f86752 100644 --- a/config.py +++ b/config.py @@ -5,9 +5,38 @@ import yaml CONFIG = {} STORAGE_ROOT = "" +DEFAULT_CONFIG = """# config.yaml +server: + host: 127.0.0.1 + port: 8000 + session_timeout: 3600 # Seconds + video_and_image_preview: true # Use as "CDN" or not + +security: + api_token: "test" # Change this in production + +storage: + root_dir: "./file_storage" # Where store files + default_quota_mb: 100 # Default amount of megabytes to user + +ui: + title: "Simple File Server" + contact_email: "del.pw.official@gmail.com" + disclaimer: "NO warranty or liability provided. You are SOLELY responsible for the files you upload. For deletion requests and claims use email on Telegram (prefered)" + disclaimer_ru: "НИКАКИХ гарантий не предоставляется. Вы несете ПОЛНУЮ ответственность за загружаемые вами файлы. Для запросов на удаление и претензий используйте электронную почту или Telegram (предпочтительно)" + register_info: 'RU: Для регистрации необходимо быть участником нашего чата, а затем прописать /reg_sfs и следовать инструкции бота.' + +logging: + enabled: false +""" + def load_config(): global CONFIG, STORAGE_ROOT + if not os.path.isfile("config.yaml"): + with open("config.yaml", "w") as f: + f.write(DEFAULT_CONFIG) + print("No config found. CREATED NEW config.yaml") with open("config.yaml", "r") as f: CONFIG = yaml.safe_load(f) STORAGE_ROOT = CONFIG["storage"]["root_dir"]