Skip to content

Instantly share code, notes, and snippets.

View codiini's full-sized avatar

Iniubong Obonguko codiini

View GitHub Profile
@codiini
codiini / poll.js
Created August 1, 2022 19:45
Restrict explicit content with Gatsby functions
import { collection } from "../utils/mongodb"
export default async function handler(req, res) {
try {
//Accept asset Id to search db for image with a status type of moderation
const moderatedImage = await collection.findOne({
asset_id: req.body.asset_id,
notification_type: "moderation",
})
//if the image is found, return the image
@codiini
codiini / index.module.css
Created August 1, 2022 19:43
Restric explicit content with Gatsby functions
.wrapper {
padding-top: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.title {
font-size: 2em;
@codiini
codiini / index.js
Created August 1, 2022 19:41
Restricing explicit content upload with Gatsby cloud functions
import React, { useState } from "react"
import * as styles from "../components/index.module.css"
const IndexPage = () => {
const [file, setFile] = useState()
const [uploadedImg, setUploadedImg] = useState()
const [moderatedImage, setModeratedImage] = useState()
const [isLoading, setIsLoading] = useState(false)
const [isError, setIsError] = useState(false)
@codiini
codiini / upload.js
Last active August 1, 2022 19:37
Restrict explicit content upload using Gatsby functions
//first require all dependencies
require("dotenv").config()
const cloudinary = require("cloudinary").v2
let streamifier = require("streamifier")
//Here we'll configure the cloudinary API
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
})

Keybase proof

I hereby claim:

  • I am codiini on github.
  • I am iniubong (https://keybase.io/iniubong) on keybase.
  • I have a public key ASCGYqXjzjhk45J-NekWqfX8pvH3vxLPDTKQJKT83gOK-go

To claim this, I am signing this object: