- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
66 lines
2.4 KiB
JavaScript
66 lines
2.4 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const debug_1 = __importDefault(require("debug"));
|
|
const debug = debug_1.default('https-proxy-agent:parse-proxy-response');
|
|
function parseProxyResponse(socket) {
|
|
return new Promise((resolve, reject) => {
|
|
// we need to buffer any HTTP traffic that happens with the proxy before we get
|
|
// the CONNECT response, so that if the response is anything other than an "200"
|
|
// response code, then we can re-play the "data" events on the socket once the
|
|
// HTTP parser is hooked up...
|
|
let buffersLength = 0;
|
|
const buffers = [];
|
|
function read() {
|
|
const b = socket.read();
|
|
if (b)
|
|
ondata(b);
|
|
else
|
|
socket.once('readable', read);
|
|
}
|
|
function cleanup() {
|
|
socket.removeListener('end', onend);
|
|
socket.removeListener('error', onerror);
|
|
socket.removeListener('close', onclose);
|
|
socket.removeListener('readable', read);
|
|
}
|
|
function onclose(err) {
|
|
debug('onclose had error %o', err);
|
|
}
|
|
function onend() {
|
|
debug('onend');
|
|
}
|
|
function onerror(err) {
|
|
cleanup();
|
|
debug('onerror %o', err);
|
|
reject(err);
|
|
}
|
|
function ondata(b) {
|
|
buffers.push(b);
|
|
buffersLength += b.length;
|
|
const buffered = Buffer.concat(buffers, buffersLength);
|
|
const endOfHeaders = buffered.indexOf('\r\n\r\n');
|
|
if (endOfHeaders === -1) {
|
|
// keep buffering
|
|
debug('have not received end of HTTP headers yet...');
|
|
read();
|
|
return;
|
|
}
|
|
const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n'));
|
|
const statusCode = +firstLine.split(' ')[1];
|
|
debug('got proxy server response: %o', firstLine);
|
|
resolve({
|
|
statusCode,
|
|
buffered
|
|
});
|
|
}
|
|
socket.on('error', onerror);
|
|
socket.on('close', onclose);
|
|
socket.on('end', onend);
|
|
read();
|
|
});
|
|
}
|
|
exports.default = parseProxyResponse;
|
|
//# sourceMappingURL=parse-proxy-response.js.map
|