Compare commits

..

No commits in common. "9e812fdef2685c034478798fdcd3c500d4614f27" and "c7a17d44816a576d5308f694706eced609d5382d" have entirely different histories.

11 changed files with 33 additions and 30 deletions

View File

@ -27,8 +27,8 @@ export class User extends Model {
declare telephone: string;
@Column({ type: DataTypes.STRING, allowNull: false })
declare username: string;
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), allowNull: false })
declare playertype: 'java' | 'bedrock' | 'noauth';
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'cracked'), allowNull: false })
declare playertype: 'java' | 'bedrock' | 'cracked';
@Column({ type: DataTypes.STRING })
declare password: string;
@Column({ type: DataTypes.UUIDV4 })
@ -47,7 +47,7 @@ export class Report extends Model {
declare body: string;
@Column({ type: DataTypes.BOOLEAN, allowNull: false })
declare draft: boolean;
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), allowNull: false })
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'cracked'), allowNull: false })
declare status: 'none' | 'review' | 'reviewed';
@Column({ type: DataTypes.STRING })
declare notice: string;

View File

@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest';
import { getBedrockUuid, getJavaUuid, getNoAuthUuid } from '$lib/server/minecraft';
import { getBedrockUuid, getCrackedUuid, getJavaUuid } from '$lib/server/minecraft';
describe('java username', () => {
test('is valid', async () => {
@ -19,9 +19,9 @@ describe('bedrock username', () => {
});
});
describe('noauth username', () => {
describe('cracked username', () => {
// every username can be converted to an uuid so every user id automatically valid
test('is valid', () => {
expect(getNoAuthUuid('bytedream')).toBe('88de3863-bf47-30f9-a7f4-ab6134feb49a');
expect(getCrackedUuid('bytedream')).toBe('88de3863-bf47-30f9-a7f4-ab6134feb49a');
});
});

View File

@ -68,7 +68,7 @@ export async function getBedrockUuid(username: string): Promise<string> {
}
// https://gist.github.com/yushijinhun/69f68397c5bb5bee76e80d192295f6e0
export function getNoAuthUuid(username: string): string {
export function getCrackedUuid(username: string): string {
const data = createHash('md5').update(`OfflinePlayer:${username}`).digest('binary').split('');
data[6] = String.fromCharCode((data[6].charCodeAt(0) & 0x0f) | 0x30);
data[8] = String.fromCharCode((data[8].charCodeAt(0) & 0x3f) | 0x80);

View File

@ -147,7 +147,7 @@
<Select id="edition" bind:value={user.playertype} disabled={!user.edit} size="sm">
<option value="java">Java Edition</option>
<option value="bedrock">Bedrock Edition</option>
<option value="noauth">Java noauth</option>
<option value="cracked">Java cracked</option>
</Select>
</td>
<td>

View File

@ -16,7 +16,7 @@ export const POST = (async ({ request, cookies }) => {
from: number | null;
name: string | null;
playertype: 'java' | 'bedrock' | 'noauth' | null;
playertype: 'java' | 'bedrock' | 'cracked' | null;
search: string | null;
slim: boolean | null;

View File

@ -19,7 +19,7 @@
<option value={null}>Alle</option>
<option value="java">Java</option>
<option value="beckdrock">Bedrock</option>
<option value="noauth">Noauth</option>
<option value="cracked">Cracked</option>
</Select>
</div>
</form>

View File

@ -2,22 +2,12 @@
import { env } from '$env/dynamic/public';
</script>
<div class="fixed top-0 left-0 h-full w-full bg-[#050505]" />
<img
class="bg-snipped bg-black fixed top-0 left-0 h-full w-full object-cover pointer-events-none blur-[2px]"
class="fixed top-0 left-0 h-full w-full object-cover pointer-events-none blur-[2px]"
src="{env.PUBLIC_BASE_PATH}/img/register-background.webp"
alt=""
/>
<div class="fixed top-0 left-0 h-full w-full bg-[radial-gradient(rgba(0,0,0,0),rgba(0,0,0,.4))]" />
<div class="flex justify-center w-full">
<slot />
</div>
<style>
.bg-snipped {
/* prettier-ignore */
clip-path: polygon(
0 20%, 100% -35%, 100% -5%, 0 50%,
0 110%, 100% 50%, 100% 80%, 0 140%
);
}
</style>

View File

@ -12,7 +12,7 @@
<!--the tooltip when not all fields are correctly filled won't completely show if the overflow is hidden-->
<div
class="grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 my-12 bg-base-100 shadow-[0_0_10px_10px_rgba(0,0,0,0.7)]"
class="grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 my-12 bg-base-100 shadow-lg"
class:overflow-hidden={registered}
>
{#if !registered}

View File

@ -1,7 +1,7 @@
import {
getBedrockUuid,
getCrackedUuid,
getJavaUuid,
getNoAuthUuid,
UserNotFoundError
} from '$lib/server/minecraft';
import { error, type RequestHandler } from '@sveltejs/kit';
@ -12,7 +12,7 @@ export const POST = (async ({ request }) => {
let uuid: string;
try {
// available playertypes are 'java', 'bedrock' and 'noauth'
// available playertypes are 'java', 'bedrock' and 'cracked'
switch (data.get('playertype')) {
case 'java':
uuid = await getJavaUuid(data.get('username') as string);
@ -20,8 +20,8 @@ export const POST = (async ({ request }) => {
case 'bedrock':
uuid = await getBedrockUuid(data.get('username') as string);
break;
case 'noauth':
uuid = getNoAuthUuid(data.get('username') as string);
case 'cracked':
uuid = getCrackedUuid(data.get('username') as string);
break;
default:
throw new Error(`invalid player type (${data.get('playertype')})`);

View File

@ -122,7 +122,22 @@
>
<option value="java">Java Edition</option>
<option value="bedrock">Bedrock Edition</option>
<option value="cracked">Java cracked</option>
</Select>
{#if playertype === 'cracked'}
<div class="sm:col-span-2">
<Input id="password" name="password" type="password" required={true}>
<span slot="label">Passwort</span>
<span slot="notice">
Da Du cracked spielst, musst Du ein Passwort festlegen, mit welchem Du Dich auf dem
Server authentifizierst! Das Passwort wird im Klartext gespeichert und ist in deinen
Clientlogs sowie in Serverlogs für Admins sichtbar. Verwende daher ein neues Passwort,
welches Du nirgends sonst verwendest! Merke Dir das Passwort gut, ohne kannst Du Dich
nicht auf dem Server einloggen
</span>
</Input>
</div>
{/if}
</div>
<div class="divider" />
<div class="mx-2 grid gap-y-3 mb-6">

View File

@ -13,9 +13,7 @@ export const POST = (async ({ request, url }) => {
if (data.reporter == null || data.reason == null) return new Response(null, { status: 400 });
const reporter = await User.findOne({ where: { uuid: data.reporter } });
const reported = data.reported
? await User.findOne({ where: { uuid: data.reported } })
: undefined;
const reported = data.reported ? await User.findOne({ where: { uuid: data.reported } }) : undefined;
if (reporter == null || reported === null) return new Response(null, { status: 400 });