Move config files and player-settings js files to /generated/configs and /generated/player-settings and update the pages that use them

This commit is contained in:
Chris Wilson 2021-10-11 21:37:08 -04:00
parent 79e33899a8
commit ef8af7d618
3 changed files with 10 additions and 4 deletions

View File

@ -32,7 +32,10 @@ def create():
dictify_range=dictify_range, default_converter=default_converter,
)
with open(os.path.join(target_folder, game_name + ".yaml"), "w") as f:
if not os.path.isdir(os.path.join(target_folder, 'configs')):
os.mkdir(os.path.join(target_folder, 'configs'))
with open(os.path.join(target_folder, 'configs', game_name + ".yaml"), "w") as f:
f.write(res)
# Generate JSON files for player-settings pages
@ -78,5 +81,8 @@ def create():
player_settings["gameOptions"] = game_options
with open(os.path.join(target_folder, game_name + ".json"), "w") as f:
if not os.path.isdir(os.path.join(target_folder, 'player-settings')):
os.mkdir(os.path.join(target_folder, 'player-settings'))
with open(os.path.join(target_folder, 'player-settings', game_name + ".json"), "w") as f:
f.write(json.dumps(player_settings, indent=2, separators=(',', ': ')))

View File

@ -61,7 +61,7 @@ const fetchSettingData = () => new Promise((resolve, reject) => {
try{ resolve(JSON.parse(ajax.responseText)); }
catch(error){ reject(error); }
};
ajax.open('GET', `${window.location.origin}/static/generated/${gameName}.json`, true);
ajax.open('GET', `${window.location.origin}/static/generated/player-settings/${gameName}.json`, true);
ajax.send();
});

View File

@ -21,7 +21,7 @@
A list of all games you have generated can be found <a href="/user-content">here</a>.
<br />
Advanced users can download a template file for this game
<a href="/static/generated/{{ game }}.yaml">here</a>.
<a href="/static/generated/configs/{{ game }}.yaml">here</a>.
</p>
<p><label for="player-name">Please enter your player name. This will appear in-game as you send and receive