nfp_sites/filadelfia_archive/api/server.mjs

27 lines
1 KiB
JavaScript
Raw Normal View History

2023-11-09 09:44:04 +00:00
import config from '../base/config.mjs'
import Parent from '../base/server.mjs'
import StaticRoutes from '../base/static_routes.mjs'
import ServeHandler from './serve.mjs'
import AuthenticationRoutes from '../base/authentication/routes.mjs'
2023-11-20 07:12:08 +00:00
import ArticleRoutes from './article/routes.mjs'
2023-11-09 09:44:04 +00:00
export default class Server extends Parent {
init() {
super.init()
let localUtil = new this.core.sc.Util(import.meta.url)
2023-11-20 07:12:08 +00:00
this.flaskaOptions.appendHeaders['Content-Security-Policy'] = `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-ancestors 'none'; connect-src 'self' https://media.nfp.is/; media-src 'self' https://cdn.nfp.is/`,
2023-11-09 09:44:04 +00:00
this.flaskaOptions.nonce = []
this.routes = {
static: new StaticRoutes(),
auth: new AuthenticationRoutes(),
2023-11-20 07:12:08 +00:00
article: new ArticleRoutes(),
2023-11-09 09:44:04 +00:00
}
this.routes.serve = new ServeHandler({
root: localUtil.getPathFromRoot('../public'),
version: this.core.app.running,
frontend: config.get('frontend:url'),
})
}
}