Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
APP_NAME=Libre Closet
#PWA_ENABLED=true
#AUTH_ENABLED=true
#DISABLE_REGISTRATION=true
#CLOUD_ENABLED=true
#DISABLE_REGISTRATION=true

#CHANGE THIS TO REQUIRE A CODE TO REGISTER WHEN DISABLE_REGISTRATION=false
#REGISTRATION_SECRET_CODE="RegisterCode"

# CHANGE FOR PRODUCTION!
PUBLIC_VAPID_KEY=BEl62iUYgUivxIkv69yViEuiBIa-Ib9-SkvMeAtA3LFgDzkrxZJjSgSnfckjBJuBkr3qBUYIHBQFLXYp5Nksh8U
Expand Down
176 changes: 172 additions & 4 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 @@ -117,9 +117,10 @@
"eslint-plugin-prettier": "^5.2.2",
"globals": "^16.0.0",
"jest": "^30.0.0",
"node-gyp": "^12.4.0",
"npm-check-updates": "^19.1.1",
"patch-package": "^8.0.1",
"prettier": "^3.4.2",
"prettier": "^3.9.9",
"source-map-support": "^0.5.21",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.2",
Expand Down
Binary file added public/assets/mannequin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified scripts/preCommit.sh
100755 → 100644
Empty file.
28 changes: 19 additions & 9 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,25 @@ export class AuthController {
...((reply as any).locals ?? {}),
});
}

const jwt = await this.authService.register(body.email, body.password);
reply.setCookie('access_token', jwt, {
path: '/',
maxAge: 365 * 24 * 60 * 60 * 1000, // 365 days
httpOnly: true, // Prevents client-side JS from reading it
});
return reply.redirect('/auth/profile', 302);
}

const allowedSecretCode = process.env.REGISTRATION_SECRET_CODE;

if (allowedSecretCode && (body as any).secretCode !== allowedSecretCode) {
return reply.view('auth/register', {
layout: 'layout',
input: body,
errorMessage: 'Registration requires a valid Admin Approval Code.',
...((reply as any).locals ?? {}),
});
}
const jwt = await this.authService.register(body.email, body.password);
reply.setCookie('access_token', jwt, {
path: '/',
maxAge: 365 * 24 * 60 * 60 * 1000,
httpOnly: true,
});
return reply.redirect('/auth/profile', 302);
}

@UseGuards(RegistrationGuard)
@Render('auth/register')
Expand Down
16 changes: 16 additions & 0 deletions src/dal/entity/garment.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ export class Garment extends ShareableId {

@Property({ default: false })
public archived = false;

/**
* Default canvas transform for this garment on the 1000x1000 outfit canvas.
* Outfit slots may override these values.
*/
@Property({ default: 500 })
public canvasPositionX = 500;

@Property({ default: 500 })
public canvasPositionY = 500;

@Property({ default: 0 })
public canvasRotation = 0;

@Property({ default: 1 })
public canvasScale = 1;
@Property({ nullable: true, columnType: 'text' })
public washingDetails?: string;

Expand Down
9 changes: 9 additions & 0 deletions src/dal/entity/outfit.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ import { Garment } from './garment.entity';
import { ShareableId } from './shareableId.entity';
import { User } from './user.entity';

export interface OutfitSlotPosition {
x: number;
y: number;
}

export interface OutfitSlot {
category: string;
garmentId: number | null;
position?: OutfitSlotPosition;
rotation?: number;
scale?: number;
zIndex?: number;
}

@Entity()
Expand Down
17 changes: 17 additions & 0 deletions src/dal/migrations/postgres/Migration20261006120001.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Migration } from '@mikro-orm/migrations';

export class Migration20261006120001 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "garment" add column "canvas_position_x" double precision not null default 500;`);
this.addSql(`alter table "garment" add column "canvas_position_y" double precision not null default 500;`);
this.addSql(`alter table "garment" add column "canvas_rotation" double precision not null default 0;`);
this.addSql(`alter table "garment" add column "canvas_scale" double precision not null default 1;`);
}

override async down(): Promise<void> {
this.addSql(`alter table "garment" drop column "canvas_position_x";`);
this.addSql(`alter table "garment" drop column "canvas_position_y";`);
this.addSql(`alter table "garment" drop column "canvas_rotation";`);
this.addSql(`alter table "garment" drop column "canvas_scale";`);
}
}
Loading
Loading