✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
/**
|
|
* Module dependencies.
|
|
*/
|
|
var pause = require('pause')
|
|
, util = require('util')
|
|
, Strategy = require('passport-strategy');
|
|
|
|
|
|
/**
|
|
* `SessionStrategy` constructor.
|
|
*
|
|
* @api public
|
|
*/
|
|
function SessionStrategy(options, deserializeUser) {
|
|
if (typeof options == 'function') {
|
|
deserializeUser = options;
|
|
options = undefined;
|
|
}
|
|
options = options || {};
|
|
|
|
Strategy.call(this);
|
|
this.name = 'session';
|
|
this._key = options.key || 'passport';
|
|
this._deserializeUser = deserializeUser;
|
|
}
|
|
|
|
/**
|
|
* Inherit from `Strategy`.
|
|
*/
|
|
util.inherits(SessionStrategy, Strategy);
|
|
|
|
/**
|
|
* Authenticate request based on the current session state.
|
|
*
|
|
* The session authentication strategy uses the session to restore any login
|
|
* state across requests. If a login session has been established, `req.user`
|
|
* will be populated with the current user.
|
|
*
|
|
* This strategy is registered automatically by Passport.
|
|
*
|
|
* @param {Object} req
|
|
* @param {Object} options
|
|
* @api protected
|
|
*/
|
|
SessionStrategy.prototype.authenticate = function(req, options) {
|
|
if (!req.session) { return this.error(new Error('Login sessions require session support. Did you forget to use `express-session` middleware?')); }
|
|
options = options || {};
|
|
|
|
var self = this,
|
|
su;
|
|
if (req.session[this._key]) {
|
|
su = req.session[this._key].user;
|
|
}
|
|
|
|
if (su || su === 0) {
|
|
// NOTE: Stream pausing is desirable in the case where later middleware is
|
|
// listening for events emitted from request. For discussion on the
|
|
// matter, refer to: https://github.com/jaredhanson/passport/pull/106
|
|
|
|
var paused = options.pauseStream ? pause(req) : null;
|
|
this._deserializeUser(su, req, function(err, user) {
|
|
if (err) { return self.error(err); }
|
|
if (!user) {
|
|
delete req.session[self._key].user;
|
|
} else {
|
|
var property = req._userProperty || 'user';
|
|
req[property] = user;
|
|
}
|
|
self.pass();
|
|
if (paused) {
|
|
paused.resume();
|
|
}
|
|
});
|
|
} else {
|
|
self.pass();
|
|
}
|
|
};
|
|
|
|
|
|
/**
|
|
* Expose `SessionStrategy`.
|
|
*/
|
|
module.exports = SessionStrategy;
|