Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview: use https if s.config.Dev isn't set

+35 -8
+35 -8
appview/state/repo.go
··· 35 35 log.Println("failed to fully resolve repo", err) 36 36 return 37 37 } 38 + protocol := "http" 39 + if !s.config.Dev { 40 + protocol = "https" 41 + } 42 + 38 43 var reqUrl string 39 44 if ref != "" { 40 - reqUrl = fmt.Sprintf("http://%s/%s/%s/tree/%s", f.Knot, f.OwnerDid(), f.RepoName, ref) 45 + reqUrl = fmt.Sprintf("%s://%s/%s/%s/tree/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref) 41 46 } else { 42 - reqUrl = fmt.Sprintf("http://%s/%s/%s", f.Knot, f.OwnerDid(), f.RepoName) 47 + reqUrl = fmt.Sprintf("%s://%s/%s/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName) 43 48 } 44 49 45 50 resp, err := http.Get(reqUrl) ··· 106 101 } 107 102 108 103 ref := chi.URLParam(r, "ref") 109 - resp, err := http.Get(fmt.Sprintf("http://%s/%s/%s/log/%s?page=%d&per_page=30", f.Knot, f.OwnerDid(), f.RepoName, ref, page)) 104 + 105 + protocol := "http" 106 + if !s.config.Dev { 107 + protocol = "https" 108 + } 109 + 110 + resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/log/%s?page=%d&per_page=30", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref, page)) 110 111 if err != nil { 111 112 log.Println("failed to reach knotserver", err) 112 113 return ··· 240 229 log.Println("failed to fully resolve repo", err) 241 230 return 242 231 } 243 - 244 232 ref := chi.URLParam(r, "ref") 245 - resp, err := http.Get(fmt.Sprintf("http://%s/%s/%s/commit/%s", f.Knot, f.OwnerDid(), f.RepoName, ref)) 233 + protocol := "http" 234 + if !s.config.Dev { 235 + protocol = "https" 236 + } 237 + resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/commit/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref)) 246 238 if err != nil { 247 239 log.Println("failed to reach knotserver", err) 248 240 return ··· 282 268 283 269 ref := chi.URLParam(r, "ref") 284 270 treePath := chi.URLParam(r, "*") 285 - resp, err := http.Get(fmt.Sprintf("http://%s/%s/%s/tree/%s/%s", f.Knot, f.OwnerDid(), f.RepoName, ref, treePath)) 271 + protocol := "http" 272 + if !s.config.Dev { 273 + protocol = "https" 274 + } 275 + resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/tree/%s/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref, treePath)) 286 276 if err != nil { 287 277 log.Println("failed to reach knotserver", err) 288 278 return ··· 336 318 return 337 319 } 338 320 339 - resp, err := http.Get(fmt.Sprintf("http://%s/%s/%s/tags", f.Knot, f.OwnerDid(), f.RepoName)) 321 + protocol := "http" 322 + if !s.config.Dev { 323 + protocol = "https" 324 + } 325 + 326 + resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/tags", protocol, f.Knot, f.OwnerDid(), f.RepoName)) 340 327 if err != nil { 341 328 log.Println("failed to reach knotserver", err) 342 329 return ··· 413 390 414 391 ref := chi.URLParam(r, "ref") 415 392 filePath := chi.URLParam(r, "*") 416 - resp, err := http.Get(fmt.Sprintf("http://%s/%s/%s/blob/%s/%s", f.Knot, f.OwnerDid(), f.RepoName, ref, filePath)) 393 + protocol := "http" 394 + if !s.config.Dev { 395 + protocol = "https" 396 + } 397 + resp, err := http.Get(fmt.Sprintf("%s://%s/%s/%s/blob/%s/%s", protocol, f.Knot, f.OwnerDid(), f.RepoName, ref, filePath)) 417 398 if err != nil { 418 399 log.Println("failed to reach knotserver", err) 419 400 return