route is not working...
This commit is contained in:
parent
b5df196d96
commit
8eec6746fc
|
|
@ -0,0 +1,25 @@
|
||||||
|
// // import chromium from "@sparticuz/chromium";
|
||||||
|
// // import chromium from "chrome-aws-lambda";
|
||||||
|
// const chromium = require("chrome-aws-lambda");
|
||||||
|
// import { NextRequest, NextResponse } from "next/server";
|
||||||
|
// // import * as puppeteer from "puppeteer-core";
|
||||||
|
// import puppeteer from "puppeteer";
|
||||||
|
|
||||||
|
// export default async function getBrowser() {
|
||||||
|
// return puppeteer.launch({
|
||||||
|
// args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
||||||
|
// defaultViewport: chromium.defaultViewport,
|
||||||
|
// headless: false,
|
||||||
|
// // ignoreHTTPSErrors: true,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export async function GET(request: NextRequest) {
|
||||||
|
// const browser = await getBrowser();
|
||||||
|
// const page = await browser.newPage();
|
||||||
|
// await page.goto("https://naver.com");
|
||||||
|
// const buffer = await page.screenshot({ type: "png" });
|
||||||
|
// await browser.close();
|
||||||
|
// const base64Image = buffer.toString("base64");
|
||||||
|
// return NextResponse.json({ image: base64Image });
|
||||||
|
// }
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
// import chromium from "@sparticuz/chromium";
|
|
||||||
// import chromium from "chrome-aws-lambda";
|
|
||||||
const chromium = require("chrome-aws-lambda");
|
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
|
||||||
// import * as puppeteer from "puppeteer-core";
|
|
||||||
import puppeteer from "puppeteer";
|
|
||||||
|
|
||||||
export default async function getBrowser() {
|
|
||||||
return puppeteer.launch({
|
|
||||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
|
||||||
defaultViewport: chromium.defaultViewport,
|
|
||||||
headless: false,
|
|
||||||
// ignoreHTTPSErrors: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const browser = await getBrowser();
|
|
||||||
const page = await browser.newPage();
|
|
||||||
await page.goto("https://naver.com");
|
|
||||||
const buffer = await page.screenshot({ type: "png" });
|
|
||||||
await browser.close();
|
|
||||||
const base64Image = buffer.toString("base64");
|
|
||||||
return NextResponse.json({ image: base64Image });
|
|
||||||
}
|
|
||||||
|
|
@ -9,8 +9,6 @@ export default function Home() {
|
||||||
codeUrl: "/unity/test-project/build.wasm",
|
codeUrl: "/unity/test-project/build.wasm",
|
||||||
});
|
});
|
||||||
|
|
||||||
// We'll round the loading progression to a whole number to represent the
|
|
||||||
// percentage of the Unity Application that has loaded.
|
|
||||||
const loadingPercentage = Math.round(loadingProgression * 100);
|
const loadingPercentage = Math.round(loadingProgression * 100);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -21,8 +19,6 @@ export default function Home() {
|
||||||
</div>
|
</div>
|
||||||
<div className="relative h-[600px] w-[800px]">
|
<div className="relative h-[600px] w-[800px]">
|
||||||
{isLoaded === false && (
|
{isLoaded === false && (
|
||||||
// We'll conditionally render the loading overlay if the Unity
|
|
||||||
// Application is not loaded.
|
|
||||||
<div className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-gray-500">
|
<div className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-gray-500">
|
||||||
<p>Loading... ({loadingPercentage}%)</p>
|
<p>Loading... ({loadingPercentage}%)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue