Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 3 additions & 49 deletions news/news.go
Original file line number Diff line number Diff line change
Expand Up @@ -1521,55 +1521,9 @@ func handleArticleView(w http.ResponseWriter, r *http.Request, articleID string)

title := entry.Title

// Check if user is authenticated
sess, _ := auth.TrySession(r)
isGuest := sess == nil

// For guests: show article preview but hide AI summary
if isGuest {
imageSection := ""
if image != "" {
imageSection = fmt.Sprintf(`<img src="%s" class="article-image" referrerpolicy="no-referrer" onerror="this.style.display='none'">`, image)
}

categoryBadge := ""
if category != "" {
categoryBadge = fmt.Sprintf(` · <a href="/news#%s" class="category">%s</a>`, category, category)
}

descriptionSection := ""
if description != "" {
descriptionSection = fmt.Sprintf(`<div class="article-description"><p>%s</p></div>`, description)
}

// Show login prompt instead of AI summary
summarySection := `
<div class="article-summary bg-light" style="border: 1px dashed #ddd;">
<h3>AI Summary</h3>
<p class="text-muted"><a href="/login?redirect=/news?id=` + articleID + `">Login</a> to read the AI-generated summary.</p>
</div>`

articleHtml := fmt.Sprintf(`
<div id="news-article">
%s
<div class="article-meta">
<span><span data-timestamp="%d">%s</span> · Source: <i>%s</i>%s</span>
</div>
%s
%s
<div class="article-actions">
<a href="%s" target="_blank" rel="noopener noreferrer">Read Original →</a>
</div>
<div class="article-back">
<a href="/news">← Back to news</a>
</div>
</div>
`, imageSection, postedAt.Unix(), app.TimeAgo(postedAt), getDomain(articleURL), categoryBadge, descriptionSection, summarySection, articleURL)

pageHTML := app.RenderHTML(title, title, articleHtml)
w.Write([]byte(pageHTML))
return
}
// Previously gated AI summaries behind login, but summaries are
// pre-generated and cached — no cost to serve. Open to all so
// content can be shared and discovered.

// Debug logging
app.Log("news", "Article view: ID=%s, Title='%s', URL='%s'", articleID, title, articleURL)
Expand Down
26 changes: 0 additions & 26 deletions video/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -1078,32 +1078,6 @@ func Handler(w http.ResponseWriter, r *http.Request) {

// render watch page
if len(id) > 0 {
youtubeURL := "https://www.youtube.com/watch?v=" + id
thumbnailURL := "https://img.youtube.com/vi/" + id + "/maxresdefault.jpg"

// Check if user is authenticated
sess, _ := auth.TrySession(r)
isGuest := sess == nil

// For guests: show thumbnail with options to login or go to YouTube
if isGuest {
guestHtml := fmt.Sprintf(`
<div class="card text-center p-10" style="max-width: 640px; margin: 40px auto;">
<img src="%s" class="w-full rounded mb-5" onerror="this.src='https://img.youtube.com/vi/%s/hqdefault.jpg'">
<h2>Watch Video</h2>
<p class="text-muted my-5">Login to watch ad-free, or view on YouTube.</p>
<p class="my-5">
<a href="/login?redirect=/video?id=%s" class="btn btn-primary mr-3">Login to watch</a>
<a href="%s" target="_blank" rel="noopener noreferrer" class="btn btn-outline">Watch on YouTube →</a>
</p>
<p class="mt-5"><a href="/video">← Back to videos</a></p>
</div>
`, thumbnailURL, id, id, youtubeURL)
pageHTML := app.RenderHTML("Video", "Video", guestHtml)
w.Write([]byte(pageHTML))
return
}

// Check if autoplay is requested
autoplay := r.Form.Get("autoplay") == "1"

Expand Down
Loading