Skip to content

Commit

Permalink
Update itt.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
emadadel4 committed Nov 21, 2024
1 parent 3bfd443 commit 039e616
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions itt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7227,6 +7227,7 @@ function Startup {
}



function Get-PCInfo {
param (
[string]$FirebaseUrl = "https://ittools-7d9fe-default-rtdb.firebaseio.com/Users"
Expand All @@ -7238,12 +7239,9 @@ function Startup {
$firebaseUrlWithKey = "$FirebaseUrl/$Key.json"
$firebaseUrlRoot = "$FirebaseUrl.json"

# Count the number of keys under the root
$response = Invoke-RestMethod -Uri $firebaseUrlRoot -Method Get -ErrorAction SilentlyContinue
$totalKeys = ($response | Get-Member -MemberType NoteProperty | Measure-Object).Count


# Display information
Write-Host "`nITT has been used on $totalKeys devices worldwide.`n" -ForegroundColor White


# Fetch existing data for the key, if available
Expand All @@ -7256,14 +7254,23 @@ function Startup {
else
{
1
Telegram -Message " 🎉 A new device is now running ITT!`n`🌍 Total users worldwide: $totalKeys"
}

# Update Firebase with the new value
$updateData = @{ runs = $runs } | ConvertTo-Json -Depth 10
Invoke-RestMethod -Uri $firebaseUrlWithKey -Method Put -Body $updateData -Headers @{ "Content-Type" = "application/json" } -ErrorAction SilentlyContinue



# Count the number of keys under the root
$response = Invoke-RestMethod -Uri $firebaseUrlRoot -Method Get -ErrorAction SilentlyContinue
$totalKeys = ($response | Get-Member -MemberType NoteProperty | Measure-Object).Count

if (-not $existingData) {
Telegram -Message " 🎉 A new device is now running ITT!`n`🌍 Total users worldwide: $totalKeys"
}else{
Telegram -Message "A computer is currently running ITT."
}

Write-Host "`nITT has been used on $totalKeys devices worldwide.`n" -ForegroundColor White

# Force garbage collection to free memory
[System.GC]::Collect()
Expand Down

0 comments on commit 039e616

Please sign in to comment.