Render upload progress from fractional transfer values while keeping the visible percentage rounded. Move the green fill with a linear compositor transform and cover the 92-to-93 percent transition with monotonic frame-level Electron assertions. Keep Electron UI verification listeners loopback-only so development validation no longer raises a Windows Firewall prompt under electron.exe. Extend the public source allowlist with the focused network safety regression coverage.
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
const LOOPBACK_HOST = '127.0.0.1';
|
|
|
|
function listenOnLoopback(server, port = 0) {
|
|
return new Promise((resolve, reject) => {
|
|
const handleError = error => reject(error);
|
|
server.once('error', handleError);
|
|
server.listen(port, LOOPBACK_HOST, () => {
|
|
server.off('error', handleError);
|
|
resolve(server.address());
|
|
});
|
|
});
|
|
}
|
|
|
|
function installLoopbackRemoteServerGuard(RemoteServer, onListening = () => {}) {
|
|
const originalStart = RemoteServer.prototype.start;
|
|
const guardedStart = async function (options) {
|
|
const result = await originalStart.call(this, { ...options, host: LOOPBACK_HOST });
|
|
const address = this._wss && this._wss.address();
|
|
onListening(address && typeof address === 'object' ? address.address : '');
|
|
return result;
|
|
};
|
|
RemoteServer.prototype.start = guardedStart;
|
|
return () => {
|
|
if (RemoteServer.prototype.start === guardedStart) RemoteServer.prototype.start = originalStart;
|
|
};
|
|
}
|
|
|
|
module.exports = { listenOnLoopback, installLoopbackRemoteServerGuard };
|