A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
0
fork

Configure Feed

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

fix url rendering in ui

+19 -26
+4 -4
cmd/registry/serve.go
··· 421 421 &uihandlers.HomeHandler{ 422 422 DB: database, 423 423 Templates: templates, 424 - RegistryURL: baseURL, 424 + RegistryURL: uihandlers.TrimRegistryURL(baseURL), 425 425 }, 426 426 )).Methods("GET") 427 427 ··· 429 429 &uihandlers.RecentPushesHandler{ 430 430 DB: database, 431 431 Templates: templates, 432 - RegistryURL: baseURL, 432 + RegistryURL: uihandlers.TrimRegistryURL(baseURL), 433 433 }, 434 434 )).Methods("GET") 435 435 ··· 440 440 authRouter.Handle("/images", &uihandlers.ImagesHandler{ 441 441 DB: database, 442 442 Templates: templates, 443 - RegistryURL: baseURL, 443 + RegistryURL: uihandlers.TrimRegistryURL(baseURL), 444 444 }).Methods("GET") 445 445 446 446 authRouter.Handle("/settings", &uihandlers.SettingsHandler{ 447 447 Templates: templates, 448 448 Refresher: refresher, 449 - RegistryURL: baseURL, 449 + RegistryURL: uihandlers.TrimRegistryURL(baseURL), 450 450 }).Methods("GET") 451 451 452 452 authRouter.Handle("/api/profile/default-hold", &uihandlers.UpdateDefaultHoldHandler{
+1 -1
pkg/appview/appview.go
··· 71 71 return string([]rune(s)[0]) 72 72 }, 73 73 74 - "trimPrefix": func(s, prefix string) string { 74 + "trimPrefix": func(prefix, s string) string { 75 75 if len(s) >= len(prefix) && s[:len(prefix)] == prefix { 76 76 return s[len(prefix):] 77 77 }
-2
pkg/appview/handlers/settings.go
··· 59 59 PDSEndpoint string 60 60 DefaultHold string 61 61 } 62 - SessionExpiry time.Time 63 62 Query string 64 63 RegistryURL string 65 64 }{ 66 65 User: user, 67 - SessionExpiry: time.Now().Add(24 * time.Hour), // TODO: Get from actual session 68 66 Query: r.URL.Query().Get("q"), 69 67 RegistryURL: h.RegistryURL, 70 68 }
+11
pkg/appview/handlers/util.go
··· 1 + package handlers 2 + 3 + import "strings" 4 + 5 + // TrimRegistryURL removes http:// or https:// prefix from a URL 6 + // for use in Docker commands where only the host:port is needed 7 + func TrimRegistryURL(url string) string { 8 + url = strings.TrimPrefix(url, "https://") 9 + url = strings.TrimPrefix(url, "http://") 10 + return url 11 + }
+3 -19
pkg/appview/templates/pages/settings.html
··· 73 73 <li>Configure Docker to use the helper. Add to <code>~/.docker/config.json</code>: 74 74 <pre><code>{ 75 75 "credHelpers": { 76 - "{{ .RegistryURL | trimPrefix "http://" | trimPrefix "https://" }}": "atcr" 76 + "{{ .RegistryURL }}": "atcr" 77 77 } 78 78 }</code></pre> 79 79 </li> 80 80 <li>Run any Docker command: 81 - <pre><code>docker pull {{ .RegistryURL | trimPrefix "http://" | trimPrefix "https://" }}/{{ .Profile.Handle }}/myimage</code></pre> 81 + <pre><code>docker pull {{ .RegistryURL }}/{{ .Profile.Handle }}/myimage</code></pre> 82 82 </li> 83 83 <li>Browser will open for authorization - click Approve</li> 84 84 <li>Done! Device is automatically authorized</li> 85 85 </ol> 86 86 87 87 <div class="fallback-note"> 88 - <strong>Fallback:</strong> Use app-password with <code>docker login {{ .RegistryURL | trimPrefix "http://" | trimPrefix "https://" }}</code> for quick start (no device tracking) 88 + <strong>Fallback:</strong> Use app-password with <code>docker login {{ .RegistryURL }}</code> for quick start (no device tracking) 89 89 </div> 90 90 </div> 91 91 ··· 107 107 </tbody> 108 108 </table> 109 109 </div> 110 - </section> 111 - 112 - <!-- OAuth Session Section --> 113 - <section class="settings-section"> 114 - <h2>OAuth Session</h2> 115 - <div class="form-group"> 116 - <label>Logged in as:</label> 117 - <span>{{ .Profile.Handle }}</span> 118 - </div> 119 - <div class="form-group"> 120 - <label>Session expires:</label> 121 - <time datetime="{{ .SessionExpiry.Format "2006-01-02T15:04:05Z07:00" }}"> 122 - {{ .SessionExpiry.Format "2006-01-02 15:04:05 MST" }} 123 - </time> 124 - </div> 125 - <a href="/auth/oauth/login?return_to=/settings" class="btn-secondary">Re-authenticate</a> 126 110 </section> 127 111 </div> 128 112 </main>