Skip to content

feat: add arXiv papers, GitHub code and file links from an address - #75

Merged
bencode merged 1 commit into
mainfrom
feat/add-from-url
Oct 3, 2026
Merged

bencode merged 1 commit into
mainfrom
feat/add-from-url

Conversation

@bencode

@bencode bencode commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What

The Add menu gains Add from URL…. Paste an address and the browser downloads it directly. No server is involved and no list of sites is kept.

Address Result
arXiv paper page (abs/<id> or pdf/<id>) The paper's PDF, opened
GitHub file (blob/<ref>/<path>) The raw file, opened
GitHub repository or folder (tree/<ref>/<dir>) Added as a chosen folder would be
Any other https link Downloaded as it is, where the site allows cross-origin reads

How

  • Addresses. core/url-import.ts turns an address into a target. arXiv and GitHub pages are rewritten to the file they stand for. Any other https address is downloaded as given.
  • GitHub folders. One call to the trees API returns every path and size. selectFolderFiles (now generic over file metadata) then applies the folder rules: hidden and dependency folders, files over 1 MiB, unreadable formats, and the 5000-file limit. This happens before anything is downloaded, and the skipped count stays accurate. The remaining files come from raw.githubusercontent.com, six at a time.
  • Shared folder path. use-file-library gains addFromUrl. A folder goes through the same settleFolder path as a folder picked from disk, so duplicates, limits and status messages are shared. A single file's id is returned and opened once the library lists it.
  • Failures. A site that refuses cross-origin reads gets a sentence asking the reader to download the file and drag it in. A 404 and GitHub's hourly listing limit get their own messages.
  • Add menu. It is now always a menu, with Add folder… shown where the browser supports it.

Limits

  • GitHub allows 60 unauthenticated listings an hour per network. Raw file downloads are not limited.
  • A ref containing / is read as the ref's first segment.
  • Private repositories are not supported.

Verification

  • pnpm check passes.
  • New tests:
    • url-import unit tests: arXiv forms, GitHub forms, generic links, and rejected input.
    • An integration test that adds a GitHub file, which opens, and a GitHub folder, then checks that skipped files are never downloaded and a 404 shows its message.
  • Checked against the real network in a browser:
    • arxiv.org/abs/1706.03762 opens.
    • github.com/octocat/Spoon-Knife is added as a folder.
    • example.com shows the cross-origin message.

Add from URL takes an arXiv paper page, a GitHub repository, folder or
file, or a link to any file. The browser downloads it directly, so no
server is involved and no site list is kept: a site that does not allow
cross-origin reads gets a sentence asking the reader to download the
file and drag it in.

An arXiv abstract page stands for its PDF and a GitHub file page for its
raw content; both open once added. A GitHub folder is listed once
through the API, filtered by the rules a chosen folder follows before
anything is downloaded, and then fetched file by file from raw content.
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.

1 participant