Spaces:
Paused
Paused
Vo Hoang Minh commited on
Commit ·
f002fc5
1
Parent(s): 8066559
up
Browse files- entrypoint.sh +5 -2
- src/server.mjs +16 -4
entrypoint.sh
CHANGED
|
@@ -13,6 +13,9 @@ echo "Files in directory: $(ls -la)"
|
|
| 13 |
|
| 14 |
# Khởi động server Node.js
|
| 15 |
echo "Starting Node.js server..."
|
| 16 |
-
/usr/sbin/nginx -c /etc/nginx/nginx.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
node src/server.mjs
|
|
|
|
| 13 |
|
| 14 |
# Khởi động server Node.js
|
| 15 |
echo "Starting Node.js server..."
|
| 16 |
+
# /usr/sbin/nginx -c /etc/nginx/nginx.conf
|
| 17 |
+
|
| 18 |
+
node src/server.mjs &
|
| 19 |
+
|
| 20 |
+
nginx -g 'daemon off;'
|
| 21 |
|
|
|
src/server.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import { Hono } from "hono";
|
| 2 |
import puppeteer from "puppeteer-core";
|
| 3 |
import { default as GoLogin } from "gologin";
|
| 4 |
-
import { serve } from
|
| 5 |
|
| 6 |
const app = new Hono();
|
| 7 |
const PORT = process.env.PORT || 3000;
|
|
@@ -14,10 +14,22 @@ const GL = new GoLogin({
|
|
| 14 |
tmpdir: "/tmp", // Thư mục lưu trữ tạm thời
|
| 15 |
profile_id: "67eeaf4dc3162f03167f4570",
|
| 16 |
remote_debugging_port: 3500,
|
| 17 |
-
executablePath:
|
| 18 |
-
extra_params: [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
});
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
app.get("/api/ping", (c) => {
|
| 22 |
return c.json({
|
| 23 |
message: "Hello",
|
|
@@ -182,4 +194,4 @@ console.log(`Server is starting on port ${PORT}...`);
|
|
| 182 |
serve({
|
| 183 |
fetch: app.fetch,
|
| 184 |
port: 3000,
|
| 185 |
-
})
|
|
|
|
| 1 |
import { Hono } from "hono";
|
| 2 |
import puppeteer from "puppeteer-core";
|
| 3 |
import { default as GoLogin } from "gologin";
|
| 4 |
+
import { serve } from "@hono/node-server";
|
| 5 |
|
| 6 |
const app = new Hono();
|
| 7 |
const PORT = process.env.PORT || 3000;
|
|
|
|
| 14 |
tmpdir: "/tmp", // Thư mục lưu trữ tạm thời
|
| 15 |
profile_id: "67eeaf4dc3162f03167f4570",
|
| 16 |
remote_debugging_port: 3500,
|
| 17 |
+
executablePath: "/usr/bin/orbita-browser/chrome",
|
| 18 |
+
extra_params: [
|
| 19 |
+
"--start-maximized",
|
| 20 |
+
"--disable-dev-shm-usage",
|
| 21 |
+
"--no-sandbox",
|
| 22 |
+
"--no-zygote",
|
| 23 |
+
"--window-position=0,0",
|
| 24 |
+
],
|
| 25 |
});
|
| 26 |
|
| 27 |
+
const wsUrl = await GL.start({
|
| 28 |
+
uploadCookiesToServer: true,
|
| 29 |
+
autoUpdateBrowser: false,
|
| 30 |
+
});
|
| 31 |
+
console.log({wsUrl});
|
| 32 |
+
|
| 33 |
app.get("/api/ping", (c) => {
|
| 34 |
return c.json({
|
| 35 |
message: "Hello",
|
|
|
|
| 194 |
serve({
|
| 195 |
fetch: app.fetch,
|
| 196 |
port: 3000,
|
| 197 |
+
});
|