updates to match sam's output HTML
This commit is contained in:
committed by
Dan Abramov
parent
769e0774f8
commit
0c309d6dd8
@@ -126,14 +126,16 @@ func (srv *Server) postEmbedHTML(post *appbsky.FeedDefs_PostView) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("bad AT-URI in reponse", "aturi", aturi)
|
log.Error("bad AT-URI in reponse", "aturi", aturi)
|
||||||
}
|
}
|
||||||
// TODO: could add language, maybe other fiels here?
|
// XXX: should use html/template for this render
|
||||||
// XXX: should actually use html/template for this render
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"<iframe src=\"%s\" class=\"bluesky-post-embed\" data-aturi=\"%s\" data-record-cid=\"%s\"></iframe><script src=\"%s\" async=\"async\"></script>",
|
"<blockquote class=\"bluesky-embed\" data-bluesky-uri=\"%s\" data-bluesky-cid=\"%s\"><p lang=\"%s\">%s</p>— %s %s</blockquote><script async src=\"%s\" charset=\"utf-8\"></script>",
|
||||||
fmt.Sprintf("https://embed.bsky.app/embed/%s/app.bsky.feed.post/%s", post.Author.Did, aturi.RecordKey()),
|
|
||||||
post.Uri,
|
post.Uri,
|
||||||
post.Cid,
|
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)
|
return c.String(http.StatusNotImplemented, "Unsupported oEmbed format: "+formatParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: do we actually do something with width?
|
||||||
width := 550
|
width := 550
|
||||||
maxWidthParam := c.QueryParam("maxwidth")
|
maxWidthParam := c.QueryParam("maxwidth")
|
||||||
if maxWidthParam != "" {
|
if maxWidthParam != "" {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func serve(cctx *cli.Context) error {
|
|||||||
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
|
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
|
||||||
// Don't log requests for static content.
|
// Don't log requests for static content.
|
||||||
Skipper: func(c echo.Context) bool {
|
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{
|
e.Use(middleware.RateLimiterWithConfig(middleware.RateLimiterConfig{
|
||||||
@@ -139,9 +139,9 @@ func serve(cctx *cli.Context) error {
|
|||||||
staticHandler := http.FileServer(func() http.FileSystem {
|
staticHandler := http.FileServer(func() http.FileSystem {
|
||||||
if debug {
|
if debug {
|
||||||
log.Debugf("serving static file from the local file system")
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user