Skip to content

Commit

Permalink
Add Saekawa hook as an import method for CHUNITHM (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-psi authored Nov 20, 2023
1 parent 94f4d30 commit 35974fc
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 9 deletions.
23 changes: 18 additions & 5 deletions client/src/app/pages/dashboard/import/ImportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,31 @@ function ImportInfoDisplayer({ game }: { game: Game }) {
} else if (game === "chunithm") {
Content.unshift(
<ImportInfoCard
name="Chunitachi"
href="chunitachi"
desc="Automatically import scores, whenever you get them!"
moreInfo="This is the recommended way to import CHUNITHM scores, as it provides high quality data in real-time."
key="Chunitachi"
name="Saekawa"
href="saekawa"
desc="Automatically import scores and dans!"
moreInfo="This is the recommended way to import CHUNITHM scores, data is submitted at the end of every credit."
key="Saekawa"
/>,
<ImportInfoCard
name="CHUNITHM Site Importer"
href="kt-chunithm-site-importer"
desc="Use your data from CHUNITHM NET."
moreInfo="If you are currently playing on CHUNITHM International, you can import play data from it here."
key="CHUNITHM Site Importer"
/>,
<ImportInfoCard
name="Chunitachi"
href="chunitachi"
desc="Automatically import scores, whenever you get them!"
moreInfo={
<>
This is the recommended way to import CHUNITHM scores, as it provides high
quality data in real-time. <br />
Note: Only for versions PARADISE and PARADISE LOST.
</>
}
key="Chunitachi"
/>
);
} else if (game === "bms") {
Expand Down
7 changes: 3 additions & 4 deletions client/src/app/pages/dashboard/import/MikadoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default function MikadoPage() {
<h1 className="text-center mb-4">What Is Mikado?</h1>
<div>
Mikado is a <code>.dll</code> file that hooks into SDVX and automatically sends
the scores to a server. {TachiConfig.name} is compatible with what Mikado sends,
so you can use it to submit scores!
scores to a server. {TachiConfig.name} is compatible with what Mikado sends, so you
can use it to submit scores!
</div>
<Divider />
<h1 className="text-center my-4">Setup Instructions</h1>
Expand All @@ -39,8 +39,7 @@ export default function MikadoPage() {
</li>
<ul className="instructions-list">
<li>
BemaniTools: Add <code>-K mikado.dll</code> to your <code>.bat</code>{" "}
file.
BemaniTools: Add <code>-K mikado.dll</code> to your <code>.bat</code> file.
</li>
<li>
SpiceTools: Add <code>-k mikado.dll</code> to your <code>.bat</code> file.
Expand Down
48 changes: 48 additions & 0 deletions client/src/app/pages/dashboard/import/SaekawaPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import useSetSubheader from "components/layout/header/useSetSubheader";
import Divider from "components/util/Divider";
import ExternalLink from "components/util/ExternalLink";
import { TachiConfig } from "lib/config";
import React from "react";
import Alert from "react-bootstrap/Alert";

export default function SaekawaPage() {
useSetSubheader(["Import Scores", "Saekawa"]);

return (
<div>
<h1 className="text-center mb-4">What is Saekawa?</h1>
<div>
Saekawa is a <code>.dll</code> file that hooks into CHUNITHM and automatically sends
scores to a server. {TachiConfig.name} is compatible with what Saekawa sends, so you
can use it to submit scores!
</div>
<Divider />
<h1 className="text-center my-4">Setup Instructions</h1>
<ol className="instructions-list">
<li>
Download the latest version of <code>saekawa.dll</code> from{" "}
<ExternalLink href="https://github.com/beerpiss/saekawa/releases/latest">
here
</ExternalLink>
.
</li>
<li>
Download your <code>saekawa.toml</code> config file{" "}
<ExternalLink href="/client-file-flow/CXSaekawa">here</ExternalLink>
. <br />
<Alert variant="warning" className="mt-2">
This file contains an API Key, which is meant to be kept secret!
</Alert>
</li>
<li>
Follow the remaining install instructions on{" "}
<ExternalLink href="https://github.com/beerpiss/saekawa/blob/trunk/README.md">
GitHub
</ExternalLink>
.
</li>
<li>Your scores and dans now automatically upload to {TachiConfig.name}!</li>
</ol>
</div>
);
}
5 changes: 5 additions & 0 deletions client/src/app/routes/ImportRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import CGIntegrationPage from "components/imports/CGIntegrationPage";
import ITGHookPage from "app/pages/dashboard/import/ITGHookPage";
import MaimaiDXSiteImportPage from "app/pages/dashboard/import/MaimaiDXSiteImportPage";
import ChunithmSiteImportPage from "app/pages/dashboard/import/ChunithmSiteImportPage";
import SaekawaPage from "app/pages/dashboard/import/SaekawaPage";

export default function ImportRoutes() {
const { user } = useContext(UserContext);
Expand Down Expand Up @@ -127,6 +128,10 @@ export default function ImportRoutes() {
<ChunithmSiteImportPage />
</Route>

<Route exact path="/import/saekawa">
<SaekawaPage />
</Route>

<Route exact path="/import/iidx-flo">
<KAIIntegrationPage
hash="6f64b82107cea90aa4c51a33705cd57c1883c8cdc22a634730ca461a431744b3"
Expand Down
62 changes: 62 additions & 0 deletions server/src/lib/builtin-clients/builtin-clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,68 @@ pbs = '/api/v1/users/{}/games/sdvx/Single/pbs/all'
api_key = '%%TACHI_KEY%%'
`,
},
{
clientID: "CXSaekawa",
requestedPermissions: ["submit_score"],
name: "Saekawa",
redirectUri: null,
webhookUri: null,
apiKeyFilename: "saekawa.toml",
apiKeyTemplate: `[general]
# Set to 'false' to disable the hook
enable = true
# Whether the hook should export your class medals and emblems or not.
export_class = true
# Whether the hook should export PBs. This should be used as a last resort, if
# you cannot import scores from your network, since this provides less data
# and sends only one pre-joined score per chart. Will only work once every session; you'll
# need to restart the game to do it again.
export_pbs = false
# Whether FAILED should override FULL COMBO and ALL JUSTICE.
fail_over_lamp = false
# Timeout for web requests, in milliseconds
timeout = 3000
[cards]
# **DOES NOT WORK FOR WHITELISTING PBS!!**
#
# Access codes that should be whitelisted
# If this is empty, all cards will be whitelisted
# There should be no whitespace between the digits
#
# example: whitelist = ["00001111222233334444"]
whitelist = []
[crypto]
# Since CRYSTAL+, the game employs network encryption. If you do not wish to
# patch out encryption from your game, you will need to fill in these values.
#
# All values are in hex strings.
key = ""
iv = ""
# Salt for deriving hashed API endpoint names. Not necessary on PARADISE LOST
# and older. For CHUNITHM NEW and later versions, this must be set if encryption
# is not patched out, otherwise the hook will be active but doing nothing, since
# it cannot recognize the score upload endpoint.
#
# This must also be a hex string.
salt = ""
# Number of PBKDF2 iterations to hash the endpoint URL. Set to 70 for CHUNITHM SUN
# and newer, and 44 for older versions.
iterations = 70
[tachi]
# Tachi instance base URL
base_url = '${ServerConfig.OUR_URL}'
# Tachi status endpoint
status = '/api/v1/status'
# Tachi score import endpoint
import = '/ir/direct-manual/import'
# Your Tachi API key
api_key = '%%TACHI_KEY%%'`,
},
];

const BtchiDefaultClients: DefaultClients = [
Expand Down

0 comments on commit 35974fc

Please sign in to comment.