papilot 0.3.0 → 0.5.0

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.
Files changed (34) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/bin/doctor.mjs +11 -0
  4. package/dist/assets/index-BqX4tIMz.js +217 -0
  5. package/dist/assets/index-C0hHDQdZ.css +1 -0
  6. package/dist/assets/{math-BTm2hvOz.js → math-CUuXX16h.js} +7 -7
  7. package/dist/assets/{pdf-view-BEn1EztO.js → pdf-view-CNYCI_LH.js} +2 -2
  8. package/dist/index.html +2 -2
  9. package/package.json +4 -2
  10. package/src/notes.ts +1 -1
  11. package/src/server/access.ts +170 -0
  12. package/src/server/accounts.ts +226 -0
  13. package/src/server/app.ts +345 -0
  14. package/src/server/changes.ts +295 -0
  15. package/src/server/frontend.ts +1 -1
  16. package/src/server/main.ts +22 -223
  17. package/src/server/manuscript.ts +40 -18
  18. package/src/server/paths.ts +4 -0
  19. package/src/server/security.ts +20 -0
  20. package/src/server/store.ts +5 -0
  21. package/src/server/workspace.ts +48 -18
  22. package/src/shared.ts +17 -4
  23. package/vendor/latex-review/dist/web/assets/index-Bq8CnbPr.js +19 -0
  24. package/vendor/latex-review/dist/web/assets/index-vftKrRf_.css +1 -0
  25. package/vendor/latex-review/dist/web/index.html +2 -2
  26. package/vendor/latex-review/src/render/pdf.ts +35 -1
  27. package/vendor/latex-review/src/web/main.tsx +8 -1
  28. package/vendor/latex-review/src/web/review.tsx +249 -109
  29. package/vendor/latex-review/src/web/style.css +6 -0
  30. package/vendor/latex-review/src/web/zh-CN.ts +35 -0
  31. package/dist/assets/index-BkowXmKr.js +0 -206
  32. package/dist/assets/index-Dq3s-vhH.css +0 -1
  33. package/vendor/latex-review/dist/web/assets/index-Bg-VqnPa.css +0 -1
  34. package/vendor/latex-review/dist/web/assets/index-xLeqYBJt.js +0 -19
package/README.md CHANGED
@@ -103,6 +103,8 @@ npm uninstall -g papilot # remove it; your state stays in ~/.papilot until
103
103
 
104
104
  Papilot listens only on `127.0.0.1`. To use it from another device, publish it on your tailnet with Tailscale Serve and set `PAPILOT_PUBLIC_ORIGIN` and `PAPILOT_TAILSCALE_LOGIN`. Papilot then checks the host, the browser origin and the Tailscale identity of every request. The [guide](docs/guide.md#remote-access-with-tailscale) has the steps.
105
105
 
106
+ To invite an advisor or co-authors, give Papilot a public HTTPS address with `PAPILOT_ACCOUNT_ORIGIN` and open **People**: each person signs in with a passkey and sees only the papers you share. Invite only people you would trust with access to the computer Papilot runs on; see [Collaborators](docs/guide.md#collaborators).
107
+
106
108
  </details>
107
109
 
108
110
  <details>
package/README.zh-CN.md CHANGED
@@ -103,6 +103,8 @@ npm uninstall -g papilot # 卸载;状态仍保留在 ~/.papilot,可自
103
103
 
104
104
  Papilot 只监听 `127.0.0.1`。若要从其他设备访问,用 Tailscale Serve 把它发布到你的 tailnet,并设置 `PAPILOT_PUBLIC_ORIGIN` 和 `PAPILOT_TAILSCALE_LOGIN`;Papilot 会校验每个请求的主机、浏览器来源和 Tailscale 身份。具体步骤见[指南](docs/guide.md#remote-access-with-tailscale)。
105
105
 
106
+ 要邀请导师或合作者,用 `PAPILOT_ACCOUNT_ORIGIN` 给 Papilot 一个公开的 HTTPS 地址,然后打开 **成员**:每个人用通行密钥登录,只能看到你共享的论文。只邀请你愿意让其访问运行 Papilot 的这台电脑的人,详见[协作者](docs/guide.md#collaborators)。
107
+
106
108
  </details>
107
109
 
108
110
  <details>
package/bin/doctor.mjs CHANGED
@@ -191,6 +191,17 @@ export async function doctor(args) {
191
191
  try { const url = new URL(origin); remoteValid = ['http:', 'https:'].includes(url.protocol) && url.origin === origin && !url.username && !url.password; } catch { /* Invalid origin. */ }
192
192
  }
193
193
  check('remote', remoteValid, 'error', origin || owner ? 'Tailscale origin and owner configuration.' : 'Local access only; remote access is optional.', 'Set both PAPILOT_PUBLIC_ORIGIN (scheme and host, optional port, no path) and PAPILOT_TAILSCALE_LOGIN, or unset both for local access.');
194
+ // The collaborators' sign-in address: its own HTTPS origin and local port, apart from the tailnet endpoint.
195
+ const accountOrigin = (process.env.PAPILOT_ACCOUNT_ORIGIN || '').replace(/\/+$/, ''), accountPort = Number(process.env.PAPILOT_ACCOUNT_PORT || 7275);
196
+ let accountValid = !accountOrigin;
197
+ if (accountOrigin) {
198
+ try {
199
+ const url = new URL(accountOrigin);
200
+ accountValid = url.origin === accountOrigin && (url.protocol === 'https:' || (url.protocol === 'http:' && url.hostname === 'localhost'))
201
+ && Number.isInteger(accountPort) && accountPort > 0 && accountPort < 65536 && accountPort !== port && !(origin && URL.canParse(origin) && new URL(origin).host === url.host);
202
+ } catch { /* Invalid origin. */ }
203
+ }
204
+ check('accounts', accountValid, 'error', accountOrigin ? `Collaborators sign in at ${accountOrigin}, forwarded to 127.0.0.1:${accountPort}.` : 'No public sign-in for collaborators; it is optional.', 'Set PAPILOT_ACCOUNT_ORIGIN to an https:// origin without a path that differs from PAPILOT_PUBLIC_ORIGIN (for Funnel, port 10000), and PAPILOT_ACCOUNT_PORT to a free port other than the Papilot port. Papilot does not start otherwise.');
194
205
  try {
195
206
  const response = await fetch(`http://127.0.0.1:${port}/api/health`, { signal: AbortSignal.timeout(1500), redirect: 'error' });
196
207
  const health = await response.json();