diff --git a/django/demsausage/app/webdriver.py b/django/demsausage/app/webdriver.py index ddf548e634..7649454c2e 100644 --- a/django/demsausage/app/webdriver.py +++ b/django/demsausage/app/webdriver.py @@ -20,6 +20,7 @@ def get_map_screenshot(election): # firefox_options.add_argument("--start-fullscreen") # firefox_options.add_argument("--start-maximized") firefox_options.binary_location = '/usr/lib/firefox-esr/firefox-esr' + firefox_options.set_preference("general.useragent.override", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0; Demsausage-Webdriver-Screenshot-Service") if os.path.isfile('/app/logs/webdriver/geckodriver.log') is False: Path('/app/logs/webdriver/').mkdir(parents=True, exist_ok=True) diff --git a/public-redesign/src/features/embedBuilder/embedBuilderHelpers.ts b/public-redesign/src/features/embedBuilder/embedBuilderHelpers.ts index 679d047883..86461ad708 100644 --- a/public-redesign/src/features/embedBuilder/embedBuilderHelpers.ts +++ b/public-redesign/src/features/embedBuilder/embedBuilderHelpers.ts @@ -1,6 +1,8 @@ import { Election } from '../../app/services/elections'; import { getAPIBaseURL, getBaseURL } from '../../app/utils'; +export const isEmbedModeActive = () => navigator.userAgent.includes('Demsausage-Webdriver-Screenshot-Service'); + export const getEmbedStaticMapImageURL = (election: Election) => `${getAPIBaseURL()}/0.1/map_image/${election.id}/`; // export const embedPrecannedMapBboxes = [ diff --git a/public-redesign/src/features/map/map.tsx b/public-redesign/src/features/map/map.tsx index d6267578b7..86167e6a3e 100644 --- a/public-redesign/src/features/map/map.tsx +++ b/public-redesign/src/features/map/map.tsx @@ -21,6 +21,7 @@ import { getAPIBaseURL, getBaseURL } from '../../app/utils'; import { selectMapFilterSettings, setPollingPlaces } from '../app/appSlice'; import { getDefaultElection, getViewForElection } from '../elections/electionHelpers'; import { selectAllElections, selectElectionById } from '../elections/electionsSlice'; +import { isEmbedModeActive } from '../embedBuilder/embedBuilderHelpers'; import { getPollingPlaceIdsFromFeatures } from '../pollingPlaces/pollingPlaceHelpers'; import SearchBarCosmeticNonFunctional from '../search/searchByAddressOrGPS/searchBar/searchBarCosmeticNonFunctional'; import AddStallButton from './addStallButton/addStallButton'; @@ -265,7 +266,7 @@ function Map(props: Props) { - + {isEmbedModeActive() === false && } theme.zIndex.drawer + 1 }} open={isMapDataLoading}>