Skip to content

Commit

Permalink
Added dynamic rules link to config and escaped slashes.
Browse files Browse the repository at this point in the history
If you know what you're doing you can add in your own dynamic rules link.

There's usually a pull request with the updated rules.

https://github.com/DATAHOARDERS/dynamic-rules

Helpful if I'm afk and someone already has the updated rules.
  • Loading branch information
UltimaHoarder committed May 25, 2021
1 parent 5f86596 commit 77fd03e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion apis/api_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, original_sessions=[], headers: dict = {}, session_rules=None,
self.headers = headers
self.session_rules = session_rules
self.session_retry_rules = session_retry_rules
dr_link = "https://raw.githubusercontent.com/DATAHOARDERS/dynamic-rules/main/onlyfans.json"
dr_link = global_settings["dynamic_rules_link"]
dynamic_rules = requests.get(dr_link).json()
self.dynamic_rules = dynamic_rules

Expand Down
17 changes: 4 additions & 13 deletions classes/make_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@
from classes.prepare_metadata import format_types
import uuid as uuid


def export_json(path, metadata):
if "auth" not in metadata:
auth = {}
auth["auth"] = metadata
metadata = auth
with open(path, 'w', encoding='utf-8') as outfile:
ujson.dump(metadata, outfile, indent=2, escape_forward_slashes=False)


def fix(config={}):
info = config.get("info")
if not info:
print("If you're not using >= v7 release, please download said release so the script can properly update your config. \nIf you're using >= v7 release or you don't care about your current config settings, press enter to continue.")
print("If you're not using >= v7 release, please download said release so the script can properly update your config. \nIf you're using >= v7 release or you don't care about your current config settings, press enter to continue. If script crashes, delete config.")
input()
return config

Expand All @@ -32,7 +22,7 @@ def __init__(self) -> None:
self.version = 7.1

class Settings(object):
def __init__(self, auto_site_choice="", profile_directories=[".profiles"], export_type="json", max_threads=-1, min_drive_space=0, helpers={}, webhooks={}, exit_on_completion=False, infinite_loop=True, loop_timeout="0", proxies=[], cert="", random_string=""):
def __init__(self, auto_site_choice="", profile_directories=[".profiles"], export_type="json", max_threads=-1, min_drive_space=0, helpers={}, webhooks={}, exit_on_completion=False, infinite_loop=True, loop_timeout="0", dynamic_rules_link="https://raw.githubusercontent.com/DATAHOARDERS/dynamic-rules/main/onlyfans.json", proxies=[], cert="", random_string=""):
class webhooks_settings:
def __init__(self, option={}) -> None:
class webhook_template:
Expand Down Expand Up @@ -85,6 +75,7 @@ def __init__(self, option={}) -> None:
self.exit_on_completion = exit_on_completion
self.infinite_loop = infinite_loop
self.loop_timeout = loop_timeout
self.dynamic_rules_link = dynamic_rules_link
self.proxies = proxies
self.cert = cert
self.random_string = random_string if random_string else uuid.uuid1().hex
Expand Down Expand Up @@ -129,7 +120,7 @@ def __init__(self, option={}) -> None:
'posts', True)
self.comments = option.get(
'comments', True)
self.auto_profile_choice:Union[List] = option.get(
self.auto_profile_choice: Union[List] = option.get(
'auto_profile_choice', [])
self.auto_model_choice = option.get(
'auto_model_choice', False)
Expand Down
11 changes: 2 additions & 9 deletions helpers/main_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,22 +513,15 @@ def get_config(config_path):
updated = False
if json_config != json_config2:
updated = True
update_config(json_config, file_name=file_name)
filepath = os.path.join(".settings", "config.json")
export_data(json_config, filepath)
if not json_config:
input(
f"The .settings\\{file_name} file has been created. Fill in whatever you need to fill in and then press enter when done.\n")
json_config = ujson.load(open(config_path))
return json_config, updated


def update_config(json_config, file_name="config.json"):
directory = '.settings'
os.makedirs(directory, exist_ok=True)
path = os.path.join(directory, file_name)
with open(path, 'w', encoding='utf-8') as f:
ujson.dump(json_config, f, ensure_ascii=False, indent=2)


def choose_auth(array):
names = []
array = [{"auth_count": -1, "username": "All"}]+array
Expand Down

0 comments on commit 77fd03e

Please sign in to comment.