add svg blob

This commit is contained in:
Medzik 2021-08-19 21:13:03 +00:00
parent 53c668c616
commit 031cd1236d
14 changed files with 89 additions and 96 deletions

View File

@ -25,7 +25,7 @@
], ],
"quotes": [ "quotes": [
"error", "error",
"double" "single"
] ]
} }
} }

View File

@ -1,25 +1,21 @@
import fetch from "node-fetch" import fetch from 'node-fetch'
import connectToDatabase from "./lib/dbConnect" import connectToDatabase from './lib/dbConnect'
export default async (req, res) => { export default async (req, res) => {
const { method } = req const { method } = req
const db = await connectToDatabase() const db = await connectToDatabase()
switch (method) { switch (method) {
case "POST": case 'POST':
if (!req.body || !req.body.url || !req.body.cluster) { if (!req.body || !req.body.url || !req.body.cluster) {
res.status(400).json({ success: false, message: "Invalid body" }) return res.status(400).json({ success: false, message: 'Invalid body' })
return
} }
try { try {
await fetch(req.body.url) await fetch(req.body.url)
} catch { } catch {
res.status(400).json({ success: false, message: "Invalid URL" }) return res.status(400).json({ success: false, message: 'Invalid URL' })
return
} }
try { try {
@ -28,19 +24,15 @@ export default async (req, res) => {
cluster: req.body.cluster cluster: req.body.cluster
}) })
} catch { } catch {
res.status(400).json({ success: false, message: "Error Inserting to DB" }) return res.status(400).json({ success: false, message: 'Error Inserting to DB' })
return
} }
res.status(200).json({ url: req.body.url }) res.status(200).json({ url: req.body.url })
break break
case "DELETE": case 'DELETE':
if (!req.query.url) { if (!req.query.url) {
res.status(400).json({ success: false, message: "Invalid body" }) return res.status(400).json({ success: false, message: 'Invalid body' })
return
} }
try { try {
@ -49,17 +41,14 @@ export default async (req, res) => {
}) })
if (deletedCount == 0) { if (deletedCount == 0) {
res.status(400).json({ success: false, message: "Not Found" }) return res.status(400).json({ success: false, message: 'Not Found' })
return
} }
} catch { } catch {
res.status(400).json({ success: false, message: "Error Deleting from DB" }) return res.status(400).json({ success: false, message: 'Error Deleting from DB' })
return
} }
res.status(200).json({ url: req.query.url }) res.status(200).json({ url: req.query.url })
break break
default: default:
res.status(404).json({ success: false }) res.status(404).json({ success: false })

View File

@ -1,4 +1,4 @@
import { MongoClient } from "mongodb" import { MongoClient } from 'mongodb'
const { MONGODB_URI, MONGODB_DB, MONGODB_COLLECTION } = process.env const { MONGODB_URI, MONGODB_DB, MONGODB_COLLECTION } = process.env
@ -26,6 +26,7 @@ export default async function connectToDatabase() {
} }
}) })
} }
cached.conn = await cached.promise cached.conn = await cached.promise
return cached.conn return cached.conn

View File

@ -1 +1 @@
import "./src/css/base.sass" import './src/css/base.sass'

View File

@ -1,23 +1,23 @@
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
siteUrl: "https://www.pingbot.cf", siteUrl: 'https://www.pingbot.cf',
title: "Ping Bot", title: 'Ping Bot',
description: "Keep your apps alive on replit.com or glitch.com" description: 'Keep your apps alive on replit.com or glitch.com'
}, },
plugins: [ plugins: [
"gatsby-plugin-react-helmet", 'gatsby-plugin-react-helmet',
"gatsby-plugin-transition-link", 'gatsby-plugin-transition-link',
"gatsby-plugin-sass", 'gatsby-plugin-sass',
{ {
resolve: "gatsby-plugin-manifest", resolve: 'gatsby-plugin-manifest',
options: { options: {
name: "pingbot", name: 'pingbot',
short_name: "pingbot", short_name: 'pingbot',
start_url: "/", start_url: '/',
background_color: "#9517cf", background_color: '#9517cf',
theme_color: "#9517cf", theme_color: '#9517cf',
display: "minimal-ui", display: 'minimal-ui',
icon: "src/images/icon.png", // This path is relative to the root of the site. icon: 'src/images/icon.png', // This path is relative to the root of the site.
} }
} }
] ]

View File

@ -1,7 +1,7 @@
import axios from "axios" import axios from 'axios'
const instance = axios.create({ const instance = axios.create({
baseURL: "/api" baseURL: '/api'
}) })
export default instance export default instance

View File

@ -1,7 +1,7 @@
import React from "react" import React from 'react'
import { useStaticQuery, graphql } from "gatsby" import { useStaticQuery, graphql } from 'gatsby'
import PropTypes from "prop-types" import PropTypes from 'prop-types'
import { Helmet } from "react-helmet" import { Helmet } from 'react-helmet'
function Seo(props) { function Seo(props) {
const { site } = useStaticQuery( const { site } = useStaticQuery(
@ -22,26 +22,26 @@ function Seo(props) {
return ( return (
<Helmet <Helmet
title={props.title + " - " + defaultTitle} title={props.title + ' - ' + defaultTitle}
meta={[ meta={[
{ {
name: "description", name: 'description',
content: defaultDesc, content: defaultDesc,
}, },
{ {
property: "og:title", property: 'og:title',
content: props.title || defaultTitle, content: props.title || defaultTitle,
}, },
{ {
property: "og:description", property: 'og:description',
content: defaultDesc, content: defaultDesc,
}, },
{ {
property: "og:type", property: 'og:type',
content: "website", content: 'website',
}, },
{ {
property: "theme-color", property: 'theme-color',
content: props.embedColor content: props.embedColor
} }
].concat(props.meta)} ].concat(props.meta)}
@ -50,9 +50,9 @@ function Seo(props) {
} }
Seo.defaultProps = { Seo.defaultProps = {
lang: "en", lang: 'en',
meta: [], meta: [],
embedColor: "#9517cf" embedColor: '#9517cf'
} }
Seo.propTypes = { Seo.propTypes = {

View File

@ -3,6 +3,8 @@ $fonts: "-apple-system, Roboto, sans-serif, serif"
body body
color: #fff color: #fff
background-color: #111 background-color: #111
background: url("../images/blob.svg") no-repeat center center fixed
background-size: cover
margin: 0 margin: 0
padding: 96px padding: 96px

1
src/images/blob.svg Normal file
View File

@ -0,0 +1 @@
<svg id="visual" viewBox="0 0 900 675" width="900" height="675" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><rect x="0" y="0" width="900" height="675" fill="#001220"></rect><defs><linearGradient id="grad1_0" x1="25%" y1="0%" x2="100%" y2="100%"><stop offset="23.333333333333336%" stop-color="#001220" stop-opacity="1"></stop><stop offset="76.66666666666666%" stop-color="#001220" stop-opacity="1"></stop></linearGradient></defs><defs><linearGradient id="grad2_0" x1="0%" y1="0%" x2="75%" y2="100%"><stop offset="23.333333333333336%" stop-color="#001220" stop-opacity="1"></stop><stop offset="76.66666666666666%" stop-color="#001220" stop-opacity="1"></stop></linearGradient></defs><g transform="translate(900, 0)"><path d="M0 393.8C-36.4 374.8 -72.9 355.8 -112.5 346.2C-152.1 336.6 -195 336.4 -231.4 318.6C-267.9 300.7 -298.1 265.2 -312.3 226.9C-326.5 188.6 -324.8 147.4 -335.7 109.1C-346.6 70.8 -370.2 35.4 -393.7 0L0 0Z" fill="#915a08"></path></g><g transform="translate(0, 675)"><path d="M0 -393.7C45.7 -396.2 91.4 -398.6 121.7 -374.5C151.9 -350.3 166.7 -299.6 197.5 -271.8C228.3 -244.1 275.1 -239.4 294.5 -214C313.8 -188.5 305.7 -142.3 317.7 -103.2C329.6 -64.1 361.7 -32 393.8 0L0 0Z" fill="#915a08"></path></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,7 +1,7 @@
import React from "react" import React from 'react'
import AniLink from "gatsby-plugin-transition-link/AniLink" import AniLink from 'gatsby-plugin-transition-link/AniLink'
import Seo from "../components/seo" import Seo from '../components/seo'
const NotFoundPage = () => { const NotFoundPage = () => {
return ( return (

View File

@ -1,15 +1,15 @@
import React from "react" import React from 'react'
import AniLink from "gatsby-plugin-transition-link/AniLink" import AniLink from 'gatsby-plugin-transition-link/AniLink'
import { ToastContainer, toast } from "react-toastify" import { ToastContainer, toast } from 'react-toastify'
import Seo from "../components/seo" import Seo from '../components/seo'
import axios from "../axios" import axios from '../axios'
import "../css/url.sass" import '../css/url.sass'
import "../css/notifications.sass" import '../css/notifications.sass'
const AddURLPage = () => { const AddURLPage = () => {
const [url, setURL] = React.useState("") const [url, setURL] = React.useState('')
const handleKeypress = e => { const handleKeypress = e => {
if (e.charCode === 13 || e.keyCode === 13) { if (e.charCode === 13 || e.keyCode === 13) {
@ -23,27 +23,27 @@ const AddURLPage = () => {
} }
const addURL = async () => { const addURL = async () => {
setURL("") setURL('')
if (url === "") { if (url === '') {
return toast("Empty", { return toast('Empty', {
type: "error" type: 'error'
}) })
} }
try { try {
const res = await axios.post("", { const res = await axios.post('', {
url: url, url: url,
cluster: 1 cluster: 1
}) })
const data = res.data const data = res.data
toast("Added " + data.url, { toast('Added ' + data.url, {
type: "success" type: 'success'
}) })
} catch (err) { } catch (err) {
let e = "" let e = ''
if (err.response && err.response.data.message) { if (err.response && err.response.data.message) {
e = err.response.data.message e = err.response.data.message
@ -52,7 +52,7 @@ const AddURLPage = () => {
} }
toast(e, { toast(e, {
type: "error" type: 'error'
}) })
} }
} }

View File

@ -1,15 +1,15 @@
import React from "react" import React from 'react'
import AniLink from "gatsby-plugin-transition-link/AniLink" import AniLink from 'gatsby-plugin-transition-link/AniLink'
import { ToastContainer, toast } from "react-toastify" import { ToastContainer, toast } from 'react-toastify'
import Seo from "../components/seo" import Seo from '../components/seo'
import axios from "../axios" import axios from '../axios'
import "../css/url.sass" import '../css/url.sass'
import "../css/notifications.sass" import '../css/notifications.sass'
const DeleteURLPage = () => { const DeleteURLPage = () => {
const [url, setURL] = React.useState("") const [url, setURL] = React.useState('')
const handleKeypress = e => { const handleKeypress = e => {
if (e.charCode === 13 || e.keyCode === 13) { if (e.charCode === 13 || e.keyCode === 13) {
@ -23,11 +23,11 @@ const DeleteURLPage = () => {
} }
const deleteURL = async () => { const deleteURL = async () => {
setURL("") setURL('')
if (url === "") { if (url === '') {
return toast("Empty", { return toast('Empty', {
type: "error" type: 'error'
}) })
} }
@ -36,11 +36,11 @@ const DeleteURLPage = () => {
const data = res.data const data = res.data
toast("Deleted " + data.url, { toast('Deleted ' + data.url, {
type: "success" type: 'success'
}) })
} catch (err) { } catch (err) {
let e = "" let e = ''
if (err.response && err.response.data.message) { if (err.response && err.response.data.message) {
e = err.response.data.message e = err.response.data.message
@ -49,7 +49,7 @@ const DeleteURLPage = () => {
} }
toast(e, { toast(e, {
type: "error" type: 'error'
}) })
} }
} }

View File

@ -1,7 +1,7 @@
import React from "react" import React from 'react'
import AniLink from "gatsby-plugin-transition-link/AniLink" import AniLink from 'gatsby-plugin-transition-link/AniLink'
import Seo from "../components/seo" import Seo from '../components/seo'
const LoginPage = () => { const LoginPage = () => {
return ( return (

View File

@ -1,7 +1,7 @@
import React from "react" import React from 'react'
import AniLink from "gatsby-plugin-transition-link/AniLink" import AniLink from 'gatsby-plugin-transition-link/AniLink'
import Seo from "../components/seo" import Seo from '../components/seo'
const LoginPage = () => { const LoginPage = () => {
return ( return (