aufacicenta / pulsemarkets

pulsemarkets-v2-web.vercel.app
1 stars 3 forks source link

authenticate the request, only this server should be able to execute this endpoi... #146

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://api.github.com/aufacicenta/pulsemarkets/blob/22ddad1e2ff6df181ef3ad5577ab44a9a0c20db3/app/src/pages/api/prompt-wars/generate-random-image.ts#L13


// https://source.unsplash.com/random/512x512?sport - this is unsplash random photo generator, we can also feed the Stable Diffusion API with random prompts created by ChatGPT

// Once an image is created, store its IPFS hash in a database with an is_used flag set to false, set to true when we've used this image
// Or don't store anything, just chain the API calls, create a market just after this endpoint

import { NextApiRequest, NextApiResponse } from "next";

// @TODO fetch images from generators, upload them to IPFS and create a market
// labels: 500 USDT
export default async function Fn(_request: NextApiRequest, response: NextApiResponse) {
  try {
    // @TODO authenticate the request, only this server should be able to execute this endpoint
    // labels: 100 USDT

    response.status(200).json({ image_uri: "TODO" });
  } catch (error) {
    console.log(error);
    response.status(500).json({ error: (error as Error).message });
  }
}
netpoe commented 1 year ago

No need to authenticate, the contracts throw if it's not time to call the functions.