diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml deleted file mode 100644 index 8bc16a5bb8..0000000000 --- a/.github/workflows/build-image.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build and Push Docker Image - -on: - push: - branches: [ main ] - paths: - - 'Dockerfile' - - 'index.js' - - 'package.json' - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: | - ghcr.io/${{ github.repository_owner }}/ws:latest - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.description=Websocket Server - org.opencontainers.image.licenses=MIT - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 4351d63b1c..e9870fa0a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM node:alpine +FROM node:20-alpine3.20 -WORKDIR /app +WORKDIR /tmp -COPY . . +COPY index.js index.html package.json ./ -EXPOSE 3000 +EXPOSE 7860 -RUN apk update && apk add --no-cache openssl curl &&\ +RUN apk update && apk add --no-cache bash openssl curl &&\ chmod +x index.js &&\ npm install diff --git a/README.md b/README.md index d741779c2f..77553ba05d 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,56 @@ -## Node-ws说明 +## hugggingfface部署指南 -## [web-hosting部署指南](https://github.com/eooce/node-ws/blob/main/web-hosting.md) (适用于所有带nodejs App功能DirectAdmin面板) +huggingface视频教程地址:https://youtu.be/XERxg9AODeo -* 用于node环境的玩具和容器,基于node三方ws库,集成哪吒探针服务,可自行添加环境变量 +1. fork 此项目 +2. 在Actions菜单允许 `I understand my workflows, go ahead and enable them` 按钮 +3. 将hug分支中的index.js填写需要的变量后混淆保存,js混肴地址:https://obfuscator.io +4. 在.github/workflows/build-hug-image.yml 44中修改镜像名称 +5. 去huggingface创建空白space,docker +6. 创建一个新文件,文件名`Dockerfile` 内容如下: +``` +FROM ghcr.io/github用户名/镜像名:latest + +ENV DOMAIN=space域名 +``` * PaaS 平台设置的环境变量 | 变量名 | 是否必须 | 默认值 | 备注 | | ------------ | ------ | ------ | ------ | | UUID | 否 |de04add9-5c68-6bab-950c-08cd5320df33| 开启了哪吒v1,请修改UUID| - | PORT | 否 | 3000 | 监听端口 | + | PORT | 否 | 7860 | 监听端口 | | NEZHA_SERVER | 否 | |哪吒v1填写形式:nz.abc.com:8008 哪吒v0填写形式:nz.abc.com| | NEZHA_PORT | 否 | | 哪吒v1没有此变量,v0的agent端口| | NEZHA_KEY | 否 | | 哪吒v1的NZ_CLIENT_SECRET或v0的agent端口 | | NAME | 否 | | 节点名称前缀,例如:Glitch | | DOMAIN | 是 | | 项目分配的域名或已反代的域名,不包括https://前缀 | | SUB_PATH | 否 | sub | 订阅路径 | - | AUTO_ACCESS | 否 | false | 是否开启自动访问保活,false为关闭,true为开启,需同时填写DOMAIN变量 | - -* 域名/sub查看节点信息,也是订阅地址,包含 https:// 或 http:// 前缀,非标端口,域名:端口/sub + | AUTO_ACCESS | 否 | true | 是否开启自动访问保活,false为关闭,true为开启,需同时填写DOMAIN变量 | - -* 温馨提示:READAME.md为说明文件,请不要上传。 -* js混肴地址:https://obfuscator.io +* 域名/${SUB_APTH}查看节点信息,非标端口,域名:端口/${SUB_APTH} +### 使用cloudflare workers 或 snippets 反代域名给节点套cdn加速 +``` +export default { + async fetch(request, env) { + let url = new URL(request.url); + if (url.pathname.startsWith('/')) { + var arrStr = [ + 'your-space.domain', // 此处单引号里填写你的节点伪装域名 + ]; + url.protocol = 'https:' + url.hostname = getRandomArray(arrStr) + let new_request = new Request(url, request); + return fetch(new_request); + } + return env.ASSETS.fetch(request); + }, +}; +function getRandomArray(array) { + const randomIndex = Math.floor(Math.random() * array.length); + return array[randomIndex]; +} +``` ## 开源协议说明(基于GPL) diff --git a/index.html b/index.html new file mode 100644 index 0000000000..7813feb3da --- /dev/null +++ b/index.html @@ -0,0 +1,722 @@ + + +
+ + +Join the global movement to create a sustainable world through conservation, education, and community action.
+ Join Our Network +We are a global community dedicated to environmental protection and sustainable development.
+Green Network is committed to creating a sustainable future by protecting natural ecosystems, promoting renewable energy, and empowering communities to take environmental action.
+Founded in 2010, we've grown from a small grassroots organization to an international network with over 50,000 members across 120 countries.
+Our approach combines scientific research, community engagement, and policy advocacy to address the most pressing environmental challenges of our time.
+ Learn More +Trees Planted
+Active Members
+Countries Reached
+Cleanup Projects
+Discover the key programs and projects we're implementing to protect our planet.
+
+ Planting millions of trees worldwide to restore ecosystems, combat climate change, and protect biodiversity.
+ Learn More +Protecting marine ecosystems, reducing plastic pollution, and promoting sustainable fishing practices.
+ Learn More +Promoting solar, wind, and other clean energy sources to reduce dependence on fossil fuels.
+ Learn More +Together, we can create a sustainable future for generations to come. Every action counts, no matter how small.
+ Become a Member +