blob: 1529ee1d236ebf32ec4d9774dd640129f0d13f07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
{{define "live-feed"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}} - Live Feed</title>
<style>
/* ========================================
BASE STYLE
======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: monospace;
background: #fff;
color: #000;
padding: 20px;
line-height: 1.6;
}
h1 {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 20px;
}
/* ========================================
NAV (live-feed | score-scan)
======================================== */
.nav {
margin-bottom: 30px;
display: flex;
gap: 30px;
border-bottom: 1px solid #000;
padding-bottom: 10px;
}
.nav a {
text-decoration: none;
color: #000;
font-family: monospace;
}
.nav a.active {
border-bottom: 2px solid #000;
padding-bottom: 5px;
}
/* ========================================
ARTICLE LIST
======================================== */
.article {
margin-bottom: 15px;
padding: 10px;
border: 1px solid #ccc;
}
.article a {
color: #00f;
text-decoration: underline;
}
.article-meta {
margin-top: 8px;
color: #666;
font-size: 0.9em;
}
/* ========================================
ARTICLE LIST STUFF
======================================== */
.summary {
margin-bottom: 15px;
padding: 10px;
border: 1px solid #000;
background: #f9f9f9;
}
.rss-link {
background: #f9f9f9;
padding: 15px;
border: 1px solid #000;
margin-bottom: 20px;
}
.rss-link a {
color: #00f;
text-decoration: underline;
}
.feed-list {
max-height: 600px;
overflow-y: auto;
border: 1px solid #000;
padding: 10px;
}
.error {
color: #f00;
margin-top: 10px;
padding: 10px;
border: 1px solid #f00;
}
</style>
</head>
<body>
<h1><a href="/live-feed" style="color: inherit; text-decoration: none;">{{.Title}}</a></h1>
<div class="nav">
<a href="/live-feed" class="active">Live Feed</a>
<a href="/tools">Score & Scan</a>
</div>
<div class="rss-link">
<strong>Filtered RSS Feed:</strong>
<a href="/api/filtered/rss" target="_blank">Subscribe to filtered articles</a>
<span style="margin-left: 10px; color: #666; font-size: 0.9em;">(rss link for feed readers)</span>
<div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #ccc; color: #666; font-size: 0.9em;">
Last updated: <span id="feedTimestamp">{{if .UpdatedAt}}{{.UpdatedAt}}{{else}}—{{end}}</span>
</div>
</div>
<div style="margin-bottom: 20px;">
<strong>Filter by date:</strong>
<div style="margin-top: 8px; display: flex; gap: 10px;">
<a href="/live-feed?filter=day" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "day"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">Last 24h</a>
<a href="/live-feed?filter=week" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "week"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">Last 7 days</a>
<a href="/live-feed?filter=all" style="padding: 6px 12px; text-decoration: none; {{if eq .Filter "all"}}background: #000; color: #fff;{{else}}border: 1px solid #000; color: #000;{{end}}">All</a>
</div>
</div>
<div class="feed-list">
{{if .Error}}
<div class="error">{{.Error}}</div>
{{else if .Articles}}
<div class="summary">
<strong>{{len .Articles}}</strong> articles (threshold: {{printf "%.2f" .Threshold}})
</div>
{{$threshold := .Threshold}}
{{range .Articles}}
{{$isGood := ge .Score $threshold}}
{{$bgColor := "white"}}
{{if $isGood}}
{{$bgColor = "#e8f5e9"}}
{{else}}
{{$bgColor = "#ffebee"}}
{{end}}
{{$indicator := "✗"}}
{{if $isGood}}
{{$indicator = "✓"}}
{{end}}
<div class="article" style="background-color: {{$bgColor}};">
<div style="font-weight: bold;">
<a href="{{.URL}}" target="_blank">{{.Title}}</a>
</div>
<div class="article-meta">
Rating: {{$indicator}} {{.Rating}}/10 (raw: {{printf "%.3f" .Score}}) · {{.Source}}{{if .PublishedAt}} · {{.PublishedAt}}{{end}}
</div>
</div>
{{end}}
{{else}}
<p>No articles to display</p>
{{end}}
</div>
</body>
</html>
{{end}}
|