Don't create embeds of profiles/posts from users who ask not to be sh… (#2189)
* Don't create embeds of profiles/posts from users who ask not to be shown in public views * Formatting cleanup * Bump workflow file to build an image for this branchzio/stable
parent
9ab0ff6f1d
commit
bc42747297
|
@ -4,6 +4,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- traffic-reduction
|
- traffic-reduction
|
||||||
|
- respect-optout-for-embeds
|
||||||
env:
|
env:
|
||||||
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
|
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
|
||||||
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
|
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
|
||||||
|
|
|
@ -296,6 +296,14 @@ func (srv *Server) WebPost(c echo.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed to fetch handle: %s\t%v", handle, err)
|
log.Warnf("failed to fetch handle: %s\t%v", handle, err)
|
||||||
} else {
|
} else {
|
||||||
|
unauthedViewingOkay := true
|
||||||
|
for _, label := range pv.Labels {
|
||||||
|
if label.Src == pv.Did && label.Val == "!no-unauthenticated" {
|
||||||
|
unauthedViewingOkay = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if unauthedViewingOkay {
|
||||||
did := pv.Did
|
did := pv.Did
|
||||||
data["did"] = did
|
data["did"] = did
|
||||||
|
|
||||||
|
@ -314,6 +322,7 @@ func (srv *Server) WebPost(c echo.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return c.Render(http.StatusOK, "post.html", data)
|
return c.Render(http.StatusOK, "post.html", data)
|
||||||
|
@ -329,11 +338,19 @@ func (srv *Server) WebProfile(c echo.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed to fetch handle: %s\t%v", handle, err)
|
log.Warnf("failed to fetch handle: %s\t%v", handle, err)
|
||||||
} else {
|
} else {
|
||||||
|
unauthedViewingOkay := true
|
||||||
|
for _, label := range pv.Labels {
|
||||||
|
if label.Src == pv.Did && label.Val == "!no-unauthenticated" {
|
||||||
|
unauthedViewingOkay = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if unauthedViewingOkay {
|
||||||
req := c.Request()
|
req := c.Request()
|
||||||
data["profileView"] = pv
|
data["profileView"] = pv
|
||||||
data["requestURI"] = fmt.Sprintf("https://%s%s", req.Host, req.URL.Path)
|
data["requestURI"] = fmt.Sprintf("https://%s%s", req.Host, req.URL.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return c.Render(http.StatusOK, "profile.html", data)
|
return c.Render(http.StatusOK, "profile.html", data)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue