Skip to content

Commit

Permalink
temp fixes for SSL and removal of broken EOL API
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsotc committed Jun 5, 2020
1 parent ad02ace commit 756940e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions __tests__/controllers/test-publishers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions __tests__/test-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
*/
});
6 changes: 6 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
15 changes: 3 additions & 12 deletions public/client/js/react/src/search/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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){
Expand All @@ -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);
}
Expand Down Expand Up @@ -545,4 +536,4 @@ var NumericRangeFilter = React.createClass({
</div>
)
}
})
})

0 comments on commit 756940e

Please sign in to comment.