Skip to content

Commit

Permalink
adding althome to sbh1 and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfang97 committed May 7, 2024
1 parent 94a4e18 commit d0074e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/views/admin/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function form (req, res) {
uriPrefix: config.get('databasePrefix'),
frontPageText: config.get('frontPageText'),
firstLaunch: config.get('firstLaunch'),
altHome: config.get('altHome'),
currentTheme: currentTheme,
themeParameters: themeParameters
}
Expand Down
8 changes: 8 additions & 0 deletions lib/views/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const settingsSchema = Joi.object({
frontendURL: requiredString('Please enter the frontend URL of your instance'),
instanceUrl: requiredString('Please enter the backend URL of your instance'),
uriPrefix: requiredString('Please enter the URI prefix of your instance'),
altHome: requiredString('Please enter your alternate homepage'),
frontPageText: requiredString('Please enter some welcome text for your homepage'),
userPassword: requiredString('Please enter a password for the initial user account', { trim: false }),
userPasswordConfirm: requiredString("Passwords didn't match", { trim: false }).valid(Joi.ref('userPassword')),
Expand Down Expand Up @@ -58,6 +59,7 @@ module.exports = function (req, res) {
frontendURL: req.protocol + '://' + req.get('Host') + '/',
instanceUrl: req.protocol + '://' + req.get('Host') + '/',
uriPrefix: req.protocol + '://' + req.get('Host') + '/',
altHome: req.protocol + '://' + req.get('Host') + '/',
userName: '',
affiliation: '',
userFullName: '',
Expand Down Expand Up @@ -96,6 +98,7 @@ async function setupPost (req, res, settings) {
frontendURL: req.body.frontendURL,
instanceUrl: req.body.instanceUrl,
uriPrefix: req.body.uriPrefix,
altHome: req.body.altHome,
userName: req.body.userName,
affiliation: req.body.affiliation,
userFullName: req.body.userFullName,
Expand Down Expand Up @@ -129,6 +132,10 @@ async function setupPost (req, res, settings) {
updatedSettings.uriPrefix += '/'
}

if (updatedSettings.altHome && updatedSettings.altHome[updatedSettings.altHome.length - 1] !== '/') {
updatedSettings.altHome += '/'
}

if (error) {
if (req.accepts('text/html')) {
return setupForm(req, res, updatedSettings, {
Expand Down Expand Up @@ -156,6 +163,7 @@ async function setupPost (req, res, settings) {
config.set('frontPageText', updatedSettings.frontPageText)
config.set('allowPublicSignup', updatedSettings.allowPublicSignup)
config.set('databasePrefix', updatedSettings.uriPrefix)
config.set('altHome', updatedSettings.altHome)

config.set('triplestore', {
...config.get('triplestore'),
Expand Down
4 changes: 4 additions & 0 deletions templates/views/setup.jade
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ block body
| We need to know how to prefix URIs of objects stored in this SynBioHub. Its default is the same as the URL, and should only be changed if you are shadowing another instance.
label URI Prefix
input.form-control(name='uriPrefix',value=settings.uriPrefix)
p
| We need to know where if you would like to set up your own home page.
label Alternate Home Page
input.form-control(name='altHome',value=settings.altHome)
p
| We need to know where the Virtuoso INI is stored. We have guessed it to be
b #{config.triplestore.virtuosoINI}
Expand Down

0 comments on commit d0074e8

Please sign in to comment.