From e64b001bf9236e3e67de35c9260bddb171d4e154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?= Date: Fri, 13 Nov 2026 13:50:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9B=B9=EB=B7=B0=EA=B0=80=20=EB=82=A0?= =?UTF-8?q?=EC=94=A8=EA=B0=81=EA=B3=BC=20=EC=A0=95=ED=99=95=ED=9E=88=20?= =?UTF-8?q?=EA=B0=99=EC=9D=80=20origin=20=EB=A7=8C=20=EC=97=B4=EA=B2=8C=20?= =?UTF-8?q?=E2=80=94=20originWhitelist=20=EB=8A=94=20=EC=A0=91=EB=91=90?= =?UTF-8?q?=EC=82=AC=20=EC=9D=BC=EC=B9=98=EB=9D=BC=20weather.o2o.kr.evil.c?= =?UTF-8?q?om=C2=B7weather.o2o.kr@evil.com=20=EB=8F=84=20=ED=86=B5?= =?UTF-8?q?=EA=B3=BC=ED=95=B4,=20onShouldStartLoadWithRequest=20=EB=A1=9C?= =?UTF-8?q?=20=EB=8B=A4=EC=8B=9C=20=EA=B1=B0=EB=A5=B4=EA=B3=A0=20=EB=82=98?= =?UTF-8?q?=EB=A8=B8=EC=A7=80=EB=8A=94=20=ED=9C=B4=EB=8C=80=ED=8F=B0=20?= =?UTF-8?q?=EB=B8=8C=EB=9D=BC=EC=9A=B0=EC=A0=80=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/components/web-shell.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mobile/src/components/web-shell.tsx b/mobile/src/components/web-shell.tsx index c0a7f86..02f0f03 100644 --- a/mobile/src/components/web-shell.tsx +++ b/mobile/src/components/web-shell.tsx @@ -26,6 +26,22 @@ function toSiteUrl(link: string): string | null { } } +/** + * 웹뷰는 날씨각 사이트(정확히 같은 origin)에서만 움직인다. originWhitelist 는 접두사 일치라 + * weather.o2o.kr.evil.com·weather.o2o.kr@evil.com 도 통과시키므로, 통과한 주소를 여기서 다시 거른다. + * 다른 주소는 웹뷰에 열지 않고 휴대폰 브라우저로 보낸다. + */ +function stayOnSite(req: { url: string }) { + if (req.url === 'about:blank') return true; + try { + if (new URL(req.url).origin === SITE_ORIGIN) return true; + } catch { + // 읽을 수 없는 주소는 웹뷰에서 열지 않는다 + } + Linking.openURL(req.url).catch((e: unknown) => console.warn('[shell] 외부 주소를 열지 못함', req.url, e)); + return false; +} + function LoadFailed({ onRetry }: { onRetry: () => void }) { return ( @@ -116,6 +132,7 @@ export function WebShell({ onReady }: { onReady: () => void }) { ref={webView} source={{ uri: startUri }} originWhitelist={[SITE_ORIGIN]} + onShouldStartLoadWithRequest={stayOnSite} applicationNameForUserAgent={APP_UA} onNavigationStateChange={onNavigationStateChange} onMessage={onMessage}