symbiot 0.54.2 → 0.54.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/watch.mjs CHANGED
@@ -201,6 +201,9 @@ async function briefOf(news, name, { chat = false } = {}) {
201
201
  }
202
202
 
203
203
  // ---- watches -------------------------------------------------------------------
204
+ // A watch whose last read found the sign-in page: it reads nothing until you sign in again.
205
+ const SIGNED_OUT = "Signed out of ";
206
+ const isSignedOut = (w) => String((w && w.error) || "").startsWith(SIGNED_OUT);
204
207
  const view = (w) => ({ id: w.id, name: w.name, url: w.url, every: w.every, added: w.added, last: w.last || 0, ...(w.checked ? { checked: w.checked } : {}), ...(w.error ? { error: w.error } : {}), ...(w.via ? { via: w.via } : {}), ...(w.cleared ? { cleared: w.cleared } : {}), known: (w.seen || []).length });
205
208
  // What's new is marked `mail` when it's from an inbox, `chat` from WhatsApp,
206
209
  // `social` from LinkedIn's notifications: each can get a drafted reply. A social
@@ -565,7 +568,7 @@ async function checkWatch(id, { read = readPage, github = readGitHub, notify = d
565
568
  w.last = Date.now();
566
569
  // through gh, a list with nothing unread is a good read; a page always lists something
567
570
  const items = page.error || page.login ? [] : page.list || itemsOf(page), before = w.error || "";
568
- if (page.login) w.error = `Signed out of ${hostOf(page.url) || hostOf(w.url)}. Under Screens, type ${hostOf(w.url)} and click Sign in, sign in once and close the window.` + (isGitHubInbox(w.url) ? " Or sign in the GitHub CLI (gh auth login): Symbiot then reads your notifications through it." : "");
571
+ if (page.login) w.error = `${SIGNED_OUT}${hostOf(page.url) || hostOf(w.url)}. Under Screens, type ${hostOf(w.url)} and click Sign in, sign in once and close the window.` + (isGitHubInbox(w.url) ? " Or sign in the GitHub CLI (gh auth login): Symbiot then reads your notifications through it." : "");
569
572
  else if (page.error) w.error = page.error;
570
573
  else if (!items.length && !page.list) w.error = "Found nothing listed on the page this time.";
571
574
  if (page.error || page.login || (!items.length && !page.list)) {
@@ -621,4 +624,4 @@ function startWatches(opts = {}) {
621
624
  return () => { clearTimeout(first); clearInterval(every); };
622
625
  }
623
626
 
624
- export { LINK_ASK, WATCH_FILE, EVERY, GITHUB_INBOX, DRAFTS_DIR, itemsOf, fromOf, chatName, recheckChats, itemKey, newItems, remember, isGitHubInbox, githubItems, readGitHub, setBrief, briefOf, newsNotice, markNews, watchState, addWatch, setEvery, removeWatch, clearNews, seenWatch, newsSince, newsAfter, waitingOn, watchBoard, boardLine, boardChat, boardTalk, clearBoardChat, talkOf, isMail, isChat, isSocial, draftsUrl, draftBrief, chatBrief, socialBrief, draftReply, openChat, checkWatch, dueWatches, startWatches };
627
+ export { LINK_ASK, WATCH_FILE, EVERY, GITHUB_INBOX, DRAFTS_DIR, itemsOf, fromOf, chatName, recheckChats, itemKey, newItems, remember, isGitHubInbox, githubItems, readGitHub, setBrief, briefOf, newsNotice, markNews, watchState, addWatch, setEvery, removeWatch, clearNews, seenWatch, newsSince, newsAfter, waitingOn, watchBoard, boardLine, boardChat, boardTalk, clearBoardChat, talkOf, isSignedOut, isMail, isChat, isSocial, draftsUrl, draftBrief, chatBrief, socialBrief, draftReply, openChat, checkWatch, dueWatches, startWatches };