prividium 0.5.0 → 0.6.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.
|
@@ -48,6 +48,9 @@ async function startServer(opts) {
|
|
|
48
48
|
},
|
|
49
49
|
onReAuthNeeded() {
|
|
50
50
|
workflow.onMessage(`Please login again: ${serverUrl}`);
|
|
51
|
+
},
|
|
52
|
+
onError: (err) => {
|
|
53
|
+
workflow.onError(err);
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
checkHostAndPortWarnings(opts.host, opts.port, opts.allowExternalAccess);
|
|
@@ -23,6 +23,11 @@ export function buildServer(config) {
|
|
|
23
23
|
const app = fastifyApp();
|
|
24
24
|
const validHosts = config.host === 'localhost' || config.host === '127.0.0.1' ? ['localhost', '127.0.0.1'] : [config.host];
|
|
25
25
|
app.setValidatorCompiler(validatorCompiler);
|
|
26
|
+
app.setErrorHandler((err, _req, reply) => {
|
|
27
|
+
config.onError(err);
|
|
28
|
+
console.error(err);
|
|
29
|
+
return reply.status(500).send({ error: err.message });
|
|
30
|
+
});
|
|
26
31
|
const state = randomStateString();
|
|
27
32
|
let accessToken = '';
|
|
28
33
|
let expiresAt = new Date();
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
<span>You can now access your Prividium™ RPC proxy at: </span>
|
|
39
39
|
<span class="font-bold">http://127.0.0.1:24101/rpc</span>
|
|
40
40
|
</div>
|
|
41
|
+
<pre
|
|
42
|
+
id="error-details"
|
|
43
|
+
style="display: none"
|
|
44
|
+
class="mt-4 p-4 bg-red-50 border border-red-200 rounded-lg text-left text-sm text-red-800 overflow-auto max-h-48"
|
|
45
|
+
></pre>
|
|
41
46
|
</div>
|
|
42
47
|
<script>
|
|
43
48
|
const titleElem = document.getElementById('main-title');
|
|
@@ -58,12 +63,32 @@
|
|
|
58
63
|
token: maybeToken,
|
|
59
64
|
state: maybeState
|
|
60
65
|
})
|
|
61
|
-
}).then(() => {
|
|
62
|
-
|
|
66
|
+
}).then((res) => {
|
|
67
|
+
if (res.status === 200) {
|
|
68
|
+
titleElem.innerHTML = 'Done! This window can be closed now.';
|
|
69
|
+
document.querySelector('svg').style.display = 'none';
|
|
70
|
+
const urlElem = document.getElementById('proxy-url');
|
|
71
|
+
urlElem.style.display = 'block';
|
|
72
|
+
} else {
|
|
73
|
+
titleElem.innerHTML = 'Oops! Something went wrong';
|
|
74
|
+
titleElem.className = 'text-2xl md:text-3xl font-bold text-red-600';
|
|
75
|
+
document.querySelector('svg').style.display = 'none';
|
|
76
|
+
res.text().then((errMsg) => {
|
|
77
|
+
const errorElem = document.getElementById('error-details');
|
|
78
|
+
errorElem.textContent = errMsg;
|
|
79
|
+
errorElem.style.display = 'block';
|
|
80
|
+
console.error(errMsg);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, (err) => {
|
|
84
|
+
titleElem.innerHTML = 'Oops! Something went wrong';
|
|
85
|
+
titleElem.className = 'text-2xl md:text-3xl font-bold text-red-600';
|
|
63
86
|
document.querySelector('svg').style.display = 'none';
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
const errorElem = document.getElementById('error-details');
|
|
88
|
+
errorElem.textContent = err.message;
|
|
89
|
+
errorElem.style.display = 'block';
|
|
90
|
+
console.error(err);
|
|
91
|
+
});
|
|
67
92
|
}
|
|
68
93
|
</script>
|
|
69
94
|
</body>
|