| 497 | } |
| 498 | |
| 499 | func (ui *UIHandler) discovery() *camtypes.UIDiscovery { |
| 500 | pubRoots := map[string]*camtypes.PublishRootDiscovery{} |
| 501 | for _, v := range ui.publishRoots { |
| 502 | rd := &camtypes.PublishRootDiscovery{ |
| 503 | Name: v.Name, |
| 504 | Prefix: []string{v.Prefix}, |
| 505 | CurrentPermanode: v.Permanode, |
| 506 | } |
| 507 | pubRoots[v.Name] = rd |
| 508 | } |
| 509 | |
| 510 | mapClustering, _ := strconv.ParseBool(os.Getenv("CAMLI_DEV_MAP_CLUSTERING")) |
| 511 | uiDisco := &camtypes.UIDiscovery{ |
| 512 | UIRoot: ui.prefix, |
| 513 | UploadHelper: ui.prefix + "?camli.mode=uploadhelper", |
| 514 | DownloadHelper: path.Join(ui.prefix, "download") + "/", |
| 515 | DirectoryHelper: path.Join(ui.prefix, "tree") + "/", |
| 516 | PublishRoots: pubRoots, |
| 517 | MapClustering: mapClustering, |
| 518 | ImportShare: path.Join(ui.prefix, "importshare") + "/", |
| 519 | } |
| 520 | return uiDisco |
| 521 | } |
| 522 | |
| 523 | func (ui *UIHandler) serveDownload(w http.ResponseWriter, r *http.Request) { |
| 524 | if ui.root.Storage == nil { |