diff --git a/public/index.html b/public/index.html
index b43bad0..82484ef 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,9 +5,6 @@
-
-
-
diff --git a/src/Common.js b/src/Common.js
index f9e48c7..0da0a86 100644
--- a/src/Common.js
+++ b/src/Common.js
@@ -140,14 +140,16 @@ export class HighlightedMarkdown extends Component {
{
shouldProcessNode: (node) => node.name === 'img',
processNode(node, index) {
- const rp =
- STORAGE_BASE && node.attribs.src.startsWith(STORAGE_BASE)
- ? 'origin'
- : 'no-referrer';
+ const with_referrer =
+ STORAGE_BASE &&
+ node.attribs.src &&
+ node.attribs.src.startsWith(STORAGE_BASE);
+ const rp = with_referrer ? 'origin' : 'no-referrer';
return (
@@ -167,16 +169,16 @@ export class HighlightedMarkdown extends Component {
{
shouldProcessNode: (node) => node.name === 'a',
processNode(node, children, index) {
+ const with_referrer =
+ STORAGE_BASE &&
+ node.attribs.href &&
+ node.attribs.href.startsWith(STORAGE_BASE);
return (
@@ -218,11 +220,13 @@ export class HighlightedMarkdown extends Component {
return (
{splitted.map(([rule, p], idx) => {
+ const with_referrer =
+ STORAGE_BASE && p && p.startsWith(STORAGE_BASE);
return (
{rule === 'url_pid' ? (
{
e.preventDefault();
@@ -237,21 +241,17 @@ export class HighlightedMarkdown extends Component {
href={normalize_url(p)}
className="ext-link"
target="_blank"
- rel="noopener"
+ rel={
+ with_referrer ? 'noopener' : 'noopener noreferrer'
+ }
referrerPolicy={
- STORAGE_BASE && p.startsWith(STORAGE_BASE)
- ? 'origin'
- : 'no-referrer'
+ with_referrer ? 'origin' : 'no-referrer'
}
>
{p}
- {/*
- 这里对referrer暂时没有比较好的办法
- 如果使用ifrmae对fireofx可行在chomre上很容易变成下载
- */}
{is_video(p) && (
)}