renamed handleWebmonetizationPremiumContent
This commit is contained in:
parent
3456766893
commit
820dcc09c0
|
@ -43,9 +43,9 @@ var (
|
|||
mentionReg = regexp.MustCompile(`@([A-Za-z0-9._%+-]+)(@[A-Za-z0-9.-]+\.[A-Za-z]+)\b`)
|
||||
)
|
||||
|
||||
func (p *Post) handlePremiumContent(c *Collection, isOwner, postPage bool, cfg *config.Config) {
|
||||
if c.Monetization != "" || c.UnlockProtocol != nil {
|
||||
// User has Web Monetization or Unlock enabled, so split content if it exists
|
||||
func (p *Post) handleWebmonetizationPremiumContent(c *Collection, isOwner, postPage bool, cfg *config.Config) {
|
||||
if c.Monetization != "" {
|
||||
// User has Web Monetization enabled, so split content if it exists
|
||||
spl := strings.Index(p.Content, shortCodePaid)
|
||||
p.IsPaid = spl > -1
|
||||
if postPage {
|
||||
|
@ -55,12 +55,7 @@ func (p *Post) handlePremiumContent(c *Collection, isOwner, postPage bool, cfg *
|
|||
} else {
|
||||
if spl > -1 {
|
||||
p.Content = p.Content[:spl+len(shortCodePaid)]
|
||||
if c.Monetization != "" {
|
||||
p.Content = strings.Replace(p.Content, shortCodePaid, "\n\n"+`<p class="split">Continue reading with a <strong>Coil</strong> membership.</p>`+"\n\n", 1)
|
||||
} else if c.UnlockProtocol != nil {
|
||||
p.Content = strings.Replace(p.Content, shortCodePaid, "\n\n"+`<p class="split">Continue reading with a <strong>Coil</strong> membership.</p>`+"\n\n", 1)
|
||||
}
|
||||
|
||||
p.Content = strings.Replace(p.Content, shortCodePaid, "\n\n"+`<p class="split">Continue reading with a <strong>Coil</strong> membership.</p>`+"\n\n", 1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -85,7 +80,7 @@ func (p *Post) formatContent(cfg *config.Config, c *Collection, isOwner bool, is
|
|||
baseURL = "/" + c.Alias + "/"
|
||||
}
|
||||
|
||||
p.handlePremiumContent(c, isOwner, isPostPage, cfg)
|
||||
p.handleWebmonetizationPremiumContent(c, isOwner, isPostPage, cfg)
|
||||
p.Content = strings.Replace(p.Content, "<!--paid-->", "<!--paid-->", 1)
|
||||
|
||||
p.HTMLTitle = template.HTML(applyBasicMarkdown([]byte(p.Title.String)))
|
||||
|
|
2
read.go
2
read.go
|
@ -115,7 +115,7 @@ func (app *App) FetchPublicPosts() (interface{}, error) {
|
|||
}
|
||||
|
||||
p.extractData()
|
||||
p.handlePremiumContent(c, false, false, app.cfg)
|
||||
p.handleWebmonetizationPremiumContent(c, false, false, app.cfg)
|
||||
p.HTMLContent = template.HTML(applyMarkdown([]byte(p.Content), "", app.cfg))
|
||||
fp := p.processPost()
|
||||
if isCollectionPost {
|
||||
|
|
Loading…
Reference in New Issue