Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Neuter age assurance

Fixes #98. Tested locally.

Default moderation settings are still applied to logged-out accounts
(per comments in the file, logged-out moderation settings are now
downstream of AA code, ~~because bsky pbc are jerks like that~~ because
it makes sense to keep everything in one place), but logged-in users are
now afforded the freedom to choose their own moderation settings, as
intended.

I did not touch logged-out moderation prefs to avoid exposing users who
might not yet have access to the moderation panel due to not having an
account to anything objectionable — this, in my opinion, is sufficient
balance considering AA is no longer functional for logged-in users.

authored by

Vika and committed by tangled.org 09e0dff3 a4968374

+8 -58
+8 -58
src/ageAssurance/state.ts
··· 1 1 import {useEffect, useMemo, useState} from 'react' 2 - import {computeAgeAssuranceRegionAccess} from '@atproto/api' 3 2 4 3 import {useSession} from '#/state/session' 5 4 import {useAgeAssuranceDataContext} from '#/ageAssurance/data' ··· 8 7 AgeAssuranceAccess, 9 8 type AgeAssuranceState, 10 9 AgeAssuranceStatus, 11 - parseAccessFromString, 12 - parseStatusFromString, 13 10 } from '#/ageAssurance/types' 14 - import {getAgeAssuranceRegionConfigWithFallback} from '#/ageAssurance/util' 15 11 import {useGeolocation} from '#/geolocation' 16 12 17 13 export function useAgeAssuranceState(): AgeAssuranceState { ··· 30 26 access: AgeAssuranceAccess.Safe, 31 27 } 32 28 33 - /** 34 - * This can happen if the prefetch fails (such as due to network issues). 35 - * The query handler will try it again, but if it continues to fail, of 36 - * course we won't have config. 37 - * 38 - * In this case, fail open to avoid blocking users. 39 - */ 40 - if (!config) { 41 - logger.warn('useAgeAssuranceState: missing config') 42 - return { 43 - status: AgeAssuranceStatus.Unknown, 44 - access: AgeAssuranceAccess.Safe, 45 - error: 'config', 46 - } 47 - } 48 - 49 - const region = getAgeAssuranceRegionConfigWithFallback(config, geolocation) 50 - const isAARequired = region.countryCode !== '*' 51 - const isTerminalState = 52 - state?.status === 'assured' || state?.status === 'blocked' 53 - 54 - /* 55 - * If we are in a terminal state and AA is required for this region, 56 - * we can trust the server state completely and avoid recomputing. 57 - */ 58 - if (isTerminalState && isAARequired) { 59 - return { 60 - lastInitiatedAt: state.lastInitiatedAt, 61 - status: parseStatusFromString(state.status), 62 - access: parseAccessFromString(state.access), 63 - } 64 - } 65 - 66 - /* 67 - * Otherwise, we need to compute the access based on the latest data. For 68 - * accounts with an accurate birthdate, our default fallback rules should 69 - * ensure correct access. 70 - */ 71 - const result = computeAgeAssuranceRegionAccess(region, data) 29 + // Don't baby the user. They know what they're doing. Age assurance is not 30 + // mandatory in many regions, and there is no need to pander to bureaucrats 31 + // when making FOSS software. You're free not to use this software if the 32 + // notion of letting the user choose their moderation settings freely, 33 + // without giving up their personal data to anyone, offends you. 72 34 const computed = { 73 - lastInitiatedAt: state?.lastInitiatedAt, 74 - // prefer server state 75 - status: state?.status 76 - ? parseStatusFromString(state?.status) 77 - : AgeAssuranceStatus.Unknown, 78 - // prefer server state 79 - access: result 80 - ? parseAccessFromString(result.access) 81 - : AgeAssuranceAccess.Full, 35 + lastInitiatedAt: undefined, 36 + status: AgeAssuranceStatus.Unknown, 37 + access: AgeAssuranceAccess.Full, 82 38 } 83 - logger.debug('debug useAgeAssuranceState', { 84 - region, 85 - state, 86 - data, 87 - computed, 88 - }) 89 39 return computed 90 40 }, [hasSession, geolocation, config, state, data]) 91 41 }