rename cracked to noauth and remove the possibility to self register as such
This commit is contained in:
@@ -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', 'cracked'), allowNull: false })
|
||||
declare playertype: 'java' | 'bedrock' | 'cracked';
|
||||
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), allowNull: false })
|
||||
declare playertype: 'java' | 'bedrock' | 'noauth';
|
||||
@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', 'cracked'), allowNull: false })
|
||||
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'noauth'), allowNull: false })
|
||||
declare status: 'none' | 'review' | 'reviewed';
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare notice: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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', () => {
|
||||
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
|
||||
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
|
||||
export function getCrackedUuid(username: string): string {
|
||||
export function getNoAuthUuid(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);
|
||||
|
||||
Reference in New Issue
Block a user