Skip to content

Commit

Permalink
Merge branch 'release/0.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
pipisebastian committed Dec 4, 2024
2 parents 12df503 + d58d9e7 commit e12110b
Show file tree
Hide file tree
Showing 16 changed files with 210 additions and 98 deletions.
10 changes: 9 additions & 1 deletion @noctaCrdt/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ export type ElementType =
| "blockquote"
| "hr";

export type AnimationType = "none" | "highlight" | "gradation";
export type AnimationType =
| "none"
| "highlight"
| "rainbow"
| "fadeIn"
| "slideIn"
| "pulse"
| "gradation"
| "bounce";

export type TextStyleType = "bold" | "italic" | "underline" | "strikethrough";

Expand Down
12 changes: 3 additions & 9 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="ko">

<head>
<meta charset="UTF-8" />
Expand All @@ -14,19 +14,13 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.nocta.site/" />
<meta property="og:title" content="Nocta" />
<meta
property="og:description"
content="๋ฐคํ•˜๋Š˜์˜ ๋ณ„๋น›์ฒ˜๋Ÿผ, ์ž์œ ๋กœ์šด ์ธํ„ฐ๋ž™์…˜ ์‹ค์‹œ๊ฐ„ ์—๋””ํ„ฐ"
/>
<meta property="og:description" content="๋ฐคํ•˜๋Š˜์˜ ๋ณ„๋น›์ฒ˜๋Ÿผ, ์ž์œ ๋กœ์šด ์ธํ„ฐ๋ž™์…˜ ์‹ค์‹œ๊ฐ„ ์—๋””ํ„ฐ" />
<meta property="og:image" content="https://www.nocta.site/images/nocta.png" />

<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://www.nocta.site/" />
<meta property="twitter:title" content="Nocta" />
<meta
property="twitter:description"
content="๋ฐคํ•˜๋Š˜์˜ ๋ณ„๋น›์ฒ˜๋Ÿผ, ์ž์œ ๋กœ์šด ์ธํ„ฐ๋ž™์…˜ ์‹ค์‹œ๊ฐ„ ์—๋””ํ„ฐ"
/>
<meta property="twitter:description" content="๋ฐคํ•˜๋Š˜์˜ ๋ณ„๋น›์ฒ˜๋Ÿผ, ์ž์œ ๋กœ์šด ์ธํ„ฐ๋ž™์…˜ ์‹ค์‹œ๊ฐ„ ์—๋””ํ„ฐ" />
<meta property="twitter:image" content="https://www.nocta.site/images/nocta.png" />

<meta name="robots" content="index, follow" />
Expand Down
5 changes: 5 additions & 0 deletions client/src/constants/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export const OPTION_CATEGORIES = {
options: [
{ id: "none", label: "์—†์Œ" },
{ id: "highlight", label: "ํ•˜์ด๋ผ์ดํŠธ" },
{ id: "rainbow", label: "๋ ˆ์ธ๋ณด์šฐ" },
{ id: "gradation", label: "๊ทธ๋ผ๋ฐ์ด์…˜" },
{ id: "fadeIn", label: "ํŽ˜์ด๋“œ ์ธ" },
{ id: "slideIn", label: "์Šฌ๋ผ์ด๋“œ ์ธ" },
{ id: "pulse", label: "ํŽ„์Šค" },
{ id: "bounce", label: "๋ฐ”์šด์Šค" },
] as { id: AnimationType; label: string }[],
},
DUPLICATE: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { css, cva } from "@styled-system/css";
export const iconContainerStyle = css({
display: "flex",
justifyContent: "center",
alignItems: "center",
minWidth: "24px",
width: "24px",
height: "24px",
marginRight: "8px",
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const menuBlockStyle = css({
left: 0,
justifyContent: "center",
alignItems: "center",
width: "20px",
height: "20px",
width: "24px",
height: "24px",
marginLeft: "-20px",
opacity: 0,
transition: "opacity 0.2s ease-in-out",
Expand Down
153 changes: 135 additions & 18 deletions client/src/features/editor/components/block/Block.animation.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,60 @@
const defaultState = {
background: "transparent",
opacity: 1,
x: 0,
y: 0,
scale: 1,
backgroundSize: "100% 100%",
backgroundPosition: "0 0",
};

const none = {
initial: {
background: "transparent",
...defaultState,
},
animate: {
background: "transparent",
...defaultState,
},
};

const highlight = {
initial: {
background: `linear-gradient(to right,
#BFBFFF70 0%,
#BFBFFF70 0%,
transparent 0%,
transparent 100%
)`,
...defaultState,
background: `linear-gradient(to right,
#BFBFFF70 0%,
#BFBFFF70 0%,
transparent 0%,
transparent 100%
)`,
},
animate: {
background: `linear-gradient(to right,
#BFBFFF70 0%,
#BFBFFF70 100%,
transparent 100%,
transparent 100%
)`,
...defaultState,
background: `linear-gradient(to right,
#BFBFFF70 0%,
#BFBFFF70 100%,
transparent 100%,
transparent 100%
)`,
transition: {
duration: 1,
ease: "linear",
},
},
};

const gradation = {
const rainbow = {
initial: {
...defaultState,
background: `linear-gradient(to right,
#BFBFFF 0%,
#B0E2FF 50%,
#FFE4E1 100%
#BFBFFF 0%,
#B0E2FF 50%,
#FFE4E1 100%
)`,
backgroundSize: "300% 100%",
backgroundPosition: "100% 0",
},
animate: {
...defaultState,
background: [
`linear-gradient(to right,
#BFBFFF 0%,
Expand All @@ -63,6 +77,7 @@ const gradation = {
#FFE4E1 100%
)`,
],
backgroundSize: "300% 100%",
transition: {
duration: 3,
ease: "linear",
Expand All @@ -72,8 +87,110 @@ const gradation = {
},
};

const fadeIn = {
initial: {
...defaultState,
opacity: 0,
},
animate: {
...defaultState,
opacity: 1,
transition: {
duration: 1,
ease: "easeOut",
},
},
};

const slideIn = {
initial: {
...defaultState,
x: -20,
opacity: 0,
},
animate: {
...defaultState,
x: 0,
opacity: 1,
transition: {
duration: 0.5,
ease: "easeOut",
},
},
};

const pulse = {
initial: {
...defaultState,
scale: 1,
},
animate: {
...defaultState,
scale: [1, 1.02, 1],
transition: {
duration: 1.5,
ease: "easeInOut",
repeat: Infinity,
},
},
};

const gradation = {
initial: {
...defaultState,
background: `linear-gradient(
90deg,
rgba(255,255,255,0) 0%,
#BFBFFF80 70%,
rgba(255,255,255,0) 100%
)`,
backgroundSize: "200% 100%",
backgroundPosition: "100% 0",
},
animate: {
...defaultState,
background: `linear-gradient(
90deg,
rgba(255,255,255,0) 0%,
#BFBFFF80 70%,
rgba(255,255,255,0) 100%
)`,
backgroundSize: "200% 100%",
backgroundPosition: ["100% 0", "-100% 0"],
transition: {
duration: 2,
ease: "linear",
repeat: Infinity,
},
},
};

const bounce = {
initial: {
...defaultState,
y: 0,
},
animate: {
...defaultState,
y: [-2, 2, -2],
transition: {
duration: 1,
ease: "easeInOut",
repeat: Infinity,
},
},
};

export const blockAnimation = {
none,
highlight,
rainbow,
fadeIn,
slideIn,
pulse,
gradation,
bounce,
};

// types.ts
export type AnimationType = keyof typeof blockAnimation;
3 changes: 2 additions & 1 deletion client/src/features/editor/components/block/Block.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export const contentWrapperStyle = cva({
position: "relative",
flex: 1,
flexDirection: "row",
alignItems: "center",
alignItems: "flex-start",
width: "100%",
height: "100%",
},
});

Expand Down
3 changes: 0 additions & 3 deletions server/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ export class AuthController {
// DB์—์„œ refresh token ์‚ญ์ œ
await this.authService.removeRefreshToken(user.id);

// ์‚ฌ์šฉ์ž์˜ token version ์ฆ๊ฐ€
await this.authService.increaseTokenVersion(user);

// ์ฟ ํ‚ค ์‚ญ์ œ
this.authService.clearCookie(req.res);
}
Expand Down
7 changes: 0 additions & 7 deletions server/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export class AuthService {
return this.jwtService.sign({
sub: user.id,
email: user.email,
tokenVersion: await this.increaseTokenVersion(user),
});
}

Expand All @@ -87,12 +86,6 @@ export class AuthService {
return refreshToken;
}

async increaseTokenVersion(user: User): Promise<number> {
const tokenVersion = user.tokenVersion + 1;
await this.userModel.updateOne({ id: user.id }, { tokenVersion });
return tokenVersion;
}

async login(user: User, res: Response): Promise<UserDto> {
const accessToken = await this.generateAccessToken(user);
const refreshToken = await this.generateRefreshToken(user.id);
Expand Down
15 changes: 1 addition & 14 deletions server/src/auth/guards/jwt-auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { Injectable, ExecutionContext, UnauthorizedException } from "@nestjs/common";
import { AuthGuard } from "@nestjs/passport";
import { AuthService } from "../auth.service";
import { JwtService } from "@nestjs/jwt";

@Injectable()
export class JwtAuthGuard extends AuthGuard("jwt") {
constructor(
private readonly authService: AuthService,
private readonly jwtService: JwtService,
) {
constructor() {
super();
}

Expand All @@ -22,14 +17,6 @@ export class JwtAuthGuard extends AuthGuard("jwt") {

const canActivate = (await super.canActivate(context)) as boolean;

// Access Token์˜ tokenVersion๊ณผ ์‚ฌ์šฉ์ž์˜ tokenVersion ์ผ์น˜ ์—ฌ๋ถ€ ํ™•์ธ
const decodedToken = this.jwtService.decode(token) as { sub: string; tokenVersion: number };
const user = await this.authService.findById(decodedToken.sub);

if (!user || user.tokenVersion !== decodedToken.tokenVersion) {
throw new UnauthorizedException("Invalid token version");
}

return canActivate;
}
}
3 changes: 0 additions & 3 deletions server/src/auth/schemas/user.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export class User {
@Prop({ required: true })
name: string;

@Prop({ required: true, default: () => 0 })
tokenVersion: number;

@Prop()
refreshToken: string;

Expand Down
1 change: 0 additions & 1 deletion server/src/auth/test/auth.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe("AuthController", () => {
validateUser: jest.fn(),
getProfile: jest.fn(),
refresh: jest.fn(),
increaseTokenVersion: jest.fn(),
isValidEmail: jest.fn(),
};

Expand Down
Loading

0 comments on commit e12110b

Please sign in to comment.