Skip to content

Commit

Permalink
Merge pull request #12 from OpenIPC/master
Browse files Browse the repository at this point in the history
v1.0.6.1 Fix for settings corruption
  • Loading branch information
mikecarr authored Oct 5, 2024
2 parents e4dd36a + d9f22f3 commit 130684f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
9 changes: 8 additions & 1 deletion py_config_gs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,16 @@ def settings_view():

if request.method == "POST":
try:
config_files = request.form.getlist("config_files")
config_files_names = request.form.getlist("config_files_names")
config_files_paths = request.form.getlist("config_files_paths")
video_dir = request.form.get("VIDEO_DIR")
server_port = request.form.get("SERVER_PORT")

config_files = [
{"name": name, "path": path}
for name, path in zip(config_files_names, config_files_paths)
]

settings_data = {
"VIDEO_DIR": video_dir,
"SERVER_PORT": server_port,
Expand All @@ -294,5 +300,6 @@ def settings_view():
return render_template("settings.html", settings=settings)



if __name__ == "__main__":
app.run(host="0.0.0.0", port=SERVER_PORT)
6 changes: 3 additions & 3 deletions py_config_gs/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ul>
<li><a href="#configuration">Configuration</a></li>
<li><a href="#system-control">System Control</a></li>
<li><a href="#camera-control">Camera Control</a></li>
<!-- <li><a href="#camera-control">Camera Control</a></li> -->
</ul>
</div>

Expand Down Expand Up @@ -119,7 +119,7 @@ <h2>System Control</h2>
</table>
</div>

<div class="config-section" id="camera-control">
<!-- <div class="config-section" id="camera-control">
<h2>Camera Control</h2>
<div class="config-content"></div>
<h3><i>Work in Progress</i></h3>
Expand All @@ -132,7 +132,7 @@ <h3><i>Work in Progress</i></h3>
</select>
<button type="button" onclick="runCommand()">Run</button>
</form>
</div>
</div> -->

<script>
function runCommand() {
Expand Down
21 changes: 10 additions & 11 deletions py_config_gs/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ <h2>Configuration Files</h2>
<div id="config-files">
{% for file in settings.config_files %}
<div>
<label for="file_{{ loop.index0 }}">Name:</label>
<input type="text" name="config_files" id="file_{{ loop.index0 }}" value="{{ file.name }}">
<label for="path_{{ loop.index0 }}">Path:</label>
<input type="text" name="path_{{ loop.index0 }}" id="path_{{ loop.index0 }}" value="{{ file.path }}">
<label for="file_name_{{ loop.index0 }}">Name:</label>
<input type="text" name="config_files_names" id="file_name_{{ loop.index0 }}" value="{{ file.name }}">
<label for="file_path_{{ loop.index0 }}">Path:</label>
<input type="text" name="config_files_paths" id="file_path_{{ loop.index0 }}" value="{{ file.path }}">
</div>
{% endfor %}
</div>
Expand All @@ -33,20 +33,19 @@ <h2>Additional Settings</h2>
</form>
</div>


<script>
document.getElementById('add-file').addEventListener('click', function () {
const configFilesDiv = document.getElementById('config-files');
const index = configFilesDiv.children.length;
const newFileDiv = document.createElement('div');
newFileDiv.innerHTML = `
<label for="file_${index}">Name:</label>
<input type="text" name="config_files" id="file_${index}" value="">
<label for="path_${index}">Path:</label>
<input type="text" name="path_${index}" id="path_${index}" value="">
`;
<label for="file_name_${index}">Name:</label>
<input type="text" name="config_files_names" id="file_name_${index}" value="">
<label for="file_path_${index}">Path:</label>
<input type="text" name="config_files_paths" id="file_path_${index}" value="">
`;
configFilesDiv.appendChild(newFileDiv);
});
</script>

{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion py_config_gs/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.5-next
1.0.6
1 change: 1 addition & 0 deletions release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.6 : removed, there is an issue with the settings file getting corrupted when adding a new file in settings

0 comments on commit 130684f

Please sign in to comment.