diff --git a/lib/views/admin/theme.js b/lib/views/admin/theme.js index 51f7ee3a..d7ddc54d 100644 --- a/lib/views/admin/theme.js +++ b/lib/views/admin/theme.js @@ -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 } @@ -112,6 +113,13 @@ function post (req, res) { publishUpdate = true } + console.log(typeof (req.body)) + + if (typeof req.body === 'object' && 'altHome' in req.body && req.body.altHome !== config.get('altHome')) { + config.set('altHome', req.body.altHome) + publishUpdate = true + } + if (publishUpdate) { updateWor() } diff --git a/lib/views/setup.js b/lib/views/setup.js index 3052622c..8fb2912a 100644 --- a/lib/views/setup.js +++ b/lib/views/setup.js @@ -19,9 +19,10 @@ const settingsSchema = Joi.object({ userName: requiredString('Please enter a username for the initial user account'), userFullName: requiredString('Please enter a full name for the initial user account'), userEmail: requiredString('Please enter a valid e-mail address for the initial user account').email(), - frontendURL: requiredString('Please enter the frontend URL of your instance'), + frontendURL: Joi.string().allow(''), instanceUrl: requiredString('Please enter the backend URL of your instance'), uriPrefix: requiredString('Please enter the URI prefix of your instance'), + altHome: Joi.string().allow(''), 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')), @@ -55,9 +56,10 @@ module.exports = function (req, res) { const settings = { instanceName: 'My SynBioHub', - frontendURL: req.protocol + '://' + req.get('Host') + '/', + frontendURL: '', instanceUrl: req.protocol + '://' + req.get('Host') + '/', uriPrefix: req.protocol + '://' + req.get('Host') + '/', + altHome: '', userName: '', affiliation: '', userFullName: '', @@ -93,9 +95,10 @@ async function setupPost (req, res, settings) { { ...settings, instanceName: req.body.instanceName, - frontendURL: req.body.frontendURL, + 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, @@ -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, { @@ -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'), diff --git a/templates/views/setup.jade b/templates/views/setup.jade index 77ee42e3..d8719596 100644 --- a/templates/views/setup.jade +++ b/templates/views/setup.jade @@ -50,18 +50,12 @@ block body br h2 2. Some technical details div.form-group - p - | Frontend Url: We need to know where this SynBioHub instance is is displayed. If the URL below is incorrect, please change it - b #{settings.frontendURL} - |, but if this is incorrect, please change it here. - label Frontend URL - input.form-control(name='frontendURL',value=settings.frontendURL) p | Backend Url: We need to know where this SynBioHub instance is hosted so we can assign URLs to your submissions. The instance URL has been automatically guessed as b #{settings.instanceUrl} |, but if this is incorrect, please change it here. label Instance URL - input.form-control(name='instanceURL',value=settings.instanceUrl) + input.form-control(name='instanceUrl',value=settings.instanceUrl) p | 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 diff --git a/tests/first_time_setup.py b/tests/first_time_setup.py index 9240a5a3..767198b9 100644 --- a/tests/first_time_setup.py +++ b/tests/first_time_setup.py @@ -25,7 +25,7 @@ def test_post(self): 'userEmail': 'test@user.synbiohub', 'userPassword': 'test', 'userPasswordConfirm': 'test', - 'instanceName': 'Test Synbiohub', 'frontendURL': 'http://localhost:7777', + 'instanceName': 'Test Synbiohub', 'instanceUrl': 'http://localhost:7777/', 'uriPrefix': 'http://localhost:7777/', 'color': '#D25627', diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml index 2d25d7d0..209926df 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml @@ -1,5 +1,82 @@ + + + part_pIKE_Toggle_1 + 1 + LacI/TetR Toggle Switch + LacI/TetR Toggle Switch + + + + + + + + pIKELeftCassette_1 + 1 + + + + + + + + + + pIKERightCassette_1 + 1 + + + + + + + + + + anno2 + 1 + + + + + + location2 + 1 + + + 1286 + 2834 + + + + + + + + + + anno1 + 1 + + + + + + location1 + 1 + + + 1 + 1285 + + + + + + + BBa_R0040 @@ -48,6 +125,42 @@ + + + ECK120033736 + 1 + ECK120033736 + Terminator2 + + + + + + + + + BBa_C0040 + 1 + tetR + tetR coding sequence + + + + + + + + + BBa_J61130 + 1 + BBa_J61101 RBS + RBS2 + + + + + + part_pIKERightCassette_1 @@ -59,36 +172,36 @@ - - - BBa_C0040 + + + BBa_J61130 1 - + - - - BBa_R0010 + + + ECK120033736 1 - + - - - BBa_J61130 + + + BBa_J61120 1 - + @@ -103,69 +216,69 @@ - - - BBa_J61120 + + + BBa_R0010 1 - + - - - ECK120033736 + + + BBa_C0040 1 - + - - - anno6 + + + anno2 1 - - - location6 + + + location2 1 - 1464 - 1554 + 56 + 68 - + - - - anno3 + + + anno6 1 - - - location3 + + + location6 1 - 69 - 729 + 1464 + 1554 - + @@ -191,25 +304,25 @@ - - - anno2 + + + anno5 1 - - - location2 + + + location5 1 - 56 - 68 + 743 + 1463 - + @@ -235,51 +348,51 @@ - - - anno5 + + + anno3 1 - - - location5 + + + location3 1 - 743 - 1463 + 69 + 729 - + - - - ECK120033736 + + + BBa_J61120 1 - ECK120033736 - Terminator2 - + BBa_J61101 RBS + RBS2 + - - + + - - - BBa_C0040 + + + BBa_J61101 1 - tetR - tetR coding sequence - + BBa_J61101 RBS + RBS1 + - - + + @@ -292,14 +405,14 @@ - - - BBa_R0040 + + + BBa_C0012 1 - + @@ -325,58 +438,36 @@ - - - BBa_C0012 + + + BBa_R0040 1 - + - - - anno1 - 1 - - - - - - location1 - 1 - - - 1 - 55 - - - - - - - - - - anno3 + + + anno4 1 - - - location3 + + + location4 1 - 69 - 1197 + 1198 + 1288 - + @@ -402,138 +493,47 @@ - - - anno4 + + + anno3 1 - - - location4 + + + location3 1 - 1198 - 1288 + 69 + 1197 - + - - - - BBa_J61130 - 1 - BBa_J61101 RBS - RBS2 - - - - - - - - - BBa_J61120 - 1 - BBa_J61101 RBS - RBS2 - - - - - - - - - BBa_J61101 - 1 - BBa_J61101 RBS - RBS1 - - - - - - - - - part_pIKE_Toggle_1 - 1 - LacI/TetR Toggle Switch - LacI/TetR Toggle Switch - - - - - - - - pIKELeftCassette_1 - 1 - - - - - - - - - - pIKERightCassette_1 - 1 - - - - - - - - + + anno1 1 - + - - + + location1 1 - + 1 - 1285 - - - - - - - - - - anno2 - 1 - - - - - - location2 - 1 - - - 1286 - 2834 + 55 - + diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml index 6e56bf21..4aa7a4d5 100644 Binary files a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml and b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml differ diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml index e7cef170..2e3a41fd 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml @@ -11,24 +11,24 @@ - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + @@ -87,6 +87,17 @@ + + + + ECK120029600 + 1 + + + + + + @@ -120,17 +131,6 @@ - - - - ECK120029600 - 1 - - - - - - @@ -230,6 +230,17 @@ + + + + BBa_J61130 + 1 + + + + + + @@ -285,17 +296,6 @@ - - - - BBa_J61130 - 1 - - - - - - diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbolnr_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbolnr_.xml index 34190c27..fcbedbe9 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbolnr_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbolnr_.xml @@ -11,24 +11,24 @@ - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml index e7cef170..2e3a41fd 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml @@ -11,24 +11,24 @@ - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + @@ -87,6 +87,17 @@ + + + + ECK120029600 + 1 + + + + + + @@ -120,17 +131,6 @@ - - - - ECK120029600 - 1 - - - - - - @@ -230,6 +230,17 @@ + + + + BBa_J61130 + 1 + + + + + + @@ -285,17 +296,6 @@ - - - - BBa_J61130 - 1 - - - - - - diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml index e7cef170..2e3a41fd 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml @@ -11,24 +11,24 @@ - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + @@ -87,6 +87,17 @@ + + + + ECK120029600 + 1 + + + + + + @@ -120,17 +131,6 @@ - - - - ECK120029600 - 1 - - - - - - @@ -230,6 +230,17 @@ + + + + BBa_J61130 + 1 + + + + + + @@ -285,17 +296,6 @@ - - - - BBa_J61130 - 1 - - - - - - diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml index 810a2487..f19df8bc 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml @@ -24,38 +24,129 @@ - - - part_pIKELeftCassette_1 + + + BBa_R0010 1 - TetR Inverter - TetR Inverter - + pLacI + pLacI promoter + + + + + + + + + BBa_J61101 + 1 + BBa_J61101 RBS + RBS1 + + + + + + + + + BBa_C0012 + 1 + lacI + lacI coding sequence + + + + + + + + + part_pIKE_Toggle_1 + 1 + LacI/TetR Toggle Switch + LacI/TetR Toggle Switch + - - - BBa_R0040 + + + pIKERightCassette_1 1 - + - + - - - BBa_J61101 + + + pIKELeftCassette_1 1 - + - + + + + + anno2 + 1 + + + + + + location2 + 1 + + + 1286 + 2834 + + + + + + + + + + anno1 + 1 + + + + + + location1 + 1 + + + 1 + 1285 + + + + + + + + + + part_pIKELeftCassette_1 + 1 + TetR Inverter + TetR Inverter + + + + @@ -67,6 +158,17 @@ + + + + BBa_R0040 + 1 + + + + + + @@ -78,6 +180,17 @@ + + + + BBa_J61101 + 1 + + + + + + @@ -101,25 +214,25 @@ - - - anno3 + + + anno2 1 - - - location3 + + + location2 1 - 69 - 1197 + 56 + 68 - + @@ -145,64 +258,28 @@ - - - anno2 + + + anno3 1 - - - location2 + + + location3 1 - 56 - 68 + 69 + 1197 - + - - - BBa_R0010 - 1 - pLacI - pLacI promoter - - - - - - - - - BBa_J61101 - 1 - BBa_J61101 RBS - RBS1 - - - - - - - - - BBa_C0012 - 1 - lacI - lacI coding sequence - - - - - - ECK120033736 @@ -262,91 +339,91 @@ - - - ECK120033736 + + + BBa_J61120 1 - + - - - BBa_J61130 + + + BBa_R0010 1 - + - - - BBa_E0040 + + + ECK120033736 1 - + - - - BBa_R0010 + + + BBa_C0040 1 - + - - - BBa_J61120 + + + BBa_J61130 1 - + - - - BBa_C0040 + + + BBa_E0040 1 - + - - - anno6 + + + anno5 1 - - - location6 + + + location5 1 - 1464 - 1554 + 743 + 1463 - + @@ -372,168 +449,91 @@ - - - anno1 + + + anno2 1 - - - location1 + + + location2 1 - 1 - 55 + 56 + 68 - + - - - anno5 + + + anno6 1 - - - location5 + + + location6 1 - 743 - 1463 + 1464 + 1554 - + - - - anno3 + + + anno1 1 - - - location3 + + + location1 1 - 69 - 729 + 1 + 55 - + - - - anno2 + + + anno3 1 - - - location2 + + + location3 1 - 56 - 68 - - - - - - - - - - part_pIKE_Toggle_1 - 1 - LacI/TetR Toggle Switch - LacI/TetR Toggle Switch - - - - - - - - pIKELeftCassette_1 - 1 - - - - - - - - - - pIKERightCassette_1 - 1 - - - - - - - - - - anno2 - 1 - - - - - - location2 - 1 - - - 1286 - 2834 - - - - - - - - - - anno1 - 1 - - - - - - location1 - 1 - - - 1 - 1285 + 69 + 729 - + diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml index 5bf9ee10..80c2fe6c 100644 Binary files a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml and b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml differ diff --git a/tests/previousresults/getrequest_setup_.html b/tests/previousresults/getrequest_setup_.html index 388a5b5b..e0ec142a 100644 --- a/tests/previousresults/getrequest_setup_.html +++ b/tests/previousresults/getrequest_setup_.html @@ -100,17 +100,6 @@

2. Some technical details

-

- Frontend Url: We need to know where this SynBioHub instance is is displayed. If the URL below is incorrect, please change it - - http://localhost:7777/ - - , but if this is incorrect, please change it here. -

-

Backend Url: We need to know where this SynBioHub instance is hosted so we can assign URLs to your submissions. The instance URL has been automatically guessed as @@ -120,7 +109,7 @@

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. diff --git a/tests/test_functions.py b/tests/test_functions.py index 83d904b2..8f4a6d74 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -120,7 +120,7 @@ def post_request(request, data, headers, route_parameters, files): user_token = test_state.get_authentication() if user_token != None: headers["X-authorization"] = user_token - + test_print(str(data)) address = get_address(request, route_parameters) session = requests_html.HTMLSession()