redlib-org / redlib-instances

GNU General Public License v3.0
48 stars 29 forks source link

Lazily check if onion or i2p sites exist in instances.json #54

Open sahal opened 3 months ago

sahal commented 3 months ago

A silly attempt to fix #53

no onion test

$ cat instances-noonion.txt
https://example.com/redlib,US,false,""
https://example.org/redlib,US,false,""
$ cat instances-noonion.json 
{
  "updated": "2024-07-15",
  "instances": [
    {
      "url": "https://example.com/redlib",
      "country": "US",
      "version": "v0.0.0"
    },
    {
      "url": "https://example.org/redlib",
      "country": "US",
      "version": "v0.0.0"
    }
  ]
}
$ ./generate-instances-json.sh -e -i ./instances-noonion.txt -I ./instances-noonion.json -o ./instances-noonion.json
https://example.com/redlib: FAILED
https://example.org/redlib: FAILED
The following instances could not be reached:
        https://example.com/redlib
        https://example.org/redlib

with onion test

$ cat instances-withonion.txt 
https://example.onion/redlib,US,false,""
https://example.i2p/redlib,US,false,""
$ cat instances-withonion.json 
{
  "updated": "2024-07-26",
  "instances": [
    {
      "onion": "https://example.onion/redlib",
      "country": "US",
      "version": "v0.0.0"
    },
    {
      "onion": "https://example.i2p/redlib",
      "country": "US",
      "version": "v0.0.0"
    }
  ]
}
$ ./generate-instances-json.sh -e -i ./instances-withonion.txt -I ./instances-withonion.json -o ./instances-withonion.json 
https://example.onion/redlib: SKIPPED
https://example.i2p/redlib: SKIPPED