diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index b25ce4a..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: heroku-deploy-stop-start-destroy - -on: - workflow_dispatch: - inputs: - actions: - description: "action: deploy/stop/start/destroy" - default: "deploy" - required: true - heroku-region: - description: "us 或者 eu. 如果你的app已经创建,切换到不同的region,需要先输入 actions 为 destroy 删除app" - default: "us" - required: false - heroku-app-name: - description: "可选,如果输入,则会覆盖 Secrets 里面配置的 APP_NAME。" - default: "" - required: false - env: - description: "environment: Input the name of Environment. If left blank, the main secrets setting will be used by default." - default: "" - required: false - -jobs: - jobenv: - runs-on: ubuntu-latest - environment: ${{ github.event.inputs.env }} - env: # Or as an environment variable - APP_NAME: ${{ secrets.APP_NAME }} - outputs: - actions: ${{ github.event.inputs.actions || 'deploy'}} - test111: ${{ github.event.inputs.env }} # todo - steps: - - id: isDeployHeroku # TODO check atcion doc for usage - # if: ${{ github.event.inputs.actions == 'start'}} - run: echo "test output" - - output-jobenv: - runs-on: ubuntu-latest - needs: jobenv - env: - APP_NAME: ${{ secrets.APP_NAME }} - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - EMAIL: ${{ secrets.EMAIL }} - HEROKU_V2RAY_UUID: ${{ secrets.HEROKU_V2RAY_UUID }} - HEROKU_TUNNEL_TOKEN: ${{ secrets.HEROKU_TUNNEL_TOKEN }} - steps: - - run: | - echo "actions: ${{ github.event.inputs.actions }}" - echo "heroku-region: ${{ github.event.inputs.heroku-region }}" - echo "heroku-app-name: ${{ github.event.inputs.heroku-app-name }}" - echo "env: ${{ github.event.inputs.env }}" - - id: APP_NAME_is_empty - if: ${{ env.APP_NAME == ''}} - run: echo APP_NAME is empty - - id: HEROKU_API_KEY_is_empty - if: ${{ env.HEROKU_API_KEY == ''}} - run: echo HEROKU_API_KEY is empty - - id: EMAIL_is_empty - if: ${{ env.EMAIL == ''}} - run: echo EMAIL is empty - - id: HEROKU_V2RAY_UUID_is_empty - if: ${{ env.HEROKU_V2RAY_UUID == ''}} - run: echo HEROKU_V2RAY_UUID is empty - - id: HEROKU_TUNNEL_TOKEN_is_empty - if: ${{ env.HEROKU_TUNNEL_TOKEN == ''}} - run: echo HEROKU_TUNNEL_TOKEN is empty - # - run: echo ${{needs.jobenv.outputs.herokuAppName}} | sed 's/./& /g' - - - heroku-deploy: - needs: jobenv - if: ${{ needs.jobenv.outputs.actions == 'deploy' || needs.jobenv.outputs.actions == ''}} - runs-on: ubuntu-latest - environment: ${{ github.event.inputs.env }} - env: # Or as an environment variable - APP_NAME: ${{ github.event.inputs.heroku-app-name || secrets.APP_NAME }} - steps: - - uses: actions/checkout@v2 - - uses: akhileshns/heroku-deploy@v3.12.12 # This is the action - with: - heroku_api_key: ${{secrets.HEROKU_API_KEY}} - heroku_app_name: ${{ env.APP_NAME }} #Must be unique in Heroku - heroku_email: ${{secrets.EMAIL}} - usedocker: true - region: ${{github.event.inputs.heroku-region || 'us'}} - # docker_build_args: | - # HD_UUID - env: - # 这是为了heroku,注意前缀有个HD,这是为了告诉heroku-deploy,这些变量需要传入到 container 中。 - HD_UUID: ${{ secrets.HEROKU_V2RAY_UUID }} # UUID for v2ray user, 为了安全,一定要放入 github action token 中 - HD_TUNNEL_TOKEN: ${{ secrets.HEROKU_TUNNEL_TOKEN }} # token for cloudflared tunnel - NODE_ENV: production - SECRET_KEY: ${{ secrets.MY_SECRET_KEY }} - stop-start-destroy: - needs: jobenv - if: ${{ needs.jobenv.outputs.actions == 'start' || needs.jobenv.outputs.actions == 'stop' || needs.jobenv.outputs.actions == 'destroy' }} - runs-on: ubuntu-latest - environment: ${{ github.event.inputs.env }} - env: # Or as an environment variable - APP_NAME: ${{ github.event.inputs.heroku-app-name || secrets.APP_NAME }} - steps: - - uses: actions/checkout@v2 - - uses: akhileshns/heroku-deploy@v3.7.8 # This is the action - with: - heroku_api_key: ${{secrets.HEROKU_API_KEY}} - heroku_email: ${{secrets.EMAIL}} - justlogin: true - - run: | - echo action is ${{ needs.jobenv.outputs.actions }} - if [[ ${{ needs.jobenv.outputs.actions }} == 'stop' ]]; then heroku ps:scale web=0 -a ${{env.APP_NAME}} && echo "stop"; fi - if [[ ${{ needs.jobenv.outputs.actions }} == 'start' ]]; then heroku ps:scale web=1 -a ${{env.APP_NAME}} && echo "start"; fi - heroku ps -a ${{env.APP_NAME}} - if [[ ${{ needs.jobenv.outputs.actions }} == 'destroy' ]]; then heroku apps:destroy -a ${{env.APP_NAME}} --confirm ${{env.APP_NAME}} && echo "destroy app"; fi diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d891e84..0000000 --- a/.gitignore +++ /dev/null @@ -1,105 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port -.local/ diff --git a/Caddyfile b/Caddyfile deleted file mode 100644 index 09ddb70..0000000 --- a/Caddyfile +++ /dev/null @@ -1,18 +0,0 @@ -http://:{$PORT} { - root * /root/html - file_server - # http2 not support by heroku yet - reverse_proxy /h2 127.0.0.1:8082 { - transport http { - versions h2c - } - } - - @websockets { - header Connection *Upgrade* - header Upgrade websocket - } - reverse_proxy @websockets localhost:8080 - - -} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4ffee0d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM v2fly/v2fly-core:latest - -RUN apk add caddy -RUN apk add gettext -RUN apk add curl -RUN apk add jq - -COPY html /root/html/ - -COPY config.json.tp /root/ -# COPY caddy.template.conf /root/ -COPY Caddyfile /root/ - -ADD startup.sh /startup.sh -RUN chmod +x /startup.sh - -ENTRYPOINT [ "/bin/sh" ] -CMD ["/startup.sh"] - - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 36b8bce..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 zizifn - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index be8230e..0000000 --- a/README.md +++ /dev/null @@ -1,263 +0,0 @@ -# 本项目已死, 如有需求请访问 https://github.com/zizifn/edgetunnel - - -**Starting October 26, 2022, we will begin deleting inactive accounts and associated storage for accounts that have been inactive for over a year. -Starting November 28, 2022, we plan to stop offering free product plans and plan to start shutting down free dynos and data services. -We will be sending out a series of email communications to affected users.** - - - - - - - - - - -# v2ray-heroku - -> ~~貌似新建的app有些需要科学访问~~,如果需要,请使用cloudflare worker CDN 或者 cloudflare tunnel 套一层。 - -> 切换到最新的 VLESS 协议。具体客户端配置请看 config 章节。 - -> v2ray-heroku 是我为了体验 github action 的产物,也是我的主力 backup,我会日常维护它。加入或者修改一些我认为好的配置。但这一般会导致客户端配置需要些许修改。 不过具体配置都会体现在 [详细 VLESS websocket 客户端配置](#vless-websocket-客户端配置) - -> 有问题请开 issue 或者 discussions。 - -> 很多人反馈 heroku 封号,我自己的还好用,请大家反馈,如果大部分人都被封号,那么就没有办法了,其他的免费的我试了 Okteto Cloud, 秒封。 - -## **请大家不要跑速度测试,或者长时间大流量。** - - -## Change log - -应需求,加上首页伪装,每次部署都会随机生成首页,如果你有想法,请自己把想要的html放入到 项目html 文件,然后后续 action 部署会自动拿到。 - -## !!!!!!! **对于一些老用户是 breaking change, 对 ws 的 path 做了修改, 请注意查看客户端配置** - - -首先查看别人的 [youtube 教程](https://www.youtube.com/watch?v=xHZyDsFYdvA),了解怎么配置 v2ray-heroku。**本项目使用最新 VLESS 协议,请在客户端配置选择 VLESS**。 -[详细 VLESS websocket 客户端配置](#vless-websocket-客户端配置) 。 - -如果你还想自动化你的 heroku,请查看下面的教程。 - -本项目是包含, - -- 一键部署 V2ray 到 heroku。 -- 利用 Github action 实现 [重新部署](#重新部署)/[停止](#停止)/[启动](#启动)/[删除](#删除)。 -- 支持 heroku 的区域(us 和 eu) -- **支持[多app和多账户](#使用-environments-实现-多账户多app-secrets-管理) [重新部署](#重新部署)/[停止](#停止)/[启动](#启动)/[删除](#删除)。** - -- 利用 cloudflare CDN 进行加速。 -- **利用 [cloudflare tunnel](https://www.cloudflare.com/products/tunnel/) 进行加速。** -- **随机生成首页。每次部署都会产生随机首页。** - 1. 如想自定义主页,请自行在仓库中生成 index.html 放入 `html` 中 - -```text -项目Dockerfile是基于V2fly 官方镜像制作。仅仅增加生产配置文件的脚本。重新部署就可以更新到最新的v2ray。 -基于官方镜像,这也是v2fly 推荐的做法。 -``` - -> 保持安全最简单的方式就是,保持软件更新。 - -## 一键部署 - -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) - -> 貌似在这个 repo 下 点击 一键部署貌似 heroku 提示违反某些原则,但是action 正常工作!!建议 fork 时候,项目名字,尽量不要带有 v2ray 关键字。 - -> 如果被heroku 提示错误,请用 github action 来部署。 - -> 部署成功后,可以先用浏览器访问 ***.herokuapp.com, 查看页面是否能正常访问。会显示一个随机的维基百科页面。 - -## Github Actions 管理 - -请 Fork 本项目到自己的账户下。 Actions 需要以下 Secrets 才能正常工作,这些 Secrets 会被 workflow 中的 [akhileshns/heroku-deploy](https://github.com/AkhileshNS/heroku-deploy) 使用。 - -具体实现细节,请查看 [workflow 配置文件](./.github/workflows/main.yml). 如何配置, 请查看,[Github Secrets](#github-secrets) - -| Name | Description | -| ----------------- | ------------------------------------------ | -| APP_NAME | 就是你 heroku 项目的名字. 如果你是第一次创建APP,**请确保名字是唯一的**| -| EMAIL | heroku 账户的 email | -| HEROKU_API_KEY | heroku API key,在 account 设置下可以找到 | -| HEROKU_V2RAY_UUID | V2rayUUID | -| HEROKU_TUNNEL_TOKEN | **可选** cloudflare tunnel 的 token | - -> 这样Token一定必须是大写。。请在 heroku 网站创建app,来确保项目的名字的唯一性。 - -HEROKU_TUNNEL_TOKEN 是可选项,可以忽略. 详细说明,请查看章节 《建立-cloudflare-tunnel-(可选)》 - -> 请务必生成新的 UUID。使用已有的 UUID 会使自己 V2ray 暴露在危险之下。 - - -PowerShell: - -```powershell -PS C:\Users\> New-Guid -``` - -Shell: - -```bash -xxx@xxx:/mnt/c/Users/$ uuidgen -``` - -### Github Secrets - -路径 - -```text -项目Setting-->Secrets -``` - -![Secrets](./readme-data/GithubSecrets.gif) - -### Heroku API key - -路径 - -```text -heroku Account settings-->API key -``` - -![Secrets](./readme-data/herokuapikey.gif) - -### Github Actions 界面 - -```text -Actions -``` - -![Actions](./readme-data/githubactions.gif) - -### 重新部署 - -点击 `Run workflow`, 输入 deploy。 然后就会重新 deploy。 - -这里可以**选择区域**,但是请确保app没有被创建过。如果要切换区域,请先使用 destroy 删除应用。 - -![deploy](./readme-data/deploy.png) - -### 停止 - -点击 `Run workflow`, 输入 stop。 然后就会 stop,不在计入小时数。 -![stop](./readme-data/stop.jpg) - -### 启动 - -点击 `Run workflow`, 输入 start。 然后就会启动。 - -![start](./readme-data/start.jpg) - -### 删除 - -点击 `Run workflow`, 输入 destroy 然后就会删除。 - -![delete](./readme-data/delete-app.png) - - -## 建立 cloudflare worker (可选) - -如果遇到创建的app在正常网络下不能访问,请尝试这个。 - -可以参考 开头的视频。代码如下。 - -```javascript -const targetHost = "xxx.herokuapp.com"; //你的heroku的hostname -addEventListener("fetch", (event) => { - let url = new URL(event.request.url); - url.hostname = targetHost; - let request = new Request(url, event.request); - event.respondWith(fetch(request)); -}); - -// herokuapp 如果长时间不访问就会休眠。增加cron事件监听器以支持定时job访问herokuapp url。 -addEventListener('scheduled', event => { - event.waitUntil( - handleSchedule(event) - ) -}) - -async function handleSchedule(event) { - let url = new URL("https://" + targetHost); - url.hostname = targetHost; - let request = new Request(url); - const resp = await fetch(request); - //console.log(await resp.text()); -} -``` -然后添加Worker的触发器以定时访问herokuapp url: -![image](https://user-images.githubusercontent.com/78028446/174426881-cc16c91a-eab1-4900-ad7c-957ede42a67c.png) - - -如果 worker 不好用,请用自己域名代理 worker -https://owo.misaka.rest/cf-workers-ban-solution/ - -为 worker 选择速度更快的 IP。 -https://github.com/badafans/better-cloudflare-ip - -## 建立 cloudflare tunnel (可选) - -项目集成 cloudflare tunnel, 在配置 Secrets `HEROKU_TUNNEL_TOKEN` 之后生效。具体怎么配置,请查看 [cloudflare tunnel](./cloudflared-tunnel.md)。 - -## 使用 Environments 实现 多账户/多app Secrets 管理 - -文档介绍: https://docs.github.com/en/actions/deployment/using-environments-for-deployment - -### 建立 Environments, 并添加 Secrets - -1. 创建 Environments -![Environments](./readme-data/Environments.png) -2. 添加 Secrets -![EnvironmentsSercet](./readme-data/EnvironmentsSercet.png) - -### 输入环境名字 -**一定要确保环境名字是对的,要不然就会用主的Secrets。** -![EnvironmentsDeploy](./readme-data/EnvironmentsDeploy.png) - -## VLESS websocket 客户端配置 - -### JSON - -```json -"outbounds": [ - { - "protocol": "vless", - "settings": { - "vnext": [ - { - "address": "***.herokuapp.com", // heroku app URL 或者 cloudflare worker url/ip - "port": 443, - "users": [ - { - "id": "", // 填写你的 UUID - "encryption": "none" - } - ] - } - ] - }, - "streamSettings": { - "network": "ws", - "security": "tls", - "tlsSettings": { - "serverName": "***.herokuapp.com" // heroku app host 或者 cloudflare worker host - } - } - } - ] -``` - -### v2rayN - - -换成 [V2rayN](https://github.com/2dust/v2rayN) - -别人的配置教程参考,https://v2raytech.com/v2rayn-config-tutorial/. - -![v2rayN](/readme-data/V2rayN.jpg) - -cloudflare worker ip 配置 - -![v2rayN1](/readme-data/V2rayN1.jpg) diff --git a/app.json b/app.json deleted file mode 100644 index f4179c4..0000000 --- a/app.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "V2Ray", - "description": "Deploy V2ray on Heroku.", - "keywords": [ - "V2Ray" - ], - "env": { - "UUID": { - "description": "V2Ray UUID", - "value": "ce7ea10b-5b27-49ab-a93d-6b184df9cce9" - }, - "TUNNEL_TOKEN": { - "description": "Cloudflare Tunnel Token", - "required": false - } - }, - "website": "", - "repository": "", - "stack": "container" -} diff --git a/cloudflared-tunnel.md b/cloudflared-tunnel.md deleted file mode 100644 index b60fdb6..0000000 --- a/cloudflared-tunnel.md +++ /dev/null @@ -1,50 +0,0 @@ -# Cloudflare Tunnel - -## 申请 Cloudflare, 并且开通 https://dash.teams.cloudflare.com/ - -虽然免费,但是申请 zero trust 需要绑定信用卡。 - -> 用人反馈不需要绑定信用卡,但是我是需要的。 - -需要一个**域名**,并且绑定到 Cloudflare。 - -## Cloudflare tunnels - -![tunnels](./readme-data/tunnels.png) - -## 保存 Token - -在创建时候,可以在 Tunnels 的页面中找到 Token。 - -> Token 是 `--token` 后面的字符串。就是图片中,用**红色涂抹**的部分。 - -![tunnels-token](./readme-data/tunnel-tokens.png) - -## 添加域名 - -![tunnel-host-name](./readme-data/tunnel-host-name.png) - -**注意事项**, - -1. 定义一个自己的二级域名,不要和其他的二级域名冲突。 - -> 这个域名就是你 tunnel 的地址,需要最后配置在 V2ray 客户端中。 - -2. Service 配成自己 heroku 的名字, \*\*\*.herokuapp.com - -3. HTTP Host Header - 把自己 heroku 的名字, \*\*\*.herokuapp.com,添加进入,**很重要**。 - -然后把 Token 配置到 Github Action `HEROKU_TUNNEL_TOKEN`。然后重新部署 herokuapp。 - -Cloudflare Tunnel 的配置,运行在 herokuapp 的 Cloudflared 会动态获取。 也就是说,如果成功后,你在 Cloudflare Tunnel 的改动会动态同步到 herokuapp 中。 - -重新部署 herokuapp 成功后, 记得在浏览器输入你 tunnel 地址和 自己 herokuapp 的地址,如果返回 Bad Request 字样,代表一切通顺。tunnel 地址可能会有 1 分钟左右延迟。 - -> herokuapp 如果长时间不访问就会休眠。。所以你如果用tunnel,就需要一个定时job 访问herokuapp url. - -## v2rayN - -其他配置和直接连接 herokuapp 是**一样的**,只需要把 v2rayN 的配置**地址改成你自己 tunnel 的地址**就可以。也就是你在设置 tunnel,添加的自己的域名。 - -![V2rayN-tunnel](./readme-data/V2rayN.jpg) diff --git a/config.json.tp b/config.json.tp deleted file mode 100644 index dfa30fd..0000000 --- a/config.json.tp +++ /dev/null @@ -1,69 +0,0 @@ -{ - "policy": { - "levels": { - "0": { - "handshake": 5, - "connIdle": 300, - "uplinkOnly": 2, - "downlinkOnly": 5, - "statsUserUplink": false, - "statsUserDownlink": false, - "bufferSize": 10240 - } - }, - "system": { - "statsInboundUplink": false, - "statsInboundDownlink": false, - "statsOutboundUplink": false, - "statsOutboundDownlink": false - } - }, - "inbounds": [ - { - "port": 8080, - "protocol": "vless", - "settings": { - "clients": [ - { - "id": "$UUID", - "level": 0 - } - ], - "decryption": "none" - }, - "streamSettings": { - "network": "ws", - "security": "none" - } - } - // { - // "port": 8082, - // "listen": "127.0.0.1", - // "protocol": "vless", - // "settings": { - // "clients": [ - // { - // "id": "$UUID", - // "level": 0 - // } - // ], - // "decryption": "none" - // }, - // "streamSettings": { - // "security": "none", - // "network": "h2", - // "httpSettings": { - // "path": "/h2", - // "host": [ - // "**.herokuapp.com" - // ] - // } - // } - // } - ], - "outbounds": [ - { - "protocol": "freedom" - } - ] -} \ No newline at end of file diff --git a/heroku.yml b/heroku.yml deleted file mode 100644 index 8eec25b..0000000 --- a/heroku.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - docker: - web: Dockerfile diff --git a/html/50x.html b/html/50x.html deleted file mode 100644 index 3dde65b..0000000 --- a/html/50x.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - 500 - - - 500 - - \ No newline at end of file diff --git a/html/cat.html b/html/cat.html deleted file mode 100644 index d6adabd..0000000 --- a/html/cat.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Document - - - - My first website and show cat!!!! - - - - - - \ No newline at end of file diff --git a/html/img/cat.webp b/html/img/cat.webp deleted file mode 100644 index 861f9fa..0000000 Binary files a/html/img/cat.webp and /dev/null differ diff --git a/html/manage-utils.js b/html/manage-utils.js deleted file mode 100644 index c80fe35..0000000 --- a/html/manage-utils.js +++ /dev/null @@ -1,23 +0,0 @@ - -const testStr= "1111"; - -async function restartAPP(appname, key){ - - const resp = await fetch(`https://api.heroku.com/apps/${appname}/dynos`,{ - method: "Delete", - headers: { - Accept: "application/vnd.heroku+json; version=3", - Authorization: `Bearer ${key}` - } - }); - - if(resp.status === 202){ - alert("restart success!") - } - -} - -export { - testStr, - restartAPP -} \ No newline at end of file diff --git a/html/manage.html b/html/manage.html deleted file mode 100644 index 0e71d43..0000000 --- a/html/manage.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - 管理 - - - - -
-
- - - - - - - -
- - -
- - - - \ No newline at end of file diff --git a/html/manage.js b/html/manage.js deleted file mode 100644 index e4cfa14..0000000 --- a/html/manage.js +++ /dev/null @@ -1,81 +0,0 @@ - -import { testStr, restartAPP } from './manage-utils.js' - -const main = document.querySelector("#main"); -const template = document.querySelector('#app-list'); -const save2Local = document.querySelector("#save2Local") -const clearlocalstorage = document.querySelector("#clearlocalstorage"); -clearlocalstorage.addEventListener('click', ()=>{ - localStorage.clear(); -}) -// const accounts = []; -const accountsStr = localStorage.getItem("accounts"); -const accounts = new Set(JSON.parse(accountsStr) || []); -for (const account of accounts) { - addAccount(account); -} -document.querySelector("#addKey")?.addEventListener( - 'click', - async () => { - /** @type string*/ - const key = document.getElementById("key")?.value; - if (key && accounts.has(key) === false) { - await addAccount(key); - } - } -) - - -async function addAccount(key) { - const clone = template.content.cloneNode(true); - const keySpan = clone.querySelector("div>.key"); - keySpan.textContent = "****" + key.slice(4); - - const resp = await fetch("https://api.heroku.com/apps", { - method: "Get", - headers: { - Accept: "application/vnd.heroku+json; version=3", - Authorization: `Bearer ${key}` - } - }); - - /** @type any[] */ - const jsonContent = await resp.json(); - console.log(jsonContent); - - if (save2Local.checked && resp.ok) { - const appStr = localStorage.getItem("accounts") || '[]'; - const appSet = new Set(JSON.parse(appStr)).add(key); - const apps = [...appSet]; - localStorage.setItem("accounts", JSON.stringify(apps)); - - console.log(localStorage.getItem("accounts")); - } - - const appsUl = clone.querySelector("UL.app-list"); - for (const app of jsonContent) { - const appli = document.createElement('li'); - appli.classList.add("appli"); - const restartBtn = document.createElement('button'); - restartBtn.dataset.appname = app.name; - - restartBtn.addEventListener('click', (event) => { - restartAPP(app.name, key); - }); - restartBtn.textContent = "restart"; - const url = document.createElement('a'); - url.href = app.web_url; - url.textContent = app.web_url; - - appli.textContent = `app: ${app.name}`; - appli.appendChild(url); - appli.appendChild(restartBtn); - appsUl.appendChild(appli); - - - } - main.appendChild(clone); - accounts.add(key); - console.log(testStr); -} - diff --git a/html/style/manage.css b/html/style/manage.css deleted file mode 100644 index 1915cbb..0000000 --- a/html/style/manage.css +++ /dev/null @@ -1,24 +0,0 @@ -.keyContainer { - display: flex; - /* border: 1px solid red; */ - background-color: white; - margin-bottom: 10px; - gap: 5px; -} - -.keyContainer > .key { - margin-right: 5px; -} - -.accountContainer { - display: flex; - /* border: 1px solid blue; */ - flex-direction: column; - background-color: aliceblue; - margin-bottom: 10px; -} - -.appli{ - display: flex; - gap: 5px; -} diff --git a/html/style/style.css b/html/style/style.css deleted file mode 100644 index a163442..0000000 --- a/html/style/style.css +++ /dev/null @@ -1,4 +0,0 @@ -img { - height: auto; - width: 100%; -} \ No newline at end of file diff --git a/html/test.js b/html/test.js deleted file mode 100644 index d8e839b..0000000 --- a/html/test.js +++ /dev/null @@ -1 +0,0 @@ -alert("test alert") \ No newline at end of file diff --git a/nginx.template.conf b/nginx.template.conf deleted file mode 100644 index fd65858..0000000 --- a/nginx.template.conf +++ /dev/null @@ -1,53 +0,0 @@ -user root; -worker_processes auto; - -error_log stderr; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - access_log /dev/stdout; - server_tokens off; # Hide nginx version in Server header & page footers - -# include /etc/nginx/conf.d/*.conf; - - server { - listen $PORT; - - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - - location / { - root /root/html; - index index.html index.htm; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /root/html; - } - - location /ws { # 与 V2Ray 配置中的 path 保持一致 - if ($http_upgrade != "websocket") { # WebSocket协商失败时返回404 - return 404; - } - proxy_redirect off; - proxy_pass http://127.0.0.1:8080; # 假设WebSocket监听在环回地址的10000端口上 - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - # Show real IP in v2ray access.log - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } -} - -} - - - diff --git a/readme-data/Environments.png b/readme-data/Environments.png deleted file mode 100644 index af18d1e..0000000 Binary files a/readme-data/Environments.png and /dev/null differ diff --git a/readme-data/EnvironmentsDeploy.png b/readme-data/EnvironmentsDeploy.png deleted file mode 100644 index ab93088..0000000 Binary files a/readme-data/EnvironmentsDeploy.png and /dev/null differ diff --git a/readme-data/EnvironmentsSercet.png b/readme-data/EnvironmentsSercet.png deleted file mode 100644 index 50612b8..0000000 Binary files a/readme-data/EnvironmentsSercet.png and /dev/null differ diff --git a/readme-data/GithubSecrets.gif b/readme-data/GithubSecrets.gif deleted file mode 100644 index 7b06f70..0000000 Binary files a/readme-data/GithubSecrets.gif and /dev/null differ diff --git a/readme-data/V2rayN.jpg b/readme-data/V2rayN.jpg deleted file mode 100644 index 9becdbd..0000000 Binary files a/readme-data/V2rayN.jpg and /dev/null differ diff --git a/readme-data/V2rayN1.jpg b/readme-data/V2rayN1.jpg deleted file mode 100644 index 3e26cec..0000000 Binary files a/readme-data/V2rayN1.jpg and /dev/null differ diff --git a/readme-data/delete-app.png b/readme-data/delete-app.png deleted file mode 100644 index 4351089..0000000 Binary files a/readme-data/delete-app.png and /dev/null differ diff --git a/readme-data/deploy.png b/readme-data/deploy.png deleted file mode 100644 index 551696c..0000000 Binary files a/readme-data/deploy.png and /dev/null differ diff --git a/readme-data/githubactions.gif b/readme-data/githubactions.gif deleted file mode 100644 index 6250e8c..0000000 Binary files a/readme-data/githubactions.gif and /dev/null differ diff --git a/readme-data/herokuapikey.gif b/readme-data/herokuapikey.gif deleted file mode 100644 index db42ba6..0000000 Binary files a/readme-data/herokuapikey.gif and /dev/null differ diff --git a/readme-data/start.jpg b/readme-data/start.jpg deleted file mode 100644 index a04d934..0000000 Binary files a/readme-data/start.jpg and /dev/null differ diff --git a/readme-data/stop.jpg b/readme-data/stop.jpg deleted file mode 100644 index f8b0ef3..0000000 Binary files a/readme-data/stop.jpg and /dev/null differ diff --git a/readme-data/tunnel-host-name.png b/readme-data/tunnel-host-name.png deleted file mode 100644 index bf00a05..0000000 Binary files a/readme-data/tunnel-host-name.png and /dev/null differ diff --git a/readme-data/tunnel-tokens.png b/readme-data/tunnel-tokens.png deleted file mode 100644 index 4cf5ef3..0000000 Binary files a/readme-data/tunnel-tokens.png and /dev/null differ diff --git a/readme-data/tunnels.png b/readme-data/tunnels.png deleted file mode 100644 index 48282d1..0000000 Binary files a/readme-data/tunnels.png and /dev/null differ diff --git a/startup.sh b/startup.sh deleted file mode 100755 index a333af5..0000000 --- a/startup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -echo "start to run startup ..." - -envsubst < /root/config.json.tp > /root/config.json -# envsubst '\$PORT' < /root/nginx.template.conf > /root/nginx.conf - -# get random page from wikipedia -if [[ -e "/root/html/index.html" ]]; then - echo "index.html exsit, skip genreate index page" -else - randomurl=$(curl -L 'https://en.wikipedia.org/api/rest_v1/page/random/summary' | jq -r '.content_urls.desktop.page') - echo $randomurl - curl "$randomurl" -o /root/html/index.html -fi - -# Run V2Ray -echo "Start V2Ray ..." -if [[ $TUNNEL_TOKEN ]]; then -echo 'has tunnel token, run cloudflared tunnel' -wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /root/cloudflared -chmod +x /root/cloudflared -# /usr/bin/v2ray -config /root/config.json & /root/cloudflared tunnel --no-autoupdate run --token $TUNNEL_TOKEN & nginx -c /root/nginx.conf -g 'daemon off;' -echo "Start V2Ray and cloudflared tunnel" -v2ray run -c /root/config.json & caddy run --config /root/Caddyfile & /root/cloudflared tunnel --no-autoupdate run --token $TUNNEL_TOKEN --protocol http2 -else -echo "Start V2Ray without cloudflared" -v2ray run -c /root/config.json & caddy run --config /root/Caddyfile -fi -