File size: 5,782 Bytes
81d8726 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | const Datastore = require('@seald-io/nedb')
const {
credentialsDBPath,
hostListDBPath,
keyDBPath,
notifyDBPath,
notifyConfigDBPath,
groupConfDBPath,
scriptsDBPath,
scriptGroupDBPath,
onekeyDBPath,
plusDBPath,
aiConfigDBPath,
chatHistoryDBPath,
favoriteSftpDBPath,
proxyDBPath,
fileTransferDBPath,
terminalConfigDBPath,
serverListDBPath,
sessionDBPath,
terminalSessionDBPath
} = require('../config')
module.exports.KeyDB = class KeyDB {
constructor() {
if (!KeyDB.instance) {
KeyDB.instance = new Datastore({ filename: keyDBPath, autoload: true })
// KeyDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return KeyDB.instance
}
}
module.exports.HostListDB = class HostListDB {
constructor() {
if (!HostListDB.instance) {
HostListDB.instance = new Datastore({ filename: hostListDBPath, autoload: true })
// HostListDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return HostListDB.instance
}
}
module.exports.CredentialsDB = class CredentialsDB {
constructor() {
if (!CredentialsDB.instance) {
CredentialsDB.instance = new Datastore({ filename: credentialsDBPath, autoload: true })
// CredentialsDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return CredentialsDB.instance
}
}
module.exports.NotifyDB = class NotifyDB {
constructor() {
if (!NotifyDB.instance) {
NotifyDB.instance = new Datastore({ filename: notifyDBPath, autoload: true })
// NotifyDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return NotifyDB.instance
}
}
module.exports.NotifyConfigDB = class NotifyConfigDB {
constructor() {
if (!NotifyConfigDB.instance) {
NotifyConfigDB.instance = new Datastore({ filename: notifyConfigDBPath, autoload: true })
// NotifyConfigDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return NotifyConfigDB.instance
}
}
module.exports.GroupDB = class GroupDB {
constructor() {
if (!GroupDB.instance) {
GroupDB.instance = new Datastore({ filename: groupConfDBPath, autoload: true })
// GroupDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return GroupDB.instance
}
}
module.exports.ScriptsDB = class ScriptsDB {
constructor() {
if (!ScriptsDB.instance) {
ScriptsDB.instance = new Datastore({ filename: scriptsDBPath, autoload: true })
// ScriptsDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return ScriptsDB.instance
}
}
module.exports.ScriptGroupDB = class ScriptGroupDB {
constructor() {
if (!ScriptGroupDB.instance) {
ScriptGroupDB.instance = new Datastore({ filename: scriptGroupDBPath, autoload: true })
}
}
getInstance() {
return ScriptGroupDB.instance
}
}
module.exports.OnekeyDB = class OnekeyDB {
constructor() {
if (!OnekeyDB.instance) {
OnekeyDB.instance = new Datastore({ filename: onekeyDBPath, autoload: true })
// OnekeyDB.instance.setAutocompactionInterval(5000)
}
}
getInstance() {
return OnekeyDB.instance
}
}
module.exports.PlusDB = class PlusDB {
constructor() {
if (!PlusDB.instance) {
PlusDB.instance = new Datastore({ filename: plusDBPath, autoload: true })
}
}
getInstance() {
return PlusDB.instance
}
}
module.exports.AIConfigDB = class AIConfigDB {
constructor() {
if (!AIConfigDB.instance) {
AIConfigDB.instance = new Datastore({ filename: aiConfigDBPath, autoload: true })
}
}
getInstance() {
return AIConfigDB.instance
}
}
module.exports.ChatHistoryDB = class ChatHistoryDB {
constructor() {
if (!ChatHistoryDB.instance) {
ChatHistoryDB.instance = new Datastore({ filename: chatHistoryDBPath, autoload: true })
}
}
getInstance() {
return ChatHistoryDB.instance
}
}
module.exports.FavoriteSftpDB = class FavoriteSftpDB {
constructor() {
if (!FavoriteSftpDB.instance) {
FavoriteSftpDB.instance = new Datastore({ filename: favoriteSftpDBPath, autoload: true })
}
}
getInstance() {
return FavoriteSftpDB.instance
}
}
module.exports.ProxyDB = class ProxyDB {
constructor() {
if (!ProxyDB.instance) {
ProxyDB.instance = new Datastore({ filename: proxyDBPath, autoload: true })
}
}
getInstance() {
return ProxyDB.instance
}
}
module.exports.FileTransferDB = class FileTransferDB {
constructor() {
if (!FileTransferDB.instance) {
FileTransferDB.instance = new Datastore({ filename: fileTransferDBPath, autoload: true })
}
}
getInstance() {
return FileTransferDB.instance
}
}
module.exports.TerminalConfigDB = class TerminalConfigDB {
constructor() {
if (!TerminalConfigDB.instance) {
TerminalConfigDB.instance = new Datastore({ filename: terminalConfigDBPath, autoload: true })
}
}
getInstance() {
return TerminalConfigDB.instance
}
}
module.exports.ServerListDB = class ServerListDB {
constructor() {
if (!ServerListDB.instance) {
ServerListDB.instance = new Datastore({ filename: serverListDBPath, autoload: true })
}
}
getInstance() {
return ServerListDB.instance
}
}
module.exports.SessionDB = class SessionDB {
constructor() {
if (!SessionDB.instance) {
SessionDB.instance = new Datastore({ filename: sessionDBPath, autoload: true })
}
}
getInstance() {
return SessionDB.instance
}
}
module.exports.TerminalSessionDB = class TerminalSessionDB {
constructor() {
if (!TerminalSessionDB.instance) {
TerminalSessionDB.instance = new Datastore({ filename: terminalSessionDBPath, autoload: true })
}
}
getInstance() {
return TerminalSessionDB.instance
}
}
|