@gpdoc/cli 1.6.0 → 1.7.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 (2) hide show
  1. package/lib/remote.js +9 -1
  2. package/package.json +1 -1
package/lib/remote.js CHANGED
@@ -17,6 +17,14 @@ function apiBase(env) {
17
17
  return String(env.GPDOC_API_BASE_URL || 'https://gpdoc.io').replace(/\/$/, '');
18
18
  }
19
19
 
20
+ // @spec RUNTIME-CF-ACCOUNT-019
21
+ function accountApiBase(env) {
22
+ const configured = String(env.GPDOC_ACCOUNT_API_BASE_URL || '').trim().replace(/\/$/, '');
23
+ if (configured) return configured;
24
+ const configuredApiBase = apiBase(env);
25
+ return configuredApiBase === 'https://gpdoc.io' ? 'https://api.gpdoc.io' : configuredApiBase;
26
+ }
27
+
20
28
  async function jsonRequest(fetchImpl, url, init, fallbackCode = 'REMOTE_REQUEST_FAILED') {
21
29
  let response;
22
30
  try {
@@ -69,7 +77,7 @@ function microsoftFilename(filename, title) {
69
77
 
70
78
  async function githubToken({ auth, env, fetchImpl }) {
71
79
  const token = await auth.getAccessToken();
72
- const payload = await jsonRequest(fetchImpl, `${apiBase(env)}/.netlify/functions/get-user-profile`, { headers: bearer(token) }, 'GITHUB_IDENTITY_REQUIRED');
80
+ const payload = await jsonRequest(fetchImpl, `${accountApiBase(env)}/account/profile`, { headers: bearer(token) }, 'GITHUB_IDENTITY_REQUIRED');
73
81
  if (typeof payload.github_access_token !== 'string' || !payload.github_access_token) {
74
82
  throw new RemoteError('GITHUB_IDENTITY_REQUIRED', 'Connect GitHub to the signed-in GPDoc account before using GitHub sources.');
75
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpdoc/cli",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "description": "GPDoc command-line file conversion and validation tools",
6
6
  "repository": "https://github.com/repetere/gpdoc.git",