Skip to content

Commit 50b671c

Browse files
committed
prepend https
1 parent bff5d60 commit 50b671c

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Hackertab.dev",
33
"description": "The Developer’s Homepage",
4-
"version": "1.12.3",
4+
"version": "1.12.4",
55
"manifest_version": 2,
66
"chrome_url_overrides": {
77
"newtab": "index.html"

src/components/CarbonAd.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@ export default function CarbonAd() {
1818
setup()
1919
}, [])
2020

21+
const prependHTTP = (url) => {
22+
url = decodeURIComponent(url)
23+
if (!/^(?:f|ht)tps?\:\/\//.test(url)) {
24+
url = 'https://' + url
25+
}
26+
return url
27+
}
28+
2129
return (
2230
<div className="carbon-ad-wrapper blockRow">
2331
{ad && (
2432
<div id="carbonads">
2533
<span>
2634
<span className="carbon-wrap">
2735
<a
28-
href={ad.statlink}
36+
href={prependHTTP(ad.statlink)}
2937
className="carbon-img"
3038
target="_blank"
3139
rel="noopener sponsored"
@@ -40,7 +48,7 @@ export default function CarbonAd() {
4048
</a>
4149

4250
<a
43-
href={ad.statlink}
51+
href={prependHTTP(ad.statlink)}
4452
className="carbon-text"
4553
target="_blank"
4654
rel="noopener sponsored">

0 commit comments

Comments
 (0)