2022-08-02 09:34:02 +00:00
|
|
|
import config from '../base/config.mjs'
|
|
|
|
import Parent from '../base/server.mjs'
|
2022-08-18 09:59:48 +00:00
|
|
|
import ServeHandler from './serve.mjs'
|
2022-08-12 23:33:50 +00:00
|
|
|
import ArticleRoutes from './article_routes.mjs'
|
|
|
|
import PageRoutes from './page_routes.mjs'
|
2022-08-02 09:34:02 +00:00
|
|
|
|
|
|
|
export default class Server extends Parent {
|
2022-08-05 14:26:29 +00:00
|
|
|
init() {
|
2022-08-12 23:33:50 +00:00
|
|
|
super.init()
|
2022-08-02 09:34:02 +00:00
|
|
|
let localUtil = new this.core.sc.Util(import.meta.url)
|
2022-08-12 23:33:50 +00:00
|
|
|
|
|
|
|
this.flaskaOptions.appendHeaders['Content-Security-Policy'] = `default-src 'self'; script-src 'self' talk.hyvor.com; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-src talk.hyvor.com` //; frame-ancestors 'none'`
|
|
|
|
this.routes.article = new ArticleRoutes()
|
|
|
|
this.routes.page = new PageRoutes()
|
|
|
|
this.routes.serve = new ServeHandler({
|
|
|
|
pageRoutes: this.routes.page,
|
2022-08-18 09:59:48 +00:00
|
|
|
articleRoutes: this.routes.article,
|
2022-08-02 09:34:02 +00:00
|
|
|
root: localUtil.getPathFromRoot('../public'),
|
|
|
|
version: this.core.app.running,
|
|
|
|
frontend: config.get('frontend:url'),
|
2022-08-12 23:33:50 +00:00
|
|
|
})
|
2022-08-02 09:34:02 +00:00
|
|
|
}
|
|
|
|
}
|