From 9f4aef35d068b17d6819d1150fd9a953725d80a1 Mon Sep 17 00:00:00 2001 From: GirlsLikeMyY Date: Sat, 8 Jun 2024 12:55:59 +0900 Subject: [PATCH] =?UTF-8?q?index=20host=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my-replicate-app/index.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/my-replicate-app/index.js b/my-replicate-app/index.js index 1c47b25..96b6090 100644 --- a/my-replicate-app/index.js +++ b/my-replicate-app/index.js @@ -15,7 +15,8 @@ import path from "path"; dotenv.config(); const REPLICATE_API_TOKEN = process.env.REPLICATE_API_TOKEN; -const JWT2 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI3NWQxNDhiNS1kMzQ5LTRlZmUtYTcwYy04YjA2NmIwYWVlYjciLCJlbWFpbCI6InJ5bHlubjEwMjlAbmF2ZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9LHsiaWQiOiJOWUMxIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjFlNjIwM2Q0NjIzY2I3ZTBlODFkIiwic2NvcGVkS2V5U2VjcmV0IjoiZjczNDVlNDIxZjkzNjNkNjJiYzU3ZWQ5ZTBlY2Y5NzQ5YzEzMjRhM2Q1YjE1ZmQwY2U4MTk4ZDU5ZTBmM2NiMSIsImlhdCI6MTcxMTA4Mzg5M30.ofdRllbxJO2Qk0-co3FXaPpou6EBRqE9gImfu6iR06Q"; // Replace with your actual JWT token +const JWT2 = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI3NWQxNDhiNS1kMzQ5LTRlZmUtYTcwYy04YjA2NmIwYWVlYjciLCJlbWFpbCI6InJ5bHlubjEwMjlAbmF2ZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9LHsiaWQiOiJOWUMxIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjFlNjIwM2Q0NjIzY2I3ZTBlODFkIiwic2NvcGVkS2V5U2VjcmV0IjoiZjczNDVlNDIxZjkzNjNkNjJiYzU3ZWQ5ZTBlY2Y5NzQ5YzEzMjRhM2Q1YjE1ZmQwY2U4MTk4ZDU5ZTBmM2NiMSIsImlhdCI6MTcxMTA4Mzg5M30.ofdRllbxJO2Qk0-co3FXaPpou6EBRqE9gImfu6iR06Q"; // Replace with your actual JWT token const PORT = process.env.PORT || 5002; const pipeline = promisify(stream.pipeline); @@ -28,17 +29,20 @@ app.use(bodyParser.json()); app.use( cors({ - origin: ['http://localhost:3000', 'http://localhost:8888', 'https://spirographmaker.netlify.app'], - methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', + origin: [ + "http://localhost:3000", + "http://localhost:8888", + "https://spirographmaker.netlify.app", + ], + methods: "GET,HEAD,PUT,PATCH,POST,DELETE", credentials: true, - allowedHeaders: 'Content-Type, Authorization', + allowedHeaders: "Content-Type, Authorization", }) ); const urlStatus = {}; async function pinFileToIPFS(filePath) { - const proxyUrl = "https://frozen-scrubland-19711-6243810201c8.herokuapp.com/"; const targetUrl = "https://api.pinata.cloud/pinning/pinFileToIPFS"; const url = `${proxyUrl}${targetUrl}`; @@ -63,7 +67,6 @@ async function pinFileToIPFS(filePath) { } const pinJSONToIPFS = async (json) => { - const proxyUrl = "https://frozen-scrubland-19711-6243810201c8.herokuapp.com/"; const targetUrl = "https://api.pinata.cloud/pinning/pinFileToIPFS"; const url = `${proxyUrl}${targetUrl}`; @@ -98,7 +101,8 @@ async function runReplicateModel(url, prompt) { auth: REPLICATE_API_TOKEN, }); - const model = "stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b"; + const model = + "stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b"; const input = { width: 768, height: 768, @@ -234,6 +238,6 @@ app.get("/check-status", (req, res) => { res.json(statusInfo); }); -app.listen(PORT, host, () => { +app.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}`); });