diff --git a/src/api/GametoolsApi.tsx b/src/api/GametoolsApi.tsx index f38a480..d44ac7e 100644 --- a/src/api/GametoolsApi.tsx +++ b/src/api/GametoolsApi.tsx @@ -405,7 +405,7 @@ export class ApiProvider extends JsonClient { if (game == "bf1marne") { return await bf1MarneApi.serverList({ searchTerm, regions, limit }); } - return await this.getJsonMethod(`/${gameStuff[0]}/servers/`, { + const result = await this.getJsonMethod(`/${gameStuff[0]}/servers/`, { name: encodeURIComponent(serverName), experiencename: encodeURIComponent(experienceName), lang: lang, @@ -415,6 +415,11 @@ export class ApiProvider extends JsonClient { limit: limit, ...extraQueries, }); + // hard limit to 4 on main page + if (limit === "4") { + result.servers = result.servers.slice(0, 4); + } + return result; } async graphs({ diff --git a/src/api/static.tsx b/src/api/static.tsx index 7e4a4ff..bb77d40 100644 --- a/src/api/static.tsx +++ b/src/api/static.tsx @@ -17,6 +17,15 @@ export const supportedGames = [ "battlebit", ]; +export const projects = { + "bfvietnam.openspy": "http://openspy.net", + "bf2.bf2hub": "https://www.bf2hub.com/", + "bf2.playbf2": "https://playbf2.tilda.ws/en", + "bf2142.openspy": "http://openspy.net", + "bf2142.play2142": "https://battlefield2142.co/", + bf1marne: "https://marne.io/", +}; + export const platformGames = { pc: ["bf3", "bf4", "bfh", "bf1", "bfv", "bf2042"], xboxone: ["bf4", "bfh", "bf1", "bfv", "bf2042"], diff --git a/src/components/routes/Servers/Search/Main.tsx b/src/components/routes/Servers/Search/Main.tsx index 44e0191..94c4e43 100644 --- a/src/components/routes/Servers/Search/Main.tsx +++ b/src/components/routes/Servers/Search/Main.tsx @@ -33,6 +33,7 @@ import { newGen, newTitles, oldJoinGames, + projects, supportedGames, } from "../../../../api/static"; import { Results } from "./Results"; @@ -1087,6 +1088,13 @@ export function ServerSearch(): React.ReactElement { {t("serverSearch.showMore")} + {Object.keys(projects).includes(gameName) && ( + + + {t("serverSearch.showProject")} + + + )} ); } diff --git a/src/locales/languages/en-US.json b/src/locales/languages/en-US.json index 8dd9b43..5c38d15 100644 --- a/src/locales/languages/en-US.json +++ b/src/locales/languages/en-US.json @@ -206,6 +206,7 @@ "playground": "Experience name" }, "showMore": "Show more", + "showProject": "Go to project", "region": "Region", "map": "Map", "platform": "platform",