tripo-cli 0.3.1 → 0.3.2

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.
@@ -391,8 +391,8 @@ function safeTimeZone() {
391
391
  async function keyFromConsole(region, openBrowser) {
392
392
  // The console SPA nests every page under a locale segment (/:lang/keys);
393
393
  // a bare /keys is swallowed by the ":lang" route and lands on the home
394
- // page. Both regions' backends use /en in their canonical URLs.
395
- const keysUrl = `${platformUrlFor(region)}/en/keys`;
394
+ // page. cn opens the Chinese console, ov the English one.
395
+ const keysUrl = `${platformUrlFor(region)}/${REGION_DEFAULTS[region].lang}/keys`;
396
396
  if (openBrowser && shouldOpen()) {
397
397
  openExternal(keysUrl);
398
398
  log(t({ zh: `已打开控制台 API Keys 页面(未弹出请手动访问):\n ${keysUrl}`, en: `opened the console API Keys page (visit manually if it didn't open):\n ${keysUrl}` }));
@@ -31,17 +31,22 @@ export const DEFAULT_PROFILE = 'default';
31
31
  * is why this is one CLI with a `region` field and not two CLIs. A key is
32
32
  * valid in exactly one region, so region is *detected* from the key at login
33
33
  * time, never asked when a key is already in hand.
34
+ *
35
+ * `lang` is the console's locale segment (/:lang/...) the CLI opens pages
36
+ * under: the cn console in Chinese, the ov console in English.
34
37
  */
35
38
  export const REGION_DEFAULTS = {
36
39
  ov: {
37
40
  api: 'https://openapi.tripo3d.ai',
38
41
  platform: 'https://developers.tripo3d.ai',
39
42
  consoleApi: 'https://apiplatform.tripo3d.ai',
43
+ lang: 'en',
40
44
  },
41
45
  cn: {
42
46
  api: 'https://openapi.tripo3d.com',
43
47
  platform: 'https://developers.tripo3d.com',
44
48
  consoleApi: 'https://apiplatform.tripo3d.com',
49
+ lang: 'zh',
45
50
  },
46
51
  };
47
52
  export function tripoHome() {
@@ -89,10 +89,19 @@ export async function requestDeviceCode(region, profile) {
89
89
  }
90
90
  return {
91
91
  ...grant,
92
+ verification_url_complete: localizeConsoleUrl(grant.verification_url_complete, region),
92
93
  expires_in: grant.expires_in > 0 ? grant.expires_in : 900,
93
94
  interval: grant.interval > 0 ? grant.interval : 5,
94
95
  };
95
96
  }
97
+ /**
98
+ * The console SPA nests every page under a locale segment (/:lang/...) and
99
+ * the backend hardcodes /en in the URLs it issues — which drops cn users on
100
+ * the English authorization page. Swap in the region's console locale.
101
+ */
102
+ function localizeConsoleUrl(url, region) {
103
+ return url.replace(/^(https?:\/\/[^/]+)\/en(?=[/?#]|$)/, `$1/${REGION_DEFAULTS[region].lang}`);
104
+ }
96
105
  export async function pollDeviceToken(region, deviceCode) {
97
106
  const body = await post(`${consoleApiBaseUrl(region)}/cli/device/token`, { device_code: deviceCode });
98
107
  if (body.code === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripo-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Tripo 3D intelligent CLI — turn a prompt or an image into engine-ready 3D assets from your terminal (Tripo V3 API)",
5
5
  "keywords": [
6
6
  "tripo",