Implement banlist

This commit is contained in:
ItsCharaHere
2025-01-20 15:10:15 -08:00
parent 8a4b710eeb
commit 43fc3bfbf5
3 changed files with 48 additions and 3 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ app.post('/MatchingServer/:api', async (req, res) => {
service: 'Yukiotoko Matching',
message: `BeginMatching`,
})
return res.json(await beginMatching(body))
return res.json(await beginMatching(body, req.ip))
} else
if (mEndMatchingApi.includes(api)){
log.info({
@@ -14,7 +14,45 @@ export const pingMatching = () => {
return { returnCode: 1 }
}
export const beginMatching = async body => {
export const beginMatching = async (body, ip) => {
//Check if user is banned
const banList = await db.chusanGameBanlist.findMany()
var banResult: any
banList.forEach(banEntry =>{
switch (banEntry.type){
//Keychip Ban
case 1: {
if (body.matchingMemberInfo.clientId == banEntry.value) {
banResult = {
message: "Cabinet Is Banned."
}
return
}
}
//UserID + Name ban
case 2: {
if (body.matchingMemberInfo.userId == banEntry.value && convertIso88591ToUtf8(body.matchingMemberInfo.userName) == banEntry.value2) {
banResult = {
message: "User Is Banned."
}
return
}
}
//IP Ban
case 3: {
if (ip == banEntry.value) {
banResult = {
message: "User Is Banned."
}
return
}
}
default:
}
})
if (banResult != null){
return banResult
}
var matchingrooms = await db.chusanUserMatching.findMany()
matchingrooms.forEach(async (room) => {
var olddate = new Date(room.updatedAt)
+8 -1
View File
@@ -25,7 +25,14 @@ model ChusanUserMatching {
allowAnybody Boolean
updatedAt DateTime
mergedRoom Int?
}
model ChusanGameBanlist {
id String @id @default(cuid())
type Int
value String
value2 String?
note String?
}
model ChusanUserRooms {