forked from Qortal/qortal-ui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.4 KiB
106 lines
2.4 KiB
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
|
|
|