initial commit

main
hazycora 3 months ago
commit 27dbe3d5e6
Signed by: h
GPG Key ID: 215AF1F81F86940E

1
.gitignore vendored

@ -0,0 +1 @@
node_modules/

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

@ -0,0 +1,53 @@
const express = require('express')
const app = express()
const port = 4003
app.use(express.static('static'))
function addProtocolIfMissing(str) {
if (!str.startsWith('https://') && !str.startsWith('http://')) {
str = 'https://'+str
}
return str
}
app.get('/:base64forTheWorld/:base64forTwitter', (req, res) => {
let linkForTheWorld
let linkForTwitter
try {
linkForTheWorld = addProtocolIfMissing(Buffer.from(req.params.base64forTheWorld, 'base64').toString('utf-8'))
linkForTwitter = addProtocolIfMissing(Buffer.from(req.params.base64forTwitter, 'base64').toString('utf-8'))
} catch (error) {
res.status(400).send('idk what to do with this url! someone broke something.')
return
}
if (req.headers['user-agent'].startsWith('Twitterbot/')) {
console.log('found a twitter request lol')
res.redirect(linkForTwitter)
return
}
res.redirect(linkForTheWorld)
})
app.get('/:base64forTheWorld/:base64forTwitter/*', (req, res) => {
let linkForTheWorld
let linkForTwitter
try {
linkForTheWorld = getValidUrl(Buffer.from(req.params.base64forTheWorld, 'base64').toString('utf-8'))
linkForTwitter = getValidUrl(Buffer.from(req.params.base64forTwitter, 'base64').toString('utf-8'))
} catch (error) {
res.status(400).send('idk what to do with this url! someone broke something.')
return
}
if (req.headers['user-agent'].startsWith('Twitterbot/')) {
console.log('found a twitter request lol')
res.redirect(linkForTwitter)
return
}
res.redirect(linkForTheWorld)
})
app.listen(port, '127.0.0.1', () => {
console.log(`Example app listening on port ${port}`)
})

1018
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
{
"name": "fedishout",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
<title>doing a little bit of trolling</title>
</head>
<body>
<h1>doing a little bit of trolling</h1>
<p>Wanna post a link, but have Twitter not notice? For some reason? This may be the tool for you ;)</p>
<input placeholder="URL to redirect to here" autocomplete="off" type="url" name="link-for-the-world" id="link-for-the-world">
<input placeholder="URL Twitter displays here" autocomplete="off" type="url" name="link-for-twitter" id="link-for-twitter">
<div id="result-stuff" class="result-stuff" style="display: none">
<p>Here's your URL to use on Twitter (don't blame me if you get banned lol):</p>
<code id="result-link" class="result-link"></code>
</div>
<p>For example, put a link to your Mastodon profile in the first input box, and put a link to Elon's Twitter profile in the second box to make a link that looks like it goes to Elon's profile but goes to your Mastodon instead when clicked.</p>
<div class="demo-graphic">
<img src="/elon-link-card.png" alt="Screenshot of a Twitter card for Elon Musk's profile" class="link-card-graphic">
<img src="/arrow.png" alt="arrow" class="arrow-graphic">
<img src="/mastodon.svg" alt="mastodon logo" class="mastodon-graphic">
</div>
<p>(This could be used to make phishing links, sorry about that, but Twitter has had this unpatched for so long now and have been warned about this vulnerability multiple times, so they allowed this to happen.)</p>
<br>
<p>made with ❤️ by <a href="https://fuckgov.org">fuckgov.org</a></p>
</body>
<script>
function isValidUrl(str) {
return /^(https?:\/\/.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\..{2,15}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/.test(str)
}
function onInputChange() {
let worldLinkUrl = document.getElementById('link-for-the-world').value
let twitterLinkUrl = document.getElementById('link-for-twitter').value
if (!isValidUrl(worldLinkUrl)||!isValidUrl(twitterLinkUrl)) {
document.getElementById('result-stuff').style.display = 'none'
document.getElementById('result-link').innerText = 'invalid URLs (be sure both are proper URLs beginning with https://)'
return
}
document.getElementById('result-stuff').style.display = 'block'
worldLinkUrl = worldLinkUrl.replace(/https?:\/\//, '')
twitterLinkUrl = twitterLinkUrl.replace(/https?:\/\//, '')
let urlOfPage = new URL(window.location)
urlOfPage.pathname = `/${btoa(worldLinkUrl).replace(/=/gm, '')}/${btoa(twitterLinkUrl).replace(/=/gm, '')}`
document.getElementById('result-link').innerText = urlOfPage.href
}
document.getElementById('link-for-twitter').addEventListener('input', onInputChange)
document.getElementById('link-for-the-world').addEventListener('input', onInputChange)
</script>
</html>

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="61.076954mm" height="65.47831mm" viewBox="0 0 216.4144 232.00976">
<path fill="#2b90d9" d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915"/>
<path fill="#fff" d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,71 @@
*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: 'DM Sans', Arial, sans-serif;
background-color: black;
color: white;
}
input {
background-color: black;
color: white;
border: 1px solid #2f3336;
padding: 0.8rem 0.4rem;
border-radius: 10px;
display: block;
margin: 0.4rem 0;
width: 100%;
max-width: 300px;
}
a {
color: #2b90d9;
}
.result-stuff {
border: 1px solid #2f3336;
padding: 0.8rem 0.4rem;
border-radius: 10px;
}
.result-link {
display: block;
margin-top: 1rem;
}
.result-stuff p {
margin: 0;
}
.demo-graphic {
display: flex;
flex-direction: column;
align-items: center;
}
.arrow-graphic {
transform: rotate(90deg);
}
.mastodon-graphic {
width: 100px;
}
.link-card-graphic {
max-width: 100%;
}
@media (min-width: 700px) {
.demo-graphic {
flex-direction: row;
}
.link-card-graphic {
max-width: 70%;
}
.arrow-graphic {
transform: none;
}
}
Loading…
Cancel
Save