Merge pull request #22 from igor04091968/реконструкция-кода-репозитория-298c5

Update from task 9d312d5c-ebcc-4c50-a5f3-9e14f71298c5
This commit is contained in:
IgorRachkov
2026-05-08 20:52:49 +03:00
committed by GitHub
2 changed files with 63 additions and 37 deletions
+49 -33
View File
@@ -1,51 +1,67 @@
```
# Dependencies
node_modules/
package-lock.json
# Logs and temp files
*.log
# PowerShell/Windows specific
Thumbs.db
Desktop.ini
$RECYCLE.BIN/
System Volume Information/
*.tmp
*.log
# Environment
# Environment variables
.env
.env.local
*.env.*
# Editors
# IDE/Editor files
.vscode/
.idea/
*.swp
*.swo
# Python
# Dependencies and build artifacts
node_modules/
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.venv/
pip-log.txt
pip-delete-this-directory.txt
# Build directories
*.class
*.o
*.obj
*.exe
*.dll
*.so
*.a
*.out
dist/
build/
*.egg-info/
# Coverage
target/
.venv/
venv/
.mypy_cache/
.pytest_cache/
.coverage
coverage/
htmlcov/
.nyc_output/
.gradle/
# Testing
.pytest_cache/
.mypy_cache/
.tox/
.hypothesis/
# OS generated files
# System files
.DS_Store
Thumbs.db
```
*.zip
*.gz
*.tar
*.tgz
*.bz2
*.xz
*.7z
*.rar
*.zst
*.lz4
*.lzh
*.cab
*.arj
*.rpm
*.deb
*.Z
*.lz
*.lzo
*.tar.gz
*.tar.bz2
*.tar.xz
*.tar.zst
+14 -4
View File
@@ -48,6 +48,16 @@ function Get-DeploymentConfig {
return $null
}
function Invoke-AwJsonPost {
param(
[Parameter(Mandatory = $true)][string]$Uri,
[Parameter(Mandatory = $true)][string]$Json
)
$bytes = [Text.Encoding]::UTF8.GetBytes($Json)
Invoke-RestMethod -Method Post -Uri $Uri -ContentType 'application/json; charset=utf-8' -Body $bytes | Out-Null
}
$deploymentConfig = Get-DeploymentConfig -Path $ConfigPath
$resolvedServerHost = if ($ServerHost) { $ServerHost } elseif ($deploymentConfig) { [string]$deploymentConfig.server.host } else { throw 'ServerHost is required.' }
$resolvedServerPort = if ($PSBoundParameters.ContainsKey('ServerPort')) { $ServerPort } elseif ($deploymentConfig) { [int]$deploymentConfig.server.port } else { 5600 }
@@ -541,7 +551,7 @@ function Send-DlpIncidentHeartbeat {
} + $captureData
} | ConvertTo-Json -Depth 5 -Compress
Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null
Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event
}
function Get-FileSha256Hex {
@@ -707,7 +717,7 @@ function Ensure-Bucket {
hostname = $script:Hostname
} | ConvertTo-Json -Compress
Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$BucketId" -ContentType 'application/json' -Body $body | Out-Null
Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$BucketId" -Json $body
$script:KnownBuckets[$BucketId] = $true
}
@@ -733,7 +743,7 @@ function Send-Heartbeat {
}
} | ConvertTo-Json -Depth 4 -Compress
Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$BucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null
Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$BucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event
}
function Send-CategoryHeartbeat {
@@ -770,7 +780,7 @@ function Send-CategoryHeartbeat {
}
} | ConvertTo-Json -Depth 4 -Compress
Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null
Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event
}
Load-CustomCategoryRules -Path $resolvedRulesPath