From ed176c6a717892343ed896f1d394bdba394ccb23 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Sun, 31 Jul 2022 18:48:57 +0800 Subject: [PATCH] referer for link to storage --- src/Common.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Common.js b/src/Common.js index d95e9f0..ba4ff55 100644 --- a/src/Common.js +++ b/src/Common.js @@ -120,7 +120,11 @@ export class HighlightedMarkdown extends Component { src={normalize_url(node.attribs.src)} alt={node.alt} className="ext-img" - referrerPolicy="no-referrer" + referrerPolicy={ + STORAGE_BASE && node.attribs.src.startsWith(STORAGE_BASE) + ? 'origin' + : 'no-referrer' + } onError={stop_loading} onLoad={stop_loading} /> @@ -135,7 +139,12 @@ export class HighlightedMarkdown extends Component { @@ -196,11 +205,21 @@ export class HighlightedMarkdown extends Component { href={normalize_url(p)} className="ext-link" target="_blank" - rel="noopener noreferrer" + rel="noopener" + referrerPolicy={ + STORAGE_BASE && p.startsWith(STORAGE_BASE) + ? 'origin' + : 'no-referrer' + } > {p} + + {/* + 这里对referrer暂时没有比较好的办法 + 如果使用ifrmae对fireofx可行在chomre上很容易变成下载 + */} {is_video(p) && (