mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-03 13:31:28 +03:00
Fixed bug that caused users with large amounts of data to have extremely large tokens
Subfolders are now ensured to exist with the normal downloading method Initialization now happens after token retrieval to avoid failed requests Fixed bug that caused login to be called twice, introducing a possible race condition
This commit is contained in:
@@ -46,7 +46,7 @@ exports.initialize = function(input_users_db, input_logger) {
|
||||
opts.audience = 'example.com';*/
|
||||
|
||||
exports.passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
|
||||
const user = users_db.get('users').find({uid: jwt_payload.user.uid}).value();
|
||||
const user = users_db.get('users').find({uid: jwt_payload.user}).value();
|
||||
if (user) {
|
||||
return done(null, user);
|
||||
} else {
|
||||
@@ -209,7 +209,7 @@ exports.authenticateViaPassport = function(req, res, next) {
|
||||
exports.generateJWT = function(req, res, next) {
|
||||
var payload = {
|
||||
exp: Math.floor(Date.now() / 1000) + JWT_EXPIRATION
|
||||
, user: req.user
|
||||
, user: req.user.uid
|
||||
};
|
||||
req.token = jwt.sign(payload, SERVER_SECRET);
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user