Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /opt/push-server/lib/storages/ |
Upload File : |
const SqliteDatabase = require("better-sqlite3"); const config = require("../../config"); const logger = require("../debug"); let dbConnection; class Sqlite { /** * * @returns {SqliteDatabase|null} */ static getDatabase() { if (dbConnection) { return dbConnection; } try { dbConnection = new SqliteDatabase(config.dataDir + "/push-server.db"); dbConnection.exec(Sqlite.getSchema()); } catch (error) { logger.systemError(error); dbConnection = null; } return dbConnection; } static getSchema() { return ` CREATE TABLE IF NOT EXISTS licenses ( id integer not null primary key, clientId varchar(32) not null, securityKey varchar(512) not null, securityAlgo varchar(10), dateTo integer not null, siteUrl varchar(100), verificationQuery varchar(200), lastCheck integer default 0 ); CREATE UNIQUE INDEX IF NOT EXISTS UX_LICENCES_CLIENT_ID ON licenses (clientId); `; } } module.exports = Sqlite;