wip: commit current progress for devolutions patch

This commit is contained in:
Parkreiner
2024-06-24 20:07:39 +00:00
parent 20795aa2b6
commit ff96b3f653
3 changed files with 283 additions and 4 deletions

View File

@@ -35,8 +35,8 @@ const SCREEN_POLL_INTERVAL_MS = 500;
* values from the Coder workspace.
*
* All properties should be defined as placeholder templates in the form
* {{ VALUE_NAME }}. The Coder module, when spun up, should then run some logic
* to replace the template slots with actual values. These values should never
* VALUE_NAME. The Coder module, when spun up, should then run some logic to
* replace the template slots with actual values. These values should never
* change from within JavaScript itself.
*
* @satisfies {FormFieldEntries}
@@ -48,7 +48,7 @@ const formFieldEntries = {
querySelector: "web-client-username-control input",
/** @readonly */
value: "{{ CODER_USERNAME }}",
value: "CODER_USERNAME",
},
/** @readonly */
@@ -57,7 +57,7 @@ const formFieldEntries = {
querySelector: "web-client-password-control input",
/** @readonly */
value: "{{ CODER_PASSWORD }}",
value: "CODER_PASSWORD",
},
};

View File

@@ -89,9 +89,25 @@ resource "coder_script" "windows-rdp" {
Start-Service 'DevolutionsGateway'
}
function Patch-Devolutions-HTML {
$root = "C:\Program Files\Devolutions\Gateway\webapp\client"
$devolutionsHtml = "$root\index.html"
$patch = '<script defer id="coder-patch" src="coder.js"></script>'
$isPatched = Select-String -Path "$devolutionsHtml" -Pattern "$patch"
if ($isPatched -e $null) {
"templatefile("${path.module}/devolutions-patch.js", {
CODER_USERNAME : var.admin_username,
CODER_PASSWORD : var.admin_password,
}" | Set-Content "$root\coder.js"
(Get-Content $devolutionsHtml).Replace('</app-root>', "</app-root>$patch") | Set-Content $devolutionsHtml
}
}
Set-AdminPassword -adminPassword "${var.admin_password}"
Configure-RDP
Install-DevolutionsGateway
Patch-Devolutions-HTML
EOF