1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-06-08 10:26:36 +00:00

Set headers for every HTTPoison request

This serves as a workaround for bot blocking via filtron.
This commit is contained in:
Ben Busby 2021-11-24 16:10:00 -07:00
parent 1216854196
commit 4a824e449b
No known key found for this signature in database
GPG key ID: 339B7B7EB5333D14
2 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@ defmodule Farside.Instances do
@update_file Application.fetch_env!(:farside, :update_file)
@services_json Application.fetch_env!(:farside, :services_json)
@service_prefix Application.fetch_env!(:farside, :service_prefix)
@headers Application.fetch_env!(:farside, :headers)
def sync() do
File.rename(@update_file, "#{@update_file}-prev")
@ -21,7 +22,7 @@ defmodule Farside.Instances do
System.get_env("FARSIDE_TEST") ->
:good
true ->
case HTTPoison.get(url) do
case HTTPoison.get(url, @headers) do
{:ok, %HTTPoison.Response{status_code: 200}} ->
# TODO: Add validation of results, not just status code
:good