-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matheus Cesar C. - Matsukii
committed
Jan 30, 2020
1 parent
02eb136
commit c186b3d
Showing
7 changed files
with
239 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* code below created colored boxes for any element using bg color */ | ||
/* * { background-color: rgba(255,0,0,.2); } | ||
* * { background-color: rgba(0,255,0,.2); } | ||
* * * { background-color: rgba(0,0,255,.2); } | ||
* * * * { background-color: rgba(255,0,255,.2); } | ||
* * * * * { background-color: rgba(0,255,255,.2); } | ||
* * * * * * { background-color: rgba(255,255,0,.2); } | ||
* * * * * * * { background-color: rgba(255,0,0,.2); } | ||
* * * * * * * * { background-color: rgba(0,255,0,.2); } | ||
* * * * * * * * * { background-color: rgba(0,0,255,.2); } */ | ||
|
||
|
||
body{ | ||
/* margin: 0; */ | ||
background-color: var(--color-backgroud); | ||
color: var(--text-dark); | ||
} | ||
|
||
|
||
.inputs{ | ||
border: none; | ||
border-radius:5px; | ||
padding: 5px 10px; | ||
font-size: 130%; | ||
color: var(--text-dark); | ||
background-color: var(--color-tertiary); | ||
} | ||
#dataIn{ | ||
position: absolute; | ||
left: 5px; | ||
margin-top: -25px; | ||
color: var(--color-highlight); | ||
} | ||
h1{ | ||
color: var(--color-highlight); | ||
} | ||
|
||
p[raw]{ | ||
background: var(--color-tertiary); | ||
padding: 15px; | ||
border-radius: 5px; | ||
box-shadow: 0px 0px 10px 0px var(--warn-half); | ||
} | ||
|
||
|
||
button{ | ||
border: none; | ||
background: var(--warn-half); | ||
color: var(--warn-full); | ||
padding: 5px 10px; | ||
font-size: 100%; | ||
border-radius: 5px; | ||
margin: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" prefix="og: https://polarpod.herokuapp.com/cleanfb"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Polarpod - Clean facebook links</title> | ||
<link rel="stylesheet" href="/face-cleaner/cleanfb.css"> | ||
<link rel="stylesheet" href="/global.css"> | ||
<link rel="shortcut icon" href="/logo/app_icon-dark.png" type="image/x-icon"> | ||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script> | ||
|
||
<meta property="og:type" content="website"> | ||
<meta property="og:name" content="Polarpod"/> | ||
<meta property="og:site_name" content="Polarpod"> | ||
<meta property="og:title" content="Facebook URL param cleaner"/> | ||
<meta property="og:description" content="Remove fbclid, extract original link from facebook post"/> | ||
<meta property="og:url" content="https://polarpod.herokuapp.com/cleanfb"/> | ||
<meta property="og:image" content="https://polarpod.herokuapp.com/logo/app_icon-dark.png"/> | ||
|
||
</head> | ||
<!-- konnichiwa sekai --> | ||
<body class="dark" link="#03A9F4" vlink="#03A9F4"> | ||
<h1>Facebook url 'cleaner'</h1> | ||
<h2>API link: <a href="/apis/cleanfb?u=">https://polarpod.herokuapp.com/apis/cleanfb?u=</a></h2> | ||
<h3>Extract original link from facebook post <br>(facebook redirect any link to 'facebook.com/l.php' before <br> go to final link, this api extract the original <br> link from url and remove 'fb click id' <br> its a way to avoid trackers from clicks)</h3> | ||
<br> | ||
<br> | ||
<div id="polar"> | ||
<label for="dataIn" id="dataIn" v-if="dataIn.length > 0">{{dataLabel}}</label> | ||
<input type="text" class="inputs" v-model="dataIn" placeholder="Link to clear"> | ||
|
||
<br> | ||
|
||
<h2><a>Discovered:</a></h2> | ||
<div id="responsed"> | ||
<p v-if="dataIn"><b>Original url:</b> <a target="blank" v-bind:href="dataIn">{{dataInCut}}</a></p> | ||
<p v-if="dataOut"><b>Cleaned url:</b> <a target="blank" v-bind:href="dataOut">{{dataOut}}</a></p> | ||
|
||
<button v-on:click="showRaw = !showRaw" v-if='false'>How it works</button> <br> | ||
<p raw v-if="showRaw && false"> | ||
This code can be used in browser devTools console <br><br> | ||
url = new URL([link_to_clear]) <br> | ||
let link = new URL(url.searchParams.get('u'));<br> | ||
link = `${link.origin}${link.pathname}`<br> | ||
</p> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
|
||
<script src="/face-cleaner/cleanfb.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
let get; | ||
let app = new Vue({ | ||
el:'#polar', | ||
data:{ | ||
apiLink: `https://${window.location.host}/apis/cleanfb?u=`, | ||
dataIn: '', | ||
dataInCut:'', | ||
dataOut: '', | ||
dataLabel:'Link to clear', | ||
showRaw: false, | ||
urlPattern: new RegExp('(http||https):\/\/[0-9a-zA-Z]*.'), | ||
res:{ | ||
original:'', | ||
clean:'', | ||
timestamp: Date.now(), | ||
} | ||
}, | ||
watch:{ | ||
dataIn(val){ | ||
if(this.urlPattern.test(val)){ | ||
if(get){clearTimeout(get)} | ||
get = setTimeout(() => { | ||
console.warn("fetching"); | ||
this.clearURL(val); | ||
}, 500); | ||
} | ||
else{ | ||
if(get){clearTimeout(get)} | ||
} | ||
if(val.length > 20){ | ||
this.dataInCut = `${this.dataIn.slice(0, 30)}...` | ||
} | ||
} | ||
}, | ||
methods:{ | ||
clearURL: async function(url){ | ||
fetch(`/apis/cleanfb?u=${url}`, { | ||
method: 'GET' | ||
}).then(r => r.json()).then(r => { | ||
app.res = r; | ||
this.dataOut = r.clean; | ||
console.log(r); | ||
}) | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @description extract original link and remove click id param from facebook links | ||
* @author Matsukii | ||
* | ||
* @param {String} url url from facebook to clean | ||
*/ | ||
module.exports = (url) => { | ||
|
||
url = new URL(url); | ||
|
||
if(url.pathname == '/l.php' && url.searchParams.get('u')){ | ||
let link = new URL(url.searchParams.get('u')); | ||
link = `${link.origin}${link.pathname}` | ||
return link | ||
} | ||
else if (url.searchParams.get('fbclid')){ | ||
return `${url.origin}${url.pathname}` | ||
} | ||
else{ | ||
return url; | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters