feat(web): 18+ games hidden by default, /removed, version 4.0.0

- Games marked nsfw=Yes are left out of the table, dashboard and charts
  unless the visitor opts in (Settings -> Content, after confirming they
  are 18+; stored only in this browser). Their detail pages show a notice
  instead. The admin app still sees everything.
- /deleted is now /removed (301 from the Worker, redirect in the SPA,
  sitemap and canonical updated); <html lang> follows the language.
- Legal links: the gate lists only the documents being accepted (ToS,
  Privacy, Disclaimer, and the EULA inside the apps) and asks to confirm
  the visitor is 16+; new "Licenses & notice", "Data license" and
  "Content removal" links; the retired Telegram bot link is gone.
  LEGAL_VERSION 2026-09-18, so everyone is asked once more.
- Version 4.0.0 in about.ts, package.json (+ "license": "MIT"),
  tauri.conf.json (+ bundle copyright), Cargo.toml / Cargo.lock.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5 committed 2026-09-18 17:55:02 +07:00
1 parent cbe3e389ea
commit 6f8b9ed490
24 files changed
+168 -46

No files matched your search

+3 -2
View File
@@ -1,12 +1,13 @@
{
"name": "webapp",
"version": "0.0.0",
"version": "4.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "webapp",
"version": "0.0.0",
"version": "4.0.0",
"license": "MIT",
"dependencies": {
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dialog": "^1.1.15",
+2 -1
View File
@@ -1,7 +1,8 @@
{
"name": "webapp",
"private": true,
"version": "0.0.0",
"version": "4.0.0",
"license": "MIT",
"type": "module",
"engines": {
"node": ">=22.22"
+1 -1
View File
@@ -1057,7 +1057,7 @@ dependencies = [
[[package]]
name = "free-games-itchio-webapp"
version = "3.9.0"
version = "4.0.0"
dependencies = [
"serde",
"serde_json",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "free-games-itchio-webapp"
version = "3.9.0"
version = "4.0.0"
description = "Itch.io free games catalog viewer"
authors = ["poli0981"]
license = "MIT"
+2 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Itch.io Free Games DB",
"version": "3.9.0",
"version": "4.0.0",
"identifier": "com.poli0981.freegamesitchio",
"build": {
"beforeDevCommand": "npm run dev",
@@ -42,6 +42,7 @@
"category": "Utility",
"shortDescription": "Browse the free itch.io games catalog",
"longDescription": "Desktop and Android viewer for the Free Itch Games catalog (freeitchgames.win): search, filter and explore free itch.io games. Read-only; the catalog is refreshed daily.",
"copyright": "Copyright (c) 2025-2026 poli0981 (SkullMute)",
"licenseFile": "installer/EULA.rtf"
}
}
+3 -2
View File
@@ -1,5 +1,5 @@
import { lazy, Suspense, useEffect, useRef } from 'react'
import { Routes, Route, useLocation } from 'react-router'
import { Navigate, Routes, Route, useLocation } from 'react-router'
import { Sidebar, MobileTopBar } from '@/components/sidebar'
import { LegalGate } from '@/components/legal-gate'
import ScrollToTop from '@/components/scroll-to-top'
@@ -68,7 +68,8 @@ export default function App() {
<Route path="/games" element={<Games />} />
<Route path="/games/:slug" element={<GameDetail />} />
<Route path="/charts" element={<Charts />} />
<Route path="/deleted" element={<Deleted />} />
<Route path="/removed" element={<Deleted />} />
<Route path="/deleted" element={<Navigate to="/removed" replace />} />
<Route path="/settings" element={<Settings />} />
<Route path="/about" element={<About />} />
<Route path="/suggest" element={<Suggest />} />
+3 -4
View File
@@ -4,6 +4,7 @@ import { ExternalLink as ExternalLinkIcon } from 'lucide-react'
import { usePrefs, LEGAL_VERSION } from '@/stores/prefs'
import { useT } from '@/lib/i18n'
import { LEGAL_LINKS, LEGAL_VI_INDEX_URL } from '@/lib/about'
import { isTauri } from '@/lib/runtime'
import { ExtLink } from '@/components/ext-link'
import { Button } from '@/components/ui/button'
import { Checkbox } from '@/components/ui/checkbox'
@@ -19,10 +20,8 @@ import { Checkbox } from '@/components/ui/checkbox'
* provides the focus trap and aria-modal labelling.
*/
// Policy links + the canonical License — reuse about.ts, never hardcode URLs.
const GATE_LINKS = LEGAL_LINKS.filter(
(l) => l.group === 'policy' || l.name === 'License (MIT)',
)
// The documents being accepted — reuse about.ts, never hardcode URLs.
const GATE_LINKS = LEGAL_LINKS.filter((l) => l.inGate && (!l.appOnly || isTauri()))
export function LegalGate({ children }: { children: ReactNode }) {
const accepted = usePrefs((s) => s.acceptedLegalVersion)
+1 -1
View File
@@ -37,7 +37,7 @@ const NAV_ITEMS: NavItem[] = [
{ to: '/', label: 'nav.dashboard', icon: LayoutDashboard, end: true },
{ to: '/games', label: 'nav.games', icon: Gamepad2 },
{ to: '/charts', label: 'nav.charts', icon: BarChart3 },
{ to: '/deleted', label: 'nav.deleted', icon: Trash2 },
{ to: '/removed', label: 'nav.deleted', icon: Trash2 },
{ to: '/suggest', label: 'nav.suggest', icon: Lightbulb },
{ to: '/settings', label: 'nav.settings', icon: Settings },
{ to: '/about', label: 'nav.about', icon: Info },
+19
View File
@@ -1,4 +1,7 @@
import { useMemo } from 'react'
import { useQuery } from '@tanstack/react-query'
import { isNsfw } from '@/lib/nsfw'
import { usePrefs } from '@/stores/prefs'
import {
loadAllGames,
loadDeletedLog,
@@ -12,6 +15,22 @@ export function useAllGames() {
})
}
/**
* The catalog as this visitor sees it: games marked 18+ are left out unless
* they opted in (Settings). `hiddenNsfw` counts what was left out. The admin
* app uses useAllGames() and always sees everything.
*/
export function useVisibleGames() {
const all = useAllGames()
const showNsfw = usePrefs((s) => s.showNsfw)
const data = useMemo(() => {
if (!all.data || showNsfw) return all.data
return { ...all.data, games: all.data.games.filter((g) => !isNsfw(g)) }
}, [all.data, showNsfw])
const hiddenNsfw = all.data && data ? all.data.games.length - data.games.length : 0
return { ...all, data, hiddenNsfw }
}
export function useDeletedGames() {
return useQuery({
queryKey: ['deleted'],
+1 -1
View File
@@ -5,7 +5,7 @@ import { isTauri } from '@/lib/runtime'
// Pages worth indexing. Keep in sync with the <Routes> in App.tsx (and
// worker/spa.ts, which answers unknown paths and game slugs with a 404).
const INDEXED = ['/', '/games', '/games/:slug', '/charts', '/deleted', '/about', '/suggest'].map((path) => ({
const INDEXED = ['/', '/games', '/games/:slug', '/charts', '/removed', '/about', '/suggest'].map((path) => ({
path,
}))
+17 -12
View File
@@ -8,9 +8,9 @@ export interface ThirdParty {
export const APP = {
name: 'Itch.io Free Games DB',
version: '3.9.0',
version: '4.0.0',
repo: 'https://github.com/poli0981/free-games-itchio-list',
license: 'MIT',
license: 'code MIT · data CC BY 4.0',
} as const
export const DEV = {
@@ -69,8 +69,7 @@ export const SOCIAL_LINKS: SocialLink[] = [
{ platform: 'discord-game', label: 'Discord — Game chat', handle: '#general', url: 'https://discord.gg/kDM9GMu5vm', group: 'community' },
// Messaging — DM only; never post your Telegram numeric ID to public channels.
{ platform: 'telegram-user', label: 'Telegram (DM for bot whitelist)', handle: '@SkullMute0011', url: 'https://t.me/SkullMute0011', group: 'messaging' },
{ platform: 'telegram-bot', label: 'Telegram bot (game submission)', handle: '@my_skull_bot', url: 'https://t.me/my_skull_bot', group: 'messaging' },
{ platform: 'telegram-user', label: 'Telegram (DM)', handle: '@SkullMute0011', url: 'https://t.me/SkullMute0011', group: 'messaging' },
// Support — mirrors .github/FUNDING.yml (single source of truth on GitHub side).
{ platform: 'github-sponsors', label: 'GitHub Sponsors', handle: 'poli0981', url: 'https://github.com/sponsors/poli0981', group: 'support' },
@@ -100,20 +99,26 @@ export interface LegalLink {
description: string
url: string
group: LegalGroup
/** Listed in the first-visit legal gate (the documents being accepted). */
inGate?: boolean
/** Only relevant to the desktop / Android apps. */
appOnly?: boolean
}
export const LEGAL_LINKS: LegalLink[] = [
// Policy
{ name: 'Disclaimer', description: 'No warranty, no liability, "as-is" basis.', url: `${REPO_BLOB}/docs/DISCLAIMER.md`, group: 'policy' },
{ name: 'EULA', description: 'MIT-licensed; what the license does and does not cover.', url: `${REPO_BLOB}/docs/EULA.md`, group: 'policy' },
{ name: 'Terms of Use', description: 'Permitted uses, prohibited activities, contributor obligations, PAT.', url: `${REPO_BLOB}/docs/ToS.md`, group: 'policy' },
{ name: 'Privacy Policy', description: 'Zero server-side data collection. Local-only browser storage detailed.', url: `${REPO_BLOB}/docs/PrivacyPolicy.md`, group: 'policy' },
{ name: 'Code of Conduct', description: 'Be cool. The full version is on GitHub.', url: `${REPO_BLOB}/CODE_OF_CONDUCT.md`, group: 'policy' },
{ name: 'Security Policy', description: 'Reporting vulnerabilities + PAT handling overview.', url: `${REPO_BLOB}/SECURITY.md`, group: 'policy' },
{ name: 'Terms of Use', description: 'Using the website and the public data; how to ask for a removal.', url: `${REPO_BLOB}/docs/ToS.md`, group: 'policy', inGate: true },
{ name: 'Privacy Policy', description: 'What the site and apps process, what stays in your browser, your rights.', url: `${REPO_BLOB}/docs/PrivacyPolicy.md`, group: 'policy', inGate: true },
{ name: 'Disclaimer', description: 'No warranty, no liability, "as-is" basis; not affiliated with itch.io.', url: `${REPO_BLOB}/docs/DISCLAIMER.md`, group: 'policy', inGate: true },
{ name: 'EULA', description: 'License terms of the desktop and Android apps.', url: `${REPO_BLOB}/docs/EULA.md`, group: 'policy', inGate: true, appOnly: true },
{ name: 'Code of Conduct', description: 'Be kind. Contributor Covenant 2.1, adapted.', url: `${REPO_BLOB}/CODE_OF_CONDUCT.md`, group: 'policy' },
{ name: 'Security Policy', description: 'How to report a vulnerability privately.', url: `${REPO_BLOB}/SECURITY.md`, group: 'policy' },
{ name: 'Content removal', description: 'Creators and rights holders: ask for a game to be removed or corrected.', url: `${REPO_BLOB}/.github/ISSUE_TEMPLATE/remove_game.yml`, group: 'policy' },
// Meta
{ name: 'License (MIT)', description: 'The canonical license text.', url: `${REPO_BLOB}/LICENSE`, group: 'meta' },
{ name: 'Changelog', description: 'What changed when.', url: `${REPO_BLOB}/CHANGELOG.md`, group: 'meta' },
{ name: 'Licenses & notice', description: 'Code: MIT. Data and docs: CC BY 4.0. Not affiliated with itch.io.', url: `${REPO_BLOB}/NOTICE.md`, group: 'meta' },
{ name: 'Data license', description: 'What CC BY 4.0 covers in the catalog, and how to credit it.', url: `${REPO_BLOB}/data_game/LICENSE.md`, group: 'meta' },
{ name: 'Changelog', description: 'What changed when.', url: `${REPO_BLOB}/CHANGELOG.md`, group: 'meta' },
]
export const LEGAL_GROUP_LABELS: Record<LegalGroup, string> = {
+13 -5
View File
@@ -31,7 +31,7 @@ export const en = {
'nav.dashboard': 'Dashboard',
'nav.games': 'Games',
'nav.charts': 'Charts',
'nav.deleted': 'Deleted',
'nav.deleted': 'Removed',
'nav.settings': 'Settings',
'nav.about': 'About',
@@ -39,7 +39,7 @@ export const en = {
'titles.dashboard': 'Dashboard',
'titles.games': 'Games',
'titles.charts': 'Charts',
'titles.deleted': 'Deleted Games',
'titles.deleted': 'Removed games',
'titles.settings': 'Settings',
'titles.about': 'About',
'titles.notFound': '404 — Not found',
@@ -81,13 +81,13 @@ export const en = {
"about.ai.desc": "No real co-maintainers (introvert max level). These two LLMs are the closest thing.",
"about.ai.title": "AI co-authors",
"about.app.descPrefix": "A read/write companion app for the ",
"about.app.meta": "v{version} · built {buildDate} · {license} licensed",
"about.app.meta": "v{version} · built {buildDate} · {license}",
"about.bug.desc": "If something's broken — desktop or web — file it here so I see it. Grok will probably patch it before I wake up :D",
"about.bug.openTemplate": "Open bug report template",
"about.bug.title": "Found a bug?",
"about.developer.title": "Developer",
"about.footer": "Made with the libraries above. No tracking, no analytics, no telemetry.",
"about.legal.desc": "All policies are MD files in the repo — short, plain-language, slight humor, full on-the-record terms. Updated 2026-06-14.",
"about.legal.desc": "All policies are Markdown files in the repository — plain language, full terms. Updated 2026-09-18.",
"about.legal.title": "Legal & policies",
"about.legal.viNote": "— Vietnamese translations of the policies above (community-readable, English remains the controlling version for legal interpretation).",
"about.social.desc": "DMs open on most. Replies slow (introvert max level). Pick whichever channel fits.",
@@ -190,7 +190,7 @@ export const en = {
"games.facet.platforms": "Platforms",
"games.facet.status": "Status",
"legal.gate.accept": "Accept & continue",
"legal.gate.checkboxLabel": "I have read and accept all the terms and policies listed above.",
"legal.gate.checkboxLabel": "I have read and accept the terms and policies listed above, and I am at least 16 years old.",
"legal.gate.decline": "Decline",
"legal.gate.declinedMsg": "You must accept the terms to use this app. It stays locked until you do.",
"legal.gate.intro": "By using this app you accept and agree to abide by the legal terms below. Please review them before continuing.",
@@ -280,6 +280,14 @@ export const en = {
"suggest.error.challenge": "The anti-spam check failed. Please try again.",
"suggest.error.challengeLoad": "The anti-spam check couldn't load. Check your connection or content blocker.",
"suggest.error.generic": "Something went wrong. Please try again later.",
// ---- nsfw ----
"nsfw.confirm": "Show games marked 18+? Confirm that you are at least 18 years old. The choice is stored only in this browser.",
"nsfw.gate.title": "This game is marked 18+",
"nsfw.gate.desc": "Games with adult content are hidden unless you choose to show them. You can change this any time in Settings.",
"nsfw.gate.show": "I'm 18 or older — show 18+ games",
"settings.content.title": "Content",
"settings.content.nsfw": "Show 18+ games",
"settings.content.nsfwDesc": "Off by default. Turning it on asks you to confirm you are 18 or older; the choice stays in this browser.",
} as const
export type MessageKey = keyof typeof en
+5
View File
@@ -34,6 +34,11 @@ export async function switchLanguage(lang: Language): Promise<void> {
/** Call once at startup: preload VI if it was the persisted preference. */
export function initI18n(): void {
if (usePrefs.getState().language === 'vi') void ensureVi()
// <html lang> follows the preference (screen readers, hyphenation, translation prompts).
document.documentElement.lang = usePrefs.getState().language
usePrefs.subscribe((s) => {
document.documentElement.lang = s.language
})
}
function format(template: string, params?: Record<string, string | number>): string {
+13 -5
View File
@@ -33,7 +33,7 @@ export const vi: Record<MessageKey, string> = {
'nav.dashboard': 'Trang chính',
'nav.games': 'Danh sách game',
'nav.charts': 'Biểu đồ',
'nav.deleted': 'Đã xoá',
'nav.deleted': 'Đã gỡ',
'nav.settings': 'Cài đặt',
'nav.about': 'Giới thiệu',
@@ -41,7 +41,7 @@ export const vi: Record<MessageKey, string> = {
'titles.dashboard': 'Trang chính',
'titles.games': 'Danh sách game',
'titles.charts': 'Biểu đồ',
'titles.deleted': 'Game đã xoá',
'titles.deleted': 'Game đã gỡ',
'titles.settings': 'Cài đặt',
'titles.about': 'Giới thiệu',
'titles.notFound': '404 — Không tìm thấy',
@@ -83,13 +83,13 @@ export const vi: Record<MessageKey, string> = {
"about.ai.desc": "Không có đồng bảo trì viên thật nào (hướng nội cấp tối đa). Hai LLM này là thứ gần giống nhất.",
"about.ai.title": "Đồng tác giả AI",
"about.app.descPrefix": "Ứng dụng đồng hành đọc/ghi cho catalog ",
"about.app.meta": "v{version} · build ngày {buildDate} · giấy phép {license}",
"about.app.meta": "v{version} · build ngày {buildDate} · {license}",
"about.bug.desc": "Nếu có gì hỏng — desktop hay web — hãy báo tại đây để mình thấy. Grok có lẽ sẽ vá xong trước khi mình thức dậy :D",
"about.bug.openTemplate": "Mở mẫu báo cáo bug",
"about.bug.title": "Phát hiện bug?",
"about.developer.title": "Nhà phát triển",
"about.footer": "Được tạo bằng các thư viện ở trên. Không theo dõi, không analytics, không telemetry.",
"about.legal.desc": "Tất cả chính sách là file MD trong repo — ngắn gọn, dễ hiểu, hơi hài hước, điều khoản chính thức đầy đủ. Cập nhật 2026-06-14.",
"about.legal.desc": "Tất cả chính sách là file Markdown trong repo — dễ hiểu, đầy đủ điều khoản. Cập nhật 2026-09-18.",
"about.legal.title": "Pháp lý & chính sách",
"about.legal.viNote": "— bản dịch tiếng Việt của các chính sách trên (để cộng đồng dễ đọc; bản tiếng Anh vẫn là bản có hiệu lực khi diễn giải pháp lý).",
"about.social.desc": "DM mở trên hầu hết các kênh. Trả lời chậm (hướng nội cấp tối đa). Chọn kênh nào tiện cho bạn.",
@@ -192,7 +192,7 @@ export const vi: Record<MessageKey, string> = {
"games.facet.platforms": "Nền tảng",
"games.facet.status": "Trạng thái",
"legal.gate.accept": "Chấp nhận & tiếp tục",
"legal.gate.checkboxLabel": "Tôi đã đọc và chấp nhận toàn bộ điều khoản và chính sách liệt kê ở trên.",
"legal.gate.checkboxLabel": "Tôi đã đọc và chấp nhận các điều khoản và chính sách liệt kê ở trên, và tôi đủ 16 tuổi trở lên.",
"legal.gate.decline": "Từ chối",
"legal.gate.declinedMsg": "Bạn phải chấp nhận các điều khoản để dùng ứng dụng. Ứng dụng vẫn bị khoá cho đến khi bạn chấp nhận.",
"legal.gate.intro": "Khi sử dụng ứng dụng này, bạn chấp nhận và đồng ý tuân thủ các điều khoản pháp lý dưới đây. Vui lòng đọc qua trước khi tiếp tục.",
@@ -282,4 +282,12 @@ export const vi: Record<MessageKey, string> = {
"suggest.error.challenge": "Kiểm tra chống spam không thành công. Vui lòng thử lại.",
"suggest.error.challengeLoad": "Không tải được bước kiểm tra chống spam. Hãy kiểm tra kết nối hoặc trình chặn nội dung.",
"suggest.error.generic": "Đã có lỗi xảy ra. Vui lòng thử lại sau.",
// ---- nsfw ----
"nsfw.confirm": "Hiện các game gắn nhãn 18+? Hãy xác nhận bạn đủ 18 tuổi trở lên. Lựa chọn chỉ được lưu trong trình duyệt này.",
"nsfw.gate.title": "Game này được gắn nhãn 18+",
"nsfw.gate.desc": "Các game có nội dung người lớn được ẩn trừ khi bạn chọn hiện chúng. Bạn có thể đổi lựa chọn này bất cứ lúc nào trong Cài đặt.",
"nsfw.gate.show": "Tôi đủ 18 tuổi — hiện game 18+",
"settings.content.title": "Nội dung",
"settings.content.nsfw": "Hiện game 18+",
"settings.content.nsfwDesc": "Mặc định tắt. Khi bật, bạn sẽ được yêu cầu xác nhận đủ 18 tuổi; lựa chọn chỉ lưu trong trình duyệt này.",
}
+15
View File
@@ -0,0 +1,15 @@
import { usePrefs } from '@/stores/prefs'
import { t } from '@/lib/i18n'
import type { Game } from '@/types/game'
/** Games the maintainer marked 18+ are hidden until the visitor opts in. */
export function isNsfw(game: Pick<Game, 'nsfw'>): boolean {
return game.nsfw === 'Yes'
}
/** Ask for the 18+ confirmation, then show adult games on this device. */
export function enableNsfw(): boolean {
if (!window.confirm(t('nsfw.confirm'))) return false
usePrefs.getState().setShowNsfw(true)
return true
}
+2 -2
View File
@@ -2,7 +2,7 @@ import { lazy, Suspense } from 'react'
import { Skeleton } from '@/components/ui/skeleton'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { RouteError } from '@/components/route-error'
import { useAllGames, useCountHistory, useDeletedGames } from '@/hooks/useGames'
import { useVisibleGames, useCountHistory, useDeletedGames } from '@/hooks/useGames'
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
import { useT } from '@/lib/i18n'
@@ -27,7 +27,7 @@ function ChartGridSkeleton({ count = 4 }: { count?: number }) {
export default function Charts() {
const t = useT()
useDocumentTitle(t('titles.charts'))
const games = useAllGames()
const games = useVisibleGames()
const deleted = useDeletedGames()
const history = useCountHistory()
+2 -2
View File
@@ -1,7 +1,7 @@
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Skeleton } from '@/components/ui/skeleton'
import { RouteError } from '@/components/route-error'
import { useAllGames, useDeletedGames } from '@/hooks/useGames'
import { useVisibleGames, useDeletedGames } from '@/hooks/useGames'
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
import { useT } from '@/lib/i18n'
import { computeOverview } from '@/lib/analytics'
@@ -10,7 +10,7 @@ import { formatNumber } from '@/lib/utils'
export default function Dashboard() {
const t = useT()
useDocumentTitle(t('titles.dashboard'))
const games = useAllGames()
const games = useVisibleGames()
const deleted = useDeletedGames()
if (games.isLoading) {
+22 -1
View File
@@ -10,6 +10,8 @@ import { ErrorPage } from '@/components/error-page'
import { RouteError } from '@/components/route-error'
import { GameThumb } from '@/components/game-thumb'
import { useGameBySlug } from '@/hooks/useGameBySlug'
import { enableNsfw, isNsfw } from '@/lib/nsfw'
import { usePrefs } from '@/stores/prefs'
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
import { useT } from '@/lib/i18n'
import type { Game } from '@/types/game'
@@ -212,5 +214,24 @@ export default function GameDetail() {
)
}
return <GameDetailView game={game} />
return <NsfwGate game={game} />
}
/** An 18+ game stays behind this notice until the visitor opts in. */
function NsfwGate({ game }: { game: Game }) {
const t = useT()
const showNsfw = usePrefs((s) => s.showNsfw)
if (!isNsfw(game) || showNsfw) return <GameDetailView game={game} />
return (
<div className="container mx-auto max-w-xl space-y-4 p-6">
<h1 className="text-2xl font-semibold">{t('nsfw.gate.title')}</h1>
<p className="text-muted-foreground">{t('nsfw.gate.desc')}</p>
<div className="flex flex-wrap gap-2">
<Button onClick={() => enableNsfw()}>{t('nsfw.gate.show')}</Button>
<Button variant="outline" asChild>
<Link to="/games">{t('detail.backToGames')}</Link>
</Button>
</div>
</div>
)
}
+2 -2
View File
@@ -16,7 +16,7 @@ import { MobileCardList } from '@/components/data-table/mobile-card-list'
import { gameColumns } from '@/components/data-table/columns'
import type { FacetOption } from '@/components/data-table/faceted-filter'
import { RouteError } from '@/components/route-error'
import { useAllGames } from '@/hooks/useGames'
import { useVisibleGames } from '@/hooks/useGames'
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
import { useT } from '@/lib/i18n'
import { countBy, countByArray } from '@/lib/analytics'
@@ -37,7 +37,7 @@ function gameSearch(g: Game, q: string): boolean {
export default function Games() {
const t = useT()
useDocumentTitle(t('titles.games'))
const games = useAllGames()
const games = useVisibleGames()
const [globalFilter, setGlobalFilter] = useState('')
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([])
const [sorting, setSorting] = useState<SortingState>([{ id: 'name', desc: false }])
+20
View File
@@ -13,6 +13,7 @@ import {
import { NOTIFICATION_DURATION_OPTIONS, usePrefs } from '@/stores/prefs'
import { useThemeStore, type Theme } from '@/stores/theme'
import { useDocumentTitle } from '@/hooks/useDocumentTitle'
import { enableNsfw } from '@/lib/nsfw'
import { switchLanguage, useT, type MessageKey } from '@/lib/i18n'
import { cn } from '@/lib/utils'
@@ -106,6 +107,25 @@ export default function Settings() {
</CardContent>
</Card>
<Card className="mt-6">
<CardHeader>
<CardTitle className="text-base">{t('settings.content.title')}</CardTitle>
</CardHeader>
<CardContent>
<div className="flex items-center justify-between gap-3">
<div className="space-y-0.5">
<Label htmlFor="show-nsfw">{t('settings.content.nsfw')}</Label>
<p className="text-xs text-muted-foreground">{t('settings.content.nsfwDesc')}</p>
</div>
<Switch
id="show-nsfw"
checked={prefs.showNsfw}
onCheckedChange={(on) => (on ? enableNsfw() : prefs.setShowNsfw(false))}
/>
</div>
</CardContent>
</Card>
<Card className="mt-6">
<CardHeader>
<CardTitle className="text-base">{t('settings.notif.title')}</CardTitle>
+6 -1
View File
@@ -11,7 +11,7 @@ export const NOTIFICATION_DURATION_OPTIONS = [2_000, 4_000, 6_000, 10_000] as co
* policy in docs/) to re-prompt every user once. Kept in sync with the
* "Updated …" date in `about.legal.desc`. Stored value !== this → gate shows.
*/
export const LEGAL_VERSION = '2026-06-14'
export const LEGAL_VERSION = '2026-09-18'
interface PrefsStore {
sidebarCollapsed: boolean
@@ -20,6 +20,8 @@ interface PrefsStore {
notificationsEnabled: boolean
notificationDurationMs: number
acceptedLegalVersion: string | null
/** 18+ games are hidden unless the visitor opted in (after confirming their age). */
showNsfw: boolean
toggleSidebar: () => void
setSidebarCollapsed: (v: boolean) => void
setDensity: (d: Density) => void
@@ -27,6 +29,7 @@ interface PrefsStore {
setNotificationsEnabled: (v: boolean) => void
setNotificationDurationMs: (v: number) => void
acceptLegal: () => void
setShowNsfw: (v: boolean) => void
}
export const usePrefs = create<PrefsStore>()(
@@ -38,6 +41,7 @@ export const usePrefs = create<PrefsStore>()(
notificationsEnabled: true,
notificationDurationMs: 4_000,
acceptedLegalVersion: null,
showNsfw: false,
toggleSidebar: () => set((s) => ({ sidebarCollapsed: !s.sidebarCollapsed })),
setSidebarCollapsed: (v) => set({ sidebarCollapsed: v }),
setDensity: (d) => set({ density: d }),
@@ -45,6 +49,7 @@ export const usePrefs = create<PrefsStore>()(
setNotificationsEnabled: (v) => set({ notificationsEnabled: v }),
setNotificationDurationMs: (v) => set({ notificationDurationMs: v }),
acceptLegal: () => set({ acceptedLegalVersion: LEGAL_VERSION }),
setShowNsfw: (v) => set({ showNsfw: v }),
}),
{ name: 'webapp.prefs' },
),
+1 -1
View File
@@ -31,7 +31,7 @@ interface GameLike {
}
const SITE = 'https://freeitchgames.win'
const STATIC_PAGES = ['/', '/games', '/charts', '/deleted', '/about']
const STATIC_PAGES = ['/', '/games', '/charts', '/removed', '/about', '/suggest']
// Keep in sync with slugify() in src/lib/utils.ts.
function slugify(url: string): string {
+9
View File
@@ -64,3 +64,12 @@ describe('handleMiss', () => {
expect((await miss('/games', { method: 'POST' })).status).toBe(405)
})
})
describe('renamed routes', () => {
it('permanently redirects /deleted to /removed', async () => {
const res = await miss('/deleted?x=1')
expect(res.status).toBe(301)
expect(res.headers.get('location')).toBe(`${ORIGIN}/removed?x=1`)
expect((await miss('/removed')).status).toBe(200)
})
})
+5 -1
View File
@@ -13,7 +13,9 @@ import { catalogUrls, type DataSource } from './data'
import { json } from './http'
// Keep in sync with the <Routes> in src/App.tsx.
const ROUTES = new Set(['/', '/games', '/charts', '/deleted', '/settings', '/about', '/suggest'])
const ROUTES = new Set(['/', '/games', '/charts', '/removed', '/settings', '/about', '/suggest'])
// Renamed routes: permanent redirects (the SPA would also redirect, but crawlers get a 301).
const MOVED: Record<string, string> = { '/deleted': '/removed' }
const GAME_ROUTE = /^\/games\/([a-z0-9-]+)$/
const ERROR_PREVIEW_ROUTE = /^\/errors\/[a-z0-9-]+$/
@@ -61,6 +63,8 @@ export async function handleMiss(request: Request, url: URL, assets: Fetcher): P
const cors = url.pathname.startsWith('/data/') ? { 'Access-Control-Allow-Origin': '*' } : undefined
return json({ error: 'not_found' }, 404, cors)
}
const moved = MOVED[url.pathname.replace(/\/+$/, '')]
if (moved) return Response.redirect(new URL(moved + url.search, url).toString(), 301)
// "/" rather than "/index.html": auto-trailing-slash would redirect the latter.
const shell = await assets.fetch(new Request(new URL('/', url), request))
if (shell.status !== 200 || (await isAppRoute(url.pathname, { assets, origin: url.origin }))) {