From 756940ecbd4a05169fd0cb2c55f8fde60f502dd0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 5 Jun 2020 12:35:26 -0400 Subject: [PATCH] temp fixes for SSL and removal of broken EOL API --- __tests__/controllers/test-publishers.js | 1 + __tests__/test-app.js | 3 +++ app/app.js | 6 ++++++ config/config.js | 4 ++-- public/client/js/react/src/search/filters.js | 15 +++------------ 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/__tests__/controllers/test-publishers.js b/__tests__/controllers/test-publishers.js index 53c98902..3324502c 100644 --- a/__tests__/controllers/test-publishers.js +++ b/__tests__/controllers/test-publishers.js @@ -6,6 +6,7 @@ import app from 'app/app'; describe('Publishers', function() { let server = null; beforeAll(async function() { + jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; server = app.listen(); }); afterAll(() => server.close()); diff --git a/__tests__/test-app.js b/__tests__/test-app.js index a10c4143..81f35b76 100644 --- a/__tests__/test-app.js +++ b/__tests__/test-app.js @@ -16,10 +16,13 @@ describe('records', function() { }); afterAll(() => server.close()); +/* + * This function is deprecated it('should return json', async function() { const response = await request(server) .get("/eol_api/search/1.0.json?page=1&q=aphis") .expect('Content-Type', /json/) .expect(200); }); + */ }); diff --git a/app/app.js b/app/app.js index 2e96570b..75f6c6dd 100644 --- a/app/app.js +++ b/app/app.js @@ -119,6 +119,7 @@ app.all('*', function(req, res, next) { next(); }); +/* app.get('/eol_api/*', function(req, res) { var url = ""; if(req.originalUrl.slice(0, 7) === "/portal") { @@ -133,8 +134,13 @@ app.get('/eol_api/*', function(req, res) { if (typeof response != "undefined") { res.send(response.body); } + else { + var temp = { header: "empty" }; + res.send(temp); + } }); }); +*/ app.get('/', home.index); app.get('/search*', search.searchBackbone); diff --git a/config/config.js b/config/config.js index 84722d5e..bdbce7c6 100644 --- a/config/config.js +++ b/config/config.js @@ -3,8 +3,8 @@ var path = require('path'); var _ = require('lodash'); var config = { env: process.env.NODE_ENV, - api: 'https://search.idigbio.org/v2/', - media: 'https://api.idigbio.org/', + api: 'http://search.idigbio.org/v2/', + media: 'http://api.idigbio.org/', secret: process.env.IDB_SECRET || "imnotsecret", root: path.normalize(path.join(__dirname, '..')), app: { diff --git a/public/client/js/react/src/search/filters.js b/public/client/js/react/src/search/filters.js index 6673ce69..25120bc4 100644 --- a/public/client/js/react/src/search/filters.js +++ b/public/client/js/react/src/search/filters.js @@ -164,15 +164,6 @@ $.widget("custom.IDBAutocomplete", $.ui.autocomplete, { } }) -function stripHtml(html){ - // Create a new div element - var temporalDivElement = document.createElement("div"); - // Set the HTML content with the providen - temporalDivElement.innerHTML = html; - // Retrieve the text property of the element (cross-browser support) - return temporalDivElement.textContent || temporalDivElement.innerText || ""; -} - var TextFilter = React.createClass({ componentWillMount: function(){ var self = this; @@ -286,7 +277,7 @@ var TextFilter = React.createClass({ url: '/portal/eol_api/search/1.0.json?page=1&q='+val, //'http://eol.org/api/search/1.0.json?page=1&q='+val, type: 'GET', crossDomain: true, - //dataType: 'jsonp', + dataType: 'jsonp', success: function(resp) { if(resp.results.length > 0){ @@ -295,7 +286,7 @@ var TextFilter = React.createClass({ if(!_.isUndefined(resp.results[i])){ var res = resp.results[i].content.split(';'); res.forEach(function(it,ind){ - var syn = helpers.strip(stripHtml(it.toLowerCase())); + var syn = helpers.strip(it.toLowerCase()); if(text.indexOf(syn)=== -1){ output.push(syn); } @@ -545,4 +536,4 @@ var NumericRangeFilter = React.createClass({ ) } -}) +}) \ No newline at end of file