mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-10 01:15:06 +02:00
Remove jsonwebtoken dependency
This commit is contained in:
parent
b61ecefce4
commit
954cf3e14e
29 changed files with 2130 additions and 93 deletions
18
server/libs/jsonwebtoken/lib/timespan.js
Normal file
18
server/libs/jsonwebtoken/lib/timespan.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
var ms = require('../../ms');
|
||||
|
||||
module.exports = function (time, iat) {
|
||||
var timestamp = iat || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (typeof time === 'string') {
|
||||
var milliseconds = ms(time);
|
||||
if (typeof milliseconds === 'undefined') {
|
||||
return;
|
||||
}
|
||||
return Math.floor(timestamp + milliseconds / 1000);
|
||||
} else if (typeof time === 'number') {
|
||||
return timestamp + time;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue