Skip to content

feat: add configurable base URL for self-hosted Overleaf instances#11

Open
Alice-space wants to merge 8 commits intoaloth:mainfrom
Alice-space:feature/custom-base-url
Open

feat: add configurable base URL for self-hosted Overleaf instances#11
Alice-space wants to merge 8 commits intoaloth:mainfrom
Alice-space:feature/custom-base-url

Conversation

@Alice-space
Copy link
Copy Markdown

@Alice-space Alice-space commented Apr 10, 2026

Summary

Adds configurable baseUrl and sessionCookieName for compatibility with self-hosted ShareLaTeX/Overleaf instances (tested against IHEP's instance at https://latex.ihep.ac.cn).

Changes

src/config.ts

  • getBaseUrl() / setBaseUrl() / clearBaseUrl() — env OVERLEAF_BASE_URL, default https://www.overleaf.com
  • getSessionCookieName() / setSessionCookieName() — env OVERLEAF_COOKIE_NAME, default overleaf_session2

src/client.ts

  • Constructor accepts baseUrl parameter; all API URLs derived from it
  • listProjects(): tries POST /api/project first (legacy ShareLaTeX JSON API), falls back to HTML scraping
  • New project CRUD: createProject, renameProject, trashProject, deleteProject
  • findEntityByPath() uses socket.io joinProject for instances without ol-project HTML meta

src/cli.ts

  • Global --base-url and --cookie-name options
  • config set-url / get-url / set-cookie-name / get-cookie-name subcommands
  • create-project, delete-project (--permanent), rename-project commands
  • File delete / rename commands re-enabled

Tested with

  • https://latex.ihep.ac.cn (IHEP self-hosted ShareLaTeX, cookie name overleaf.sid)
  • 24 projects visible, full create/rename/trash/delete/upload/compile cycle verified

🤖 Generated with Claude Code

Alice-space and others added 8 commits April 10, 2026 11:27
…onfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…leaf instances

Adds OVERLEAF_COOKIE_NAME env var, config set-cookie-name/get-cookie-name
commands, and --cookie-name global option. Defaults to overleaf_session2;
set to overleaf.sid for instances running older Overleaf versions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ted instances

Some self-hosted Overleaf versions expose a JSON API at POST /api/project
instead of embedding projects in HTML meta tags. Try this endpoint first
and fall back to HTML parsing for backward compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eX instances

Implements project CRUD commands (create-project, delete-project, rename-project)
tested against latex.ihep.ac.cn API based on T001 API findings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… resolution

Uncomment delete and rename commands in cli.ts - these previously required
entity _ids that weren't available via REST API, but client.ts now resolves
them via socket.io joinProject (getProjectFileTreeFromSocket).

Smoke tested on IHEP instance: upload, delete, rename all pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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