pinokiod 7.1.61 → 7.1.62

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "7.1.61",
3
+ "version": "7.1.62",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -11367,7 +11367,8 @@ class Server {
11367
11367
  name: "x",
11368
11368
  title: "x.com",
11369
11369
  description: "Connect with X.com",
11370
- url: "/connect/x"
11370
+ url: "/connect/x",
11371
+ hidden: true
11371
11372
  }]
11372
11373
  let github_hosts = await this.get_github_hosts()
11373
11374
  for(let i=0; i<items.length; i++) {
@@ -11408,7 +11409,7 @@ class Server {
11408
11409
  logo: this.logo,
11409
11410
  theme: this.theme,
11410
11411
  agent: req.agent,
11411
- items,
11412
+ items: items.filter((item) => !item.hidden),
11412
11413
  })
11413
11414
  }))
11414
11415
  /*
@@ -591,6 +591,21 @@
591
591
  .replace(/=/g, '');
592
592
  }
593
593
 
594
+ async function openAuthInBrowser(authUrl) {
595
+ const response = await fetch('/go', {
596
+ method: 'POST',
597
+ headers: { 'Content-Type': 'application/json' },
598
+ body: JSON.stringify({ url: authUrl })
599
+ });
600
+ if (!response.ok) {
601
+ throw new Error(`Browser launch failed with status ${response.status}`);
602
+ }
603
+ const payload = await response.json().catch(() => ({}));
604
+ if (payload && payload.error) {
605
+ throw new Error(payload.error);
606
+ }
607
+ }
608
+
594
609
  // OAuth functions
595
610
  async function login() {
596
611
  try {
@@ -624,10 +639,9 @@
624
639
  startSecureConnectPolling();
625
640
  setStatus(`Continue the ${name} login in your browser.`, 'warning');
626
641
  try {
627
- window.open(authUrl, '_blank', 'browser');
642
+ await openAuthInBrowser(authUrl);
628
643
  } catch (openError) {
629
- hideLoader();
630
- setStatus(`Could not open the browser. Please open ${authUrl} manually.`, 'error');
644
+ stopSecureConnectPolling(`Could not open the browser automatically. Please open ${authUrl} manually.`, 'error');
631
645
  return;
632
646
  }
633
647
  return;