Skip to content

Commit

Permalink
pull 과정 충돌 해결 중
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunjin1109 committed Jun 8, 2024
2 parents df2ab0b + b763a23 commit a038712
Show file tree
Hide file tree
Showing 462 changed files with 47,501 additions and 525 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to Heroku

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install dependencies
working-directory: ./my-replicate-app
run: npm install

- name: Install Heroku CLI
run: curl https://cli-assets.heroku.com/install.sh | sh

- name: Authenticate with Heroku
env:
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
echo "machine api.heroku.com" > ~/.netrc
echo " login $HEROKU_EMAIL" >> ~/.netrc
echo " password $HEROKU_API_KEY" >> ~/.netrc
echo "machine git.heroku.com" >> ~/.netrc
echo " login $HEROKU_EMAIL" >> ~/.netrc
echo " password $HEROKU_API_KEY" >> ~/.netrc
- name: Add Heroku remote
run: git remote add heroku https://git.heroku.com/calm-eyrie-10609.git

- name: Set up Git for pushing to Heroku
run: |
git config --global user.email "[email protected]"
git config --global user.name "jaewon"
- name: Push to Heroku
run: git push heroku `git subtree split --prefix my-replicate-app main`:refs/heads/main --force
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

spirograph/public/assets/videos/humanSample.glb
spirograph/public/assets/videos/humanSample.glb
# Local Netlify folder
.netlify
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cors-anywhere"]
path = cors-anywhere
url = https://github.com/Rob--W/cors-anywhere.git
Empty file added app.json
Empty file.
1 change: 1 addition & 0 deletions cors-anywhere
Submodule cors-anywhere added at 70aaa2
1 change: 1 addition & 0 deletions my-replicate-app/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node index.js
27 changes: 18 additions & 9 deletions my-replicate-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,36 @@ import FormData from "form-data";
import path from "path";

dotenv.config();
//병합 전

const REPLICATE_API_TOKEN = process.env.REPLICATE_API_TOKEN;
const JWT2 =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI3NWQxNDhiNS1kMzQ5LTRlZmUtYTcwYy04YjA2NmIwYWVlYjciLCJlbWFpbCI6InJ5bHlubjEwMjlAbmF2ZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9LHsiaWQiOiJOWUMxIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjFlNjIwM2Q0NjIzY2I3ZTBlODFkIiwic2NvcGVkS2V5U2VjcmV0IjoiZjczNDVlNDIxZjkzNjNkNjJiYzU3ZWQ5ZTBlY2Y5NzQ5YzEzMjRhM2Q1YjE1ZmQwY2U4MTk4ZDU5ZTBmM2NiMSIsImlhdCI6MTcxMTA4Mzg5M30.ofdRllbxJO2Qk0-co3FXaPpou6EBRqE9gImfu6iR06Q";
const JWT2 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiI3NWQxNDhiNS1kMzQ5LTRlZmUtYTcwYy04YjA2NmIwYWVlYjciLCJlbWFpbCI6InJ5bHlubjEwMjlAbmF2ZXIuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInBpbl9wb2xpY3kiOnsicmVnaW9ucyI6W3siaWQiOiJGUkExIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9LHsiaWQiOiJOWUMxIiwiZGVzaXJlZFJlcGxpY2F0aW9uQ291bnQiOjF9XSwidmVyc2lvbiI6MX0sIm1mYV9lbmFibGVkIjpmYWxzZSwic3RhdHVzIjoiQUNUSVZFIn0sImF1dGhlbnRpY2F0aW9uVHlwZSI6InNjb3BlZEtleSIsInNjb3BlZEtleUtleSI6IjFlNjIwM2Q0NjIzY2I3ZTBlODFkIiwic2NvcGVkS2V5U2VjcmV0IjoiZjczNDVlNDIxZjkzNjNkNjJiYzU3ZWQ5ZTBlY2Y5NzQ5YzEzMjRhM2Q1YjE1ZmQwY2U4MTk4ZDU5ZTBmM2NiMSIsImlhdCI6MTcxMTA4Mzg5M30.ofdRllbxJO2Qk0-co3FXaPpou6EBRqE9gImfu6iR06Q"; // Replace with your actual JWT token

const PORT = process.env.PORT || 5002;
const pipeline = promisify(stream.pipeline);
const app = express();

const host = "127.0.0.1";
const upload = multer({ dest: "uploads/" });
const __dirname = path.dirname(fileURLToPath(import.meta.url));

app.use(bodyParser.json());

app.use(
cors({
origin: "http://localhost:3000",
origin: ['http://localhost:3000', 'http://localhost:8888', 'https://spirographmaker.netlify.app'],
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
credentials: true,
allowedHeaders: 'Content-Type, Authorization',
})
);

const urlStatus = {};

async function pinFileToIPFS(filePath) {
const url = "https://api.pinata.cloud/pinning/pinFileToIPFS";

const proxyUrl = "https://frozen-scrubland-19711-6243810201c8.herokuapp.com/";
const targetUrl = "https://api.pinata.cloud/pinning/pinFileToIPFS";
const url = `${proxyUrl}${targetUrl}`;

let data = new FormData();
data.append("file", fs.createReadStream(filePath));
data.append("pinataOptions", '{"cidVersion": 1}');
Expand All @@ -58,6 +63,11 @@ 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}`;

const data = JSON.stringify({
pinataOptions: { cidVersion: 1 },
pinataMetadata: {
Expand Down Expand Up @@ -88,8 +98,7 @@ 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,
Expand Down Expand Up @@ -149,7 +158,7 @@ app.post("/upload-to-ipfs", upload.single("image"), async (req, res) => {
app.post("/save-url", async (req, res) => {
console.log("/save-url 경로로 POST 요청 받음");
const { url, status1, status2 } = req.body;
console.log("Request Body:", req.body); // 추가된 로그
console.log("Request Body:", req.body);
if (!url || !status1 || !status2) {
console.log("URL이 요청 본문에 없음");
return res.status(400).send("URL is required");
Expand Down
16 changes: 16 additions & 0 deletions my-replicate-app/node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions my-replicate-app/node_modules/.bin/mkdirp.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions my-replicate-app/node_modules/.bin/mkdirp.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a038712

Please sign in to comment.