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

View File

@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest'; 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', () => { describe('java username', () => {
test('is valid', async () => { 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 // every username can be converted to an uuid so every user id automatically valid
test('is 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 // 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(''); const data = createHash('md5').update(`OfflinePlayer:${username}`).digest('binary').split('');
data[6] = String.fromCharCode((data[6].charCodeAt(0) & 0x0f) | 0x30); data[6] = String.fromCharCode((data[6].charCodeAt(0) & 0x0f) | 0x30);
data[8] = String.fromCharCode((data[8].charCodeAt(0) & 0x3f) | 0x80); 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"> <Select id="edition" bind:value={user.playertype} disabled={!user.edit} size="sm">
<option value="java">Java Edition</option> <option value="java">Java Edition</option>
<option value="bedrock">Bedrock Edition</option> <option value="bedrock">Bedrock Edition</option>
<option value="noauth">Java noauth</option> <option value="cracked">Java cracked</option>
</Select> </Select>
</td> </td>
<td> <td>

View File

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

View File

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

View File

@ -2,22 +2,12 @@
import { env } from '$env/dynamic/public'; import { env } from '$env/dynamic/public';
</script> </script>
<div class="fixed top-0 left-0 h-full w-full bg-[#050505]" />
<img <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" src="{env.PUBLIC_BASE_PATH}/img/register-background.webp"
alt="" 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"> <div class="flex justify-center w-full">
<slot /> <slot />
</div> </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--> <!--the tooltip when not all fields are correctly filled won't completely show if the overflow is hidden-->
<div <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} class:overflow-hidden={registered}
> >
{#if !registered} {#if !registered}

View File

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

View File

@ -122,7 +122,22 @@
> >
<option value="java">Java Edition</option> <option value="java">Java Edition</option>
<option value="bedrock">Bedrock Edition</option> <option value="bedrock">Bedrock Edition</option>
<option value="cracked">Java cracked</option>
</Select> </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>
<div class="divider" /> <div class="divider" />
<div class="mx-2 grid gap-y-3 mb-6"> <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 }); if (data.reporter == null || data.reason == null) return new Response(null, { status: 400 });
const reporter = await User.findOne({ where: { uuid: data.reporter } }); const reporter = await User.findOne({ where: { uuid: data.reporter } });
const reported = data.reported const reported = data.reported ? await User.findOne({ where: { uuid: data.reported } }) : undefined;
? await User.findOne({ where: { uuid: data.reported } })
: undefined;
if (reporter == null || reported === null) return new Response(null, { status: 400 }); if (reporter == null || reported === null) return new Response(null, { status: 400 });