Remind before LinkedIn's sign-in expires, and stop posting once it has
LinkedIn tokens last 60 days and can't be renewed without signing in again. The expiry LinkedIn reports is now recorded (60 days from sign-in for older connections). The LinkedIn card says until when; from two weeks before, the Overview, the Inbox and the card remind you, with a Reconnect button. Once expired, LinkedIn counts as not connected, due posts come back to the Inbox saying why, and a 401 from LinkedIn reads "reconnect LinkedIn" instead of the raw error. Also fixes a leftover "Settings → Credentials" in a publish error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package linkedin
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -69,6 +70,9 @@ func (c *Client) PostUpdate(ctx context.Context, text, sourceURL string) (string
|
|||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
raw, _ := io.ReadAll(res.Body)
|
raw, _ := io.ReadAll(res.Body)
|
||||||
|
if res.StatusCode == http.StatusUnauthorized {
|
||||||
|
return "", ErrUnauthorized
|
||||||
|
}
|
||||||
if res.StatusCode != http.StatusCreated {
|
if res.StatusCode != http.StatusCreated {
|
||||||
return "", fmt.Errorf("linkedin HTTP %d: %s", res.StatusCode, raw)
|
return "", fmt.Errorf("linkedin HTTP %d: %s", res.StatusCode, raw)
|
||||||
}
|
}
|
||||||
@@ -81,6 +85,10 @@ func (c *Client) PostUpdate(ctx context.Context, text, sourceURL string) (string
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetAuthorURN fetches the LinkedIn person URN for the owner of accessToken.
|
// GetAuthorURN fetches the LinkedIn person URN for the owner of accessToken.
|
||||||
|
// ErrUnauthorized is LinkedIn refusing the access token, usually because it
|
||||||
|
// expired (they last 60 days and can't be renewed without signing in again).
|
||||||
|
var ErrUnauthorized = errors.New("LinkedIn refused the sign-in; it has probably expired: reconnect LinkedIn under Settings → Social accounts")
|
||||||
|
|
||||||
func GetAuthorURN(ctx context.Context, accessToken string) (string, error) {
|
func GetAuthorURN(ctx context.Context, accessToken string) (string, error) {
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiBase+"/v2/userinfo", nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiBase+"/v2/userinfo", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func Publish(ctx context.Context, d *db.DB, pubs Publishers, tags *utm.Tagger, i
|
|||||||
}
|
}
|
||||||
pub := pubs[dr.Channel]
|
pub := pubs[dr.Channel]
|
||||||
if pub == nil {
|
if pub == nil {
|
||||||
return dr, fmt.Errorf("%s isn't connected: sign in under Settings → Credentials", dr.ChannelName())
|
return dr, fmt.Errorf("%s isn't connected: sign in under Settings → Social accounts", dr.ChannelName())
|
||||||
}
|
}
|
||||||
if problem := dr.Problem(); problem != "" {
|
if problem := dr.Problem(); problem != "" {
|
||||||
return dr, fmt.Errorf("%s. Fix it first", problem)
|
return dr, fmt.Errorf("%s. Fix it first", problem)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ var httpClient = &http.Client{Timeout: 20 * time.Second}
|
|||||||
type Result struct {
|
type Result struct {
|
||||||
AccessToken string
|
AccessToken string
|
||||||
RefreshToken string
|
RefreshToken string
|
||||||
|
ExpiresIn time.Duration // how long the access token lasts, if the provider said
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pending is a started flow, kept by the caller until the callback arrives.
|
// Pending is a started flow, kept by the caller until the callback arrives.
|
||||||
@@ -225,6 +226,7 @@ func tokenResponse(req *http.Request) (*Result, error) {
|
|||||||
var out struct {
|
var out struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
ExpiresIn int64 `json:"expires_in"`
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(raw, &out); err != nil {
|
if err := json.Unmarshal(raw, &out); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -232,7 +234,8 @@ func tokenResponse(req *http.Request) (*Result, error) {
|
|||||||
if out.AccessToken == "" {
|
if out.AccessToken == "" {
|
||||||
return nil, fmt.Errorf("no access_token in the token response")
|
return nil, fmt.Errorf("no access_token in the token response")
|
||||||
}
|
}
|
||||||
return &Result{AccessToken: out.AccessToken, RefreshToken: out.RefreshToken}, nil
|
return &Result{AccessToken: out.AccessToken, RefreshToken: out.RefreshToken,
|
||||||
|
ExpiresIn: time.Duration(out.ExpiresIn) * time.Second}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func pkce() (verifier, challenge string, err error) {
|
func pkce() (verifier, challenge string, err error) {
|
||||||
|
|||||||
@@ -62,7 +62,11 @@ func (s *Server) publishers() content.Publishers {
|
|||||||
pubs[content.ChannelX] = xPublisher{c}
|
pubs[content.ChannelX] = xPublisher{c}
|
||||||
}
|
}
|
||||||
if tok, urn := s.Secrets.Get(secrets.LinkedInAccessToken), s.Secrets.Get(secrets.LinkedInAuthorURN); tok != "" && urn != "" {
|
if tok, urn := s.Secrets.Get(secrets.LinkedInAccessToken), s.Secrets.Get(secrets.LinkedInAuthorURN); tok != "" && urn != "" {
|
||||||
pubs[content.ChannelLinkedIn] = linkedInPublisher{linkedin.New(tok, urn)}
|
if e := s.linkedInExpiry(); e != nil && e.Expired() {
|
||||||
|
pubs[content.ChannelLinkedIn] = expiredPublisher{*e}
|
||||||
|
} else {
|
||||||
|
pubs[content.ChannelLinkedIn] = linkedInPublisher{linkedin.New(tok, urn)}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if c := s.redditUser(); c != nil {
|
if c := s.redditUser(); c != nil {
|
||||||
pubs[content.ChannelReddit] = redditPublisher{s: s, c: c}
|
pubs[content.ChannelReddit] = redditPublisher{s: s, c: c}
|
||||||
@@ -70,6 +74,15 @@ func (s *Server) publishers() content.Publishers {
|
|||||||
return pubs
|
return pubs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// expiredPublisher stands in for a network whose sign-in ran out: it posts
|
||||||
|
// nothing and says so, rather than letting the network answer 401.
|
||||||
|
type expiredPublisher struct{ e Expiry }
|
||||||
|
|
||||||
|
func (p expiredPublisher) Publish(context.Context, content.Post) (string, error) {
|
||||||
|
return "", fmt.Errorf("%s's sign-in expired on %s: reconnect %s under Settings → Social accounts, then publish again",
|
||||||
|
p.e.Network, p.e.At.Local().Format("2 Jan 2006"), p.e.Network)
|
||||||
|
}
|
||||||
|
|
||||||
type xPublisher struct{ c *twitter.Client }
|
type xPublisher struct{ c *twitter.Client }
|
||||||
|
|
||||||
// Publish appends the source link to the post, as the old app did; X shows
|
// Publish appends the source link to the post, as the old app did; X shows
|
||||||
|
|||||||
@@ -148,10 +148,10 @@ func (s *Server) entryData(e *inventory.Entry, showDismissed bool) (*entryPage,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
pubs := s.publishers()
|
conn := s.connected()
|
||||||
var chans []channelChoice
|
var chans []channelChoice
|
||||||
for _, c := range content.Channels {
|
for _, c := range content.Channels {
|
||||||
chans = append(chans, channelChoice{c, pubs[c.ID] != nil})
|
chans = append(chans, channelChoice{c, conn[c.ID]})
|
||||||
}
|
}
|
||||||
var subs []string
|
var subs []string
|
||||||
seen := map[string]bool{}
|
seen := map[string]bool{}
|
||||||
|
|||||||
@@ -72,8 +72,10 @@ func groupBatches(drafts []content.Draft) []*draftBatch {
|
|||||||
|
|
||||||
func (s *Server) connected() map[string]bool {
|
func (s *Server) connected() map[string]bool {
|
||||||
out := map[string]bool{}
|
out := map[string]bool{}
|
||||||
for id := range s.publishers() {
|
for id, p := range s.publishers() {
|
||||||
out[id] = true
|
if _, expired := p.(expiredPublisher); !expired {
|
||||||
|
out[id] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
@@ -93,6 +95,7 @@ func (s *Server) renderInbox(w http.ResponseWriter, r *http.Request, errMsg stri
|
|||||||
sections = append(sections, inboxSection{Module: "Content", Batches: groupBatches(pending)})
|
sections = append(sections, inboxSection{Module: "Content", Batches: groupBatches(pending)})
|
||||||
}
|
}
|
||||||
s.render(w, r, "inbox", page{Title: "Inbox", Nav: "content/inbox", Error: errMsg, Data: map[string]any{
|
s.render(w, r, "inbox", page{Title: "Inbox", Nav: "content/inbox", Error: errMsg, Data: map[string]any{
|
||||||
|
"Reminders": s.reminders(),
|
||||||
"Sections": sections,
|
"Sections": sections,
|
||||||
"Reddit": s.redditViews(r.Context(), pending),
|
"Reddit": s.redditViews(r.Context(), pending),
|
||||||
"Connected": s.connected(),
|
"Connected": s.connected(),
|
||||||
|
|||||||
+55
-1
@@ -25,6 +25,57 @@ import (
|
|||||||
type Connection struct {
|
type Connection struct {
|
||||||
Account string `json:"account"`
|
Account string `json:"account"`
|
||||||
At time.Time `json:"at"`
|
At time.Time `json:"at"`
|
||||||
|
// Expires is when the sign-in stops working, for networks whose tokens
|
||||||
|
// can't be renewed (LinkedIn); zero for ones Supermarket renews itself.
|
||||||
|
Expires time.Time `json:"expires,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// linkedInTokenLife is how long LinkedIn's access tokens last, for
|
||||||
|
// sign-ins saved before the expiry was recorded.
|
||||||
|
const linkedInTokenLife = 60 * 24 * time.Hour
|
||||||
|
|
||||||
|
// expiryWarning is how long before a sign-in expires the reminders start.
|
||||||
|
const expiryWarning = 14 * 24 * time.Hour
|
||||||
|
|
||||||
|
// Expiry is when a sign-in runs out, if it does.
|
||||||
|
type Expiry struct {
|
||||||
|
Network string // e.g. LinkedIn
|
||||||
|
At time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expired reports whether it has run out.
|
||||||
|
func (e Expiry) Expired() bool { return !time.Now().Before(e.At) }
|
||||||
|
|
||||||
|
// Soon reports whether it runs out within expiryWarning (or has).
|
||||||
|
func (e Expiry) Soon() bool { return time.Until(e.At) < expiryWarning }
|
||||||
|
|
||||||
|
// Days is how many whole days are left (0 on the last day).
|
||||||
|
func (e Expiry) Days() int { return int(time.Until(e.At) / (24 * time.Hour)) }
|
||||||
|
|
||||||
|
// linkedInExpiry is when the LinkedIn sign-in runs out, or nil if LinkedIn
|
||||||
|
// isn't connected.
|
||||||
|
func (s *Server) linkedInExpiry() *Expiry {
|
||||||
|
if !s.Secrets.Has(secrets.LinkedInAccessToken) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
c := s.connections()["linkedin"]
|
||||||
|
at := c.Expires
|
||||||
|
if at.IsZero() {
|
||||||
|
if c.At.IsZero() {
|
||||||
|
return nil // a token from the old app: when it was made is unknown
|
||||||
|
}
|
||||||
|
at = c.At.Add(linkedInTokenLife)
|
||||||
|
}
|
||||||
|
return &Expiry{Network: "LinkedIn", At: at}
|
||||||
|
}
|
||||||
|
|
||||||
|
// reminders are the sign-ins running out soon, or already, for the
|
||||||
|
// Overview and the Inbox.
|
||||||
|
func (s *Server) reminders() []Expiry {
|
||||||
|
if e := s.linkedInExpiry(); e != nil && e.Soon() {
|
||||||
|
return []Expiry{*e}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const connectionsKey = "connections"
|
const connectionsKey = "connections"
|
||||||
@@ -107,6 +158,7 @@ func (s *Server) dashboard(w http.ResponseWriter, r *http.Request) {
|
|||||||
"ImportErr": errString(s.ImportErr),
|
"ImportErr": errString(s.ImportErr),
|
||||||
"QueuedPosts": queued,
|
"QueuedPosts": queued,
|
||||||
"Scheduled": len(scheduled),
|
"Scheduled": len(scheduled),
|
||||||
|
"Reminders": s.reminders(),
|
||||||
"Pending": pending,
|
"Pending": pending,
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
@@ -153,7 +205,9 @@ func (s *Server) connectionSummary(c map[string]Connection) string {
|
|||||||
} else if s.Secrets.Has(secrets.XAccessToken) {
|
} else if s.Secrets.Has(secrets.XAccessToken) {
|
||||||
parts = append(parts, "X")
|
parts = append(parts, "X")
|
||||||
}
|
}
|
||||||
if s.Secrets.Has(secrets.LinkedInAccessToken) {
|
if e := s.linkedInExpiry(); e != nil && e.Expired() {
|
||||||
|
parts = append(parts, "LinkedIn (expired)")
|
||||||
|
} else if s.Secrets.Has(secrets.LinkedInAccessToken) {
|
||||||
parts = append(parts, "LinkedIn")
|
parts = append(parts, "LinkedIn")
|
||||||
}
|
}
|
||||||
if a := c["reddit"].Account; a != "" {
|
if a := c["reddit"].Account; a != "" {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
@@ -403,3 +404,43 @@ func TestProfileDraftNeedsAI(t *testing.T) {
|
|||||||
t.Error("warning shown with an AI key saved")
|
t.Error("warning shown with an AI key saved")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLinkedInExpiryReminders(t *testing.T) {
|
||||||
|
s, h := newTestServer(t, nil)
|
||||||
|
_ = s.Secrets.Set(map[string]string{secrets.LinkedInAccessToken: "tok", secrets.LinkedInAuthorURN: "urn:li:person:1"})
|
||||||
|
day := 24 * time.Hour
|
||||||
|
get := func(path string) string { return do(h, http.MethodGet, path, nil, nil).Body.String() }
|
||||||
|
|
||||||
|
// Plenty of time: the card says until when, no reminders.
|
||||||
|
_ = s.saveConnection("linkedin", Connection{At: time.Now(), Expires: time.Now().Add(50 * day)})
|
||||||
|
if !strings.Contains(get("/settings/accounts"), "The sign-in lasts until") || strings.Contains(get("/"), "Reconnect LinkedIn") {
|
||||||
|
t.Error("50 days left: wrong reminders")
|
||||||
|
}
|
||||||
|
if !s.connected()["linkedin"] {
|
||||||
|
t.Error("50 days left: should be connected")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Saved before expiries were recorded, 50 days ago: 10 days left.
|
||||||
|
_ = s.saveConnection("linkedin", Connection{At: time.Now().Add(-50 * day)})
|
||||||
|
for _, path := range []string{"/", "/inbox"} {
|
||||||
|
if body := get(path); !strings.Contains(body, "LinkedIn's sign-in expires in 9 days") && !strings.Contains(body, "LinkedIn's sign-in expires in 10 days") {
|
||||||
|
t.Errorf("%s: no 10-day reminder", path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expired: reminders, not connected, and publishing says why.
|
||||||
|
_ = s.saveConnection("linkedin", Connection{At: time.Now().Add(-61 * day), Expires: time.Now().Add(-day)})
|
||||||
|
if body := get("/"); !strings.Contains(body, "LinkedIn's sign-in expired on") {
|
||||||
|
t.Error("expired: no reminder on the Overview")
|
||||||
|
}
|
||||||
|
if !strings.Contains(get("/settings/accounts"), "The sign-in expired on") {
|
||||||
|
t.Error("expired: the card doesn't say so")
|
||||||
|
}
|
||||||
|
if s.connected()["linkedin"] {
|
||||||
|
t.Error("expired: still counted as connected")
|
||||||
|
}
|
||||||
|
if _, err := s.publishers()["linkedin"].Publish(context.Background(), content.Post{Text: "hi"}); err == nil ||
|
||||||
|
!strings.Contains(err.Error(), "reconnect LinkedIn") {
|
||||||
|
t.Errorf("expired publish: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ type connectInfo struct {
|
|||||||
Account string
|
Account string
|
||||||
At time.Time
|
At time.Time
|
||||||
Note string
|
Note string
|
||||||
|
Expiry *Expiry // when the sign-in runs out, for LinkedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) accountsPage(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) accountsPage(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -272,6 +273,7 @@ func (s *Server) networks() []network {
|
|||||||
case "LinkedIn":
|
case "LinkedIn":
|
||||||
n.Connect = connect("linkedin", secrets.LinkedInAccessToken, "In your LinkedIn app's Auth settings, add this redirect URL:", "",
|
n.Connect = connect("linkedin", secrets.LinkedInAccessToken, "In your LinkedIn app's Auth settings, add this redirect URL:", "",
|
||||||
set[secrets.LinkedInClientID] && set[secrets.LinkedInClientSecret], func(string) string { return "" })
|
set[secrets.LinkedInClientID] && set[secrets.LinkedInClientSecret], func(string) string { return "" })
|
||||||
|
n.Connect.Expiry = s.linkedInExpiry()
|
||||||
case "Reddit":
|
case "Reddit":
|
||||||
n.Connect = connect("reddit", secrets.RedditAccessToken, "At reddit.com/prefs/apps, create a web app with this redirect URI:",
|
n.Connect = connect("reddit", secrets.RedditAccessToken, "At reddit.com/prefs/apps, create a web app with this redirect URI:",
|
||||||
"Reddit's API terms need approval for commercial use: Supermarket is meant for a few hand-approved posts, not volume.",
|
"Reddit's API terms need approval for commercial use: Supermarket is meant for a few hand-approved posts, not volume.",
|
||||||
@@ -444,7 +446,12 @@ func (s *Server) oauthCallback(w http.ResponseWriter, r *http.Request) {
|
|||||||
fail("Signed in, but couldn't save the token: " + err.Error())
|
fail("Signed in, but couldn't save the token: " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := s.saveConnection("linkedin", Connection{Account: urn, At: time.Now()}); err != nil {
|
life := res.ExpiresIn
|
||||||
|
if life <= 0 {
|
||||||
|
life = linkedInTokenLife
|
||||||
|
}
|
||||||
|
now := time.Now()
|
||||||
|
if err := s.saveConnection("linkedin", Connection{Account: urn, At: now, Expires: now.Add(life)}); err != nil {
|
||||||
s.Log.Error("saving connection", "err", err)
|
s.Log.Error("saving connection", "err", err)
|
||||||
}
|
}
|
||||||
redirect(w, r, "/settings/accounts", "li-connected")
|
redirect(w, r, "/settings/accounts", "li-connected")
|
||||||
|
|||||||
@@ -361,3 +361,7 @@ form.inline { display: inline-block; margin: 0 0 0.75rem; }
|
|||||||
/* A key's label, with where to get it */
|
/* A key's label, with where to get it */
|
||||||
.label-row { display: flex; align-items: baseline; gap: 0.75rem; }
|
.label-row { display: flex; align-items: baseline; gap: 0.75rem; }
|
||||||
.get-it { margin-left: auto; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
|
.get-it { margin-left: auto; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
|
||||||
|
|
||||||
|
/* A sign-in running out */
|
||||||
|
.reminder { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
|
||||||
|
.reminder p { margin: 0; flex: 1; min-width: 16rem; }
|
||||||
|
|||||||
@@ -33,6 +33,11 @@
|
|||||||
<div class="signin">
|
<div class="signin">
|
||||||
<h3>Sign in to post</h3>
|
<h3>Sign in to post</h3>
|
||||||
{{if .Signed}}<p>Connected{{with .Account}} as <strong>{{.}}</strong>{{end}}{{if not .At.IsZero}}, {{ago .At}}{{end}}.</p>{{end}}
|
{{if .Signed}}<p>Connected{{with .Account}} as <strong>{{.}}</strong>{{end}}{{if not .At.IsZero}}, {{ago .At}}{{end}}.</p>{{end}}
|
||||||
|
{{with .Expiry}}
|
||||||
|
{{if .Expired}}<p class="error">The sign-in expired on {{.At.Local.Format "2 Jan 2006"}}: reconnect to publish again.</p>
|
||||||
|
{{else if .Soon}}<p class="warn-text"><strong>The sign-in expires {{if eq .Days 0}}today{{else if eq .Days 1}}tomorrow{{else}}in {{.Days}} days{{end}}, on {{.At.Local.Format "2 Jan 2006"}}.</strong> Reconnect now to keep posting.</p>
|
||||||
|
{{else}}<p class="help">The sign-in lasts until {{.At.Local.Format "2 Jan 2006"}}; {{.Network}} doesn't let it be renewed without signing in again. Supermarket reminds you two weeks before.</p>{{end}}
|
||||||
|
{{end}}
|
||||||
<p class="help">{{.Setup}} <code>{{.Redirect}}</code>{{with .Note}}<br>{{.}}{{end}}</p>
|
<p class="help">{{.Setup}} <code>{{.Redirect}}</code>{{with .Note}}<br>{{.}}{{end}}</p>
|
||||||
<form method="post" action="/auth/{{.Provider}}/start">
|
<form method="post" action="/auth/{{.Provider}}/start">
|
||||||
<button type="submit" {{if not .Ready}}disabled title="Save the client ID{{if ne .Provider "x"}} and secret{{end}} first"{{end}}>{{if .Signed}}Reconnect{{else}}Connect{{end}} {{$name}}</button>
|
<button type="submit" {{if not .Ready}}disabled title="Save the client ID{{if ne .Provider "x"}} and secret{{end}} first"{{end}}>{{if .Signed}}Reconnect{{else}}Connect{{end}} {{$name}}</button>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<h1>Overview</h1>
|
<h1>Overview</h1>
|
||||||
<p class="lede">Supermarket's modules, and what's left to set up.</p>
|
<p class="lede">Supermarket's modules, and what's left to set up.</p>
|
||||||
</div>
|
</div>
|
||||||
|
{{template "reminders" .Reminders}}
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{{range .Modules}}
|
{{range .Modules}}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<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.
|
||||||
{{if .Tagged}}Links to your own sites get UTM tags when published.{{end}}</p>
|
{{if .Tagged}}Links to your own sites get UTM tags when published.{{end}}</p>
|
||||||
|
|
||||||
|
{{template "reminders" .Reminders}}
|
||||||
|
|
||||||
{{if .Sections}}
|
{{if .Sections}}
|
||||||
{{range .Sections}}
|
{{range .Sections}}
|
||||||
<h2>{{.Module}}</h2>
|
<h2>{{.Module}}</h2>
|
||||||
|
|||||||
@@ -94,6 +94,15 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{/* Sign-ins running out: {{template "reminders" .Reminders}}. */}}
|
||||||
|
{{define "reminders"}}{{range .}}
|
||||||
|
<section class="card warn reminder" role="status">
|
||||||
|
<p><strong>{{if .Expired}}{{.Network}}'s sign-in expired on {{.At.Local.Format "2 Jan 2006"}}.{{else}}{{.Network}}'s sign-in expires {{if eq .Days 0}}today{{else if eq .Days 1}}tomorrow{{else}}in {{.Days}} days{{end}}, on {{.At.Local.Format "2 Jan 2006"}}.{{end}}</strong>
|
||||||
|
{{if .Expired}}Nothing can be published to {{.Network}} until you reconnect; scheduled posts for it come back to the Inbox.{{else}}After that, nothing can be published to {{.Network}} until you reconnect.{{end}}</p>
|
||||||
|
<a class="button" href="/settings/accounts#network-{{.Network}}">Reconnect {{.Network}}</a>
|
||||||
|
</section>
|
||||||
|
{{end}}{{end}}
|
||||||
|
|
||||||
{{/* A secret's field: {{template "key-field" (dict "F" secretField "Set" bool)}}.
|
{{/* A secret's field: {{template "key-field" (dict "F" secretField "Set" bool)}}.
|
||||||
Saved values are never shown; an empty field keeps what's saved. */}}
|
Saved values are never shown; an empty field keeps what's saved. */}}
|
||||||
{{define "key-field"}}
|
{{define "key-field"}}
|
||||||
|
|||||||
Reference in New Issue
Block a user