feat: implement root domain handling for nobat724.com to prevent city filtering

This commit is contained in:
hamed
2026-07-02 21:53:45 +03:30
parent e6b55c6bad
commit 79f7df2e4d
9 changed files with 196 additions and 24 deletions
+4 -1
View File
@@ -4,6 +4,9 @@ import { headers } from "next/headers";
import citiesData from "@/data/city.json";
import statesData from "@/data/state.json";
import { ROOT_CITY_ID, isRootCity } from "@/lib/rootCity";
export { ROOT_CITY_ID, isRootCity };
export async function getStateInfo() {
const headersList = await headers();
@@ -20,5 +23,5 @@ export async function getStateInfo() {
matchedCity &&
statesData.find((state) => state.id === matchedCity.province_id);
return { matchedCity, matchedState };
return { matchedCity, matchedState, isRoot: isRootCity(matchedCity) };
}
+5
View File
@@ -0,0 +1,5 @@
// رکورد nobat724.com در city.json دامنهٔ ریشه/مخزنِ همهٔ شهرهاست، نه یک شهر.
// این ماژول pure است (بدون next/headers) تا در client و server هر دو قابل import باشد.
export const ROOT_CITY_ID = 600;
export const isRootCity = (c) => c != null && Number(c.id) === ROOT_CITY_ID;