prividium 0.13.0 → 0.14.1
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.
|
@@ -2,6 +2,7 @@ import * as net from 'node:net';
|
|
|
2
2
|
import { requireHttpOk } from '../../clients/http.js';
|
|
3
3
|
import { requireRpcResult } from '../../clients/rpc.js';
|
|
4
4
|
import { DEFAULT_DOCTOR_CALLBACK_PORT } from '../../constants.js';
|
|
5
|
+
import { getRawReason } from '../../utils.js';
|
|
5
6
|
export async function runCallbackPortProbe() {
|
|
6
7
|
const available = await new Promise((resolve) => {
|
|
7
8
|
const server = net.createServer();
|
|
@@ -17,8 +18,17 @@ export async function runUserPanelReachabilityProbe(context) {
|
|
|
17
18
|
await requireHttpOk(new URL('/health', context.targets.userPanelBaseUrl));
|
|
18
19
|
}
|
|
19
20
|
export async function runApiHealthProbe(context) {
|
|
20
|
-
await
|
|
21
|
+
const healthResponse = await fetch(new URL('/health', context.targets.apiBaseUrl));
|
|
22
|
+
if (!healthResponse.ok) {
|
|
23
|
+
const reason = getRawReason(healthResponse.status, await healthResponse.text());
|
|
24
|
+
throw new Error(reason);
|
|
25
|
+
}
|
|
21
26
|
await requireHttpOk(new URL('/readyz', context.targets.apiBaseUrl));
|
|
27
|
+
const body = (await healthResponse.json());
|
|
28
|
+
if (body.version) {
|
|
29
|
+
context.apiVersion = body.version;
|
|
30
|
+
}
|
|
31
|
+
return {};
|
|
22
32
|
}
|
|
23
33
|
export async function runPublicRpcProbe(context) {
|
|
24
34
|
const version = await requireRpcResult(context.targets.apiBaseUrl, { method: 'web3_clientVersion' });
|
|
@@ -21,6 +21,7 @@ function buildSummaryBlock(context) {
|
|
|
21
21
|
values: [
|
|
22
22
|
{ label: 'Status', value: `${failCount} failed, ${skipCount} skipped, ${passCount} passed` },
|
|
23
23
|
{ label: 'API', value: context.targets?.apiBaseUrl ?? context.rawRpcUrl },
|
|
24
|
+
...(context.apiVersion ? [{ label: 'API Version', value: context.apiVersion }] : []),
|
|
24
25
|
{ label: 'User Panel', value: context.targets?.userPanelBaseUrl ?? context.rawUserPanelUrl },
|
|
25
26
|
{ label: 'Time', value: new Date().toISOString() }
|
|
26
27
|
]
|
|
@@ -12,13 +12,21 @@
|
|
|
12
12
|
<div
|
|
13
13
|
class="text-center bg-white/80 backdrop-blur-md py-10 px-6 shadow-xl rounded-2xl border border-slate-200 sm:px-12 w-full max-w-md"
|
|
14
14
|
>
|
|
15
|
+
<div id="error-icon" style="display: none" class="mb-4">
|
|
16
|
+
<svg class="h-10 w-10 text-red-500 mx-auto" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
17
|
+
<title>Error</title>
|
|
18
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
|
|
19
|
+
<path d="M12 9v4" />
|
|
20
|
+
<path d="M12 17h.01" />
|
|
21
|
+
</svg>
|
|
22
|
+
</div>
|
|
15
23
|
<h1
|
|
16
24
|
id="main-title"
|
|
17
25
|
class="text-2xl md:text-3xl font-bold bg-gradient-to-r from-blue-700 to-blue-900 bg-clip-text text-transparent"
|
|
18
26
|
>
|
|
19
27
|
Finalizing Prividium™ sign-in...
|
|
20
28
|
</h1>
|
|
21
|
-
<div class="mt-4">
|
|
29
|
+
<div id="spinner" class="mt-4">
|
|
22
30
|
<svg
|
|
23
31
|
class="animate-spin h-8 w-8 text-blue-700 mx-auto"
|
|
24
32
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -42,18 +50,32 @@
|
|
|
42
50
|
<pre
|
|
43
51
|
id="error-details"
|
|
44
52
|
style="display: none"
|
|
45
|
-
class="mt-4 p-4 bg-red-50 border border-red-200 rounded-lg text-left text-sm text-red-800
|
|
53
|
+
class="mt-4 p-4 bg-red-50 border border-red-200 rounded-lg text-left text-sm text-red-800 whitespace-pre-wrap break-words max-h-64 overflow-auto"
|
|
46
54
|
></pre>
|
|
47
55
|
</div>
|
|
48
56
|
<script>
|
|
49
57
|
const titleElem = document.getElementById('main-title');
|
|
50
58
|
const hashPath = window.location.hash;
|
|
51
59
|
const params = new URLSearchParams(hashPath.replace(/^#/, ''));
|
|
60
|
+
|
|
61
|
+
function showError(title, detail) {
|
|
62
|
+
titleElem.innerHTML = title;
|
|
63
|
+
titleElem.className = 'text-2xl md:text-3xl font-bold text-red-600';
|
|
64
|
+
document.getElementById('spinner').style.display = 'none';
|
|
65
|
+
document.getElementById('error-icon').style.display = 'block';
|
|
66
|
+
if (detail) {
|
|
67
|
+
const errorElem = document.getElementById('error-details');
|
|
68
|
+
errorElem.textContent = detail;
|
|
69
|
+
errorElem.style.display = 'block';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
52
73
|
const maybeToken = params.get('token');
|
|
53
74
|
const maybeState = params.get('state');
|
|
54
75
|
|
|
55
|
-
if (!maybeToken || !
|
|
56
|
-
|
|
76
|
+
if (!maybeToken || !maybeState) {
|
|
77
|
+
showError('Authentication failed', 'Missing authentication parameters. Please close this window and try again.');
|
|
78
|
+
console.error('Missing token or state in callback URL');
|
|
57
79
|
} else {
|
|
58
80
|
fetch('/submit', {
|
|
59
81
|
method: 'POST',
|
|
@@ -67,27 +89,17 @@
|
|
|
67
89
|
}).then((res) => {
|
|
68
90
|
if (res.status === 200) {
|
|
69
91
|
titleElem.innerHTML = 'Done! This window can be closed now.';
|
|
70
|
-
document.
|
|
92
|
+
document.getElementById('spinner').style.display = 'none';
|
|
71
93
|
const urlElem = document.getElementById('proxy-url');
|
|
72
94
|
urlElem.style.display = 'block';
|
|
73
95
|
} else {
|
|
74
|
-
titleElem.innerHTML = 'Oops! Something went wrong';
|
|
75
|
-
titleElem.className = 'text-2xl md:text-3xl font-bold text-red-600';
|
|
76
|
-
document.querySelector('svg').style.display = 'none';
|
|
77
96
|
res.text().then((errMsg) => {
|
|
78
|
-
|
|
79
|
-
errorElem.textContent = errMsg;
|
|
80
|
-
errorElem.style.display = 'block';
|
|
97
|
+
showError('Oops! Something went wrong', `${errMsg}\n\nPlease close this window and try again.`);
|
|
81
98
|
console.error(errMsg);
|
|
82
99
|
});
|
|
83
100
|
}
|
|
84
101
|
}, (err) => {
|
|
85
|
-
|
|
86
|
-
titleElem.className = 'text-2xl md:text-3xl font-bold text-red-600';
|
|
87
|
-
document.querySelector('svg').style.display = 'none';
|
|
88
|
-
const errorElem = document.getElementById('error-details');
|
|
89
|
-
errorElem.textContent = err.message;
|
|
90
|
-
errorElem.style.display = 'block';
|
|
102
|
+
showError('Oops! Something went wrong', `${err.message}\n\nPlease close this window and try again.`);
|
|
91
103
|
console.error(err);
|
|
92
104
|
});
|
|
93
105
|
}
|