v59: simplify to single feeds view with search

This commit is contained in:
primal
2026-01-30 17:16:14 -05:00
parent 9530c2ceab
commit f49fc2f0ad
3 changed files with 179 additions and 1077 deletions
+20 -1
View File
@@ -49,6 +49,7 @@ func (c *Crawler) handleAPIAllDomains(w http.ResponseWriter, r *http.Request) {
func (c *Crawler) handleAPIDomains(w http.ResponseWriter, r *http.Request) { func (c *Crawler) handleAPIDomains(w http.ResponseWriter, r *http.Request) {
status := r.URL.Query().Get("status") status := r.URL.Query().Get("status")
hasFeeds := r.URL.Query().Get("has_feeds") == "true" hasFeeds := r.URL.Query().Get("has_feeds") == "true"
search := r.URL.Query().Get("search")
limit := 100 limit := 100
offset := 0 offset := 0
if l := r.URL.Query().Get("limit"); l != "" { if l := r.URL.Query().Get("limit"); l != "" {
@@ -66,7 +67,25 @@ func (c *Crawler) handleAPIDomains(w http.ResponseWriter, r *http.Request) {
var err error var err error
if hasFeeds { if hasFeeds {
// Only domains with feeds // Only domains with feeds
if status != "" { searchPattern := "%" + strings.ToLower(search) + "%"
if search != "" {
// Search in domain host or feed title/url
rows, err = c.db.Query(`
SELECT DISTINCT d.host, d.tld, d.status, d.last_error, f.feed_count
FROM domains d
INNER JOIN (
SELECT source_host, COUNT(*) as feed_count
FROM feeds
WHERE item_count > 0
GROUP BY source_host
) f ON d.host = f.source_host
LEFT JOIN feeds fe ON d.host = fe.source_host
WHERE d.status != 'skip'
AND (LOWER(d.host) LIKE $1 OR LOWER(fe.title) LIKE $1 OR LOWER(fe.url) LIKE $1)
ORDER BY d.tld ASC, d.host ASC
LIMIT $2 OFFSET $3
`, searchPattern, limit, offset)
} else if status != "" {
rows, err = c.db.Query(` rows, err = c.db.Query(`
SELECT d.host, d.tld, d.status, d.last_error, f.feed_count SELECT d.host, d.tld, d.status, d.last_error, f.feed_count
FROM domains d FROM domains d
+156 -1050
View File
File diff suppressed because it is too large Load Diff
+3 -26
View File
@@ -503,38 +503,15 @@ const dashboardHTML = `<!DOCTYPE html>
</div> </div>
<div class="card" id="inputCard"> <div class="card" id="inputCard">
<div id="commandButtons" style="margin-bottom: 10px;"> <input type="text" id="searchInput" placeholder="Search feeds..."
<button class="cmd-btn" data-cmd="/domains">domains</button> style="width: 100%; padding: 12px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; color: #fff; font-family: monospace;">
<button class="cmd-btn" data-cmd="/feeds">feeds</button>
<button class="cmd-btn" id="tldToggleBtn">tlds</button>
<span style="color: #333; margin: 0 4px;">|</span>
<button class="cmd-btn" data-cmd="domains:hold">d:hold</button>
<button class="cmd-btn" data-cmd="domains:pass">d:pass</button>
<button class="cmd-btn" data-cmd="domains:skip">d:skip</button>
<button class="cmd-btn" data-cmd="domains:fail">d:fail</button>
<button class="cmd-btn" data-cmd="domains:feeds">d:feeds</button>
<span style="color: #333; margin: 0 4px;">|</span>
<button class="cmd-btn" data-cmd="feeds:hold">f:hold</button>
<button class="cmd-btn" data-cmd="feeds:pass">f:pass</button>
<button class="cmd-btn" data-cmd="feeds:skip">f:skip</button>
<button class="cmd-btn" data-cmd="feeds:fail">f:fail</button>
</div>
<div id="langDropdown" style="display: none; margin-bottom: 10px; padding: 10px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; max-height: 200px; overflow-y: auto;">
<div id="langList"></div>
</div>
<div id="tldDropdown" style="display: none; margin-bottom: 10px; padding: 10px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px;">
<div id="tldList" style="display: flex; flex-wrap: wrap; gap: 6px;"></div>
</div>
<input type="text" id="commandInput" value="/help"
style="width: 100%; padding: 12px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; color: #fff; font-size: 14px; font-family: monospace;">
</div> </div>
<div class="card" id="outputCard"> <div class="card" id="outputCard">
<div id="breadcrumb" style="margin-bottom: 10px; display: none;"></div>
<div id="output"></div> <div id="output"></div>
</div> </div>
<div style="color: #333; font-size: 11px; margin-top: 10px;">v58</div> <div style="color: #333; font-size: 11px; margin-top: 10px;">v59</div>
<div class="updated" id="updatedAt">Last updated: {{.UpdatedAt.Format "2006-01-02 15:04:05"}}</div> <div class="updated" id="updatedAt">Last updated: {{.UpdatedAt.Format "2006-01-02 15:04:05"}}</div>
</body> </body>