-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.js
67 lines (61 loc) · 2.47 KB
/
index.js
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
const colors = require('colors')
const npmUpdater = require('./utils/updater/npm')
const fileUpdater = require('./utils/updater/files')
const consolePrefix = `${'['.blue}${'dbd-soft-ui'.yellow}${']'.blue} `
const Keyv = require('keyv')
const path = require('path')
module.exports = (themeConfig = {}) => {
return {
themeCodename: 'softui',
viewsPath: path.join(__dirname, '/views'),
staticPath: path.join(__dirname, '/views/src'),
themeConfig: {
...themeConfig,
defaultLocales: require('./locales.js')
},
messages: {
error: {
addonLicense: `${consolePrefix}${'Failed to initialise {{ADDON}}.\nThe license this addon was installed with does not match your current discord-dashboard license.'
.cyan
}`
},
success: {
addonLoaded: `${consolePrefix}${'Successfully loaded {{ADDON}}.'.cyan
}`
}
},
embedBuilderComponent: require('fs').readFileSync(
path.join(__dirname, '/embedBuilderComponent.txt'),
'utf8'
),
init: async (app, config) => {
let outdated = false
; (async () => {
let check = await npmUpdater.update()
await fileUpdater.update()
if (!check) outdated = true
})()
const db = new Keyv(
themeConfig.dbdriver ||
'sqlite://' + path.join(__dirname, '/database.sqlite')
)
db.on('error', (err) => {
console.log('Connection Error', err)
process.exit()
})
themeConfig = {
...themeConfig,
defaultLocales: require('./locales.js')
}
require('./utils/functions/errorHandler')(config, themeConfig, db)
require('./utils/functions/settingsPage')(config, themeConfig, db)
// await require('./utils/addonManager').execute(themeConfig, config, app, module.exports.messages);
require('./utils/initPages').init(config, themeConfig, app, db)
}
}
}
module.exports.partials = __dirname + '/views/partials'
module.exports.formTypes = require('./utils/formtypes')
module.exports.Feed = require('./utils/feedHandler')
module.exports.cmdHandler = require('./utils/cmdHandler')
module.exports.version = require('./package.json').version