diff --git a/apps/api/src/app.ts b/apps/api/src/app.ts index f553e79..f4df4ad 100644 --- a/apps/api/src/app.ts +++ b/apps/api/src/app.ts @@ -50,6 +50,10 @@ export class PublicController extends SiteScoped { @Get('site/pages/:slug') async page(@Req() r: Request, @Param('slug') slug: string) { return (await this.p.publicPage(await this.site(r), slug)) ?? null; } + // Public "Report content" form: anyone can ask for content to be removed. + @Post('site/takedown') async takedown(@Req() r: Request, @Body() b: any) { + return this.p.submitTakedown(await this.site(r), { name: b?.name, contact: b?.contact, where: b?.where, details: b?.details, aboutMe: b?.aboutMe === true }, { ip: r.ip }); + } @Post('auth/start') async start(@Req() r: Request, @Body() b: { channel: 'email' | 'phone'; target: string }) { return this.p.startVerification(await this.site(r), b.channel, String(b.target ?? ''), { ip: r.ip }); } @@ -109,18 +113,18 @@ export class MeController extends SiteScoped { @Patch() async update(@Req() r: Request, @Body() b: any) { return this.p.updateProfile(await this.ctx(r), b); } @Post('photos') async addPhoto(@Req() r: Request, @Body() b: any) { // JSON route: placeholder tones (tests) or data URIs when PHOTO_STORE=inline. Real files use /photos/upload. - return this.p.addPhoto(await this.ctx(r), { kind: b.kind, rating: b.rating, url: b.url, tone: b.tone }); + return this.p.addPhoto(await this.ctx(r), { kind: b.kind, rating: b.rating, url: b.url, tone: b.tone, consent: b.consent === true }); } @Post('photos/upload') @UseInterceptors(FileInterceptor('file', { limits: { fileSize: 10 * 1024 * 1024, files: 1 } })) - async uploadPhoto(@Req() r: Request, @UploadedFile() file: { buffer: Buffer } | undefined, @Body() b: { kind?: string; rating?: string }) { + async uploadPhoto(@Req() r: Request, @UploadedFile() file: { buffer: Buffer } | undefined, @Body() b: { kind?: string; rating?: string; consent?: string }) { const ctx = await this.ctx(r); if (!file?.buffer?.length) throw new RuleError('no_file', 'Choose a photo to upload.'); const img = await normalizeImage(file.buffer); - return this.p.addPhoto(ctx, { kind: b.kind as PhotoKind, rating: b.rating as PhotoRating, file: img }); + return this.p.addPhoto(ctx, { kind: b.kind as PhotoKind, rating: b.rating as PhotoRating, file: img, consent: b.consent === 'true' }); } @Patch('photos/:id') async updPhoto(@Req() r: Request, @Param('id') id: string, @Body() b: any) { - return this.p.updatePhoto(await this.ctx(r), id, { kind: b.kind, rating: b.rating }); + return this.p.updatePhoto(await this.ctx(r), id, { kind: b.kind, rating: b.rating, consent: b.consent === true }); } @Delete('photos/:id') async delPhoto(@Req() r: Request, @Param('id') id: string) { return this.p.deletePhoto(await this.ctx(r), id); } @Post('push') async push(@Req() r: Request, @Body() b: { token?: string; platform?: string }) { diff --git a/apps/member/src/app/_layout.tsx b/apps/member/src/app/_layout.tsx index 7aeea2b..23cc93c 100644 --- a/apps/member/src/app/_layout.tsx +++ b/apps/member/src/app/_layout.tsx @@ -5,6 +5,7 @@ import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SessionProvider, useSession } from '../lib/session'; import { PrototypeBar } from '../ui/PrototypeBar'; import { UpdateBanner } from '../ui/UpdateBanner'; +import { AgeGate } from '../ui/AgeGate'; function WebHead() { const { site } = useSession(); @@ -36,6 +37,7 @@ function Shell() { + ); } diff --git a/apps/member/src/app/admin/index.tsx b/apps/member/src/app/admin/index.tsx index 1da9661..99363a8 100644 --- a/apps/member/src/app/admin/index.tsx +++ b/apps/member/src/app/admin/index.tsx @@ -275,6 +275,7 @@ function Moderation({ api, siteId, niche, onChange }: { api: AdminApi; siteId: s risk: ['Possible scammer', 'Looks fine', 'Suspend member'], member: ['Account review', 'Looks fine', 'Suspend account'], email: ['Lost access to email', 'Move account to the new email', 'Decline'], + takedown: ['Removal request', 'Done: content removed', 'No action needed'], }; const runNiche = async () => { setNicheRun({ busy: true }); @@ -322,7 +323,7 @@ function Moderation({ api, siteId, niche, onChange }: { api: AdminApi; siteId: s ) : ( - + )} @@ -348,6 +349,22 @@ function Moderation({ api, siteId, niche, onChange }: { api: AdminApi; siteId: s ) : null} + ) : i.kind === 'takedown' && i.takedown ? ( + <> + {/* From the public "Report content" form. Find the content (See profile on the member, or Members search), remove it, then mark done. */} + + {i.takedown.details} + {i.takedown.where ? Where: {i.takedown.where} : null} + {i.takedown.aboutMe ? 'They say they are pictured in it.' : 'Reported on behalf of someone else.'} Reply to: {i.takedownContact} + + Remove the content while you look into it. Anything showing someone under 18 must also be reported to the authorities (in the US, the NCMEC CyberTipline). + {i.status === 'pending' ? ( + + decide(i.id, 'approve')} /> + decide(i.id, 'reject')} /> + + ) : null} + ) : ( <> {i.kind !== 'member' ? {i.summary} : null} diff --git a/apps/member/src/ui/AgeGate.tsx b/apps/member/src/ui/AgeGate.tsx new file mode 100644 index 0000000..ea02589 --- /dev/null +++ b/apps/member/src/ui/AgeGate.tsx @@ -0,0 +1,45 @@ +// Adult sites only: "Adults only" notice before anyone signed out can use the member app. The public +// site sets a cookie on the parent domain when a visitor answers there, so they aren't asked twice. +// Signed-in members already confirmed they are 18+ when they joined. +import { useEffect, useState } from 'react'; +import { Linking, Platform, View } from 'react-native'; +import { useSession } from '../lib/session'; +import { storage } from '../lib/storage'; +import { Btn, H, Txt, useTheme } from './kit'; + +const KEY = 'whatbox.adult-ok'; +const COOKIE = 'wb_adult_ok'; + +function cookieSaysOk() { + return Platform.OS === 'web' && typeof document !== 'undefined' && document.cookie.split('; ').some((c) => c === `${COOKIE}=1`); +} + +export function AgeGate() { + const { site, signedIn } = useSession(); + const t = useTheme(); + const [ok, setOk] = useState(null); + useEffect(() => { + if (site.mode !== 'adult' || signedIn || cookieSaysOk()) { setOk(true); return; } + storage.get(`${KEY}.${site.slug}`).then((v) => setOk(v === '1')).catch(() => setOk(false)); + }, [site, signedIn]); + if (ok !== false) return null; + const accept = () => { + storage.set(`${KEY}.${site.slug}`, '1').catch(() => {}); + setOk(true); + }; + return ( + + + 18+ + Adults only + + {site.name} is a community for adults. Members may share adult content. You must be 18 or older, and old enough to view adult content where you live, to continue. + + + + Linking.openURL('https://www.google.com')} /> + + + + ); +} diff --git a/apps/member/src/ui/PhotoManager.tsx b/apps/member/src/ui/PhotoManager.tsx index 1908bba..30a238c 100644 --- a/apps/member/src/ui/PhotoManager.tsx +++ b/apps/member/src/ui/PhotoManager.tsx @@ -1,11 +1,11 @@ // Main photo + up to 6 public + up to 6 private, with the site's explicit-photo rules. -import { ApiError, TONES, type MyProfile, type PhotoKind, type PhotoRating, type PhotoView } from '@whatbox/core'; +import { ApiError, PHOTO_CONSENT_STATEMENT, TONES, type MyProfile, type PhotoKind, type PhotoRating, type PhotoView } from '@whatbox/core'; import * as ImagePicker from 'expo-image-picker'; import { useState } from 'react'; import { Platform, Pressable, View } from 'react-native'; import { IS_PREVIEW } from '../lib/backend'; import { useSession } from '../lib/session'; -import { Badge, Btn, Chip, ErrorText, H, Icon, PhotoTile, Txt, useTheme } from './kit'; +import { Badge, Btn, Check, Chip, ErrorText, H, Icon, PhotoTile, Txt, useTheme } from './kit'; export function PhotoManager({ only }: { only?: PhotoKind[] }) { const { api, me, setMe, site } = useSession(); @@ -13,6 +13,10 @@ export function PhotoManager({ only }: { only?: PhotoKind[] }) { const [selected, setSelected] = useState(null); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); + // Adult sites: the uploader confirms age and consent for everyone in each photo (kept as a record). + const adult = site.mode === 'adult'; + const [confirmed, setConfirmed] = useState(false); + const consent = adult ? { consent: true } : {}; if (!me) return null; const photos = me.photos; const main = photos.find((p) => p.kind === 'main'); @@ -27,16 +31,17 @@ export function PhotoManager({ only }: { only?: PhotoKind[] }) { } async function add(kind: PhotoKind, source: 'device' | 'sample') { + if (adult && !confirmed) { setError('First tick the box to confirm everyone in your photos is 18 or older and agreed to them being posted.'); return; } if (source === 'sample') { const tone = TONES[Math.floor(Math.random() * TONES.length)]; - return run(() => api.addPhoto({ kind, tone })); + return run(() => api.addPhoto({ kind, tone, ...consent })); } const res = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ['images'], quality: IS_PREVIEW ? 0.5 : 0.9, base64: IS_PREVIEW, allowsEditing: true, aspect: [1, 1] }); if (res.canceled || !res.assets?.[0]) return; const a = res.assets[0]; // The preview keeps a data URI in the browser; the real app uploads the file itself. const url = IS_PREVIEW && a.base64 ? `data:${a.mimeType ?? 'image/jpeg'};base64,${a.base64}` : a.uri; - return run(() => api.addPhoto({ kind, url })); + return run(() => api.addPhoto({ kind, url, ...consent })); } const slot = (p: PhotoView | undefined, kind: PhotoKind, i: number) => { @@ -107,6 +112,12 @@ export function PhotoManager({ only }: { only?: PhotoKind[] }) { ) : null} + {adult ? ( + + + We keep a record of this for each photo you add. Every photo is reviewed before other members see it. + + ) : null} {show('public') ? section('Public photos', 'public', pub, 'Any signed-in member can see these.') : null} {show('private') ? section('Private photos', 'private', priv, `Members have to ask. You approve each request and can revoke it any time.${site.explicitPhotosAllowed ? ' Explicit photos are allowed here, shown on the website only.' : ''}`) : null} @@ -124,7 +135,10 @@ export function PhotoManager({ only }: { only?: PhotoKind[] }) { Content rating {(['safe', 'suggestive', 'explicit'] as PhotoRating[]).map((r) => ( - run(() => api.updatePhoto(sel.id, { rating: r }))} /> + { + if (adult && r === 'explicit' && !confirmed) { setError('First tick the box to confirm everyone in this photo is 18 or older and agreed to it being posted.'); return; } + run(() => api.updatePhoto(sel.id, { rating: r, ...consent })); + }} /> ))} {!site.explicitPhotosAllowed ? {site.name} does not allow explicit photos. : null} diff --git a/apps/web/app/AgeGate.tsx b/apps/web/app/AgeGate.tsx new file mode 100644 index 0000000..e92c4dd --- /dev/null +++ b/apps/web/app/AgeGate.tsx @@ -0,0 +1,45 @@ +'use client'; +// Adult sites only: a full-screen "18 or older?" notice on the first visit, remembered for a year in a +// first-party cookie. The page underneath is still in the HTML, so search engines can read it (it is +// safe for work by design); the notice only stops a visitor from using the site until they answer. +import { useEffect, useRef, useState } from 'react'; + +const COOKIE = 'wb_adult_ok'; + +export function AgeGate({ name }: { name: string }) { + const [open, setOpen] = useState(false); + const enter = useRef(null); + useEffect(() => { + if (!document.cookie.split('; ').some((c) => c === `${COOKIE}=1`)) setOpen(true); + }, []); + useEffect(() => { + if (!open) return; + enter.current?.focus(); + document.body.style.overflow = 'hidden'; + return () => { document.body.style.overflow = ''; }; + }, [open]); + if (!open) return null; + const accept = () => { + // On the real domain the cookie covers app. too, so the member app doesn't ask again. + const host = location.hostname.replace(/^www\./, ''); + const domain = host.includes('.') && !host.endsWith('.azurecontainerapps.io') && !/^[\d.]+$/.test(host) ? `; Domain=${host}` : ''; + document.cookie = `${COOKIE}=1; Max-Age=${365 * 86400}; Path=/; SameSite=Lax; Secure${domain}`; + setOpen(false); + }; + return ( +
+
+

18+

+

Adults only

+

+ {name} is a community for adults in the swinger lifestyle. Members may share adult content behind sign-in. + You must be 18 or older, and old enough to view adult content where you live, to continue. +

+
+ + Leave +
+
+
+ ); +} diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 5084e7c..5d3be65 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -133,3 +133,18 @@ summary{font-weight:700;cursor:pointer} .update-banner button{min-height:36px;padding:0 14px;border-radius:min(var(--radius),18px);font:700 14px var(--body),system-ui,sans-serif;cursor:pointer} .update-reload{background:var(--accent);color:#fff;border:1.5px solid var(--accent)} .update-later{background:transparent;color:var(--ink);border:1.5px solid var(--line)} +/* Adult sites: 18+ notice on the first visit */ +.age-gate{position:fixed;inset:0;z-index:100;background:rgba(20,12,20,.92);backdrop-filter:blur(14px);display:flex;align-items:center;justify-content:center;padding:16px} +.age-gate-card{background:var(--surface);color:var(--ink);max-width:460px;width:100%;border-radius:20px;padding:28px 24px;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.4)} +.age-gate-card h2{font-family:var(--heading),serif;font-size:30px;margin:6px 0 10px} +.age-gate-card p{color:var(--sub);line-height:1.55} +.age-gate-badge{display:inline-block;margin:0;padding:6px 14px;border-radius:999px;background:var(--accent);color:#fff !important;font-weight:800;letter-spacing:.04em} +.age-gate-actions{display:flex;flex-direction:column;gap:10px;margin-top:20px} +/* Report content form */ +.form{display:flex;flex-direction:column;gap:16px;max-width:560px;margin:24px 0} +.form label{display:flex;flex-direction:column;gap:6px;font-weight:600} +.form label.check{flex-direction:row;align-items:center;gap:10px;font-weight:500} +.form input:not([type=checkbox]),.form textarea{font:inherit;padding:12px 14px;border:1.5px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink)} +.form input[type=checkbox]{width:20px;height:20px} +.form .error{color:#9A2E3A;margin:0} +.notice{background:var(--accentSoft);border-radius:12px;padding:16px;margin:24px 0} diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 3f035f5..3c58175 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -4,6 +4,7 @@ import { articleCategories, landingStyle } from '@whatbox/core'; import { appUrl, getPages, getSite } from '../lib/site'; import { Measure } from './measure'; import { UpdateBanner } from './UpdateBanner'; +import { AgeGate } from './AgeGate'; import './globals.css'; export async function generateMetadata(): Promise { @@ -42,10 +43,15 @@ export default async function RootLayout({ children }: { children: ReactNode }) const topics = articleCategories(pages); return ( - {t.fontsHref ? : null} + + {t.fontsHref ? : null} + {/* "Restricted to Adults" label: lets parental-control software and filters recognise the site. */} + {site.mode === 'adult' ? : null} + Skip to main content + {site.mode === 'adult' ? : null}
@@ -68,7 +74,12 @@ export default async function RootLayout({ children }: { children: ReactNode }) {topics.map((c) => {c.name})} ) : null} - {footer.length ? : null} + {footer.length || site.mode === 'adult' ? ( + + ) : null} © {new Date().getFullYear()} WhatBox, LLC
diff --git a/apps/web/app/report-content/form.tsx b/apps/web/app/report-content/form.tsx new file mode 100644 index 0000000..30c0ac5 --- /dev/null +++ b/apps/web/app/report-content/form.tsx @@ -0,0 +1,42 @@ +'use client'; +// The public "Report content" form. Anyone can use it, with or without an account. +import { useState } from 'react'; + +export function TakedownForm({ api, site }: { api: string; site: string }) { + const [state, setState] = useState<'idle' | 'busy' | 'sent'>('idle'); + const [error, setError] = useState(''); + async function submit(e: React.FormEvent) { + e.preventDefault(); + const f = new FormData(e.currentTarget); + setState('busy'); setError(''); + try { + const res = await fetch(api + '/v1/site/takedown', { + method: 'POST', credentials: 'omit', + headers: { 'Content-Type': 'application/json', 'X-Site': site }, + body: JSON.stringify({ name: f.get('name'), contact: f.get('contact'), where: f.get('where'), details: f.get('details'), aboutMe: f.get('aboutMe') === 'on' }), + }); + if (!res.ok) { + const b = await res.json().catch(() => ({})); + throw new Error(b?.message || 'Something went wrong. Please try again.'); + } + setState('sent'); + } catch (err) { + setError(err instanceof Error ? err.message : 'Something went wrong. Please try again.'); + setState('idle'); + } + } + if (state === 'sent') { + return

Thank you. Our team has your request and will look at it as a priority. We will reply by email.

; + } + return ( +
+ + + +