A Transparent and Verifiable Way to Sync the AT Protocol's PLC Directory

update url index loading

+12 -4
+5
cmd/plcbundle/compare.go
··· 57 57 58 58 // loadIndexFromURL downloads and parses an index from a URL 59 59 func loadIndexFromURL(url string) (*bundle.Index, error) { 60 + // Smart URL handling - if it doesn't end with .json, append /index.json 61 + if !strings.HasSuffix(url, ".json") { 62 + url = strings.TrimSuffix(url, "/") + "/index.json" 63 + } 64 + 60 65 client := &http.Client{ 61 66 Timeout: 30 * time.Second, 62 67 }
+7 -4
cmd/plcbundle/main.go
··· 1293 1293 fs.Parse(os.Args[2:]) 1294 1294 1295 1295 if fs.NArg() < 1 { 1296 - fmt.Fprintf(os.Stderr, "Usage: plcbundle compare <target>\n") 1297 - fmt.Fprintf(os.Stderr, " target: path to plc_bundles.json or URL\n") 1296 + fmt.Fprintf(os.Stderr, "Usage: plcbundle compare <target> [options]\n") 1297 + fmt.Fprintf(os.Stderr, " target: URL or path to remote plcbundle server/index\n") 1298 1298 fmt.Fprintf(os.Stderr, "\nExamples:\n") 1299 + fmt.Fprintf(os.Stderr, " plcbundle compare https://plc.example.com\n") 1300 + fmt.Fprintf(os.Stderr, " plcbundle compare https://plc.example.com/index.json\n") 1299 1301 fmt.Fprintf(os.Stderr, " plcbundle compare /path/to/plc_bundles.json\n") 1300 - fmt.Fprintf(os.Stderr, " plcbundle compare https://example.com/index.json\n") 1301 - fmt.Fprintf(os.Stderr, " plcbundle compare https://example.com/index.json --fetch-missing\n") 1302 + fmt.Fprintf(os.Stderr, " plcbundle compare https://plc.example.com --fetch-missing\n") 1303 + fmt.Fprintf(os.Stderr, "\nOptions:\n") 1304 + fs.PrintDefaults() 1302 1305 os.Exit(1) 1303 1306 } 1304 1307