2020-08-22 13:17:31 +00:00
|
|
|
const {Pinski} = require("pinski")
|
|
|
|
const {setInstance} = require("pinski/plugins")
|
2021-08-20 08:45:36 +00:00
|
|
|
const constants = require("./utils/constants")
|
2021-12-28 03:32:11 +00:00
|
|
|
const iconLoader = require("./utils/icon-loader").icons
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
;(async () => {
|
2020-09-23 12:05:02 +00:00
|
|
|
await require("./utils/upgradedb")()
|
2021-12-28 03:32:11 +00:00
|
|
|
const icons = await iconLoader
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
const server = new Pinski({
|
2020-08-31 13:24:34 +00:00
|
|
|
port: 10412,
|
2020-08-30 13:54:59 +00:00
|
|
|
relativeRoot: __dirname,
|
|
|
|
filesDir: "html"
|
|
|
|
})
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
setInstance(server)
|
2021-08-20 08:45:36 +00:00
|
|
|
server.pugDefaultLocals.constants = constants
|
2021-12-28 03:32:11 +00:00
|
|
|
server.pugDefaultLocals.icons = icons
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2021-05-08 05:13:17 +00:00
|
|
|
server.muteLogsStartingWith("/vi/")
|
|
|
|
server.muteLogsStartingWith("/favicon")
|
|
|
|
server.muteLogsStartingWith("/static")
|
|
|
|
|
2021-12-28 03:32:11 +00:00
|
|
|
server.addSassDir("sass", ["sass/includes", "sass/themes", "sass/theme-modules"])
|
|
|
|
server.addRoute("/static/css/dark.css", "sass/dark.sass", "sass")
|
|
|
|
server.addRoute("/static/css/light.css", "sass/light.sass", "sass")
|
|
|
|
server.addRoute("/static/css/edgeless-light.css", "sass/edgeless-light.sass", "sass")
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
server.addPugDir("pug", ["pug/includes"])
|
2021-04-27 12:56:00 +00:00
|
|
|
server.addPugDir("pug/errors")
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
server.addStaticHashTableDir("html/static/js")
|
|
|
|
server.addStaticHashTableDir("html/static/js/elemjs")
|
2020-08-30 15:14:05 +00:00
|
|
|
server.addStaticHashTableDir("html/static/images")
|
|
|
|
server.addStaticHashTableDir("html/static/fonts")
|
2020-08-22 13:17:31 +00:00
|
|
|
|
2020-08-30 13:54:59 +00:00
|
|
|
server.addAPIDir("api")
|
|
|
|
|
|
|
|
server.startServer()
|
2020-08-31 13:22:16 +00:00
|
|
|
|
|
|
|
require("./background/feed-update")
|
2020-08-30 13:54:59 +00:00
|
|
|
})()
|