Files
indiekit-endpoint-microsub/views/search.njk
Ricardo 1182b8ae79 feat: Feed management with status tracking, edit, and rediscover
- Integrate updateFeedStatus into polling processor for health tracking
- Add feed management UI showing status (active/error), errors, actions
- Add edit feed URL feature to change non-RSS URLs to actual feeds
- Add rediscover feature to run feed discovery and update URL
- Add refresh button to force immediate poll
- Update UI to use Indiekit's badge/button classes (badge--green/red, button--warning)
- Add routes: /feeds/:feedId/edit, /feeds/:feedId/rediscover, /feeds/:feedId/refresh

Fixes broken feeds by allowing users to:
1. Edit URL directly to the RSS/Atom feed
2. Click "Rediscover" to auto-find the feed from a blog URL
3. View error details and consecutive error counts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 01:47:07 +01:00

89 lines
3.1 KiB
Plaintext

{% extends "layouts/reader.njk" %}
{% block reader %}
<div class="search">
<a href="{{ baseUrl }}/channels" class="back-link">
{{ icon("previous") }} {{ __("microsub.channels.title") }}
</a>
<h2>{{ __("microsub.search.title") }}</h2>
<form method="post" action="{{ baseUrl }}/search" class="search__form">
{{ input({
id: "query",
name: "query",
label: __("microsub.search.placeholder"),
type: "url",
required: true,
placeholder: "https://example.com",
autocomplete: "off",
value: query,
attributes: { autofocus: true }
}) }}
<div class="button-group">
{{ button({ text: __("microsub.search.submit") }) }}
</div>
</form>
{% if validationError %}
<div class="notice notice--error">
<p>{{ validationError }}</p>
</div>
{% endif %}
{% if discoveryError %}
<div class="notice notice--error">
<p>{{ discoveryError }}</p>
</div>
{% endif %}
{% if results and results.length > 0 %}
<div class="search__results">
<h3>{{ __("microsub.search.title") }}</h3>
<div class="search__list">
{% for result in results %}
<div class="search__item{% if not result.valid %} search__item--invalid{% endif %}{% if result.isCommentsFeed %} search__item--comments{% endif %}">
<div class="search__feed">
<span class="search__name">
{{ result.title or "Feed" }}
<span class="search__type badge badge--small{% if result.valid %} badge--green{% else %} badge--yellow{% endif %}">
{{ result.typeLabel }}
</span>
{% if result.isCommentsFeed %}
<span class="search__type badge badge--small badge--yellow">Comments</span>
{% endif %}
</span>
<span class="search__url">{{ result.url | replace("https://", "") | replace("http://", "") }}</span>
{% if not result.valid %}
<span class="search__error">{{ result.error }}</span>
{% endif %}
</div>
{% if result.valid %}
<form method="post" action="{{ baseUrl }}/subscribe" class="search__subscribe">
<input type="hidden" name="url" value="{{ result.url }}">
<label for="channel-{{ loop.index }}" class="visually-hidden">{{ __("microsub.channels.title") }}</label>
<select name="channel" id="channel-{{ loop.index }}" class="select select--small">
{% for channel in channels %}
<option value="{{ channel.uid }}">{{ channel.name }}</option>
{% endfor %}
</select>
{{ button({
text: __("microsub.feeds.follow"),
classes: "button--small"
}) }}
</form>
{% else %}
<span class="badge badge--small badge--red">Invalid</span>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% elif searched %}
<div class="reader__empty">
<p>{{ __("microsub.search.noResults") }}</p>
</div>
{% endif %}
</div>
{% endblock %}