Skip to content

Commit 130684f

Browse files
authored
Merge pull request #12 from OpenIPC/master
v1.0.6.1 Fix for settings corruption
2 parents e4dd36a + d9f22f3 commit 130684f

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

py_config_gs/app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,16 @@ def settings_view():
274274

275275
if request.method == "POST":
276276
try:
277-
config_files = request.form.getlist("config_files")
277+
config_files_names = request.form.getlist("config_files_names")
278+
config_files_paths = request.form.getlist("config_files_paths")
278279
video_dir = request.form.get("VIDEO_DIR")
279280
server_port = request.form.get("SERVER_PORT")
280281

282+
config_files = [
283+
{"name": name, "path": path}
284+
for name, path in zip(config_files_names, config_files_paths)
285+
]
286+
281287
settings_data = {
282288
"VIDEO_DIR": video_dir,
283289
"SERVER_PORT": server_port,
@@ -294,5 +300,6 @@ def settings_view():
294300
return render_template("settings.html", settings=settings)
295301

296302

303+
297304
if __name__ == "__main__":
298305
app.run(host="0.0.0.0", port=SERVER_PORT)

py_config_gs/templates/home.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ul>
1010
<li><a href="#configuration">Configuration</a></li>
1111
<li><a href="#system-control">System Control</a></li>
12-
<li><a href="#camera-control">Camera Control</a></li>
12+
<!-- <li><a href="#camera-control">Camera Control</a></li> -->
1313
</ul>
1414
</div>
1515

@@ -119,7 +119,7 @@ <h2>System Control</h2>
119119
</table>
120120
</div>
121121

122-
<div class="config-section" id="camera-control">
122+
<!-- <div class="config-section" id="camera-control">
123123
<h2>Camera Control</h2>
124124
<div class="config-content"></div>
125125
<h3><i>Work in Progress</i></h3>
@@ -132,7 +132,7 @@ <h3><i>Work in Progress</i></h3>
132132
</select>
133133
<button type="button" onclick="runCommand()">Run</button>
134134
</form>
135-
</div>
135+
</div> -->
136136

137137
<script>
138138
function runCommand() {

py_config_gs/templates/settings.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ <h2>Configuration Files</h2>
1010
<div id="config-files">
1111
{% for file in settings.config_files %}
1212
<div>
13-
<label for="file_{{ loop.index0 }}">Name:</label>
14-
<input type="text" name="config_files" id="file_{{ loop.index0 }}" value="{{ file.name }}">
15-
<label for="path_{{ loop.index0 }}">Path:</label>
16-
<input type="text" name="path_{{ loop.index0 }}" id="path_{{ loop.index0 }}" value="{{ file.path }}">
13+
<label for="file_name_{{ loop.index0 }}">Name:</label>
14+
<input type="text" name="config_files_names" id="file_name_{{ loop.index0 }}" value="{{ file.name }}">
15+
<label for="file_path_{{ loop.index0 }}">Path:</label>
16+
<input type="text" name="config_files_paths" id="file_path_{{ loop.index0 }}" value="{{ file.path }}">
1717
</div>
1818
{% endfor %}
1919
</div>
@@ -33,20 +33,19 @@ <h2>Additional Settings</h2>
3333
</form>
3434
</div>
3535

36-
3736
<script>
3837
document.getElementById('add-file').addEventListener('click', function () {
3938
const configFilesDiv = document.getElementById('config-files');
4039
const index = configFilesDiv.children.length;
4140
const newFileDiv = document.createElement('div');
4241
newFileDiv.innerHTML = `
43-
<label for="file_${index}">Name:</label>
44-
<input type="text" name="config_files" id="file_${index}" value="">
45-
<label for="path_${index}">Path:</label>
46-
<input type="text" name="path_${index}" id="path_${index}" value="">
47-
`;
42+
<label for="file_name_${index}">Name:</label>
43+
<input type="text" name="config_files_names" id="file_name_${index}" value="">
44+
<label for="file_path_${index}">Path:</label>
45+
<input type="text" name="config_files_paths" id="file_path_${index}" value="">
46+
`;
4847
configFilesDiv.appendChild(newFileDiv);
4948
});
5049
</script>
5150

52-
{% endblock %}
51+
{% endblock %}

py_config_gs/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.5-next
1+
1.0.6

release.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.6 : removed, there is an issue with the settings file getting corrupted when adding a new file in settings

0 commit comments

Comments
 (0)