bring back forced set geolocation #32

closed
opened by daniela.lol targeting main from daniela.lol/witchsky.app: main

forks cant use blueskys geolocation service (this is quite honestly a good thing) on web, due to this the moderation panel gets pretty screwed up because the geolocation by default is "undefined", social.daniela.lol worked around this by force setting the geolocation to "US, CA", this fix broke recently, this PR brings it back

couple other things this does:

  • remove left overs of old hacky solution
  • cleanup unused gelocation source file

i did specifically mention web here, for some reason geolocation stuff works just fine on mobile so i assume that most likely also means location specific blocks could be inforced there, id be good in the future to look into force setting a geolocation on mobile too

another thing that would be good to look into is a tweak that lets people set their location to whatever they want, so if they want to have their location be accurate, they can manually choose so

Changed files
+6 -36
src
geolocation
state
geolocation
-1
config.txt
··· 1 - {"countryCode":"US","regionCode":"CA","ageRestrictedGeos":[],"ageBlockedGeos":[]}
-3
justfile
··· 44 44 # copy our static pages over! 45 45 cp -r witchsky-static-about web-build/about 46 46 47 - # temporarily copy over out bootleg config.txt to simulate geolocation 48 - cp config.txt web-build/ 49 - 50 47 [group('dev')] 51 48 dev-android-setup: prebuild-android 52 49 yarn android
+6 -2
src/geolocation/const.ts
··· 6 6 /** 7 7 * Default geolocation config. 8 8 */ 9 + // forks tend to get blocked from the geolocation service bluesky uses, 10 + // instead of making our own and grabbing peoples location without their consent, 11 + // lets just force set everyone to be in the US, 12 + // maybe make a tweak in the future that lets ppl customize this 9 13 export const FALLBACK_GEOLOCATION_SERVICE_RESPONSE: Geolocation = { 10 - countryCode: undefined, 11 - regionCode: undefined, 14 + countryCode: 'US', 15 + regionCode: 'CA', 12 16 }
-30
src/state/geolocation/const.ts
··· 1 - import {type GeolocationStatus} from '#/state/geolocation/types' 2 - import {BAPP_CONFIG_DEV_URL, IS_DEV} from '#/env' 3 - import {type Device} from '#/storage' 4 - 5 - export const IPCC_URL = `https://bsky.app/ipcc` 6 - export const BAPP_CONFIG_URL_PROD = `/config.txt` 7 - export const BAPP_CONFIG_URL = IS_DEV 8 - ? (BAPP_CONFIG_DEV_URL ?? BAPP_CONFIG_URL_PROD) 9 - : BAPP_CONFIG_URL_PROD 10 - export const GEOLOCATION_CONFIG_URL = BAPP_CONFIG_URL 11 - 12 - /** 13 - * Default geolocation config. 14 - */ 15 - export const DEFAULT_GEOLOCATION_CONFIG: Device['geolocation'] = { 16 - countryCode: 'US', 17 - regionCode: 'CA', 18 - ageRestrictedGeos: [], 19 - ageBlockedGeos: [], 20 - } 21 - 22 - /** 23 - * Default geolocation status. 24 - */ 25 - export const DEFAULT_GEOLOCATION_STATUS: GeolocationStatus = { 26 - countryCode: 'US', 27 - regionCode: 'CA', 28 - isAgeRestrictedGeo: false, 29 - isAgeBlockedGeo: false, 30 - }