anderlli0053 / DEV-tools

📦 General development tools for applications and games and pretty much everything else too :) . Created and maintained by Andrew Poženel - anderlli0053 . 📦
https://andrew-pozenel.xyz/
The Unlicense
105 stars 19 forks source link

ghproxy.net cannot be accessed #223

Closed dorian-li closed 4 months ago

dorian-li commented 4 months ago

It seems that all URLs using the ghproxy.net proxy cannot be accessed. Consider ghproxy.com or mirror.ghproxy.com?

anderlli0053 commented 4 months ago

As far as i can tell there are 6170 files that need to be changed... that's .. that's a lot and i don't have time right now to do this or to write a script... maybe later, but cannot do now... anyone can do a pull request to do this if they have time and if they want

found_files.txt

dorian-li commented 4 months ago

In fact, there are 6169 of them, because the specific_search_in_json.py you wrote is also included👀.

I used Powershell to write the following two scripts:

  1. Place it in the repo directory, count the number of files containing the ghproxy.net in the bucket folder of the repo
# CheckGhproxyInBucket.ps1
$searchString = "ghproxy.net"
$bucketPath = Join-Path -Path (Get-Location) -ChildPath "bucket"
$files = Get-ChildItem -Path $bucketPath -Recurse | Where-Object {!$_.PSIsContainer}
$matchCount = 0
foreach ($file in $files) {
    $containsMatch = Select-String -Path $file.FullName -Pattern $searchString -Quiet
    if ($containsMatch) {
        $matchCount++
    }
}
Write-Output "Number of files containing '$searchString': $matchCount"
  1. Place it in the repo directory, replace all ghproxy.net in all files in the bucket folder of the repo with ghproxy.com
# ReplaceGhproxyInBucket.ps1
$originalString = "ghproxy.net"
$targetString = "ghproxy.com"
$bucketPath = Join-Path -Path (Get-Location) -ChildPath "bucket"
$files = Get-ChildItem -Path $bucketPath -Recurse | Where-Object {!$_.PSIsContainer}
foreach ($file in $files) {
    if (Select-String -Path $file.FullName -Pattern $originalString -Quiet) {
        $content = Get-Content -Path $file.FullName -Raw
        $newContent = $content -replace $originalString, $targetString
        Set-Content -Path $file.FullName -Value $newContent
    }
}
Write-Output "Completed string replacement in files."

The modified PR following this process is here