Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44660055af | ||
|
|
c14052556a | ||
|
|
34822965d2 | ||
|
|
2b65730d77 | ||
|
|
6557f28aab | ||
|
|
c8bfc9c219 | ||
|
|
0b019eaa04 | ||
|
|
dcd929a4c5 | ||
|
|
ca5402d15f | ||
|
|
86ed863e59 | ||
|
|
71aa54057f | ||
|
|
a7c78ba1b6 | ||
|
|
4586494580 |
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
cache
|
||||
*.log
|
||||
.DS_Store
|
||||
.git
|
||||
28
.gitea/workflows/release.yml
Normal file
28
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: Wavyzz/ci-workflows/.github/workflows/docker-build-publish.yml@v1
|
||||
with:
|
||||
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||
images: |
|
||||
[
|
||||
{
|
||||
"name": "cf-bypass-fast",
|
||||
"cache_ref": "cf-bypass-fast:buildcache",
|
||||
"dockerfile": "./Dockerfile",
|
||||
"context": "./"
|
||||
}
|
||||
]
|
||||
secrets:
|
||||
registry_user: ${{ secrets.REGISTRY_USER }}
|
||||
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
ci_token: ${{ secrets.CI_GITEA_TOKEN }}
|
||||
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
node_modules/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
.DS_Store
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
59
Dockerfile
59
Dockerfile
@@ -1,29 +1,48 @@
|
||||
FROM node:20-slim
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
# Install Chrome and dependencies
|
||||
RUN apt update && apt install -y \
|
||||
wget gnupg ca-certificates xvfb \
|
||||
fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
|
||||
libatk1.0-0 libxss1 libnss3 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
|
||||
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
|
||||
&& apt install -y ./google-chrome-stable_current_amd64.deb \
|
||||
&& rm google-chrome-stable_current_amd64.deb
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN apk add --no-cache python3 make g++
|
||||
RUN corepack enable
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy and install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN corepack prepare pnpm@10.28.0 --activate \
|
||||
&& pnpm install --frozen-lockfile --prod \
|
||||
&& pnpm store prune
|
||||
|
||||
# Copy app code
|
||||
COPY . .
|
||||
|
||||
# Expose port (match your app's port)
|
||||
FROM node:20-alpine
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV CHROME_PATH=/usr/bin/chromium-browser
|
||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||
|
||||
RUN apk add --no-cache chromium nss freetype harfbuzz ttf-freefont
|
||||
|
||||
# Remove npm/corepack to shrink attack surface and avoid bundled CVEs.
|
||||
RUN rm -rf /usr/local/lib/node_modules/npm \
|
||||
/usr/local/bin/npm \
|
||||
/usr/local/bin/npx \
|
||||
/usr/local/lib/node_modules/corepack \
|
||||
/usr/local/bin/corepack
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
COPY --from=build --chown=node:node /app/package.json /app/package.json
|
||||
COPY --from=build --chown=node:node /app/index.js /app/index.js
|
||||
COPY --from=build --chown=node:node /app/endpoints /app/endpoints
|
||||
COPY --from=build --chown=node:node /app/node_modules /app/node_modules
|
||||
|
||||
RUN mkdir -p /app/cache && chown -R node:node /app
|
||||
|
||||
USER node
|
||||
|
||||
EXPOSE 10000
|
||||
|
||||
# Start Xvfb and run the bot
|
||||
CMD rm -f /tmp/.X99-lock && \
|
||||
Xvfb :99 -screen 0 1024x768x24 & \
|
||||
export DISPLAY=:99 && \
|
||||
npm start
|
||||
CMD ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
@@ -75,12 +75,14 @@ Bypass Cloudflare protection and get cookies/tokens.
|
||||
{
|
||||
"mode": "iuam",
|
||||
"domain": "https://olamovies.watch/generate",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||
}
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
- **`mode`** (required): `"iuam"` or `"turnstile"`
|
||||
- **`domain`** (required): Target website URL
|
||||
- **`user_agent`** (optional): User-Agent to use for the browser session
|
||||
- **`proxy`** (optional): Proxy configuration object
|
||||
|
||||
#### Response (Success)
|
||||
|
||||
46
docker-entrypoint.sh
Normal file
46
docker-entrypoint.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
resolve_chrome_path() {
|
||||
if [ -n "${CHROME_PATH:-}" ] && [ -x "$CHROME_PATH" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
for candidate in \
|
||||
/usr/bin/chromium-browser \
|
||||
/usr/bin/chromium \
|
||||
/usr/bin/google-chrome-stable \
|
||||
/usr/bin/google-chrome \
|
||||
/opt/google/chrome/google-chrome; do
|
||||
if [ -x "$candidate" ]; then
|
||||
CHROME_PATH="$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
if command -v chromium-browser >/dev/null 2>&1; then
|
||||
CHROME_PATH="$(command -v chromium-browser)"
|
||||
return 0
|
||||
fi
|
||||
if command -v chromium >/dev/null 2>&1; then
|
||||
CHROME_PATH="$(command -v chromium)"
|
||||
return 0
|
||||
fi
|
||||
if command -v google-chrome-stable >/dev/null 2>&1; then
|
||||
CHROME_PATH="$(command -v google-chrome-stable)"
|
||||
return 0
|
||||
fi
|
||||
if command -v google-chrome >/dev/null 2>&1; then
|
||||
CHROME_PATH="$(command -v google-chrome)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "No Chrome/Chromium executable found. Set CHROME_PATH to a valid binary." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
resolve_chrome_path
|
||||
export CHROME_PATH
|
||||
export PUPPETEER_EXECUTABLE_PATH="${PUPPETEER_EXECUTABLE_PATH:-$CHROME_PATH}"
|
||||
|
||||
exec node index.js
|
||||
12
index.js
12
index.js
@@ -59,10 +59,10 @@ if (process.env.NODE_ENV !== 'development') {
|
||||
|
||||
async function createBrowser(proxyServer = null) {
|
||||
const connectOptions = {
|
||||
headless: false,
|
||||
headless: "new",
|
||||
turnstile: true,
|
||||
connectOption: { defaultViewport: null },
|
||||
disableXvfb: false,
|
||||
disableXvfb: true,
|
||||
}
|
||||
|
||||
if (proxyServer) {
|
||||
@@ -97,6 +97,9 @@ app.post('/cloudflare', async (req, res) => {
|
||||
if (!data || typeof data.mode !== 'string') {
|
||||
return res.status(400).json({ message: 'Bad Request: missing or invalid mode' })
|
||||
}
|
||||
if (data.user_agent && typeof data.user_agent !== 'string') {
|
||||
return res.status(400).json({ message: 'Bad Request: invalid user_agent' })
|
||||
}
|
||||
if (authToken && data.authToken !== authToken) {
|
||||
return res.status(401).json({ message: 'Unauthorized' })
|
||||
}
|
||||
@@ -126,6 +129,9 @@ app.post('/cloudflare', async (req, res) => {
|
||||
page = ctx.page
|
||||
|
||||
await page.goto('about:blank')
|
||||
if (data.user_agent) {
|
||||
await page.setUserAgent(data.user_agent)
|
||||
}
|
||||
|
||||
switch (data.mode) {
|
||||
case "turnstile":
|
||||
@@ -167,4 +173,4 @@ app.use((req, res) => {
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
module.exports = app
|
||||
}
|
||||
}
|
||||
|
||||
1637
pnpm-lock.yaml
generated
Normal file
1637
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user