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": [
"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) => {
const { method } = req
const db = await connectToDatabase()
switch (method) {
case "POST":
case 'POST':
if (!req.body || !req.body.url || !req.body.cluster) {
res.status(400).json({ success: false, message: "Invalid body" })
return
return res.status(400).json({ success: false, message: 'Invalid body' })
}
try {
await fetch(req.body.url)
} catch {
res.status(400).json({ success: false, message: "Invalid URL" })
return
return res.status(400).json({ success: false, message: 'Invalid URL' })
}
try {
@ -28,19 +24,15 @@ export default async (req, res) => {
cluster: req.body.cluster
})
} catch {
res.status(400).json({ success: false, message: "Error Inserting to DB" })
return
return res.status(400).json({ success: false, message: 'Error Inserting to DB' })
}
res.status(200).json({ url: req.body.url })
break
case "DELETE":
case 'DELETE':
if (!req.query.url) {
res.status(400).json({ success: false, message: "Invalid body" })
return
return res.status(400).json({ success: false, message: 'Invalid body' })
}
try {
@ -49,17 +41,14 @@ export default async (req, res) => {
})
if (deletedCount == 0) {
res.status(400).json({ success: false, message: "Not Found" })
return
return res.status(400).json({ success: false, message: 'Not Found' })
}
} catch {
res.status(400).json({ success: false, message: "Error Deleting from DB" })
return
return res.status(400).json({ success: false, message: 'Error Deleting from DB' })
}
res.status(200).json({ url: req.query.url })
break
default:
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
@ -26,6 +26,7 @@ export default async function connectToDatabase() {
}
})
}
cached.conn = await cached.promise
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 = {
siteMetadata: {
siteUrl: "https://www.pingbot.cf",
title: "Ping Bot",
description: "Keep your apps alive on replit.com or glitch.com"
siteUrl: 'https://www.pingbot.cf',
title: 'Ping Bot',
description: 'Keep your apps alive on replit.com or glitch.com'
},
plugins: [
"gatsby-plugin-react-helmet",
"gatsby-plugin-transition-link",
"gatsby-plugin-sass",
'gatsby-plugin-react-helmet',
'gatsby-plugin-transition-link',
'gatsby-plugin-sass',
{
resolve: "gatsby-plugin-manifest",
resolve: 'gatsby-plugin-manifest',
options: {
name: "pingbot",
short_name: "pingbot",
start_url: "/",
background_color: "#9517cf",
theme_color: "#9517cf",
display: "minimal-ui",
icon: "src/images/icon.png", // This path is relative to the root of the site.
name: 'pingbot',
short_name: 'pingbot',
start_url: '/',
background_color: '#9517cf',
theme_color: '#9517cf',
display: 'minimal-ui',
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({
baseURL: "/api"
baseURL: '/api'
})
export default instance

View File

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

View File

@ -3,6 +3,8 @@ $fonts: "-apple-system, Roboto, sans-serif, serif"
body
color: #fff
background-color: #111
background: url("../images/blob.svg") no-repeat center center fixed
background-size: cover
margin: 0
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 AniLink from "gatsby-plugin-transition-link/AniLink"
import React from 'react'
import AniLink from 'gatsby-plugin-transition-link/AniLink'
import Seo from "../components/seo"
import Seo from '../components/seo'
const NotFoundPage = () => {
return (

View File

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

View File

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

View File

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

View File

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