Run prettier

This commit is contained in:
Kevin Kandlbinder 2022-02-13 18:34:38 +00:00 committed by GitHub
parent 5ce412b622
commit 3ba289e1b1
15 changed files with 266 additions and 175 deletions

View file

@ -8,10 +8,10 @@ published: 2018-03-10 22:00:00
author:
name: Kevin Kandlbinder
embeddedImagesLocal:
- './assets/001-free-pizza/firefox_2018-03-10_11-51-08-e1520680515546.png'
- "./assets/001-free-pizza/firefox_2018-03-10_11-51-08-e1520680515546.png"
---
import { getImage, GatsbyImage } from 'gatsby-plugin-image';
import { getImage, GatsbyImage } from "gatsby-plugin-image";
> „Never trust user input“
@ -32,8 +32,9 @@ Nachdem ich das sah war die Challenge nicht mehr zu ignorieren: ICH WILL GEWINNE
Also habe ich mich durch den Code gewühlt und mir fielen mehrere Variablen auf, die offensichtlich für die Gewinnchancen zuständig sind. (Fun Fact: Die Chance beim ersten Versuch ist größer als bei allen weiteren) Als ich aber mit denen ein bisschen ohne Ergebnis rumgespielt habe, habe ich mich direkt in die Funktionen gesetzt und nachvollzogen was das Programm genau macht wenn ich den Button drücke, und da war es: In Zeile 203
fand sich die Funktion „win“…
<div>
<GatsbyImage alt='win();' image={getImage(props.localImages[0])} />
<GatsbyImage alt="win();" image={getImage(props.localImages[0])} />
</div>
Aber das kann doch nicht funktionieren… Die Web-Sicherheit…
@ -43,11 +44,19 @@ Aber das kann doch nicht funktionieren… Die Web-Sicherheit…
Also nichts wie ab damit in die Konsole und…
<div style="display: flex; align-items: center; gap: 20px;">
<img src="./assets/001-free-pizza/2018-03-10_11-52-49.gif" alt="Konsole" width="50%" />
<img src="./assets/001-free-pizza/2018-03-10_11-52-01.gif" alt="Casino" width="50%" />
<img
src="./assets/001-free-pizza/2018-03-10_11-52-49.gif"
alt="Konsole"
width="50%"
/>
<img
src="./assets/001-free-pizza/2018-03-10_11-52-01.gif"
alt="Casino"
width="50%"
/>
</div>
…gewonnen, der Code war besiegt, die Challenge gemeistert, die Web-Sicherheit im A**** und ich zufrieden. Toll. Aber was nun? Sich ganz viele Gutscheine auf Prepaid-Nummern holen? Zu anstrengend. Pizza.de Bescheid sagen? Ja, aber nicht genug… Darüber schreiben und eine Moral für jeden Entwickler draus ziehen? Ja, das klingt gut!
…gewonnen, der Code war besiegt, die Challenge gemeistert, die Web-Sicherheit im A\*\*\*\* und ich zufrieden. Toll. Aber was nun? Sich ganz viele Gutscheine auf Prepaid-Nummern holen? Zu anstrengend. Pizza.de Bescheid sagen? Ja, aber nicht genug… Darüber schreiben und eine Moral für jeden Entwickler draus ziehen? Ja, das klingt gut!
## Die Moral von der Geschicht...
@ -55,4 +64,13 @@ Also nichts wie ab damit in die Konsole und…
Das Casino sollte im Hintergrund seine Ergebnisse auf dem Server generieren, auch wenn es eine kurze Ladezeit gäbe und vom Server einen Token bekommen, mit dem der Gewinn abgeholt werden könnte. Somit würde der Server entscheiden ob ein Gutschein herausgegeben wird und nicht ein hobbyloser Typ mit einem PC.
<small>Importiert aus altem Blog - <a href="https://web.archive.org/web/20201216152631/https://blog.1in9.net/2018/03/never-trust-user-input-gratis-pizza/" target="_blank" rel="noreferrer ">Archiviertes Original</a></small>
<small>
Importiert aus altem Blog -{" "}
<a
href="https://web.archive.org/web/20201216152631/https://blog.1in9.net/2018/03/never-trust-user-input-gratis-pizza/"
target="_blank"
rel="noreferrer "
>
Archiviertes Original
</a>
</small>

View file

@ -19,15 +19,11 @@ Today I want to tell you the story of a business investor, amazing ideas, unregu
So put on your seatbelts, grab your popcorn, we're jumping right into the chat-log!
<Chatbox open="bottom">
<Chatmsg name="Megan">
Hello
</Chatmsg>
<Chatmsg name="Megan">Hello</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Hi
</Chatmsg>
<Chatmsg name="Megan">
How's it going?
</Chatmsg>
<Chatmsg name="Megan">How's it going?</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Can't complain, how about you?
</Chatmsg>
@ -48,59 +44,51 @@ Wasting time here is the most fun, because they just want to get to their scammy
It's not immoral to lie to a scammer... right?
<Chatbox open="both">
<Chatmsg name="Megan">
Where does your family live?
</Chatmsg>
<Chatmsg name="Megan">Where does your family live?</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Just south of Philly
</Chatmsg>
<Chatmsg name="Megan">
I work at the coca cola company, but I'm also investing in crypto. What about you?
I work at the coca cola company, but I'm also investing in crypto. What
about you?
</Chatmsg>
<Chatmsg dir="out" name="Kevin">
I do not work at the coca cola company.
</Chatmsg>
<Chatmsg name="Megan">
Where do you work?
</Chatmsg>
<Chatmsg name="Megan">Where do you work?</Chatmsg>
<Chatmsg dir="out" name="Kevin">
I work at a nightclub as a barkeeper
</Chatmsg>
<Chatmsg name="Megan">
Do you make good money with that?
</Chatmsg>
<Chatmsg name="Megan">Do you make good money with that?</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Can't complain, I recently inherited a huge sum of money
</Chatmsg>
<Chatmsg name="Megan">
Have you thought about any business?
</Chatmsg>
<Chatmsg name="Megan">Have you thought about any business?</Chatmsg>
</Chatbox>
Oh Megan, you would not *believe* just how many amazing business ideas I have...
Oh Megan, you would not _believe_ just how many amazing business ideas I have...
<Chatbox open="both">
<Chatmsg dir="out" name="Kevin">
Ok, hear me out...
<hr/>
<hr />
Vapes, but cats and dogs can use them!
</Chatmsg>
<Chatmsg name="Megan">
That sounds like a great idea.
</Chatmsg>
<Chatmsg name="Megan">That sounds like a great idea.</Chatmsg>
</Chatbox>
No it absolutely does not, but she can't say that because she still wants me to invest in her crypto scam. 🙂
<Chatbox open="both">
<Chatmsg name="Megan">
Have you ever thought about crypto?
</Chatmsg>
<Chatmsg name="Megan">Have you ever thought about crypto?</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Actually I have. That is another business idea of mine
<hr/>
Organs, but they're NFTs! Right now there's the legal donation system, illegal black markets, everything is not very transparent.
Now imagine every organ was an NFT!<br/><br/>
<hr />
Organs, but they're NFTs! Right now there's the legal donation system,
illegal black markets, everything is not very transparent. Now imagine
every organ was an NFT!
<br />
<br />
Democratizing the Organ market one transaction at a time.
</Chatmsg>
</Chatbox>
@ -110,19 +98,30 @@ But appearently my idea would work perfectly with her investment opportunity!
<Chatbox open="top">
<Chatmsg name="Megan">
<Chatblah/><Chatblah/><Chatblah/>crypto investment<Chatblah/><Chatblah/> and I love NFTs <Chatblah/> looking into minting some. <Chatblah/><Chatblah/><Chatblah/><Chatblah/> and your NFTs could work with that! <Chatblah/><Chatblah/><Chatblah/><Chatblah/><Chatblah/> with my investment company based in Denmark!
<Chatblah />
<Chatblah />
<Chatblah />
crypto investment
<Chatblah />
<Chatblah /> and I love NFTs <Chatblah /> looking into minting some. <Chatblah />
<Chatblah />
<Chatblah />
<Chatblah /> and your NFTs could work with that! <Chatblah />
<Chatblah />
<Chatblah />
<Chatblah />
<Chatblah /> with my investment company based in Denmark!
</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Denmark? That's really close to where I live. Where exactly is the company, so I can go there and give them the money directly?
</Chatmsg>
<Chatmsg name="Megan">
What do you mean? There is no need to travel
Denmark? That's really close to where I live. Where exactly is the
company, so I can go there and give them the money directly?
</Chatmsg>
<Chatmsg name="Megan">What do you mean? There is no need to travel</Chatmsg>
<Chatmsg dir="out" name="Kevin">
Oh it's no problem. It's really not far, and we can save on transaction fees if I bring the money directly!
Oh it's no problem. It's really not far, and we can save on transaction
fees if I bring the money directly!
</Chatmsg>
<Chatnotice>Megan has cleared the chat</Chatnotice>
</Chatbox>
Weird... Looks like Megan did not want me to visit her amazing investment company in Denmark... 😢

View file

@ -32,6 +32,6 @@ const LanguageSwitcher = () => {
</div>
</div>
);
}
};
export default LanguageSwitcher
export default LanguageSwitcher;

View file

@ -9,8 +9,8 @@ import OffScreenNav from "./offscreenNav";
import useSiteMetadata from "../helpers/useSiteMetadata";
type NavigationProps = {
isHome?: boolean
}
isHome?: boolean;
};
const Navigation = ({ isHome }: NavigationProps) => {
let [atTop, setAtTop] = useState(false);

View file

@ -8,9 +8,9 @@ import { X } from "lucide-react";
import useSiteMetadata from "../helpers/useSiteMetadata";
type OffScreenNavProps = {
active: boolean,
close: () => void
}
active: boolean;
close: () => void;
};
const OffScreenNav = ({ active, close }: OffScreenNavProps) => {
const { t } = useTranslation();

View file

@ -1,58 +1,72 @@
import React, { useEffect, useRef, useState } from "react";
import anime, { AnimeTimelineInstance } from "animejs";
import _uniqueId from 'lodash/uniqueId';
import {useMediaQuery} from '@react-hook/media-query'
import _uniqueId from "lodash/uniqueId";
import { useMediaQuery } from "@react-hook/media-query";
import * as styles from "./Chatbox.module.scss";
const Chatblah = () => {
const animeRef = useRef<AnimeTimelineInstance>(null)
const [myId,] = useState(_uniqueId)
const reduceMotion = useMediaQuery("(prefers-reduced-motion: reduce)")
const animeRef = useRef<AnimeTimelineInstance>(null);
const [myId] = useState(_uniqueId);
const reduceMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
useEffect(() => {
if(typeof window === "undefined") return; // Don't run on static build
if(reduceMotion) return; // Don't run the animation for users who prefer reduced motion
if (typeof window === "undefined") return; // Don't run on static build
if (reduceMotion) return; // Don't run the animation for users who prefer reduced motion
const speed = 0.25;
const delay = anime.random(100/speed, 1000/speed);
const delay = anime.random(100 / speed, 1000 / speed);
animeRef.current = anime.timeline({
targets: "#chatblah-"+myId,
targets: "#chatblah-" + myId,
loop: true,
easing: "easeInOutSine"
})
easing: "easeInOutSine",
});
const tl = animeRef.current
const tl = animeRef.current;
tl.add({
duration: 250/speed,
opacity: [0, .25],
easing: "linear"
}, delay).add({
duration: 1000/speed,
rotate: [anime.random(-5, 5)+"deg", anime.random(-10, 10)+"deg"],
translateY: [0, anime.random(0, -2)+"px"],
translateX: [0, anime.random(-2, 2)+"px"],
}, delay).add({
duration: 500/speed,
opacity: [.25, 0],
easing: "linear"
}, delay+(500/speed))
tl.add(
{
duration: 250 / speed,
opacity: [0, 0.25],
easing: "linear",
},
delay
)
.add(
{
duration: 1000 / speed,
rotate: [
anime.random(-5, 5) + "deg",
anime.random(-10, 10) + "deg",
],
translateY: [0, anime.random(0, -2) + "px"],
translateX: [0, anime.random(-2, 2) + "px"],
},
delay
)
.add(
{
duration: 500 / speed,
opacity: [0.25, 0],
easing: "linear",
},
delay + 500 / speed
);
return () => {
if(animeRef.current) {
if (animeRef.current) {
animeRef.current.pause();
animeRef.current = null;
}
}
}, [myId, reduceMotion])
};
}, [myId, reduceMotion]);
return <div className={styles.chatBlah} id={"chatblah-"+myId}>
return (
<div className={styles.chatBlah} id={"chatblah-" + myId}>
<span>blah</span>
</div>
}
);
};
export default Chatblah
export default Chatblah;

View file

@ -4,17 +4,38 @@ import { useTranslation } from "react-i18next";
import * as styles from "./Chatbox.module.scss";
type ChatboxProps = {
open?: string
}
open?: string;
};
const Chatbox = ({children, open}: React.PropsWithChildren<ChatboxProps>) => {
const {t} = useTranslation();
const Chatbox = ({ children, open }: React.PropsWithChildren<ChatboxProps>) => {
const { t } = useTranslation();
return <div className={styles.chatbox + (open === "top" ? " " + styles.openTop : "") + (open === "bottom" ? " " + styles.openBottom : "") + (open === "both" ? " " + styles.openBoth : "")}>
<span className={styles.screenReader}>-- {open === "top" || open === "both" ? t("blog.scambox.chatbox.resume") : t("blog.scambox.chatbox.begin")} --</span>
return (
<div
className={
styles.chatbox +
(open === "top" ? " " + styles.openTop : "") +
(open === "bottom" ? " " + styles.openBottom : "") +
(open === "both" ? " " + styles.openBoth : "")
}
>
<span className={styles.screenReader}>
--{" "}
{open === "top" || open === "both"
? t("blog.scambox.chatbox.resume")
: t("blog.scambox.chatbox.begin")}{" "}
--
</span>
{children}
<span className={styles.screenReader}>-- {open === "bottom" || open === "both" ? t("blog.scambox.chatbox.interrupt") : t("blog.scambox.chatbox.end")} --</span>
<span className={styles.screenReader}>
--{" "}
{open === "bottom" || open === "both"
? t("blog.scambox.chatbox.interrupt")
: t("blog.scambox.chatbox.end")}{" "}
--
</span>
</div>
}
);
};
export default Chatbox
export default Chatbox;

View file

@ -1,27 +1,40 @@
import React from "react";
import { useTranslation } from "react-i18next";
import * as styles from "./Chatbox.module.scss"
import * as styles from "./Chatbox.module.scss";
type ChatmsgProps = {
name?: string,
timestamp?: string,
color?: string,
dir: string
}
name?: string;
timestamp?: string;
color?: string;
dir: string;
};
const Chatmsg = (props: React.PropsWithChildren<ChatmsgProps>) => {
const {t} = useTranslation();
const { t } = useTranslation();
return <div className={styles.chatmsg + (props.dir === "out" ? " " + styles.alignRight : "")}>
{props.name && <span className={styles.name}>{props.name}<span className={styles.screenReader}> {t("blog.scambox.chatbox.says")}</span></span>}
return (
<div
className={
styles.chatmsg +
(props.dir === "out" ? " " + styles.alignRight : "")
}
>
{props.name && (
<span className={styles.name}>
{props.name}
<span className={styles.screenReader}>
{" "}
{t("blog.scambox.chatbox.says")}
</span>
</span>
)}
<div className={styles.chatbubble}>
<div>
{props.children}
</div>
<div>{props.children}</div>
{props.timestamp && <span>{props.timestamp}</span>}
</div>
</div>
}
);
};
export default Chatmsg
export default Chatmsg;

View file

@ -1,11 +1,13 @@
import React from "react";
import * as styles from "./Chatbox.module.scss"
import * as styles from "./Chatbox.module.scss";
const Chatnotice = (props: React.PropsWithChildren<{}>) => {
return <div className={styles.chatnotice}>
return (
<div className={styles.chatnotice}>
<span>{props.children}</span>
</div>
}
);
};
export default Chatnotice
export default Chatnotice;

View file

@ -6,14 +6,21 @@ import { useTranslation } from "gatsby-plugin-react-i18next";
import useSiteMetadata from "../helpers/useSiteMetadata";
type SEOProps = {
description?: string,
meta?: any[],
title: string,
speakable?: any,
image?: string
}
description?: string;
meta?: any[];
title: string;
speakable?: any;
image?: string;
};
function SEO({ description, meta, title, speakable, image, children }: React.PropsWithChildren<SEOProps>) {
function SEO({
description,
meta,
title,
speakable,
image,
children,
}: React.PropsWithChildren<SEOProps>) {
const { t } = useTranslation();
const { site } = useStaticQuery(
graphql`

View file

@ -6,16 +6,25 @@ import { Link, Trans } from "gatsby-plugin-react-i18next";
import LanguageSwitcher from "../components/languageSwitcher";
type LayoutProps = {
description?: string,
meta?: any[],
title: string,
transparentTopbar?: boolean,
seoAdditional?: any,
image?: string,
speakable?: any
}
description?: string;
meta?: any[];
title: string;
transparentTopbar?: boolean;
seoAdditional?: any;
image?: string;
speakable?: any;
};
const Layout = ({description, meta, title, image, speakable, seoAdditional, transparentTopbar, children}: React.PropsWithChildren<LayoutProps>) => {
const Layout = ({
description,
meta,
title,
image,
speakable,
seoAdditional,
transparentTopbar,
children,
}: React.PropsWithChildren<LayoutProps>) => {
return (
<>
<SEO
@ -50,7 +59,7 @@ const Layout = ({description, meta, title, image, speakable, seoAdditional, tran
<LanguageSwitcher />
</>
);
}
};
Layout.defaultProps = {
module: `none`,

View file

@ -105,7 +105,9 @@ const DonatePage = (props) => {
id="payPalBtn"
href={
"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" +
encodeURIComponent(site.siteMetadata.payPalMail) +
encodeURIComponent(
site.siteMetadata.payPalMail
) +
"&item_name=" +
encodeURIComponent(site.siteMetadata.title) +
"&currency_code=EUR&image_url=" +

View file

@ -49,7 +49,8 @@ const SocialPage = ({ data }) => {
<p>
<Trans i18nKey="social.descriptionWithLink">
socialDescriptionWith<Link to="/friends/">Link</Link>
socialDescriptionWith
<Link to="/friends/">Link</Link>
</Trans>
</p>

View file

@ -43,7 +43,12 @@ const BlogListing = ({ data, pageContext }) => {
>
<div className={styles.sectionImage}>
<div className={styles.sectionBg}>
<StaticImage src="https://source.unsplash.com/gf8e6XvG_3E/300x150" alt={t("blog.section.scambox.name")}></StaticImage>
<StaticImage
src="https://source.unsplash.com/gf8e6XvG_3E/300x150"
alt={t(
"blog.section.scambox.name"
)}
></StaticImage>
</div>
<span className={styles.sectionName}>
{t("blog.section.scambox.name")}

View file

@ -30,7 +30,7 @@ const BlogPost = ({ data }) => {
{
"@type": "Person",
name: data.mdx.frontmatter.author.name,
url: "https://kevink.dev/blog/"
url: "https://kevink.dev/blog/",
},
],
})}