- Sign in with a Reddit web app; access tokens refresh automatically, and an app-only token reads rules before sign-in. - Reddit drafts: a title and text for one subreddit, chosen when writing. The subreddit's guidelines and rules go into the prompt, which asks for a community member's post that discloses the affiliation and avoids marketing language. - The Inbox shows the subreddit's rules (cached for a day, with Refresh) and warns, without blocking, about promotion rules, restricted subreddits, link-only subreddits, posting in the same subreddit within a week, more than 1 in 10 recent posts linking to the company's sites, and new accounts. - Publishing makes a text post with the source link at the end, or a link post where the subreddit takes only links. - Migration 4 adds the draft's title and subreddit, and the rules cache. Publishers now take a Post, which carries the title and subreddit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
90 lines
4.5 KiB
HTML
90 lines
4.5 KiB
HTML
{{define "content"}}{{with .Data}}
|
|
<nav class="tabs">
|
|
<a href="/content" aria-current="page">Sources</a>
|
|
<a href="/content/scheduled">Scheduled</a>
|
|
<a href="/content/published">Published</a>
|
|
</nav>
|
|
<div class="heading">
|
|
<h1>{{.Entry.Name}} <span class="badge {{.Entry.Relationship}}">{{.Entry.Relationship}}</span></h1>
|
|
<div class="buttons">
|
|
<form method="post" action="/content/{{.Entry.ID}}/fetch" data-busy="Fetching…">
|
|
<button type="submit" {{if not .Sources}}disabled{{end}}>Fetch new</button>
|
|
</form>
|
|
<a class="button secondary" href="/inventory/{{.Entry.ID}}">Edit entry</a>
|
|
</div>
|
|
</div>
|
|
<p class="lede">
|
|
{{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}}
|
|
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/credentials">add them</a>): {{join .Skipped "; "}}.</p>{{end}}
|
|
</section>
|
|
{{end}}
|
|
|
|
<nav class="tabs">
|
|
<a href="/content/{{.Entry.ID}}" {{if not .ShowDismissed}}aria-current="page"{{end}}>Items</a>
|
|
<a href="/content/{{.Entry.ID}}?dismissed=1" {{if .ShowDismissed}}aria-current="page"{{end}}>Dismissed</a>
|
|
</nav>
|
|
|
|
{{if .Items}}
|
|
<form method="post" action="/content/{{.Entry.ID}}/items" data-busy-on="write" data-busy="Writing drafts…">
|
|
{{if .ShowDismissed}}<input type="hidden" name="dismissed" value="1">{{end}}
|
|
<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>
|
|
|
|
{{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="/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 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. Its rules are read and followed when writing{{if .Subreddits}}; suggestions come from this entry and your profile{{end}}.</span>
|
|
</label>
|
|
</fieldset>
|
|
<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}}No items yet. Fetch to see what {{.Entry.Name}} has been up to.{{end}}</p>
|
|
</section>
|
|
{{end}}
|
|
{{end}}{{end}}
|