/var/www/myprog.com.ua/server/node
NameSizeModeActions
.git/-0755rm
.vscode/-0755rm
api/-0755rm
db/-0755rm
helpers/-0755rm
logs/-0755rm
node_modules/-0755rm
objects/-0755rm
services/-0755rm
ws/-0755rm
www/-0755rm
.gitignore550644editdlrm
.htaccess1060644editdlrm
config-default.json2790644editdlrm
config.json3980644editdlrm
core.js139930644editdlrm
global.js28640644editdlrm
myprog.js42530644editdlrm
package-lock.json1500090644editdlrm
package.json2660644editdlrm
session_manager.js56880644editdlrm
test_db.js48380644editdlrm
Edit: /var/www/myprog.com.ua/server/node/global.js (2864B)
global.config = require('./config.json') global.core; global.WHO = { SYSTEM: { KEY: 0, PREFIX: 'system_', VALUE: "system" }, USER: { KEY: 1, PREFIX: 'user_', VALUE: "user" }, HOST: { KEY: 2, PREFIX: 'host_', VALUE: "host" }, WEB: { KEY: 4, PREFIX: 'web_', VALUE: "web" }, ADMIN: { KEY: 5, PREFIX: 'admin_', VALUE: "admin" }, ANDROID: {KEY: 6, PREFIX: 'android_', VALUE: "android"}, IOS: {KEY: 7, PREFIX: 'ios_', VALUE: "ios"}, } Date.prototype.toMysqlString = function () { var yyyy = this.getFullYear(); var mm = this.getMonth() < 9 ? "0" + (this.getMonth() + 1) : (this.getMonth() + 1); var dd = this.getDate() < 10 ? "0" + this.getDate() : this.getDate(); var hh = this.getHours() < 10 ? "0" + this.getHours() : this.getHours(); var min = this.getMinutes() < 10 ? "0" + this.getMinutes() : this.getMinutes(); var ss = this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds(); return `${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`; }; Date.prototype.toMysqlDate = function () { var yyyy = this.getFullYear(); var mm = this.getMonth() < 9 ? "0" + (this.getMonth() + 1) : (this.getMonth() + 1); var dd = this.getDate() < 10 ? "0" + this.getDate() : this.getDate(); return `${yyyy}-${mm}-${dd}`; }; Date.prototype.toMysqlTime = function () { var hh = this.getHours() < 10 ? "0" + this.getHours() : this.getHours(); var min = this.getMinutes() < 10 ? "0" + this.getMinutes() : this.getMinutes(); var ss = this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds(); return `${hh}:${min}:${ss}`; }; Date.prototype.microtime = function (getAsFloat) { var s, now, multiplier; if (typeof performance !== 'undefined' && performance.now) { now = (performance.now() + performance.timing.navigationStart) / 1000; multiplier = 1e6; // 1,000,000 for microseconds } else { now = (Date.now ? Date.now() : new Date().getTime()) / 1000; multiplier = 1e3; // 1,000 } // Getting microtime as a float is easy if (getAsFloat) { return now; } // Dirty trick to only get the integer part s = now | 0; return (Math.round((now - s) * multiplier) / multiplier) + ' ' + s; } Date.prototype.between_time = function (time_start, time_end) { let date_now = new Date(); let time_now = `${date_now.getHours()}:${date_now.getMinutes()}`; console.debug(time_start, time_now, time_end); if (time_start != time_end) { if (time_start < time_end) { // 00:00 to 23:59 if (time_now >= time_start && time_now <= time_end) { return true; } } else { if (time_now <= '23:59' && time_now >= time_start || time_now >= '00:00' && time_now <= time_end) { return true; } } } return false; }