Support embedding profiles in external web pages

prifile design SQUASH
This commit is contained in:
Daniele Tonon
2023-11-28 19:50:17 +01:00
parent 4db1a1e38d
commit 35d053fc87
5 changed files with 185 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ type TemplateID int
const (
Note TemplateID = iota
Profile
LongForm
TelegramInstantView
FileMetadata
@@ -286,6 +287,29 @@ type ProfilePage struct {
func (*ProfilePage) TemplateText() string { return tmplProfile }
var (
//go:embed templates/embedded_profile.html
tmplEmbeddedProfile string
EmbeddedProfileTemplate = tmpl.MustCompile(&EmbeddedProfilePage{})
)
type EmbeddedProfilePage struct {
AuthorRelays []string
Content string
CreatedAt string
Domain string
Metadata sdk.ProfileMetadata
NormalizedAuthorWebsiteURL string
RenderedAuthorAboutText template.HTML
Nevent string
Npub string
Nprofile string
Proxy string
Title string
}
func (*EmbeddedProfilePage) TemplateText() string { return tmplEmbeddedProfile }
var (
//go:embed templates/file_metadata.html
tmplFileMetadata string