feat: rename ktchi to kamai and btchi to boku

This commit is contained in:
zkldi
2024-04-05 16:39:35 +01:00
parent e8c2b8c465
commit 821cc343a8
19 changed files with 64 additions and 55 deletions
+4 -4
View File
@@ -19,12 +19,12 @@ if (BotConfig.DISCORD.APPROVED_ROLE) {
SLASH_COMMANDS.set("letmein", letmein);
}
// ktchi or omni specific commands
if (ServerConfig.type !== "btchi") {
// kamaitachi or omni specific commands
if (ServerConfig.type !== "boku") {
SLASH_COMMANDS.set("sync", sync);
}
// btchi or omni specific commands
if (ServerConfig.type !== "ktchi") {
// bokutachi or omni specific commands
if (ServerConfig.type !== "kamai") {
SLASH_COMMANDS.set("invite", invite);
}
+6 -6
View File
@@ -108,7 +108,7 @@ Since I don't play a lot of the the games that ${ServerConfig.name} supports, we
};
// Server specific FAQ stuff.
const KTCHI_FAQ_ENTRIES: Record<string, string> = {
const KAMAI_FAQ_ENTRIES: Record<string, string> = {
kai_support: `Support for KAI based networks (FLO, EAG, MIN) is available, but we are waiting on APIs for more games on their end. At the moment, only IIDX and SDVX are supported.`,
bokutachi: `Bokutachi is our public sister website for home games and simulators. Feel free to check out [the discord](${
Buffer.from("aHR0cHM6Ly9kaXNjb3JkLmdnL3N3VkJUanhtUFk=", "base64") // Note: obfuscating this for obvious reasons so we don't get garbage bot spam.
@@ -118,7 +118,7 @@ const KTCHI_FAQ_ENTRIES: Record<string, string> = {
Your friend can then go to ${BotConfig.TACHI_SERVER_LOCATION} and sign up with the code! You can also invite them to the discord.`,
};
const BTCHI_FAQ_ENTRIES: Record<string, string> = {
const BOKU_FAQ_ENTRIES: Record<string, string> = {
usc_hard_mode: `Hard Mode windows are not supported on ${ServerConfig.name}. Your scores **will be ignored** if they are played on non-standard windows.`,
ir_login: `You **must** put your API Key in the password field for the Bokutachi IR, **NOT your real password!**. See instructions here: ${BotConfig.TACHI_SERVER_LOCATION}/import/beatoraja-ir.
(This is because putting your real password in there is a security nightmare.)`,
@@ -129,12 +129,12 @@ Beatoraja is actively developed and integrates properly with the Bokutachi IR, i
let faqEntries = NEUTRAL_FAQ_ENTRIES;
if (ServerConfig.type !== "btchi") {
faqEntries = deepmerge(faqEntries, KTCHI_FAQ_ENTRIES);
if (ServerConfig.type !== "boku") {
faqEntries = deepmerge(faqEntries, KAMAI_FAQ_ENTRIES);
}
if (ServerConfig.type !== "ktchi") {
faqEntries = deepmerge(faqEntries, BTCHI_FAQ_ENTRIES);
if (ServerConfig.type !== "kamai") {
faqEntries = deepmerge(faqEntries, BOKU_FAQ_ENTRIES);
}
const choiceMap = new Map(Object.entries(faqEntries));
+6 -2
View File
@@ -6,7 +6,7 @@ import type { ImportDocument, UserDocument, integer } from "tachi-common";
export function CreateEmbed(userID?: integer) {
const embed = new MessageEmbed()
.setColor(ServerConfig.type === "ktchi" ? "#e61c6e" : "#527acc")
.setColor(ServerConfig.type === "kamai" ? "#e61c6e" : "#527acc")
.setTimestamp();
if (userID !== undefined) {
@@ -24,7 +24,11 @@ export function CreateImportEmbed(importDoc: ImportDocument) {
"score"
)}!`
)
.addField("Created Sessions", importDoc.createdSessions.length.toString(), true)
.addField(
"Created Sessions",
importDoc.createdSessions.length.toString(),
true
)
.addField("Errors", importDoc.errors.length.toString(), true)
.addField(
"Your Profile",
+5 -2
View File
@@ -16,7 +16,7 @@ export interface ServerConfig {
games: Array<Game>;
importTypes: Array<ImportTypes>;
name: string;
type: "btchi" | "ktchi" | "omni";
type: "boku" | "kamai" | "omni";
}
export interface ServerStatus {
@@ -50,7 +50,10 @@ export interface UGPTStats<GPT extends GPTString = GPTString> {
firstScore: ScoreDocument;
mostRecentScore: ScoreDocument;
totalScores: integer;
rankingData: Record<ProfileRatingAlgorithms[GPT], { ranking: integer; outOf: integer }>;
rankingData: Record<
ProfileRatingAlgorithms[GPT],
{ ranking: integer; outOf: integer }
>;
}
export interface ChartQueryReturns {
+2 -2
View File
@@ -40,7 +40,7 @@ VITE_MANDATE_LOGIN=true
# What git repo to read from by default in the seeds viewer.
VITE_GIT_REPO=""
# What client mode to use. Should be btchi, ktchi or omni.
# This affects some things, like what buttons should appear in certain places.
# What client mode to use. Should be boku, kamai or omni.
# This affects some things, like what buttons should appear in certain places and what colours the site should be.
VITE_TCHIC_MODE="omni"
```
@@ -217,9 +217,7 @@ function ImportInfoDisplayer({ game }: { game: Game }) {
href="chunithm-myt-exporter"
desc="Export your scores from MYT."
moreInfo={
<>
This is an userscript that exports scores from the MYT web interface.
</>
<>This is an userscript that exports scores from the MYT web interface.</>
}
key="MYT Exporter"
/>,
@@ -11,7 +11,7 @@ import Loading from "components/util/Loading";
import Muted from "components/util/Muted";
import useApiQuery from "components/util/query/useApiQuery";
import SelectLinkButton from "components/util/SelectLinkButton";
import { mode, TachiConfig } from "lib/config";
import { TachiConfig } from "lib/config";
import React, { useEffect, useReducer, useState } from "react";
import { Alert, Button, Col, Form, Modal, Row } from "react-bootstrap";
import { Link, Route, Switch } from "react-router-dom";
@@ -42,7 +42,7 @@ export default function UserIntegrationsPage({ reqUser }: { reqUser: UserDocumen
<Row>
<Col xs={12}>
<div className="btn-group d-flex justify-content-center">
{mode !== "btchi" && (
{TachiConfig.type !== "boku" && (
<SelectLinkButton className="text-wrap" to={`${baseUrl}/services`}>
<Icon type="network-wired" /> Service Configuration
</SelectLinkButton>
@@ -612,7 +612,7 @@ function EditClientModal({
}
function ServicesPage({ reqUser }: { reqUser: UserDocument }) {
if (mode === "btchi") {
if (TachiConfig.type === "boku") {
return (
<Row className="text-center">
Looks like there's no services available for integration.
+3 -3
View File
@@ -19,7 +19,7 @@ import WACCAMyPageScraperPage from "app/pages/dashboard/import/WACCAMyPageScrape
import KAIIntegrationPage from "components/imports/KAIIntegrationPage";
import Divider from "components/util/Divider";
import { UserContext } from "context/UserContext";
import { mode } from "lib/config";
import { TachiConfig } from "lib/config";
import React, { useContext } from "react";
import { Link, Redirect, Route, Switch } from "react-router-dom";
import CGIntegrationPage from "components/imports/CGIntegrationPage";
@@ -53,7 +53,7 @@ export default function ImportRoutes() {
<BatchManualPage />
</Route>
{mode !== "ktchi" && (
{TachiConfig.type !== "kamai" && (
<>
<Route exact path="/import/lr2oraja-ir">
<BeatorajaIRPage game="bms" />
@@ -82,7 +82,7 @@ export default function ImportRoutes() {
</>
)}
{mode !== "btchi" && (
{TachiConfig.type !== "boku" && (
<>
<Route exact path="/import/iidx-eam-csv">
<IIDXEamCSVPage
+6 -6
View File
@@ -3,7 +3,7 @@ import { Game, ImportTypes } from "tachi-common";
// @ts-expect-error No types available...
import syncFetch from "sync-fetch";
export const mode = process.env.VITE_TCHIC_MODE;
const mode = process.env.VITE_TCHIC_MODE;
if (!mode) {
throw new Error("No VITE_TCHIC_MODE set in Process Environment, refusing to boot.");
@@ -11,7 +11,7 @@ if (!mode) {
export interface TachiConfig {
name: string;
type: "ktchi" | "btchi" | "omni";
type: "kamai" | "boku" | "omni";
games: Game[];
importTypes: ImportTypes[];
}
@@ -79,18 +79,18 @@ const colourConf = {
primary: "#000",
};
if (mode === "ktchi") {
if (mode === "kamai") {
colourConf.primary = "#e61c6e";
} else if (mode === "btchi") {
} else if (mode === "boku") {
colourConf.primary = "#4974a5";
} else if (mode === "omni") {
colourConf.primary = "#e61c6e";
} else {
throw new Error("Invalid VITE_TCHIC_MODE. Expected ktchi, btchi or omni.");
throw new Error("Invalid VITE_TCHIC_MODE. Expected kamai, boku or omni.");
}
export const TachiConfig = conf;
export const ColourConfig = colourConf;
export const ClientConfig = {
MANDATE_LOGIN: process.env.VITE_TCHIC_MODE === "ktchi" || process.env.VITE_MANDATE_LOGIN,
MANDATE_LOGIN: process.env.VITE_MANDATE_LOGIN,
};
+4 -2
View File
@@ -1,4 +1,4 @@
import { mode } from "lib/config";
import { TachiConfig } from "lib/config";
import { Days, Months } from "./misc";
import { FormatDate } from "./time";
@@ -134,7 +134,9 @@ export const contentiousSplashes = [
"Formerly Chucks",
"Node.js Is Bad Ass Rock Star Tech",
"i'm obligated to ask for you to seek immediate psychological attention",
`Is ${mode === "ktchi" ? "IIDX" : "BMS"} still a good game or are you all basically stupid?`,
`Is ${
TachiConfig.type === "kamai" ? "IIDX" : "BMS"
} still a good game or are you all basically stupid?`,
"Please do not reply to or quote my posts in the future.",
"Is this your IP? (178.62.116.150)",
"Bad faith just coincidentally happens to be something my enemies do...",
+1 -1
View File
@@ -66,7 +66,7 @@ root.setAttribute("data-bs-theme", theme);
preprocessorOptions: {
scss: {
additionalData: [
process.env.VITE_TCHIC_MODE === "btchi"
process.env.VITE_TCHIC_MODE === "boku"
? "$primary: #527acc;"
: "$primary: #e61c6e;",
],
+2 -2
View File
@@ -296,7 +296,7 @@ Configures what the Tachi Server instance supports, and what it's generally doin
```ts
interface TACHI_CONFIG: {
NAME: string;
TYPE: "ktchi" | "btchi" | "omni";
TYPE: "kamai" | "boku" | "omni";
GAMES: Game[];
IMPORT_TYPES: ImportTypes[];
}
@@ -308,7 +308,7 @@ The name of the server. This is reported at `/api/v1/status`.
#### TYPE
What type of tachi-server this is. `ktchi` will enable Kamaitachi Only routes, `btchi` will enable
What type of tachi-server this is. `kamai` will enable Kamaitachi Only routes, `boku` will enable
Bokutachi only routes, and `omni` will enable both.
#### GAMES
@@ -18,7 +18,7 @@ type DefaultClients = Array<Omit<TachiAPIClientDocument, "author" | "clientSecre
// environment.
// These use the special Client ID prefix "CX" instead of "CI", which
// means they cannot possibly be collided.1
const KtchiDefaultClients: DefaultClients = [
const KamaiDefaultClients: DefaultClients = [
{
name: "Fervidex",
webhookUri: null,
@@ -225,7 +225,7 @@ api_key = '%%TACHI_KEY%%'`,
},
];
const BtchiDefaultClients: DefaultClients = [
const BokuDefaultClients: DefaultClients = [
{
name: "Beatoraja IR",
webhookUri: null,
@@ -277,13 +277,13 @@ const BtchiDefaultClients: DefaultClients = [
];
export async function LoadDefaultClients() {
if (TachiConfig.TYPE === "ktchi") {
await LoadClients(KtchiDefaultClients);
} else if (TachiConfig.TYPE === "btchi") {
await LoadClients(BtchiDefaultClients);
if (TachiConfig.TYPE === "kamai") {
await LoadClients(KamaiDefaultClients);
} else if (TachiConfig.TYPE === "boku") {
await LoadClients(BokuDefaultClients);
} else {
await LoadClients(KtchiDefaultClients);
await LoadClients(BtchiDefaultClients);
await LoadClients(KamaiDefaultClients);
await LoadClients(BokuDefaultClients);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Note that Version Info is intentionally identical between all variants of tachi
// viz. btchi and ktchi share versioning. This is because they
// viz. boku and kamai share versioning. This is because they
// essentially share codebases.
import CreateLogCtx from "lib/logger/logger";
import { Environment } from "lib/setup/config";
@@ -33,7 +33,7 @@ const jobs: Array<Job> = [
];
// if kamaitachi or omnitachi
if (TachiConfig.TYPE !== "btchi") {
if (TachiConfig.TYPE !== "boku") {
jobs.push({
name: "Update BPI",
cronFormat: "2 0 * * *",
@@ -48,7 +48,7 @@ if (TachiConfig.TYPE !== "btchi") {
}
// if bokutachi or omnitachi
if (TachiConfig.TYPE !== "ktchi") {
if (TachiConfig.TYPE !== "kamai") {
jobs.push({
name: "Update AI Table",
cronFormat: "2 0 * * *",
+2 -2
View File
@@ -55,7 +55,7 @@ const REGISTERED_MIGRATIONS: Array<Migration> =
// only apply type-specific migrations if we're not in testing
if (Environment.nodeEnv !== "test") {
// kamaitachi specific migrations
if (TachiConfig.TYPE !== "btchi") {
if (TachiConfig.TYPE !== "boku") {
REGISTERED_MIGRATIONS.push(
RemoveIIDXBeginners,
UpdateJubeatPreferredTables,
@@ -69,7 +69,7 @@ if (Environment.nodeEnv !== "test") {
}
// bokutachi specific migrations
if (TachiConfig.TYPE !== "ktchi") {
if (TachiConfig.TYPE !== "kamai") {
REGISTERED_MIGRATIONS.push(NullLR2HookFailedBPs, FixUndefinedBMSData, RemoveRandom);
}
}
+5 -3
View File
@@ -25,7 +25,9 @@ let confFile;
try {
confFile = fs.readFileSync(confLocation, "utf-8");
} catch (err) {
logger.error("Error while trying to open conf.json5. Is one present?", { err });
logger.error("Error while trying to open conf.json5. Is one present?", {
err,
});
process.exit(1);
}
@@ -112,7 +114,7 @@ export interface TachiServerConfig {
};
TACHI_CONFIG: {
NAME: string;
TYPE: "btchi" | "ktchi" | "omni";
TYPE: "boku" | "kamai" | "omni";
GAMES: Array<Game>;
IMPORT_TYPES: Array<ImportTypes>;
};
@@ -214,7 +216,7 @@ const err = p(config, {
}),
TACHI_CONFIG: {
NAME: "string",
TYPE: p.isIn("ktchi", "btchi", "omni"),
TYPE: p.isIn("kamai", "boku", "omni"),
GAMES: [p.isIn(allSupportedGames)],
IMPORT_TYPES: [p.isIn(allImportTypes)],
},
+1 -1
View File
@@ -276,7 +276,7 @@ const syncInstructions: Array<SyncInstructions> = [
collection: ICollection<BMSCourseDocument>,
logger
) => {
if (TachiConfig.TYPE === "ktchi") {
if (TachiConfig.TYPE === "kamai") {
return;
}
+2 -2
View File
@@ -7,7 +7,7 @@ import type { RequestHandler } from "express-serve-static-core";
* this restriction is bypassed.
*/
export const RequireBokutachi: RequestHandler = (req, res, next) => {
if (TachiConfig.TYPE === "btchi" || TachiConfig.TYPE === "omni") {
if (TachiConfig.TYPE === "boku" || TachiConfig.TYPE === "omni") {
next();
return;
}
@@ -24,7 +24,7 @@ export const RequireBokutachi: RequestHandler = (req, res, next) => {
* this restriction is bypassed.
*/
export const RequireKamaitachi: RequestHandler = (req, res, next) => {
if (TachiConfig.TYPE === "ktchi" || TachiConfig.TYPE === "omni") {
if (TachiConfig.TYPE === "kamai" || TachiConfig.TYPE === "omni") {
next();
return;
}