Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions main/js/dataAcquisition/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @returns {Promise<Object.<string, Array>>} Fetched data.
*/
const _fetchFromFireBrowse = async function(endpoint, params, expectedKey) {
const base = "https://cors-proxy-webgen.vercel.app";
const base = "https://webgen.gteref.workers.dev/?url="
// Remove a leading / in the endpoint so we don't have duplicate / in
// the url. Using // in a url is valid but it feels dirty.
if (endpoint.startsWith("/")) {
Expand All @@ -16,7 +16,7 @@ const _fetchFromFireBrowse = async function(endpoint, params, expectedKey) {
endpoint = `http://firebrowse.org/api/v1/${endpoint}`;
params = new URLSearchParams(params);
const encodedUri = encodeURIComponent(`${endpoint}?${params.toString()}`)
const url = `${base}/api/proxy?url=${encodedUri}`;
const url = `${base}${encodedUri}`
const minimalJson = { [expectedKey]: [] };

const response = await fetch(url);
Expand All @@ -26,7 +26,7 @@ const _fetchFromFireBrowse = async function(endpoint, params, expectedKey) {
}
try {
const json = await response.json();
return json.data;
return json;
} catch(error) {
console.log(`${expectedKey} is empty, returning an object with empty ${expectedKey} `);
return minimalJson;
Expand Down
Loading