From 6f1bb528bd6d7cf1ba9f04fa643fb9d7e7afc1df Mon Sep 17 00:00:00 2001 From: Bryan Gerlach Date: Thu, 25 Sep 2025 13:02:58 -0500 Subject: [PATCH] add settings for camera,terminal, and printer --- rdgenerator/forms.py | 3 +++ rdgenerator/templates/generator.html | 21 +++++++++++++++++++++ rdgenerator/views.py | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/rdgenerator/forms.py b/rdgenerator/forms.py index 1dfb011..f82c2b1 100644 --- a/rdgenerator/forms.py +++ b/rdgenerator/forms.py @@ -67,6 +67,9 @@ class GenerateForm(forms.Form): enableBlockingInput = forms.BooleanField(initial=True, required=False) enableRemoteModi = forms.BooleanField(initial=False, required=False) hidecm = forms.BooleanField(initial=False, required=False) + enablePrinter = forms.BooleanField(initial=True, required=False) + enableCamera = forms.BooleanField(initial=True, required=False) + enableTerminal = forms.BooleanField(initial=True, required=False) #Other removeWallpaper = forms.BooleanField(initial=True, required=False) diff --git a/rdgenerator/templates/generator.html b/rdgenerator/templates/generator.html index 1c70d96..865f337 100644 --- a/rdgenerator/templates/generator.html +++ b/rdgenerator/templates/generator.html @@ -333,6 +333,9 @@ + + +

Code Changes


@@ -406,6 +409,9 @@ const enableRecording = document.getElementById("{{ form.enableRecording.id_for_label }}"); const enableBlockingInput = document.getElementById("{{ form.enableBlockingInput.id_for_label }}"); const enableRemoteModi = document.getElementById("{{ form.enableRemoteModi.id_for_label }}"); + const enablePrinter = document.getElementById("{{ form.enablePrinter.id_for_label }}"); + const enableCamera = document.getElementById("{{ form.enableCamera.id_for_label }}"); + const enableTerminal = document.getElementById("{{ form.enableTerminal.id_for_label }}"); document.getElementById("{{ form.permissionsType.id_for_label }}").addEventListener('change', function() { if (this.value === 'full') { @@ -418,6 +424,9 @@ enableRecording.checked = true; enableBlockingInput.checked = true; enableRemoteModi.checked = true; + enablePrinter.checked = true; + enableCamera.checked = true; + enableTerminal.checked = true; enableKeyboard.disabled = true; enableClipboard.disabled = true; @@ -428,6 +437,9 @@ enableRecording.disabled = true; enableBlockingInput.disabled = true; enableRemoteModi.disabled = true; + enablePrinter.disabled = true; + enableCamera.disabled = true; + enableTerminal.disable = true; } else if (this.value === 'view') { enableKeyboard.checked = false; enableClipboard.checked = false; @@ -438,6 +450,9 @@ enableRecording.checked = false; enableBlockingInput.checked = false; enableRemoteModi.checked = false; + enablePrinter.checked = false; + enableCamera.checked = false; + enableTerminal.checked = false; enableKeyboard.disabled = true; enableClipboard.disabled = true; @@ -448,6 +463,9 @@ enableRecording.disabled = true; enableBlockingInput.disabled = true; enableRemoteModi.disabled = true; + enablePrinter.disabled = true; + enableCamera.disabled = true; + enableTerminal.disable = true; } else if (this.value === 'custom') { enableKeyboard.disabled = false; enableClipboard.disabled = false; @@ -458,6 +476,9 @@ enableRecording.disabled = false; enableBlockingInput.disabled = false; enableRemoteModi.disabled = false; + enablePrinter.checked = false; + enableCamera.checked = false; + enableTerminal.checked = false; } }); function previewImage(input, previewContainerId) { diff --git a/rdgenerator/views.py b/rdgenerator/views.py index b99e147..c2d6ae2 100644 --- a/rdgenerator/views.py +++ b/rdgenerator/views.py @@ -74,6 +74,9 @@ def generator_view(request): removeWallpaper = form.cleaned_data['removeWallpaper'] defaultManual = form.cleaned_data['defaultManual'] overrideManual = form.cleaned_data['overrideManual'] + enablePrinter = form.cleaned_data['enablePrinter'] + enableCamera = form.cleaned_data['enableCamera'] + enableTerminal = form.cleaned_data['enableTerminal'] if all(char.isascii() for char in filename): filename = re.sub(r'[^\w\s-]', '_', filename).strip() @@ -147,6 +150,9 @@ def generator_view(request): decodedCustom['default-settings']['approve-mode'] = passApproveMode decodedCustom['default-settings']['allow-hide-cm'] = 'Y' if hidecm else 'N' decodedCustom['default-settings']['allow-remove-wallpaper'] = 'Y' if removeWallpaper else 'N' + decodedCustom['default-settings']['enable-remote-printer'] = 'Y' if enablePrinter else 'N' + decodedCustom['default-settings']['enable-camera'] = 'Y' if enableCamera else 'N' + decodedCustom['default-settings']['enable-terminal'] = 'Y' if enableTerminal else 'N' else: decodedCustom['override-settings']['access-mode'] = permissionsType decodedCustom['override-settings']['enable-keyboard'] = 'Y' if enableKeyboard else 'N' @@ -163,6 +169,9 @@ def generator_view(request): decodedCustom['override-settings']['approve-mode'] = passApproveMode decodedCustom['override-settings']['allow-hide-cm'] = 'Y' if hidecm else 'N' decodedCustom['override-settings']['allow-remove-wallpaper'] = 'Y' if removeWallpaper else 'N' + decodedCustom['override-settings']['enable-remote-printer'] = 'Y' if enablePrinter else 'N' + decodedCustom['override-settings']['enable-camera'] = 'Y' if enableCamera else 'N' + decodedCustom['override-settings']['enable-terminal'] = 'Y' if enableTerminal else 'N' for line in defaultManual.splitlines(): k, value = line.split('=')