mirror of
https://github.com/thepeacockproject/Peacock
synced 2024-11-22 22:12:45 +01:00
refactor: consistent naming for scpc
This commit is contained in:
parent
46e66c32c9
commit
d511e1e91b
@ -21,7 +21,7 @@ import { log, LogLevel } from "./loggingInterop"
|
||||
import { userAuths } from "./officialServerAuth"
|
||||
import {
|
||||
EPIC_NAMESPACE_2021,
|
||||
FRANKENSTEIN_SNIPER_ENTITLEMENTS,
|
||||
SCPC_ENTITLEMENTS,
|
||||
getEpicEntitlements,
|
||||
H2_STEAM_ENTITLEMENTS,
|
||||
STEAM_NAMESPACE_2016,
|
||||
@ -132,7 +132,7 @@ export class EpicH1Strategy extends EntitlementStrategy {
|
||||
*/
|
||||
export class SteamScpcStrategy extends EntitlementStrategy {
|
||||
override get() {
|
||||
return FRANKENSTEIN_SNIPER_ENTITLEMENTS
|
||||
return SCPC_ENTITLEMENTS
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,10 +160,8 @@ menuDataRouter.get("/Hub", (req: RequestWithJwt, res) => {
|
||||
if (req.gameVersion === "h3" || req.gameVersion === "h2") {
|
||||
template = null
|
||||
} else {
|
||||
template =
|
||||
req.gameVersion === "scpc"
|
||||
? getConfig("FrankensteinHubTemplate", false)
|
||||
: getConfig("LegacyHubTemplate", false)
|
||||
// scpc hub will need to be contributed by a plugin
|
||||
template = getVersionedConfig("HubTemplate", req.gameVersion, false)
|
||||
}
|
||||
|
||||
res.json({
|
||||
@ -381,10 +379,12 @@ menuDataRouter.get(
|
||||
|
||||
let template: unknown | null = null
|
||||
|
||||
if (req.gameVersion === "h1") {
|
||||
template = getConfig("LegacyPlanningTemplate", false)
|
||||
} else if (req.gameVersion === "scpc") {
|
||||
template = getConfig("FrankensteinPlanningTemplate", false)
|
||||
if (req.gameVersion === "h1" || req.gameVersion === "scpc") {
|
||||
template = getVersionedConfig(
|
||||
"PlanningTemplate",
|
||||
req.gameVersion,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
res.json({
|
||||
@ -647,10 +647,7 @@ const missionEndRequest = async (
|
||||
}
|
||||
|
||||
res.json({
|
||||
template:
|
||||
req.gameVersion === "scpc"
|
||||
? getConfig("FrankensteinScoreOverviewTemplate", false)
|
||||
: null,
|
||||
template: null,
|
||||
data: missionEndOutput,
|
||||
})
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ export const error406: unique symbol = Symbol("http406")
|
||||
export async function handleOAuthToken(
|
||||
req: RequestWithJwt<never, OAuthTokenBody>,
|
||||
): Promise<typeof error400 | typeof error406 | OAuthTokenResponse> {
|
||||
const isFrankenstein = req.body.gs === "scpc-prod"
|
||||
const isScpc = req.body.gs === "scpc-prod"
|
||||
|
||||
const signOptions = {
|
||||
notBefore: -60000,
|
||||
expiresIn: 6000,
|
||||
issuer: "auth.hitman.io",
|
||||
audience: isFrankenstein ? "scpc-prod" : "pc_prod_8",
|
||||
audience: isScpc ? "scpc-prod" : "pc_prod_8",
|
||||
noTimestamp: true,
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ export async function handleOAuthToken(
|
||||
// @ts-expect-error Non-optional, we're reassigning.
|
||||
delete req.jwt.aud // audience
|
||||
|
||||
if (!isFrankenstein) {
|
||||
if (!isScpc) {
|
||||
if (userAuths.has(req.jwt.unique_name)) {
|
||||
userAuths
|
||||
.get(req.jwt.unique_name)!
|
||||
@ -169,7 +169,7 @@ export async function handleOAuthToken(
|
||||
|
||||
let gameVersion: GameVersion = "h1"
|
||||
|
||||
if (isFrankenstein) {
|
||||
if (isScpc) {
|
||||
gameVersion = "scpc"
|
||||
} else if (isHitman3) {
|
||||
gameVersion = "h3"
|
||||
@ -221,7 +221,7 @@ export async function handleOAuthToken(
|
||||
/*
|
||||
Store user auth for all games except scpc
|
||||
*/
|
||||
if (!isFrankenstein) {
|
||||
if (!isScpc) {
|
||||
const authContainer = new OfficialServerAuth(
|
||||
gameVersion,
|
||||
req.body.access_token,
|
||||
@ -261,7 +261,7 @@ export async function handleOAuthToken(
|
||||
}
|
||||
|
||||
async function getEntitlements(): Promise<string[]> {
|
||||
if (isFrankenstein) {
|
||||
if (isScpc) {
|
||||
return new SteamScpcStrategy().get()
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ export const STEAM_NAMESPACE_2018 = "863550"
|
||||
export const EPIC_NAMESPACE_2021 = "ed55aa5edc5941de92fd7f64de415793"
|
||||
export const STEAM_NAMESPACE_2021 = "1659040"
|
||||
|
||||
export const FRANKENSTEIN_SNIPER_ENTITLEMENTS = [STEAM_NAMESPACE_2016, "783781"]
|
||||
export const SCPC_ENTITLEMENTS = [STEAM_NAMESPACE_2016, "783781"]
|
||||
|
||||
export function getPlatformEntitlements(
|
||||
req: RequestWithJwt,
|
||||
|
@ -664,13 +664,13 @@ export async function getMissionEndData(
|
||||
}
|
||||
|
||||
// Resolve all opportunities for the location
|
||||
const opportunities = contractData.Metadata.Opportunities
|
||||
const opportunityCount = opportunities ? opportunities.length : 0
|
||||
const opportunityCompleted = opportunities
|
||||
? opportunities.filter(
|
||||
(ms) => ms in userData.Extensions.opportunityprogression,
|
||||
).length
|
||||
: 0
|
||||
const opportunities: string[] | null | undefined =
|
||||
contractData.Metadata.Opportunities
|
||||
const opportunityCount = opportunities?.length ?? 0
|
||||
const opportunityCompleted =
|
||||
opportunities?.filter(
|
||||
(ms: string) => ms in userData.Extensions.opportunityprogression,
|
||||
).length ?? 0
|
||||
|
||||
// Resolve all challenges for the location
|
||||
const locationChallenges =
|
||||
|
Loading…
Reference in New Issue
Block a user