* Creates (copies from the server templates dir) a Welcome index page for the * server root web directory, if one does not already exist. This page * typically has links to account signup and login, and can be overridden by * the server operator. * * @param argv {Object} Express.js app object
(argv)
| 62 | * @param argv {Object} Express.js app object |
| 63 | */ |
| 64 | async function ensureWelcomePage (argv) { |
| 65 | const { resourceMapper, templates, server, host } = argv |
| 66 | const serverRootDir = resourceMapper.resolveFilePath(host.hostname) |
| 67 | const existingIndexPage = path.join(serverRootDir, 'index.html') |
| 68 | const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'))) |
| 69 | |
| 70 | if (!fs.existsSync(existingIndexPage)) { |
| 71 | fs.mkdirp(serverRootDir) |
| 72 | await copyTemplateDir(templates.server, serverRootDir) |
| 73 | await processHandlebarFile(existingIndexPage, { |
| 74 | serverName: server ? server.name : host.hostname, |
| 75 | serverDescription: server ? server.description : '', |
| 76 | serverLogo: server ? server.logo : '', |
| 77 | serverVersion: packageData.version |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | // Ensure that the root .acl file exists, |
| 82 | // because this was not mandatory in before 5.0.0 |
| 83 | const existingRootAcl = path.join(serverRootDir, '.acl') |
| 84 | if (!fs.existsSync(existingRootAcl)) { |
| 85 | await copyTemplateDir(path.join(templates.server, '.acl'), existingRootAcl) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Ensures that the server config directory (something like '/etc/solid-server' |
nothing calls this directly
no test coverage detected