1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-10 02:27:29 +00:00
cloudtube/server.js

41 lines
1.1 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")
2020-08-22 13:17:31 +00:00
2020-08-30 13:54:59 +00:00
;(async () => {
await require("./utils/upgradedb")()
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
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")
2020-08-30 13:54:59 +00:00
server.addSassDir("sass", ["sass/includes"])
server.addRoute("/static/css/main.css", "sass/main.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")
2021-01-12 12:13:46 +00:00
server.addRoute("/cant-think", "pug/cant-think.pug", "pug")
2021-04-16 04:12:04 +00:00
server.addRoute("/privacy", "pug/privacy.pug", "pug")
2021-10-06 07:55:14 +00:00
server.addRoute("/licenses", "pug/licenses.pug", "pug")
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
})()