Switch CORS proxy
Sometime between December 4th… https://web.archive.org/web/20241204202205/https://corsproxy.io/ …and December 5th… https://web.archive.org/web/20241205230048/https://corsproxy.io/ corsproxy.io started charging for access and returning 403s. (Based on the claim of 900TB/mo of traffic, that's probably not terribly surprising!) For now, we switch to another free one. At some point, I'll probably set one up of my own to not have to deal with this again, but I'll need to figure out how to deal with authentication first to prevent abuse.
This commit is contained in:
parent
8bde7432f4
commit
07d55783fd
|
@ -35,7 +35,7 @@ vectorLayer.customPopupCallback = async function(feature) {
|
||||||
fotd_parent.append(fotd_child, fotd_image);
|
fotd_parent.append(fotd_child, fotd_image);
|
||||||
|
|
||||||
const [long, lat] = toLonLat(feature.getGeometry().getCoordinates());
|
const [long, lat] = toLonLat(feature.getGeometry().getCoordinates());
|
||||||
const res = await fetch(`https://corsproxy.io/?${encodeURIComponent(`https://www.culvers.com/api/locator/getLocations?lat=${lat}&long=${long}&limit=1&t=${Date.now()}`)}`)
|
const res = await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(`https://www.culvers.com/api/locator/getLocations?lat=${lat}&long=${long}&limit=1&t=${Date.now()}`)}`)
|
||||||
const res_data = await res.json();
|
const res_data = await res.json();
|
||||||
fotd_child.innerHTML = res_data.data.geofences[0].metadata.flavorOfDayName;
|
fotd_child.innerHTML = res_data.data.geofences[0].metadata.flavorOfDayName;
|
||||||
fotd_image.src = `https://cdn.culvers.com/menu-item-detail/${res_data.data.geofences[0].metadata.flavorOfDaySlug}`;
|
fotd_image.src = `https://cdn.culvers.com/menu-item-detail/${res_data.data.geofences[0].metadata.flavorOfDaySlug}`;
|
||||||
|
|
2
main.js
2
main.js
|
@ -225,7 +225,7 @@ function newCustomLayer(name, sourceURL, colorString) {
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
// In case people put in layers that don't serve proper CORS headers, we
|
// In case people put in layers that don't serve proper CORS headers, we
|
||||||
// wrap them in this proxy so they Just Work.
|
// wrap them in this proxy so they Just Work.
|
||||||
url: `https://corsproxy.io/?${encodeURIComponent(sourceURL)}`,
|
url: `https://api.allorigins.win/raw?url=${encodeURIComponent(sourceURL)}`,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
|
|
Loading…
Reference in a new issue