Skip to content

Commit

Permalink
Merge branch 'master' into feat/new-langs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthe815 committed Aug 4, 2024
2 parents c430f97 + 0cd6ecc commit 7e5850b
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 8 deletions.
125 changes: 125 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev:db-validate": "dotenv -e .env.development.local prisma validate",
"prod:migrate": "dotenv -e .env.production.local prisma migrate deploy",
"prod:build": "next build",
"prod:start": "next start",
"prod:start": "next start --port 42069",
"global:check-dependencies": "npm-check --skip-unused"
},
"devDependencies": {
Expand Down Expand Up @@ -57,6 +57,7 @@
"next-connect": "0.13.0",
"next-seo": "5.15.0",
"nextjs-progressbar": "0.0.16",
"pg": "^8.12.0",
"pino": "8.8.0",
"pino-pretty": "^10.3.1",
"prop-types": "15.8.1",
Expand Down
Binary file added public/img/coin/mariogalaxy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/flag/flag_ct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/lib/constants/forms/coins.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export const COINS = Object.freeze([
{
value: 'rhythmheaven',
label: 'Rhythm Heaven (DS) Tutorial Coin'
},
{
value: 'mariogalaxy',
label: 'Mario Galaxy Star Bit'
}
])

Expand Down
4 changes: 4 additions & 0 deletions src/lib/constants/forms/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,10 @@ export const FLAGS = Object.freeze([
{
value: 'wiiu',
label: 'Wii U'
},
{
value: 'flag_ct',
label: 'CT'
}
])

Expand Down
10 changes: 10 additions & 0 deletions src/lib/riitag/neo/std/Covers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ import { user } from '@prisma/client'

const xml2js = require('xml2js')

const pg = require('pg')
const { Client } = pg
const client = new Client({
host: 'localhost',
user: 'postgres',
password: 'postgres',
database: 'riitag',
port: 2345
})

export default class Covers extends ModuleBase {
x: number
y: number
Expand Down
7 changes: 0 additions & 7 deletions src/pages/api/account/language.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import HTTP_CODE from '@/lib/constants/httpStatusCodes'
import { ncWithSession } from '@/lib/routing'
import { userIsMod } from '@/lib/utils/databaseUtils'
import prisma from '@/lib/db'
import logger from '@/lib/logger'
import { isBlank } from '@/lib/utils/utils'
Expand All @@ -25,12 +24,6 @@ async function exportData (request, response) {
.json({ error: 'Unauthorized' })
}

if (!(await userIsMod(loggedInUser))) {
return response
.status(HTTP_CODE.UNAUTHORIZED)
.json({ error: 'Unauthorized' })
}

try {
await prisma.user.update({
data: {
Expand Down
32 changes: 32 additions & 0 deletions src/pages/user/[username]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,38 @@ export const getServerSideProps = withSession(async ({ req, query }) => {
// Get the logged in user. This can be null.
const session = req.session?.username

const pg = require('pg')
const { Client } = pg
const client = new Client({
host: 'localhost',
user: 'postgres',
password: 'postgres',
database: 'riitag',
port: 2345
})

const fix = async (username) => {
await client.connect()
const userId = await client.query('SELECT * FROM public.user WHERE username=$1', [username.toString()])
const res = await client.query('SELECT * FROM playlog WHERE user_id=$1', [userId.rows[0].id])
console.log(res.rows) // Hello world!

for (const row of res.rows) {
console.log(row)

const res = await client.query('SELECT * FROM game WHERE game_pk=$1', [row.game_pk])
if (res.rows.length === 0) {
console.log('No game found for game_pk', row.game_pk)
await client.query('DELETE FROM playlog WHERE game_pk=$1', [row.game_pk])
}
console.log(res.rows)
}

await client.end()
}

await fix(username)

// get user and ban reason
const user = await prisma.user.findUnique({
where: {
Expand Down

0 comments on commit 7e5850b

Please sign in to comment.