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:
@@ -20,7 +20,7 @@ const (
|
||||
X = "x"
|
||||
LinkedIn = "linkedin" // a member, posting as themselves
|
||||
LinkedInPage = "linkedin_page" // a company page
|
||||
Reddit = "reddit"
|
||||
Reddit = "reddit" // only from before: Reddit is now posted to by hand
|
||||
)
|
||||
|
||||
// NetworkName is a network as people say it.
|
||||
@@ -109,7 +109,7 @@ func scan(row interface{ Scan(...any) error }) (*Account, error) {
|
||||
// Save signs an account in: a new one, or, for the same network, owner and
|
||||
// external ID, the existing one with new tokens. refresh may be "".
|
||||
func Save(d *db.DB, sec *secrets.Store, a *Account, access, refresh string, now time.Time) error {
|
||||
if a.Network != X && a.Network != LinkedIn && a.Network != LinkedInPage && a.Network != Reddit {
|
||||
if a.Network != X && a.Network != LinkedIn && a.Network != LinkedInPage {
|
||||
return fmt.Errorf("no network %q", a.Network)
|
||||
}
|
||||
var id int64
|
||||
@@ -283,7 +283,6 @@ func Adopt(d *db.DB, sec *secrets.Store, names func(network string) (name, exter
|
||||
{X, secrets.XAccessToken, secrets.XRefreshToken, ""},
|
||||
{LinkedIn, secrets.LinkedInAccessToken, "", ""},
|
||||
{LinkedInPage, secrets.LinkedInPageAccessToken, "", ""},
|
||||
{Reddit, secrets.RedditAccessToken, secrets.RedditRefreshToken, ""},
|
||||
}
|
||||
n := 0
|
||||
for _, o := range olds {
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestAccounts(t *testing.T) {
|
||||
|
||||
func TestAdopt(t *testing.T) {
|
||||
d, sec := open(t)
|
||||
sec.Set(map[string]string{secrets.XAccessToken: "xt", secrets.XRefreshToken: "xr", secrets.RedditAccessToken: "rt"})
|
||||
sec.Set(map[string]string{secrets.XAccessToken: "xt", secrets.XRefreshToken: "xr", secrets.LinkedInAccessToken: "lt"})
|
||||
exp := time.Now().Add(time.Hour)
|
||||
n, err := Adopt(d, sec, func(network string) (string, string, time.Time) {
|
||||
return "n-" + network, "e-" + network, exp
|
||||
|
||||
Reference in New Issue
Block a user