updates to match sam's output HTML

This commit is contained in:
bryan newbold
2024-04-12 14:47:47 -07:00
committed by Dan Abramov
parent 769e0774f8
commit 0c309d6dd8
2 changed files with 11 additions and 8 deletions
+8 -5
View File
@@ -126,14 +126,16 @@ func (srv *Server) postEmbedHTML(post *appbsky.FeedDefs_PostView) string {
if err != nil {
log.Error("bad AT-URI in reponse", "aturi", aturi)
}
// TODO: could add language, maybe other fiels here?
// XXX: should actually use html/template for this render
// XXX: should use html/template for this render
return fmt.Sprintf(
"<iframe src=\"%s\" class=\"bluesky-post-embed\" data-aturi=\"%s\" data-record-cid=\"%s\"></iframe><script src=\"%s\" async=\"async\"></script>",
fmt.Sprintf("https://embed.bsky.app/embed/%s/app.bsky.feed.post/%s", post.Author.Did, aturi.RecordKey()),
"<blockquote class=\"bluesky-embed\" data-bluesky-uri=\"%s\" data-bluesky-cid=\"%s\"><p lang=\"%s\">%s</p>&mdash; %s %s</blockquote><script async src=\"%s\" charset=\"utf-8\"></script>",
post.Uri,
post.Cid,
"https://embed.bsky.app/iframe-resize.js",
"en", // XXX
"<!-- post-text -->", // XXX
"<!-- display-name (<a href=\"profile-page\">@handle</a>) -->", // XXX
fmt.Sprintf("%s <!-- <a href=\"post-page\">human-date</a> -->", post.IndexedAt), // XXX: Record.CreatedAt
"https://embed.bsky.app/embed.js", // XXX: or iframe-resize.js, for clarity?
)
}
@@ -143,6 +145,7 @@ func (srv *Server) WebOEmbed(c echo.Context) error {
return c.String(http.StatusNotImplemented, "Unsupported oEmbed format: "+formatParam)
}
// XXX: do we actually do something with width?
width := 550
maxWidthParam := c.QueryParam("maxwidth")
if maxWidthParam != "" {
+3 -3
View File
@@ -105,7 +105,7 @@ func serve(cctx *cli.Context) error {
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
// Don't log requests for static content.
Skipper: func(c echo.Context) bool {
return strings.HasPrefix(c.Request().URL.Path, "/embedr-static")
return strings.HasPrefix(c.Request().URL.Path, "/static")
},
}))
e.Use(middleware.RateLimiterWithConfig(middleware.RateLimiterConfig{
@@ -139,9 +139,9 @@ func serve(cctx *cli.Context) error {
staticHandler := http.FileServer(func() http.FileSystem {
if debug {
log.Debugf("serving static file from the local file system")
return http.FS(os.DirFS("static"))
return http.FS(os.DirFS("embedr-static"))
}
fsys, err := fs.Sub(bskyweb.EmbedrStaticFS, "static")
fsys, err := fs.Sub(bskyweb.EmbedrStaticFS, "embedr-static")
if err != nil {
log.Fatal(err)
}