referer for link to storage
This commit is contained in:
@@ -120,7 +120,11 @@ export class HighlightedMarkdown extends Component {
|
|||||||
src={normalize_url(node.attribs.src)}
|
src={normalize_url(node.attribs.src)}
|
||||||
alt={node.alt}
|
alt={node.alt}
|
||||||
className="ext-img"
|
className="ext-img"
|
||||||
referrerPolicy="no-referrer"
|
referrerPolicy={
|
||||||
|
STORAGE_BASE && node.attribs.src.startsWith(STORAGE_BASE)
|
||||||
|
? 'origin'
|
||||||
|
: 'no-referrer'
|
||||||
|
}
|
||||||
onError={stop_loading}
|
onError={stop_loading}
|
||||||
onLoad={stop_loading}
|
onLoad={stop_loading}
|
||||||
/>
|
/>
|
||||||
@@ -135,7 +139,12 @@ export class HighlightedMarkdown extends Component {
|
|||||||
<a
|
<a
|
||||||
href={normalize_url(node.attribs.href)}
|
href={normalize_url(node.attribs.href)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopenner noreferrer"
|
rel="noopenner"
|
||||||
|
referrerPolicy={
|
||||||
|
STORAGE_BASE && node.attribs.href.startsWith(STORAGE_BASE)
|
||||||
|
? 'origin'
|
||||||
|
: 'no-referrer'
|
||||||
|
}
|
||||||
className="ext-link"
|
className="ext-link"
|
||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
@@ -196,11 +205,21 @@ export class HighlightedMarkdown extends Component {
|
|||||||
href={normalize_url(p)}
|
href={normalize_url(p)}
|
||||||
className="ext-link"
|
className="ext-link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener"
|
||||||
|
referrerPolicy={
|
||||||
|
STORAGE_BASE && p.startsWith(STORAGE_BASE)
|
||||||
|
? 'origin'
|
||||||
|
: 'no-referrer'
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{p}
|
{p}
|
||||||
<span className="icon icon-new-tab" />
|
<span className="icon icon-new-tab" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{/*
|
||||||
|
这里对referrer暂时没有比较好的办法
|
||||||
|
如果使用ifrmae对fireofx可行在chomre上很容易变成下载
|
||||||
|
*/}
|
||||||
{is_video(p) && (
|
{is_video(p) && (
|
||||||
<video className="ext-video" src={p} controls />
|
<video className="ext-video" src={p} controls />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user