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>
This commit is contained in:
@@ -78,12 +78,12 @@
|
||||
<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>
|
||||
<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. Its rules are read and followed when writing{{if .Subreddits}}; suggestions come from this entry and your profile{{end}}.</span>
|
||||
<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}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<input type="hidden" name="id" value="{{$e.ID}}">
|
||||
<section class="card">
|
||||
<h2>Fill in with AI</h2>
|
||||
<p class="help">Reads their website and fills in the boxes that are still empty: links and accounts straight from the pages, and a description, talking points, keywords, hashtags and subreddits from the AI (subreddits checked with Reddit first), set against your <a href="/settings/profile">company profile</a>. What you've typed stays. Nothing is saved until you press Save.</p>
|
||||
<p class="help">Reads their website and fills in the boxes that are still empty: links and accounts straight from the pages, and a description, talking points, keywords, hashtags and subreddits from the AI, set against your <a href="/settings/profile">company profile</a>. What you've typed stays. Nothing is saved until you press Save.</p>
|
||||
{{if .NoAI}}<p class="warn-text">This needs the AI: first <a href="/settings/ai">set up the AI</a>, then come back. Or fill in the form by hand.</p>{{end}}
|
||||
<div class="row">
|
||||
<input name="draft_url" type="text" inputmode="url" value="{{.DraftURL}}" placeholder="https://example.com" aria-label="Their website">
|
||||
@@ -17,18 +17,16 @@
|
||||
{{with .Suggestions}}
|
||||
<details class="suggestions" open>
|
||||
<summary>Subreddits the AI suggested</summary>
|
||||
{{if not $.Data.CanCheck}}<p class="warn-text small">Not checked with Reddit, so some may not exist: add Reddit's client ID and secret under <a href="/settings/accounts">Settings → Social accounts</a> and fill in again to check them.</p>{{end}}
|
||||
<ul>
|
||||
{{range .}}
|
||||
<li class="{{if .Kept}}kept{{else}}dropped{{end}}">
|
||||
<a href="https://www.reddit.com/r/{{.Name}}/" target="_blank" rel="noopener noreferrer">r/{{.Name}}</a>
|
||||
{{with .Info}}<span class="muted small">{{.Subscribers}} members · {{if eq .SubmissionType "self"}}text posts only{{else if eq .SubmissionType "link"}}link posts only{{else}}text or links{{end}}</span>{{end}}
|
||||
{{if .Kept}}{{if and .Problem $.Data.CanCheck}}<span class="warn-text small">{{.Problem}}</span>{{end}}{{else}}<span class="small">left out: {{.Problem}}</span>{{end}}
|
||||
{{if not .Kept}}<span class="small">left out: more than enough already</span>{{end}}
|
||||
{{with .Why}}<span class="help">{{.}}</span>{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
<p class="help">The ones kept are in the Subreddits box below. Look at each on Reddit before posting there: the AI picks by topic, not by how a community treats companies.</p>
|
||||
<p class="help">The ones kept are in the Subreddits box below. They aren't checked with Reddit, so one may not exist, or be private: open each before posting there. The AI picks by topic, not by how a community treats companies.</p>
|
||||
</details>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{define "content"}}{{with .Data}}{{$conn := .Connected}}{{$accounts := .Accounts}}{{$chosen := .Chosen}}{{$now := .Now}}{{$zone := .Zone}}{{$reddit := .Reddit}}
|
||||
<h1>Posts</h1>
|
||||
<p class="lede">Everything waiting for your approval. Nothing is published until you say so: publish a draft now, or schedule it.
|
||||
<p class="lede">Everything waiting for your approval. Nothing is published until you say so: publish a draft now, or schedule it. Reddit posts you post yourself.
|
||||
{{if .Tagged}}Links to your own sites get UTM tags when published.{{end}}</p>
|
||||
|
||||
{{template "reminders" .Reminders}}
|
||||
@@ -23,26 +23,37 @@
|
||||
{{$rv := index $reddit .ID}}
|
||||
{{if $rv}}
|
||||
{{if $rv.Warnings}}<ul class="warnings">{{range $rv.Warnings}}<li>{{.}}</li>{{end}}</ul>{{end}}
|
||||
{{with $rv.Info}}
|
||||
<details class="rules">
|
||||
<summary>r/{{.Name}}'s rules{{if .Rules}} ({{len .Rules}}){{end}} · read {{ago .FetchedAt}}</summary>
|
||||
{{if .SubmitText}}<p class="guidelines">{{truncate 1200 .SubmitText}}</p>{{end}}
|
||||
{{if .Rules}}<ol>{{range .Rules}}<li><strong>{{.Name}}</strong>{{if .Description}}: {{truncate 500 .Description}}{{end}}</li>{{end}}</ol>{{end}}
|
||||
<p class="muted small">Posts: {{if eq .SubmissionType "self"}}text only{{else if eq .SubmissionType "link"}}links only{{else}}text or links{{end}}{{if .Subscribers}} · {{.Subscribers}} members{{end}}</p>
|
||||
<details class="rules" {{if not $rv.Info}}open{{end}}>
|
||||
<summary>r/{{.Target}}'s rules{{with $rv.Info}} · pasted {{ago .SavedAt}}{{else}} · not pasted yet{{end}}</summary>
|
||||
<form method="post" action="/reddit/rules/{{.Target}}">
|
||||
<p class="help">Supermarket can't read them from Reddit. <a href="{{$rv.RulesURL}}" target="_blank" rel="noopener noreferrer">Open r/{{.Target}}'s rules ↗</a>, copy them, and paste them here: the next drafts for r/{{.Target}} follow them, and the warnings above use them. To use them for this draft, write it again after saving.</p>
|
||||
<textarea name="rules" rows="6" aria-label="r/{{.Target}}'s rules" placeholder="Paste the rules here">{{with $rv.Info}}{{.Rules}}{{end}}</textarea>
|
||||
<button type="submit" class="secondary small">Save rules</button>
|
||||
</form>
|
||||
</details>
|
||||
{{end}}
|
||||
<form method="post" action="/reddit/rules/{{.Target}}" class="inline"><button type="submit" class="secondary small">{{if $rv.Info}}Refresh rules{{else}}Read rules{{end}}</button></form>
|
||||
{{end}}
|
||||
<form method="post" action="/drafts/{{.ID}}/save" data-busy-on="publish" data-busy="Publishing…">
|
||||
{{if eq .Channel "reddit"}}
|
||||
<label class="small">Title
|
||||
<input name="title" value="{{.Title}}" maxlength="300" required>
|
||||
<input name="title" id="title-{{.ID}}" value="{{.Title}}" maxlength="300" required>
|
||||
</label>
|
||||
{{end}}
|
||||
<textarea name="content" rows="{{if eq .Channel "x"}}5{{else}}12{{end}}"
|
||||
data-count="{{.Channel}}" data-limit="{{.Limit}}" data-reserve="{{if eq .Channel "x"}}{{xreserve .SourceURL}}{{else}}0{{end}}"
|
||||
aria-describedby="count-{{.ID}}" id="text-{{.ID}}">{{.Content}}</textarea>
|
||||
{{if eq .Channel "reddit"}}{{if .SourceURL}}<p class="help">The source link is added at the end as “Source: …”.</p>{{end}}{{end}}
|
||||
{{if eq .Channel "reddit"}}
|
||||
<p class="count{{if .TooLong}} over{{end}}" id="count-{{.ID}}">{{.Length}} / {{.Limit}}</p>
|
||||
<div class="by-hand">
|
||||
<p class="small"><strong>Post it yourself.</strong> <em>Open in Reddit</em> saves your edits and opens r/{{.Target}}'s submit page in a new tab with the title and text filled in{{if .SourceURL}} (links to your sites tagged){{end}}. If a box comes up empty, copy it from here. Check it there and post.</p>
|
||||
<div class="row">
|
||||
<button type="submit" formaction="/drafts/{{.ID}}/open" formtarget="_blank">Open in Reddit ↗</button>
|
||||
<button type="button" class="secondary small" data-copy="title-{{.ID}}">Copy title</button>
|
||||
<button type="button" class="secondary small" data-copy="text-{{.ID}}" data-copy-suffix="{{with $rv}}{{.Suffix}}{{end}}">Copy text</button>
|
||||
<button type="submit" class="secondary small">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
{{$d := .}}{{$accts := index $accounts .Channel}}
|
||||
{{if $accts}}
|
||||
<fieldset class="post-as">
|
||||
@@ -62,15 +73,8 @@
|
||||
</label>
|
||||
<button type="submit" class="secondary" formaction="/drafts/{{.ID}}/schedule">Schedule</button>
|
||||
</div>
|
||||
{{if eq .Channel "reddit"}}
|
||||
<div class="by-hand">
|
||||
<p class="small"><strong>Or post it yourself</strong>{{if not (index $conn .Channel)}}, since Supermarket can't post to Reddit for you yet{{end}}: this saves your edits and opens r/{{.Target}}'s submit page in a new tab with the title and text filled in{{if .SourceURL}} (links to your sites tagged){{end}}. Check it there and post.</p>
|
||||
<div class="row">
|
||||
<button type="submit" class="secondary" formaction="/drafts/{{.ID}}/open" formtarget="_blank">Open in Reddit ↗</button>
|
||||
<button type="button" class="secondary small" data-copy="text-{{.ID}}">Copy text</button>
|
||||
</div>
|
||||
</div>
|
||||
{{else if not (index $conn .Channel)}}<p class="help">{{.ChannelName}} isn't connected: <a href="/settings/accounts">sign in</a> before it's due.</p>{{end}}
|
||||
{{if not (index $conn .Channel)}}<p class="help">{{.ChannelName}} isn't connected: <a href="/settings/accounts">sign in</a> before it's due.</p>{{end}}
|
||||
{{end}}
|
||||
</form>
|
||||
{{if eq .Channel "reddit"}}
|
||||
<form method="post" action="/drafts/{{.ID}}/posted" class="by-hand-done">
|
||||
|
||||
Reference in New Issue
Block a user