Files
davidandClaude Opus 5.5 5451fe6d63 Reddit: posted by hand, with the rules pasted
Reddit's API isn't open to apps like this one, so Supermarket no longer
signs in to Reddit, publishes or schedules there, or reads subreddits and
the account's posts. The internal/api/reddit client, Reddit's OAuth, its
keys and its Social accounts card are gone.

Supermarket still writes the post. Each Reddit draft in Posts has a box
for its subreddit's rules, with a link to them on Reddit: pasted once,
they're kept (subreddits.data, as pasted_rules) and given to the model
for later drafts. Open in Reddit saves the edits and opens the submit
page filled in; Copy title and Copy text (with the tagged source link)
cover a box that comes up empty; Mark as posted records it. Warnings come
from the pasted rules and the posts marked as posted. Fill's subreddit
suggestions are kept unchecked, and say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:48:54 -07:00

113 lines
6.0 KiB
HTML

{{define "content"}}{{with .Data}}
<div class="heading">
<h1>{{.Name}} <span class="badge {{.Entry.Relationship}}">{{.Entry.Relationship}}</span></h1>
<div class="buttons">
<form method="post" action="{{.Base}}/fetch" data-busy="Fetching…">
<button type="submit" {{if not .Sources}}disabled{{end}}>Fetch new</button>
</form>
{{if .Own}}<a class="button secondary" href="/settings/profile">Edit profile</a>{{else}}<a class="button secondary" href="/market/{{.Entry.ID}}">Edit entry</a>{{end}}
</div>
</div>
<p class="lede">
{{if .Own}}Posts that promote your own work: pick a product, or fetch your feeds and new pages on your websites.
{{if .Sources}}Reads {{join .Sources ", "}}.{{else}}Add your blog and release feeds, and your websites, to the <a href="/settings/profile">profile</a> to fetch them.{{end}}
{{else}}{{if .Sources}}Reads {{join .Sources ", "}}.{{else}}This entry has no sources yet: add an X handle, hashtags, a YouTube channel or RSS feeds to it.{{end}}{{end}}
Last fetched {{ago .LastChecked}}; the next fetch looks for posts since {{.Since.Local.Format "2 Jan 15:04"}}.
</p>
{{if .Fetched}}
<section class="card">
<p><strong>{{if .NewItems}}{{.NewItems}} new item{{if ne .NewItems 1}}s{{end}}.{{else}}Nothing new.{{end}}</strong></p>
{{if .Errors}}<p class="warn-text">Some sources failed; they'll be read from the same point next time:</p>
<ul>{{range .Errors}}<li>{{.}}</li>{{end}}</ul>{{end}}
{{if .Skipped}}<p class="muted">Skipped, for lack of credentials (<a href="/settings/accounts">add them</a>): {{join .Skipped "; "}}.</p>{{end}}
</section>
{{end}}
<nav class="tabs">
<a href="{{.Base}}" {{if not .ShowDismissed}}aria-current="page"{{end}}>Items</a>
<a href="{{.Base}}?dismissed=1" {{if .ShowDismissed}}aria-current="page"{{end}}>Dismissed</a>
</nav>
{{if or .Items (and .Products (not .ShowDismissed))}}
<form method="post" action="{{.Base}}/items" data-busy-on="write" data-busy="Writing drafts…">
{{if .ShowDismissed}}<input type="hidden" name="dismissed" value="1">{{end}}
{{if and .Products (not .ShowDismissed)}}
<h2>Products</h2>
<ul class="items">
{{range .Products}}
<li class="item{{if .Used}} used{{end}}">
<label class="check">
<input type="checkbox" name="item" value="{{.ID}}">
<span>
<strong>{{.Title}}</strong>{{if .Used}} <span class="meta"><em>drafted before</em></span>{{end}}
<span class="body">{{truncate 300 .Body}}</span>
{{if .URL}}<a href="{{.URL}}" target="_blank" rel="noopener noreferrer">Open</a>{{end}}
</span>
</label>
</li>
{{end}}
</ul>
{{if .Items}}<h2>News from your feeds and sites</h2>{{end}}
{{end}}
{{if .Items}}
<ul class="items">
{{range .Items}}
<li class="item{{if .Used}} used{{end}}">
<label class="check">
<input type="checkbox" name="item" value="{{.ID}}">
<span>
<span class="meta">{{.Source}} · {{if .AuthorHandle}}@{{.AuthorHandle}}{{else}}{{.Author}}{{end}} · {{.PublishedAt.Local.Format "2 Jan 15:04"}}{{if .Used}} · <em>drafted</em>{{end}}</span>
{{if .Title}}<strong>{{.Title}}</strong>{{end}}
<span class="body">{{truncate 400 .Body}}</span>
{{if .URL}}<a href="{{.URL}}" target="_blank" rel="noopener noreferrer">Open</a>{{end}}
</span>
</label>
</li>
{{end}}
</ul>
{{end}}
{{if .ShowDismissed}}
<div class="actions"><button type="submit" name="action" value="restore" class="secondary">Restore selected</button></div>
{{else}}
<section class="card">
<h2>Write drafts from the selected items</h2>
{{if not .ProfileSet}}<p class="warn-text">Fill in the <a href="/settings/profile">company profile</a> first: drafts are written in its voice.</p>{{end}}
<fieldset class="choice">
<legend>Channels</legend>
{{range .Channels}}
{{/* Reddit is never pre-checked: each post there is a deliberate choice. */}}
<label class="check"><input type="checkbox" name="channel" value="{{.ID}}" {{if and .Connected (ne .ID "reddit")}}checked{{end}}> {{.Name}}{{if eq .ID "reddit"}} <span class="muted">(you post it yourself)</span>{{else if not .Connected}} <span class="muted">(not connected: you can draft, but not publish yet)</span>{{end}}</label>
{{end}}
<label class="small">Subreddit, for Reddit
<input name="subreddit" list="subreddits" placeholder="e.g. selfhosted" autocomplete="off">
<datalist id="subreddits">{{range .Subreddits}}<option value="{{.}}">{{end}}</datalist>
<span class="help">One subreddit per post. The rules you've pasted for it (on Posts) are followed when writing{{if .Subreddits}}; suggestions come from this entry and your profile{{end}}.</span>
</label>
</fieldset>
{{if .Signals}}
<label>For a buying signal <span class="muted small">(optional)</span>
<select name="signal"><option value="0">none: plain news for your audience</option>{{range .Signals}}<option value="{{.ID}}">{{.Name}}</option>{{end}}</select>
<span class="help">The posts speak to people in that situation, and their links carry its campaign tag, so visits and sign-ups count for it on the scorecard.</span>
</label>
{{end}}
<fieldset class="choice">
<legend>Posts</legend>
<label class="check"><input type="radio" name="mode" value="one" checked> One post from all selected items</label>
<label class="check"><input type="radio" name="mode" value="each"> One post per item (up to 10)</label>
</fieldset>
<div class="actions">
<button type="submit" name="action" value="write" {{if not .ProfileSet}}disabled{{end}}>Write drafts</button>
<button type="submit" name="action" value="dismiss" class="secondary">Dismiss selected</button>
</div>
</section>
{{end}}
</form>
{{else}}
<section class="card empty">
<p>{{if .ShowDismissed}}Nothing dismissed.{{else if .Own}}No products or news yet: add products, feeds or websites to your <a href="/settings/profile">profile</a>, then fetch.{{else}}No items yet. Fetch to see what {{.Name}} has been up to.{{end}}</p>
</section>
{{end}}
{{end}}{{end}}