Documentation ¶
Overview ¶
templ: version: v0.2.590
templ: version: v0.2.590
templ: version: v0.2.590
templ: version: v0.2.590
Index ¶
- func ArticleTemplate(params ArticleParams) templ.Component
- func ContentTemplate(params ArticleParams) templ.Component
- func IndexTemplate() templ.Component
- func ListArticleTemplate(params ListArticleParams) templ.Component
- func NewEventService(db eventstore.Store, cache *badger.Cache, relays []string) eventService
- func NewLogging(log *slog.Logger, next EventService) logging
- func ReplaceReferences(text string) (string, error)
- type ArticleParams
- type BaseEventPageParams
- type Data
- type DetailsParams
- type EnhancedEvent
- func (s EnhancedEvent) CreatedAtStr() string
- func (s EnhancedEvent) HashTags() []string
- func (s EnhancedEvent) ModifiedAtStr() string
- func (s EnhancedEvent) Naddr() string
- func (s EnhancedEvent) Nevent() string
- func (s EnhancedEvent) Npub() string
- func (s EnhancedEvent) NpubShort() string
- func (s EnhancedEvent) Title() string
- type EventService
- type Handler
- func (s *Handler) ArticleHandler(w http.ResponseWriter, r *http.Request)
- func (s *Handler) CodeHandler(w http.ResponseWriter, r *http.Request)
- func (s *Handler) ContentHandler(w http.ResponseWriter, r *http.Request)
- func (s *Handler) Homepage(w http.ResponseWriter, r *http.Request)
- func (s *Handler) RedirectFromPSlash(w http.ResponseWriter, r *http.Request)
- func (s *Handler) RedirectSearch(w http.ResponseWriter, r *http.Request)
- type ListArticleParams
- type ProfileMetadata
- type SpinnerParams
- type TemplateID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArticleTemplate ¶
func ArticleTemplate(params ArticleParams) templ.Component
func ContentTemplate ¶
func ContentTemplate(params ArticleParams) templ.Component
func IndexTemplate ¶
func ListArticleTemplate ¶
func ListArticleTemplate(params ListArticleParams) templ.Component
func NewEventService ¶
func NewEventService(db eventstore.Store, cache *badger.Cache, relays []string) eventService
func NewLogging ¶
func NewLogging(log *slog.Logger, next EventService) logging
func ReplaceReferences ¶
text := "Click [me](nostr:nevent17915d512457e4bc461b54ba95351719c150946ed4aa00b1d83a263deca69dae) to" replacement := `<a href="#" hx-get="article/$2" hx-push-url="true" hx-target="body" hx-swap="outerHTML">$1</a>`
Types ¶
type ArticleParams ¶
type ArticleParams struct { Event EnhancedEvent Metadata ProfileMetadata Details DetailsParams Content template.HTML // Highlights are encoded into the content }
type BaseEventPageParams ¶
type BaseEventPageParams struct { }
type Data ¶
type Data struct { TemplateId TemplateID Event EnhancedEvent Metadata ProfileMetadata // Obviously always needs the author profile data Notes []EnhancedEvent // For example, if the parent is an article, the children will be highlights Npub string Naddr string NaddrNaked string CreatedAt string ModifiedAt string Kind string Content string }
Has a parent event and a set of children: 1. Parent is 30023 - Children is 9802 2. Parent is 0 - Children is 30023
type DetailsParams ¶
type EnhancedEvent ¶
type EnhancedEvent struct { *nostr.Event Relays []string }
func (EnhancedEvent) CreatedAtStr ¶
func (s EnhancedEvent) CreatedAtStr() string
func (EnhancedEvent) HashTags ¶
func (s EnhancedEvent) HashTags() []string
func (EnhancedEvent) ModifiedAtStr ¶
func (s EnhancedEvent) ModifiedAtStr() string
func (EnhancedEvent) Naddr ¶
func (s EnhancedEvent) Naddr() string
func (EnhancedEvent) Nevent ¶
func (s EnhancedEvent) Nevent() string
func (EnhancedEvent) Npub ¶
func (s EnhancedEvent) Npub() string
func (EnhancedEvent) NpubShort ¶
func (s EnhancedEvent) NpubShort() string
func (EnhancedEvent) Title ¶
func (s EnhancedEvent) Title() string
type EventService ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(log *slog.Logger, es EventService) *Handler
func (*Handler) ArticleHandler ¶
func (s *Handler) ArticleHandler(w http.ResponseWriter, r *http.Request)
Poplated the data.Notes field with a list of requested notes based on the search field.
func (*Handler) CodeHandler ¶
func (s *Handler) CodeHandler(w http.ResponseWriter, r *http.Request)
Poplated the data.Notes field with a list of requested notes based on the search field.
func (*Handler) ContentHandler ¶
func (s *Handler) ContentHandler(w http.ResponseWriter, r *http.Request)
1. Highlights are encoded into data.Notes 2. Process the highlights into the data.Content string
func (*Handler) RedirectFromPSlash ¶
func (s *Handler) RedirectFromPSlash(w http.ResponseWriter, r *http.Request)
func (*Handler) RedirectSearch ¶
func (s *Handler) RedirectSearch(w http.ResponseWriter, r *http.Request)
type ListArticleParams ¶
type ListArticleParams struct {
Notes []EnhancedEvent
}
type ProfileMetadata ¶
type ProfileMetadata struct { PubKey string `json:"pubkey,omitempty"` Name string `json:"name,omitempty"` About string `json:"about,omitempty"` Website string `json:"website,omitempty"` Picture string `json:"picture,omitempty"` Banner string `json:"banner,omitempty"` Identifier string `json:"identifier,omitempty"` }
func ParseMetadata ¶
func ParseMetadata(e nostr.Event) (*ProfileMetadata, error)
func (ProfileMetadata) Npub ¶
func (s ProfileMetadata) Npub() string
func (ProfileMetadata) String ¶
func (s ProfileMetadata) String() string
type SpinnerParams ¶
type SpinnerParams struct {
Id string
}
type TemplateID ¶
type TemplateID int
const ( Profile TemplateID = iota ListArticle ListHighlight Article Highlight Unkown )