diff --git a/ToggleGitTracking.ps1 b/ToggleGitTracking.ps1 new file mode 100644 index 000000000..05b86141c --- /dev/null +++ b/ToggleGitTracking.ps1 @@ -0,0 +1,48 @@ +param ( + [Parameter(Position=0, Mandatory=$false)] + [ValidateSet("t", "u")] + [string]$option +) + +# Define the directory to apply changes to +$targetDir = "components\wifi-manager\webapp\dist" + +# Get the current directory +$currentDir = Get-Location + +# Get list of files from the file system +$fsFiles = Get-ChildItem -Recurse $targetDir -File | ForEach-Object { + $_.FullName.Substring($currentDir.Path.Length + 1).Replace("\", "/") +} + +# Get list of files from the Git index +$indexFiles = git ls-files -s $targetDir | ForEach-Object { + ($_ -split "\s+")[3] +} + +# Combine and remove duplicates +$allFiles = $fsFiles + $indexFiles | Sort-Object -Unique + +# Apply the git command based on the option +$allFiles | ForEach-Object { + $relativePath = $_ + $isInIndex = $indexFiles -contains $relativePath + + if ($null -eq $option) { + $status = if ($isInIndex) { 'tracked' } else { 'not tracked' } + Write-Host "$relativePath is $status" + } + elseif ($isInIndex) { + if ($option -eq "t") { + git update-index --no-skip-worktree $relativePath + Write-Host "Started tracking changes in $relativePath" + } + elseif ($option -eq "u") { + git update-index --skip-worktree $relativePath + Write-Host "Stopped tracking changes in $relativePath" + } + } + else { + Write-Host "File $relativePath is not tracked." + } +} diff --git a/components/wifi-manager/webapp/src/index.ejs b/components/wifi-manager/webapp/src/index.ejs index 13bf7a4a8..8b70bcbcd 100644 --- a/components/wifi-manager/webapp/src/index.ejs +++ b/components/wifi-manager/webapp/src/index.ejs @@ -331,8 +331,7 @@
diff --git a/components/wifi-manager/webapp/src/js/custom.js b/components/wifi-manager/webapp/src/js/custom.js index 1c45d7a47..ddb6721b8 100644 --- a/components/wifi-manager/webapp/src/js/custom.js +++ b/components/wifi-manager/webapp/src/js/custom.js @@ -923,10 +923,10 @@ window.saveAutoexec1 = function (apply) { }; data.config = { autoexec1: { value: commandLine, type: 33 }, - autoexec: { - value: $('#disable-squeezelite').prop('checked') ? '0' : '1', - type: 33, - }, + // autoexec: { + // value: $('#disable-squeezelite').prop('checked') ? '0' : '1', + // type: 33, + // }, }; $.ajax({ @@ -1216,6 +1216,28 @@ $(document).ready(function () { } }); + $('#disable-squeezelite').on('click', function () { + // this.checked = this.checked ? 1 : 0; + // $('#disable-squeezelite').prop('checked') + if (this.checked) { + // Store the current value before overwriting it + const currentValue = $('#cmd_opt_s').val(); + $('#cmd_opt_s').data('originalValue', currentValue); + + // Overwrite the value with '-disable' + $('#cmd_opt_s').val('-disable'); + } else { + // Retrieve the original value + const originalValue = $('#cmd_opt_s').data('originalValue'); + + // Restore the original value if it exists, otherwise set it to an empty string + $('#cmd_opt_s').val(originalValue ? originalValue : ''); + } + + }); + + + $('input#show-nvs').on('click', function () { this.checked = this.checked ? 1 : 0; Cookies.set("show-nvs", this.checked ? 'Y' : 'N'); @@ -2199,13 +2221,7 @@ function getConfig() { .sort() .forEach(function (key) { let val = data[key].value; - if (key === 'autoexec') { - if (data.autoexec.value === '0') { - $('#disable-squeezelite')[0].checked = true; - } else { - $('#disable-squeezelite')[0].checked = false; - } - } else if (key === 'autoexec1') { + if (key === 'autoexec1') { /* call new function to parse the squeezelite options */ processSqueezeliteCommandLine(val); } else if (key === 'host_name') { @@ -2294,6 +2310,7 @@ function processSqueezeliteCommandLine(val) { commandBTSinkName= parsed.otherOptions.btname; } handleTemplateTypeRadio('bt'); + } Object.keys(parsed.options).forEach(function (key) { const option = parsed.options[key]; @@ -2312,6 +2329,17 @@ function processSqueezeliteCommandLine(val) { $('#resample_i').prop('checked', true); } } + if (parsed.options.hasOwnProperty('s')) { + // parse -u v[:i] and check the appropriate radio button with id #resample_v + if(parsed.options.s === '-disable'){ + $('#disable-squeezelite')[0].checked = true; + } + else { + $('#disable-squeezelite')[0].checked = false; + } + } + + }