error handling for missing hdf user/pass when uploading
This commit is contained in:
9
main.rc
9
main.rc
@@ -112,7 +112,7 @@ OPTIONS=runmode:teleport
|
|||||||
|
|
||||||
OPTIONS=quick_farsight
|
OPTIONS=quick_farsight
|
||||||
|
|
||||||
{% if commenst %}
|
{% if comments %}
|
||||||
# whatis_coord: coordinates to display when looking around the map with the whatis or farlook commands
|
# whatis_coord: coordinates to display when looking around the map with the whatis or farlook commands
|
||||||
# c: compass ('east' or '3s' or '2n,4w')
|
# c: compass ('east' or '3s' or '2n,4w')
|
||||||
# f: full compass ('east' or '3south' or '2north,4west')
|
# f: full compass ('east' or '3south' or '2north,4west')
|
||||||
@@ -127,7 +127,8 @@ OPTIONS=whatis_coord:c
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
OPTIONS=!implicit_uncursed
|
OPTIONS=!implicit_uncursed
|
||||||
|
|
||||||
{% if base37 %}
|
{%- if base37 %}
|
||||||
|
|
||||||
{% if comments %}
|
{% if comments %}
|
||||||
# tutorial: play a tutorial level at the start of the game
|
# tutorial: play a tutorial level at the start of the game
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -153,7 +154,8 @@ OPTIONS=cond_held,cond_ice,cond_lava,cond_woundedlegs,cond_slip
|
|||||||
|
|
||||||
{% if comments %}
|
{% if comments %}
|
||||||
# paranoid_confirmation: space-separated list of specific situations where alternate prompting is desired
|
# paranoid_confirmation: space-separated list of specific situations where alternate prompting is desired
|
||||||
# Confirm: for any prompts which are set to require 'yes' rather than 'y', also require 'no' to reject instead of accepting any non-yes response as no
|
# Confirm: for any prompts which are set to require 'yes' rather than 'y',
|
||||||
|
# also require 'no' to reject instead of accepting any non-yes response as no
|
||||||
# quit: require 'yes' rather than 'y' to confirm quitting or switching into explore mode
|
# quit: require 'yes' rather than 'y' to confirm quitting or switching into explore mode
|
||||||
# die: require 'yes' rather than 'y' to confirm dying in explore mode
|
# die: require 'yes' rather than 'y' to confirm dying in explore mode
|
||||||
# bones: require 'yes' rather than 'y' to confirm saving bones data on death in debug mode
|
# bones: require 'yes' rather than 'y' to confirm saving bones data on death in debug mode
|
||||||
@@ -172,6 +174,7 @@ OPTIONS=cond_held,cond_ice,cond_lava,cond_woundedlegs,cond_slip
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
OPTIONS=paranoid_confirmation:pray Remove{{ " AutoAll trap swim" if base37 }}
|
OPTIONS=paranoid_confirmation:pray Remove{{ " AutoAll trap swim" if base37 }}
|
||||||
{# block for additional options to keep main set of options together #}
|
{# block for additional options to keep main set of options together #}
|
||||||
|
|
||||||
{% block options %}
|
{% block options %}
|
||||||
{% endblock options %}
|
{% endblock options %}
|
||||||
|
|
||||||
|
|||||||
12
render.py
12
render.py
@@ -16,9 +16,15 @@ def upload(rcfile, variant):
|
|||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
base_url = f"https://www.hardfought.org/nh/{variant}"
|
base_url = f"https://www.hardfought.org/nh/{variant}"
|
||||||
|
|
||||||
|
hdf_username = os.getenv("HDF_USERNAME")
|
||||||
|
hdf_password = os.getenv("HDF_PASSWORD")
|
||||||
|
if hdf_username is None or hdf_password is None or len(hdf_username) == 0 or len(hdf_password) == 0:
|
||||||
|
print("To upload config to hardfought you must specify HDF_USERNAME and HDF_PASSWORD in .env")
|
||||||
|
return False
|
||||||
|
|
||||||
login = s.post(f"{base_url}/login.php", {
|
login = s.post(f"{base_url}/login.php", {
|
||||||
"username": os.getenv("HDF_USERNAME"),
|
"username": hdf_username,
|
||||||
"password": os.getenv("HDF_PASSWORD"),
|
"password": hdf_password,
|
||||||
"submit": "Login",
|
"submit": "Login",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -64,7 +70,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
render_params = vars(args).copy()
|
render_params = vars(args).copy()
|
||||||
jnh = os.getenv("JNH_USERNAME")
|
jnh = os.getenv("JNH_USERNAME")
|
||||||
if jnh != None and len(jnh) > 0:
|
if jnh is not None and len(jnh) > 0:
|
||||||
render_params['jnh_username'] = jnh
|
render_params['jnh_username'] = jnh
|
||||||
|
|
||||||
rcfile = render(args.template, render_params)
|
rcfile = render(args.template, render_params)
|
||||||
|
|||||||
Reference in New Issue
Block a user