Merge pull request #17 from VE-FORBRYDERNE/failsafe

Update client-side story name when saving
This commit is contained in:
henk717 2021-09-20 15:49:18 +02:00 committed by GitHub
commit b89a988ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -2050,6 +2050,11 @@ def saveRequest(savpath):
return e return e
file.close() file.close()
filename = path.basename(savpath)
if(filename.endswith('.json')):
filename = filename[:-5]
vars.laststory = filename
emit('from_server', {'cmd': 'setstoryname', 'data': vars.laststory}, broadcast=True)
print("{0}Story saved to {1}!{2}".format(colors.GREEN, path.basename(savpath), colors.END)) print("{0}Story saved to {1}!{2}".format(colors.GREEN, path.basename(savpath), colors.END))
#==================================================================# #==================================================================#

View File

@ -883,7 +883,7 @@ function downloadStory(format) {
authorsnote: $("#anoteinput").val(), authorsnote: $("#anoteinput").val(),
actions: actionlist_compiled, actions: actionlist_compiled,
worldinfo: wilist_compiled, worldinfo: wilist_compiled,
}, null, 4)])); }, null, 3)]));
anchor.setAttribute('href', objectURL); anchor.setAttribute('href', objectURL);
anchor.setAttribute('download', filename_without_extension + ".json"); anchor.setAttribute('download', filename_without_extension + ".json");
anchor.click(); anchor.click();