Skip to content

Commit d701f7c

Browse files
committed
Fix external link targets and add rel="noreferrer"
Replaces all instances of target="blank" with target="_blank" for external links and adds rel="noreferrer" for security and best practices across achievement tab components, Main, and ItemWithCounter.
1 parent 39f449e commit d701f7c

9 files changed

Lines changed: 25 additions & 19 deletions

File tree

src/Components/AchieveTabs/Collection/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ interface CollectionProps {
77
const Collection = ({ museumCollection: mc }: CollectionProps) => {
88
const createCollectionItem = (item: any, i: number, type: string) => {
99
return (
10-
<a href={`https://stardewvalleywiki.com/${item.image}`} target="blank" key={i}>
10+
<a href={`https://stardewvalleywiki.com/${item.image}`}
11+
target="_blank" rel="noreferrer" key={i}>
1112
<img
1213
key={i}
1314
src={`https://stardew-tracker.s3.amazonaws.com/${type}/${item.image}.png`}

src/Components/AchieveTabs/Crafting/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ const Crafting: React.FC<CraftingProps> = ({ itemsCrafted }) => {
3636
</ul>
3737
<br />
3838
{itemsCrafted.map((item, i) => (
39-
<a href={`https://stardewvalleywiki.com/${item.image}`} target="blank" key={i}>
39+
<a href={`https://stardewvalleywiki.com/${item.image}`}
40+
target="_blank"
41+
rel="noreferrer"
42+
key={i}>
4043
<img
4144
key={i}
4245
src={`https://stardew-tracker.s3.amazonaws.com/Crafting/${item.image}.png`}

src/Components/AchieveTabs/Crops/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const Crops= (cropsShipped : CropsShippedWrapperType) => {
1919
<li>Polyculture: <span className={cropsShipped.cropsShipped.hasPolyculture ? "completed" : "pending"}>{_polycultureText}</span></li>
2020
</ul>
2121
<span className="a-title"><p>Ship 15 of the following crops to get the 'Polyculture' achievement</p></span>
22-
{cropsShipped.cropsShipped.poly_crops.map((crop, i) =><a href={`https://stardewvalleywiki.com/${crop.image}`} target="blank" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Crops/${crop.image}.png`} alt={crop.name} className={ (crop.shipped !== undefined) ? ((crop.shipped >= 15) ? "done" : "known" ): "" } title={(crop.shipped !== undefined) ? (crop.shipped >= 15) ? `You have shipped ${crop.name} ${crop.shipped} times` : `You have to ship ${ 15 - crop.shipped} more ${crop.name} ` : `You haven't shipped ${crop.name}`} ></img></a>)}
22+
{cropsShipped.cropsShipped.poly_crops.map((crop, i) =><a href={`https://stardewvalleywiki.com/${crop.image}`} target="_blank" rel="noreferrer" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Crops/${crop.image}.png`} alt={crop.name} className={ (crop.shipped !== undefined) ? ((crop.shipped >= 15) ? "done" : "known" ): "" } title={(crop.shipped !== undefined) ? (crop.shipped >= 15) ? `You have shipped ${crop.name} ${crop.shipped} times` : `You have to ship ${ 15 - crop.shipped} more ${crop.name} ` : `You haven't shipped ${crop.name}`} ></img></a>)}
2323

2424
<span className="a-title"><p>These crops are not counted for the 'Polyculture' achievement</p></span>
25-
{cropsShipped.cropsShipped.mono_extras.map((crop, i) =><a href={`https://stardewvalleywiki.com/${crop.image}`} target="blank" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Crops/${crop.image}.png`} alt={crop.name} className={ (crop.shipped !== undefined) ? ((crop.shipped > 0) ? "done" : "known" ): "" } title={(crop.shipped !== undefined) ? `You have shipped ${crop.name} ${crop.shipped} times` : `You haven't shipped ${crop.name}`} ></img></a>)}
25+
{cropsShipped.cropsShipped.mono_extras.map((crop, i) =><a href={`https://stardewvalleywiki.com/${crop.image}`} target="_blank" rel="noreferrer" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Crops/${crop.image}.png`} alt={crop.name} className={ (crop.shipped !== undefined) ? ((crop.shipped > 0) ? "done" : "known" ): "" } title={(crop.shipped !== undefined) ? `You have shipped ${crop.name} ${crop.shipped} times` : `You haven't shipped ${crop.name}`} ></img></a>)}
2626
</div>
2727
);
2828
};

src/Components/AchieveTabs/Fish/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Fish = ({ fishCaught }: FishProps) => {
2727
<li>Master Angler : {(totalFished >= fishCaught.length) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to catch {fishCaught.length - totalFished} more fish to get this </span>}</li>
2828
</ul>
2929
<br />
30-
{fishCaught.map((fish, i) => <a href={`https://stardewvalleywiki.com/${fish.image}`} target="blank" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Fishing/${fish.image}.png`} alt={fish.name} className={ (fish.fished) ? "done" : ""} title={(fish.fished) ? `You've caught ${fish.name}` : `You haven't fished ${fish.name}`} ></img></a>)}
30+
{fishCaught.map((fish, i) => <a href={`https://stardewvalleywiki.com/${fish.image}`} target="_blank" rel="noreferrer" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Fishing/${fish.image}.png`} alt={fish.name} className={ (fish.fished) ? "done" : ""} title={(fish.fished) ? `You've caught ${fish.name}` : `You haven't fished ${fish.name}`} ></img></a>)}
3131

3232
</div>
3333
);

src/Components/AchieveTabs/Monsters/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Monsters: React.FC<MonstersProps> = ({ monstersKilled }) => {
2020
const getQuestData = (monsters: MonsterData) => {
2121
return(
2222
<li key={monsters.goal}>
23-
<span className="goal-mg">{monsters.images.map((image, i) =><a href={`https://stardewvalleywiki.com/${image.img}`} target="blank" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Monsters/${image.img}.png`} className="done" title={image.name} alt={image.name} width="21px" ></img> </a>) }</span>
23+
<span className="goal-mg">{monsters.images.map((image, i) =><a href={`https://stardewvalleywiki.com/${image.img}`} target="_blank" rel="noreferrer" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Monsters/${image.img}.png`} className="done" title={image.name} alt={image.name} width="21px" ></img> </a>) }</span>
2424
{monsters.category}: {(monsters.timesKilled >= monsters.goal) ? <span className="completed"> {monsters.timesKilled} / {monsters.goal}</span> : <span className="pending"> {monsters.timesKilled} / {monsters.goal}</span> }
2525
</li>
2626
);

src/Components/AchieveTabs/Quests/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Quests: React.FC<QuestsProps> = ({ questsDone, specialReq, pendingSpecialR
2727
const getQuestData = (monsters: QuestData) => {
2828
return(
2929
<li key={monsters.goal}>
30-
<span className="goal-mg">{monsters.images.map((image, i) =><a href={`https://stardewvalleywiki.com/${image.img}`} target="blank" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Monsters/${image.img}.png`} className="done" title={image.name} alt={image.name} width="21px" ></img> </a>) }</span>
30+
<span className="goal-mg">{monsters.images.map((image, i) =><a href={`https://stardewvalleywiki.com/${image.img}`} target="_blank" rel="noreferrer" key={i}> <img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Monsters/${image.img}.png`} className="done" title={image.name} alt={image.name} width="21px" ></img> </a>) }</span>
3131
{monsters.category}: {(monsters.timesKilled >= monsters.goal) ? <span className="completed"> {monsters.timesKilled} / {monsters.goal}</span> : <span className="pending"> {monsters.timesKilled} / {monsters.goal}</span> }
3232
</li>
3333
);

src/Components/AchieveTabs/Shipping/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const Shipping: React.FC<ShippingProps> = ({ shippedItems }) => {
3737
<li>Full Shipment: {(totalShipped === shippedItems.length) ? <span className="completed">You have this achievement</span> : <span className="pending">You need to ship {shippedItems.length - totalShipped} more item to get this achievement.</span> } </li>
3838
</ul>
3939
<br />
40-
{shippedItems.map((d, i) => <a href={`https://stardewvalleywiki.com/${d.image}`} target="blank" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Shipment/${d.image}.png`} alt={d.name} className={ (d.shipped !== undefined) ? "done" : "" } title={(d.shipped !== undefined) ? `You have shipped ${d.name}` : `You haven't shipped ${d.name}`} ></img></a>)}
40+
{shippedItems.map((d, i) => <a href={`https://stardewvalleywiki.com/${d.image}`} target="_blank" rel="noreferrer" key={i}><img key={i} src={`https://stardew-tracker.s3.amazonaws.com/Shipment/${d.image}.png`} alt={d.name} className={ (d.shipped !== undefined) ? "done" : "" } title={(d.shipped !== undefined) ? `You have shipped ${d.name}` : `You haven't shipped ${d.name}`} ></img></a>)}
4141
</div>
4242
);
4343
};

src/Components/Main/Main.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ const Main = () => {
4343
<div className="main-media">
4444
<div className="cr rotated">
4545
<div className="media-container">
46-
<a href="https://www.facebook.com/TheCodeRaccoons/" target="blank"><div className="media"><img src={twit} alt="twitter"/></div></a>
47-
<a href="https://ko-fi.com/thecoderaccon/" target="blank"><div className="media"><img src={kofi} alt="ko-fi"/></div></a>
48-
<a href="https://twitter.com/thecoderaccoons/" target="blank"><div className="media"><img src={fb} alt="facebook"/></div></a>
46+
<a href="https://www.facebook.com/TheCodeRaccoons/" target="_blank" ><div className="media"><img src={twit} alt="twitter"/></div></a>
47+
<a href="https://ko-fi.com/thecoderaccon/" target="_blank"><div className="media"><img src={kofi} alt="ko-fi"/></div></a>
48+
<a href="https://twitter.com/thecoderaccoons/" target="_blank"><div className="media"><img src={fb} alt="facebook"/></div></a>
4949
</div>
5050
<div> Code by TheCodeRaccoons</div>
5151
</div>
5252
<div className="oj rotated">
5353
<div className="media-container">
54-
<a href="https://www.facebook.com/ookami.jime/" target="blank"><div className="media"><img src={twit} alt="twitter"/></div></a>
55-
<a href="https://ko-fi.com/ookamijime/" target="blank"><div className="media"><img src={kofi} alt="ko-fi"/></div></a>
56-
<a href="https://twitter.com/ookamijime/" target="blank"><div className="media"><img src={fb} alt="facebook"/></div></a>
54+
<a href="https://www.facebook.com/ookami.jime/" target="_blank"><div className="media"><img src={twit} alt="twitter"/></div></a>
55+
<a href="https://ko-fi.com/ookamijime/" target="_blank"><div className="media"><img src={kofi} alt="ko-fi"/></div></a>
56+
<a href="https://twitter.com/ookamijime/" target="_blank"><div className="media"><img src={fb} alt="facebook"/></div></a>
5757
</div>
5858
<div className="space-fix" > Design<br/> by Ookamijime</div>
5959
</div>
@@ -81,9 +81,9 @@ const Main = () => {
8181
<div className="coright" >
8282
Source at GitHub, All <br />
8383
"Stardew Valley" assets <br />
84-
copyright <a href="https://twitter.com/ConcernedApe" target="blank" >Concerned Ape</a>,
84+
copyright <a href="https://twitter.com/ConcernedApe" target="_blank" >Concerned Ape</a>,
8585
<br /> other assets and site design <br /> made by
86-
<a href="https://twitter.com/OokamiJime" target="blank" >Ookamijime</a></div>
86+
<a href="https://twitter.com/OokamiJime" target="_blank" >Ookamijime</a></div>
8787
</div>
8888
);
8989
}

src/Components/common/ItemWithCounter.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ const ItemWithCounter = ({
1717
times,
1818
}: ItemWithCounterProps) => {
1919
return (
20-
<a
20+
<a
2121
href={link}
22-
target="blank"
22+
target="_blank"
23+
rel="noreferrer"
2324
className="item-with-counter">
25+
2426
<img
2527
src={src}
2628
alt={name}
2729
className={state}
28-
title={hoverDesc && hoverDesc}
30+
title={hoverDesc}
2931
>
3032
</img>
3133
{times === undefined ?

0 commit comments

Comments
 (0)