// browser_extension for refhub.io
browser extension for saving papers to refhub directly from any tab. one shared source tree, browser-specific manifests for chrome and firefox.
- reads the current tab url on user action
- extracts metadata from the page — canonical url, citation meta tags, json-ld, open graph, document metadata
- shows a popup preview with page type, doi, source, and normalized fields
- lists writable vaults and saves the item via
POST /api/v1/vaults/:vaultId/items - detects linked google drive storage and copies the pdf into the managed drive folder when available
- opens the matching refhub route after save —
/public/:slugfor public vaults,/vault/:idfor private
npm run buildrelease builds default to production endpoints, locked in the options ui. for local or self-hosted work:
REFHUB_ALLOW_CUSTOM_URLS=1 \
REFHUB_API_BASE_URL=https://refhub-api.netlify.app \
REFHUB_APP_BASE_URL=https://refhub.io \
npm run build
# or shortcut
npm run build:devoutput:
dist/chrome
dist/firefox
manifest strategy:
- chrome: mv3
background.service_worker - firefox: mv3
background.scripts— loads as a temporary add-on without forking runtime code
- chrome / chromium — chrome web store (pending approval)
- firefox — mozilla add-ons (pending approval)
chrome / chromium
- run
npm run buildor download the latest release zip - extract to a folder on disk
- open
chrome://extensions - enable developer mode (top-right toggle)
- click load unpacked → select
dist/chrome
firefox
- run
npm run buildor download the latest release zip - extract to a folder on disk
- open
about:debugging#/runtime/this-firefox - click load temporary add-on → select
dist/firefox/manifest.json
firefox temporary add-ons are removed on browser restart — preview/testing only. do not load the release zip directly via "extensions → load from file" — firefox rejects unsigned packages.
see docs/RELEASE_NOTES.md for detailed user-facing install instructions.
- sign in to refhub
- open
refhub.io/profile-edit→api_keystab - create a key with
vaults:readandvaults:write - optionally restrict the key to selected vaults
- open the extension options page and paste the api key
- open a supported page, click the extension action
- confirm the preview, choose a vault, click
save_to_refhub
required scopes: vaults:read · vaults:write
not required: vaults:export
for local or self-hosted testing, build with REFHUB_ALLOW_CUSTOM_URLS=1 then set:
refhub api base url— backend origin only, no/api/v1suffixrefhub app url— frontend origin for post-save links
| permission | reason |
|---|---|
activeTab |
capture only runs after explicit user action on the current tab |
scripting |
extract metadata from the active tab |
storage |
persist api key and last-used vault locally |
| host permissions | narrowed to bundled refhub api origin in release builds; broader in dev builds for local override targets |
in scope:
- doi landing pages
- pages with
citation_*metadata - pages with article-like json-ld
- generic pages with usable title + url fallback
out of scope:
- direct pdf tabs
- multi-item search / index pages
- background crawling or persistent site access
- full auth / token exchange inside the extension
src/js/
background.js ← extraction orchestration, refhub api calls, vault caching, post-save routing
popup.js ← capture preview, vault picker, save flow
options.js ← api key config, dev endpoint overrides
scripts/
build.mjs ← emits browser-specific manifests from shared source tree
capture uses activeTab + scripting.executeScript — no persistent access to arbitrary sites.
shared across browsers: popup ui, extraction heuristics, normalization, storage schema, refhub api client.
isolated per browser: manifests, a thin chrome vs browser api compatibility layer, auth handoff, service worker lifecycle differences.
chrome-first for v1. firefox support is an incremental adapter-and-testing exercise, not a separate implementation.