Skip to content

Add Instapaper Reading Queue widget for Scriptable#1

Open
rachitwatts wants to merge 5 commits intomasterfrom
claude/instapaper-scriptable-widget-McEif
Open

Add Instapaper Reading Queue widget for Scriptable#1
rachitwatts wants to merge 5 commits intomasterfrom
claude/instapaper-scriptable-widget-McEif

Conversation

@rachitwatts
Copy link
Owner

Summary

This PR adds a new Scriptable widget that displays a random unread article from your Instapaper reading queue. The widget shows article metadata (title, description, featured image) and reading time estimates, with a tap action to open the article in Instapaper.

Key Changes

  • OAuth 1.0a Authentication: Implements xAuth flow to exchange Instapaper credentials for OAuth tokens, which are securely stored in the device keychain
  • Instapaper API Integration: Fetches unread bookmarks from the Instapaper API and retrieves Open Graph images from article URLs
  • Cryptographic Functions: Includes pure JavaScript implementations of SHA-1 and HMAC-SHA1 for OAuth signature generation
  • Smart Caching: Implements local file-based caching with 15-minute TTL to reduce API calls, with fallback to stale cache on network errors
  • Responsive Widget Layouts: Supports small, medium, and large widget families with adaptive layouts (image-on-top for small, side-by-side for medium/large)
  • Reading Time Estimates: Calculates total reading time across the queue based on configurable average word counts and reading speed
  • Interactive UI: Displays article count, estimated reading time, and provides direct tap-to-open functionality

Notable Implementation Details

  • Credentials are never stored locally; only OAuth tokens are persisted in the keychain
  • Image fetching is best-effort with 8-second timeouts to prevent widget hangs
  • Widget gracefully handles empty reading queues and network failures with appropriate error states
  • Supports both interactive setup mode (when run in the Scriptable app) and widget mode (on home screen)

https://claude.ai/code/session_01QsCcdu4bFzd1xy4NQ1oWYb

Self-contained iOS widget that shows unread article count and estimated
reading time using the Instapaper Full API (OAuth 1.0a / xAuth).
Tapping the widget opens a random unread article. Includes a pure-JS
SHA-1/HMAC-SHA1 implementation so no external dependencies are needed
inside the Scriptable runtime.

https://claude.ai/code/session_01QsCcdu4bFzd1xy4NQ1oWYb
The widget now shows a random unread article with its Open Graph
image and title. A horizontal separator at the bottom divides the
article card from a stats bar showing total unread count and
estimated reading time. Supports small (vertical) and medium/large
(horizontal) widget layouts. Article images are fetched from og:image
meta tags and cached locally alongside the featured article selection.

https://claude.ai/code/session_01QsCcdu4bFzd1xy4NQ1oWYb
Replaces the full OAuth 1.0a / HMAC-SHA1 implementation with a much
simpler Shortcuts-based data pipeline. An iOS Shortcut uses
Instapaper's native "Get Instapaper Bookmarks" action to fetch
articles, then passes the data to this script via Scriptable's
"Run Script" Shortcuts action. The script caches the data locally
for the widget to render.

This eliminates the need for API consumer keys, OAuth credentials,
and ~400 lines of crypto code. Requires Instapaper Premium for the
Shortcuts action.

https://claude.ai/code/session_01QsCcdu4bFzd1xy4NQ1oWYb
Instapaper has no universal links (their AASA only declares
webcredentials) and no documented deep link to a specific article,
so the best we can do is open the app directly.

https://claude.ai/code/session_01QsCcdu4bFzd1xy4NQ1oWYb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants