1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-12-22 05:06:57 +00:00
cloudtube/server.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

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")
const iconLoader = require("./utils/icon-loader").icons
2020-08-22 13:17:31 +00:00
2020-08-30 13:54:59 +00:00
;(async () => {
await require("./utils/upgradedb")()
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
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")
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"])
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
})()