rename cracked to noauth and remove the possibility to self register as such
This commit is contained in:
parent
241d6c031e
commit
4a4135c31e
@ -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', 'cracked'), allowNull: false })
|
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), allowNull: false })
|
||||||
declare playertype: 'java' | 'bedrock' | 'cracked';
|
declare playertype: 'java' | 'bedrock' | 'noauth';
|
||||||
@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', 'cracked'), allowNull: false })
|
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), 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;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
import { getBedrockUuid, getCrackedUuid, getJavaUuid } from '$lib/server/minecraft';
|
import { getBedrockUuid, getJavaUuid, getNoAuthUuid } 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('cracked username', () => {
|
describe('noauth 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(getCrackedUuid('bytedream')).toBe('88de3863-bf47-30f9-a7f4-ab6134feb49a');
|
expect(getNoAuthUuid('bytedream')).toBe('88de3863-bf47-30f9-a7f4-ab6134feb49a');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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 getCrackedUuid(username: string): string {
|
export function getNoAuthUuid(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);
|
||||||
|
@ -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="cracked">Java cracked</option>
|
<option value="noauth">Java noauth</option>
|
||||||
</Select>
|
</Select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -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' | 'cracked' | null;
|
playertype: 'java' | 'bedrock' | 'noauth' | null;
|
||||||
|
|
||||||
search: string | null;
|
search: string | null;
|
||||||
slim: boolean | null;
|
slim: boolean | null;
|
||||||
|
@ -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="cracked">Cracked</option>
|
<option value="noauth">Noauth</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -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 'cracked'
|
// available playertypes are 'java', 'bedrock' and 'noauth'
|
||||||
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 'cracked':
|
case 'noauth':
|
||||||
uuid = getCrackedUuid(data.get('username') as string);
|
uuid = getNoAuthUuid(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')})`);
|
||||||
|
@ -122,22 +122,7 @@
|
|||||||
>
|
>
|
||||||
<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">
|
||||||
|
@ -13,7 +13,9 @@ 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 ? 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 });
|
if (reporter == null || reported === null) return new Response(null, { status: 400 });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user