Fixes for lists.json to correct internal url
All checks were successful
release-tag / release-image (push) Successful in 1m51s
All checks were successful
release-tag / release-image (push) Successful in 1m51s
This commit is contained in:
13
main.go
13
main.go
@@ -41,7 +41,7 @@ import (
|
||||
// ──────────────────────────────────────────────────────────────────────────────
|
||||
// Config
|
||||
// ──────────────────────────────────────────────────────────────────────────────
|
||||
const defaultDelay = 5 * time.Second // default gap between two downloads
|
||||
const defaultDelay = 2 * time.Second // default gap between two downloads
|
||||
|
||||
var defaultLists = map[string]string{
|
||||
"bitwire": "https://raw.githubusercontent.com/bitwire-it/ipblocklist/refs/heads/main/ip-list.txt",
|
||||
@@ -603,6 +603,7 @@ func main() {
|
||||
outDir := flag.String("out", "./lists/", "target directory")
|
||||
listFile := flag.String("list", "", "optional text file with URLs or Name|URL pairs (overrides built-in map)")
|
||||
listenAddr := flag.String("listen", ":8080", "HTTP listen address (e.g. :8080 or 127.0.0.1:8000)")
|
||||
listenPrefix := flag.String("prefix", "http://importer:8080", "HTTP prefix for url in /lists.json")
|
||||
flag.Parse()
|
||||
|
||||
if *serveonly != "1" {
|
||||
@@ -654,7 +655,15 @@ func main() {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
enc := json.NewEncoder(w)
|
||||
enc.SetIndent("", " ")
|
||||
if err := enc.Encode(defaultLists); err != nil {
|
||||
data, err := buildIndexData(*outDir)
|
||||
if err != nil {
|
||||
fmt.Println("Error Build-Index")
|
||||
}
|
||||
d := map[string]string{}
|
||||
for _, b := range data.Files {
|
||||
d[b.Name] = *listenPrefix + "/lists/" + b.Name
|
||||
}
|
||||
if err := enc.Encode(d); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user