mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-07-31 22:21:38 +00:00
build
config
core
assets
config
emoji
exports
font
language
memory-pow
public
server
routes
createCommonRoutes.js
createPrimaryRoutes.js
ServerFactory.js
server.js
sound
src
tooling
translate
ui-core.js
crypto
img
lib
locales
plugins
scripts
snap
splash
.editorconfig
.gitattributes
.gitignore
CONTRIBUTING.md
LICENSE
README.md
build-setup.js
build.bat
build.js
build.sh
electron-builder.yml
electron.js
package-lock.json
package.json
run_server.bat
server.js
set-up-snap.sh
watch-inline.js
watch.js
106 lines
1.7 KiB
JavaScript
106 lines
1.7 KiB
JavaScript
const path = require('path')
|
|
|
|
const routesOptions = {
|
|
security: {
|
|
hsts: {
|
|
maxAge: 15768000,
|
|
includeSubDomains: true,
|
|
preload: true
|
|
},
|
|
xframe: 'sameorigin'
|
|
}
|
|
}
|
|
|
|
const createRoutes = config => [
|
|
{
|
|
method: 'GET',
|
|
path: '/img/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: config.build.options.imgDir,
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/language/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: path.join(__dirname, '../../language'),
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/font/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: path.join(__dirname, '../../font'),
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/sound/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: path.join(__dirname, '../../sound/'),
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/emoji/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: path.join(__dirname, '../../emoji/'),
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/memory-pow/{param*}',
|
|
handler: {
|
|
directory: {
|
|
path: path.join(__dirname, '../../memory-pow/'),
|
|
redirectToSlash: true,
|
|
index: true
|
|
}
|
|
},
|
|
options: routesOptions
|
|
},
|
|
{
|
|
method: 'GET',
|
|
path: '/getConfig',
|
|
handler: (request, h) => {
|
|
const response = {
|
|
config: {
|
|
...config
|
|
}
|
|
}
|
|
|
|
delete response.config.user.tls
|
|
delete response.config.build
|
|
|
|
return JSON.stringify(response)
|
|
},
|
|
options: routesOptions
|
|
}
|
|
]
|
|
|
|
module.exports = createRoutes |