Skip to content

Commit 6aacf2f

Browse files
committed
Merge branch 'development'
2 parents b3d79ae + 4314b38 commit 6aacf2f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

infrastructure/src/lib/ecsOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ENV } from '../env'
22

33
const serverEcsOption: EcsOption = {
44
desiredCount: ENV.isProduction ? 2 : 1,
5-
cpu: 512,
5+
cpu: ENV.isProduction ? 1024 * 0.75 : 512,
66
memory: 1024,
77
maxCapacity: 12,
88
minCapacity: ENV.isProduction ? 2 : 1,

packages/velog-server/src/common/plugins/global/ipaddrPlugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ const ipaddrPlugin: FastifyPluginAsync = async (fastify) => {
44
fastify.decorateRequest('ipaddr', null)
55
fastify.addHook('preHandler', (request, reply, done) => {
66
const fromCdnIp = request.headers['gcdn-client-ip']
7+
const xForwardedIp = request.headers['X-Forwarded-For']
8+
79
const graphCdnAddress = Array.isArray(fromCdnIp) ? fromCdnIp[0] : fromCdnIp
8-
const ipaddr = graphCdnAddress || request.ips?.slice(-1)[0] || request.ip
10+
const xForwardedForAddress = Array.isArray(xForwardedIp) ? xForwardedIp[0] : xForwardedIp
11+
12+
const ipaddr =
13+
xForwardedForAddress ?? graphCdnAddress ?? request.ips?.slice(-1)[0] ?? request.ip
914
request.ipaddr = ipaddr
1015
done()
1116
})

packages/velog-web/src/features/home/components/FloatingHeader/FloatingHeader.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ function FloatingHeader({ header }: Props) {
2121
const [height, setHeight] = useState(0)
2222
const [marginTop, setMarginTop] = useState(0)
2323

24+
const isHome = checkIsHome(pathname)
25+
2426
useEffect(() => {
2527
if (!blockRef.current) return
2628
setHeight(blockRef.current.clientHeight)
@@ -56,11 +58,19 @@ function FloatingHeader({ header }: Props) {
5658
setVisible(false)
5759
}
5860

59-
setMarginTop(Math.min(0, -1 * height + transitionPoint.current - scrollTop))
61+
const marginTopMax = 0
62+
const marginTopMin = isHome ? -112 : -64
63+
64+
const calculatedMarginTop = Math.min(
65+
marginTopMax,
66+
-1 * height + transitionPoint.current - scrollTop,
67+
)
68+
69+
setMarginTop(Math.max(calculatedMarginTop, marginTopMin))
6070

6171
direction.current = nextDirection
6272
prevScrollTop.current = scrollTop
63-
}, [height])
73+
}, [height, isHome])
6474

6575
useEffect(() => {
6676
document.addEventListener('scroll', onScroll)
@@ -69,7 +79,6 @@ function FloatingHeader({ header }: Props) {
6979
}
7080
}, [onScroll])
7181

72-
const isHome = checkIsHome(pathname)
7382
return (
7483
<div
7584
className={cx('block')}

0 commit comments

Comments
 (0)