feat(ssulbox): 썰박스 상세에 공식 링크 오버레이 추가
This commit is contained in:
1 parent
3bcca23e97
commit
94b39a44bd
5 files changed
+63
-24
No files matched your search
@@ -605,6 +605,8 @@ export interface SsulDetailItem {
|
||||
video_url: string;
|
||||
store_name: string | null;
|
||||
region: string | null;
|
||||
/** 업체 공식 링크. 영상 종료 3초 전 오버레이에 쓰며, 미확보 시 null */
|
||||
official_site_url?: string | null;
|
||||
created_at: string;
|
||||
like_count: number;
|
||||
is_liked_by_me: boolean;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 사용자·크롤링에서 온 URL을 링크로 그리기 전에 검증한다.
|
||||
*
|
||||
* `official_site_url`은 업체가 직접 입력하거나 네이버 플레이스에서 긁어온 값이라
|
||||
* `javascript:` 같은 스킴이 섞이면 href에 그대로 실려 XSS가 된다. http/https만 통과시킨다.
|
||||
*/
|
||||
export const isSafeHttpUrl = (url?: string | null): boolean => {
|
||||
if (!url) return false;
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user