diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index da87ca41..00000000 --- a/.dockerignore +++ /dev/null @@ -1,8 +0,0 @@ -.git -.idea -.env -logs -README.md -README_EN.md -LICENSE -.github diff --git a/.env.example b/.env similarity index 96% rename from .env.example rename to .env index 794d8965..c30dbd36 100644 --- a/.env.example +++ b/.env @@ -1,62 +1,61 @@ -##################################################################### -# 注意事项 -# -# - 环境变量的格式为“键=值”,顶格写,注意等号两边不能有空格,值可以用单引号或者双引号引起来,不引也行(下面的特殊情况必须引起来) -# - 因为环境变量中“#”代表注释,若密码中存在“#”字符的,一定要使用单引号将整个密码引起来,否则解析会在“#”字符前截止,如果密码中存在单双引号的, -# 需要在单双引号前加“\”转义 -# - 配置多账户不可省略单引号,且多个账户和密码的格式必须是“<账户1>@<密码1>|<账户2>@<密码2>|<账户3>@<密码3>”,不要有空格,就算有程序也会给你干掉 -# e.g. MULTIPLE_ACCOUNTS='<账户1>@<密码1>|<账户2>@<密码2>|<账户3>@<密码3>' -# 注意不要省略“<>”符号,否则无法正确匹配 -# - 若你只有单个账户,只配置FREENOM_USERNAME和FREENOM_PASSWORD就够了 -# - 单账户和多账户的配置会被合并在一起读取并去重 -##################################################################### - -###################### 账户配置 Account config ######################### -# Freenom账户 Freenom Account -FREENOM_USERNAME=593198779@qq.com - -# Freenom密码 Freenom password -FREENOM_PASSWORD='' - -# 多账户支持 Support for multiple accounts -MULTIPLE_ACCOUNTS='' -###################### end 账户配置 ######################### - -###################### 通知邮件配置 Email config ######################### -# 机器人邮箱账户 Email of robot -MAIL_USERNAME=llf.push@gmail.com - -# 机器人邮箱密码(Gmail填密码,QQ邮箱或163邮箱填授权码) Password of the robot email -MAIL_PASSWORD='' - -# 用于接收通知的邮箱 Email address used to receive notifications -TO='' - -# 是否启用邮件推送功能 true:启用 false:不启用 Whether to enable email push features true: enabled false: not enabled -MAIL_ENABLE=true -###################### end 通知邮件配置 ######################### - -###################### Telegram bot ######################### -# 可选配置,通过 Telegram bot 发送通知消息 This is an optional configuration to send notification messages via Telegram bot - -# 你的chat_id,通过发送“/start”给@userinfobot可以获取自己的id Your chat_id, you can get your own id by sending "/start" to @userinfobot -TELEGRAM_CHAT_ID='' - -# 你的Telegram bot的token Token for your Telegram bot -TELEGRAM_BOT_TOKEN='' - -# 是否启用 Telegram Bot 功能 true:启用 false:不启用 Whether to enable Telegram Bot features true: enabled false: not enabled -TELEGRAM_BOT_ENABLE=false -###################### end Telegram bot ######################### - -# 通知频率 0:仅当有续期操作的时候 1:每次执行 Notification frequency 0: Only when there is a renewal operation 1: Each execution -NOTICE_FREQ=1 - -# 在 Github Actions 上运行 Run on github actions -ON_GITHUB_ACTIONS=false - -# 是否验证服务器证书 Whether to verify server certificate -VERIFY_SSL=false - -# 是否开启 Debug 模式 Whether to enable debug mode -DEBUG=false +##################################################################### +# 注意事项 +# +# - 环境变量的格式为“键=值”,顶格写,注意等号两边不能有空格,值可以用单引号或者双引号引起来,不引也行(下面的特殊情况必须引起来) +# - 因为环境变量中“#”代表注释,若密码中存在“#”字符的,一定要使用单引号将整个密码引起来,否则解析会在“#”字符前截止,如果密码中存在单双引号的, +# 需要在单双引号前加“\”转义 +# - 配置多账户不可省略单引号,且多个账户和密码的格式必须是“<账户1>@<密码1>|<账户2>@<密码2>|<账户3>@<密码3>”,不要有空格,就算有程序也会给你干掉 +# e.g. MULTIPLE_ACCOUNTS='<账户1>@<密码1>|<账户2>@<密码2>|<账户3>@<密码3>' +# - 若你只有单个账户,只配置FREENOM_USERNAME和FREENOM_PASSWORD就够了 +# - 单账户和多账户的配置会被合并在一起读取并去重 +##################################################################### + +###################### 账户配置 Account config ######################### +# Freenom账户 Freenom Account +FREENOM_USERNAME=593198779@qq.com + +# Freenom密码 Freenom password +FREENOM_PASSWORD='' + +# 多账户支持 Support for multiple accounts +MULTIPLE_ACCOUNTS='' +###################### end 账户配置 ######################### + +###################### 通知邮件配置 Email config ######################### +# 机器人邮箱账户 Email of robot +MAIL_USERNAME=llf.push@gmail.com + +# 机器人邮箱密码(Gmail填密码,QQ邮箱或163邮箱填授权码) Password of the robot email +MAIL_PASSWORD='' + +# 用于接收通知的邮箱 Email address used to receive notifications +TO='' + +# 是否启用邮件推送功能 true:启用 false:不启用 Whether to enable email push features true: enabled false: not enabled +MAIL_ENABLE=true +###################### end 通知邮件配置 ######################### + +###################### Telegram bot ######################### +# 可选配置,通过 Telegram bot 发送通知消息 This is an optional configuration to send notification messages via Telegram bot + +# 你的chat_id,通过发送“/start”给@userinfobot可以获取自己的id Your chat_id, you can get your own id by sending "/start" to @userinfobot +TELEGRAM_CHAT_ID='' + +# 你的Telegram bot的token Token for your Telegram bot +TELEGRAM_BOT_TOKEN='' + +# 是否启用 Telegram Bot 功能 true:启用 false:不启用 Whether to enable Telegram Bot features true: enabled false: not enabled +TELEGRAM_BOT_ENABLE=false +###################### end Telegram bot ######################### + +# 通知频率 0:仅当有续期操作的时候 1:每次执行 Notification frequency 0: Only when there is a renewal operation 1: Each execution +NOTICE_FREQ=1 + +# 在 Github Actions 上运行 Run on github actions +ON_GITHUB_ACTIONS=false + +# 是否验证服务器证书 Whether to verify server certificate +VERIFY_SSL=false + +# 是否开启 Debug 模式 Whether to enable debug mode +DEBUG=false diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index aff129b4..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -custom: ["https://www.paypal.me/mybsdc", "https://s2.ax1x.com/2020/01/31/1394at.png"] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d8d4dec8..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Bug report -about: 根据此模板格式提问更可能得到帮助,没有具体描述的报告将被忽略。Create a report to help us improve. -title: bug_report -labels: '' -assignees: '' - ---- - -**描述问题** -``` -A clear and concise description of what the bug is. -``` - -**重现步骤** -``` -步骤一 -``` - -**截图&日志** - -**你做了哪些尝试** -``` -描述你发现问题后做了哪些尝试,方便我快速排除某些问题,提高沟通效率。 -``` - -**环境信息** - - centos7 x64 - - php7.2 - - freenom续期脚本版本 v0.2.2 - -**额外的备注** -- Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index edefe58f..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: feature_request -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b0bc4d35..00000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.env -app/tmp/ -app/num_limit/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1d948a7c..00000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM php:7.4.19-alpine3.13 - -LABEL author="mybsdc " \ - maintainer="luolongfei " - -ENV TZ Asia/Shanghai - -WORKDIR /app - -COPY . ./ - -RUN set -eux \ - && apk update \ - && apk add --no-cache tzdata bash - -VOLUME ["/conf", "/app/logs"] - -COPY docker-entrypoint.sh /usr/local/bin/ -ENTRYPOINT ["docker-entrypoint.sh"] - -CMD ["crond", "-f"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 42b42a78..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 luolongfei - -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. diff --git a/README.md b/README.md deleted file mode 100644 index 1d01096c..00000000 --- a/README.md +++ /dev/null @@ -1,545 +0,0 @@ -
-

Freenom:freenom域名自动续期

- -[![Build Status](https://img.shields.io/badge/build-passed-brightgreen?style=for-the-badge)](https://scrutinizer-ci.com/g/luolongfei/freenom/build-status/master) -[![Php Version](https://img.shields.io/badge/php-%3E=7.2-brightgreen.svg?style=for-the-badge)](https://secure.php.net/) -[![Scrutinizer Code Quality](https://img.shields.io/badge/scrutinizer-9.31-brightgreen?style=for-the-badge)](https://scrutinizer-ci.com/g/luolongfei/freenom/?branch=master) -[![MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge)](https://github.com/luolongfei/freenom/blob/master/LICENSE) - -Documentation: [English version](https://github.com/luolongfei/freenom/blob/master/README_EN.md) | 中文版 -
- -[📃 前言](#--前言) - -[🍭 效果](#--效果) - -[🎁 事前准备](#--事前准备) - -[📪 配置发信邮箱](#--配置发信邮箱) - -
- -*(下面三种部署方式,选择其中一种即可)* - -[⛵ 通过 Docker 方式部署](#--方式一通过-docker-部署最简单的方式)(最简单的方式,推荐) - -[🕹 通过腾讯云函数(SCF)部署](#--方式二通过腾讯云函数scf部署) - -[🚧 直接拉取源码部署](#--方式三直接拉取源码部署) - -
- -[📋 捐赠名单 Donate List](#--捐赠名单-donate-list) - -[❤ 捐赠 Donate](#--捐赠-donate) - -[🚁 我正在用的 VPS](#--我正在用的-VPS) - -[🍺 信仰](#--信仰) - -[🌚 作者](#--作者) - -[📰 更新日志](#--更新日志) (每次新版本发布,可以参考此日志决定是否更新) - -[🎉 鸣谢](#--鸣谢) - -[🥝 开源协议](#--开源协议) - -
注意:GitHub 官方不允许使用 GitHub Action 做签到或者续期类应用,否则会封禁项目甚至封号,故为项目能长期维护下去,应 GitHub 官方要求, -本项目已经移除 Action 方式的应用,望周知。已经 fork 使用的,可以尽快将项目转移到自己的 VPS 上,推荐通过 Docker 部署, -或者直接搬运到腾讯云函数部署。本项目依然长期维护。
- -### 📃 前言 -众所周知,Freenom是地球上唯一一个提供免费顶级域名的商家,不过需要每年续期,每次续期最多一年。由于我申请了一堆域名,而且不是同一时段申请的, -所以每次续期都觉得折腾,于是就写了这个自动续期的脚本。 - -### 🍭 效果 -![邮件示例](https://s2.ax1x.com/2020/01/31/139Rrd.png "邮件内容") - -无论是续期成败或者脚本执行出错,都会收到的程序发出的邮件。如果是续期成败相关的邮件,邮件会包括未续期域名的到期天数等内容。 -邮件参考了微信发送的注销公众号的邮件样式。 - -### 🎁 事前准备 -- 发信邮箱:为了方便理解又称机器人邮箱,用于发送通知邮件。目前支持`Gmail`、`QQ邮箱`以及`163邮箱`,程序会自动判断发信邮箱类型并使用合适的配置。 -- 收信邮箱:用于接收机器人发出的通知邮件。推荐使用`QQ邮箱`,`QQ邮箱`唯一的好处只是收到邮件会在`QQ`弹出消息。 -- VPS:随便一台服务器都行,系统推荐`Centos7`,另外PHP版本需在`php7.2`及以上。如果你没有 VPS,可以考虑一下 [🚁 我正在用的 VPS](#--我正在用的-VPS) ,最便宜的机器`9.9美元`一年。 -- 没有了 - -### 📪 配置发信邮箱 -下面分别介绍`Gmail`、`QQ邮箱`以及`163邮箱`的设置,你只用看自己需要的部分。注意,`QQ邮箱`与`163邮箱`均使用账户加授权码的方式登录, -`谷歌邮箱`使用账户加密码的方式登录,请知悉。另外还想吐槽一下,国产邮箱你得花一毛钱给邮箱提供方发一条短信才能拿到授权码。 - -*(点击即可展开或收起)* - -
- 设置Gmail -
- -1、在`设置>转发和POP/IMAP`中,勾选 -- 对所有邮件启用 POP -- 启用 IMAP - -![gmail配置01](https://s2.ax1x.com/2020/01/31/13tKsg.png "gmail配置01") - -然后保存更改。 - -2、允许不够安全的应用 - -登录谷歌邮箱后,访问 [谷歌权限设置界面](https://myaccount.google.com/u/0/lesssecureapps?pli=1&pageId=none) ,启用允许不够安全的应用。 - -![gmail配置02](https://s2.ax1x.com/2020/01/31/1392KH.png "gmail配置02") - -另外,若遇到提示 -> 不允许访问账户 - -登录谷歌邮箱后,去 [gmail的这个界面](https://accounts.google.com/b/0/DisplayUnlockCaptcha) 点击允许。这种情况较为少见。 - -*** - -
- -
- 设置QQ邮箱 -
- -在`设置>账户>POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务`下,开启`POP3/SMTP服务` - -![qq邮箱配置01](https://s2.ax1x.com/2020/01/31/13cIKA.png "qq邮箱配置01") - -此时坑爹的QQ邮箱会要求你用手机发送一条短信给腾讯,发送完了点一下`我已发送` - -![qq邮箱配置02](https://s2.ax1x.com/2020/01/31/13c4vd.png "qq邮箱配置02") - -然后你就能看到你的邮箱授权码了,使用邮箱账户加授权码即可登录,记下授权码 - -![qq邮箱配置03](https://s2.ax1x.com/2020/01/31/13cTbt.png "qq邮箱配置03") - -![qq邮箱配置04](https://s2.ax1x.com/2020/01/31/13coDI.png "qq邮箱配置04") - -*** - -
- -
- 设置163邮箱 -
- -在`设置>POP3/SMTP/IMAP`下,开启`POP3/SMTP服务`和`IMAP/SMTP服务`并保存 - -![163邮箱配置01](https://s2.ax1x.com/2020/01/31/13WKZn.png "163邮箱配置01") - -![163邮箱配置02](https://s2.ax1x.com/2020/01/31/13WQI0.png "163邮箱配置02") - -现在点击侧边栏的`客户端授权密码`,并获取授权码,你看到画面可能和我不一样,因为我已经获取了授权码,所以只有`重置授权码`按钮,这里自己根据网站提示申请获取授权码,网易和腾讯一样恶心,需要你用手机给它发一条短信才能拿到授权码 - -![163邮箱配置03](https://s2.ax1x.com/2020/01/31/13WMaq.png "163邮箱配置03") - -163 邮箱送信后,接收方如果没收到可以在垃圾邮件里面找一下。 - -*** - -
- -#### Telegram bot - -上面介绍了三种邮箱的设置方法,如果你不想使用邮件推送,也可以使用 Telegram bot,灵活配置。在`.env`文件中, -将`TELEGRAM_BOT_ENABLE`的值改为`true`,即可启用 Telegram bot,同样的,将`MAIL_ENABLE`的值改为`false`即可关闭邮件推送方式。 -Telegram bot 有两个配置项,一个是`chatID`(对应`.env`文件中的`TELEGRAM_CHAT_ID`), -通过使用你的 Telegram 账户发送`/start`给`@userinfobot`即可以获取自己的id, -另一个是`token`(对应`.env`文件中的`TELEGRAM_BOT_TOKEN`),你的 Telegram bot 令牌,你会创建 Telegram bot 就知道怎么获取, -不多赘述。如何创建一个 Telegram bot 请参考:[官方文档](https://core.telegram.org/bots#6-botfather) - -*** - -*与通知相关的设置到此就完成了,下面开始讲本项目的三种使用方式,一种是通过 Docker,另一种是通过腾讯云函数,再一种是直接拉取源码部署,推荐使用 Docker 方式,无需纠结环境。* - -### ⛵ 方式一:通过 Docker 部署(最简单的方式) - -
- -Docker 仓库地址为: [https://hub.docker.com/r/luolongfei/freenom](https://hub.docker.com/r/luolongfei/freenom) ,同样欢迎 star 。 -此镜像支持的架构为`linux/amd64`,`linux/arm64`,`linux/ppc64le`,`linux/s390x`,`linux/386`,`linux/arm/v7`,`linux/arm/v6`, -理论上支持`群晖`、`威联通`、`树莓派`以及各种类型的`VPS`。 - -#### 1、安装 Docker - -##### 1.1 以 root 用户登录,执行一键脚本安装 Docker - -升级源并安装软件(下面两行命令二选一,根据你自己的系统) - -Debian / Ubuntu -```shell -apt-get update && apt-get install -y wget vim -``` -CentOS -```shell -yum update && yum install -y wget vim -``` - -执行此命令等候自动安装 Docker -```shell -wget -qO- get.docker.com | bash -``` - -说明:请使用 KVM 架构的 VPS,OpenVZ 架构的 VPS 不支持安装 Docker,另外 CentOS 8 不支持用此脚本来安装 Docker。 -更多关于 Docker 安装的内容参考 [Docker 官方安装指南](https://docs.docker.com/engine/install/) 。 - -##### 1.2 对 Docker 的一些命令操作 - -查看 Docker 安装版本等信息 -```shell -docker version -``` - -启动 Docker 服务 -```shell -systemctl start docker -``` - -查看 Docker 运行状态 -```shell -systemctl status docker -``` - -将 Docker 服务加入开机自启动 -```shell -systemctl enable docker -``` - -#### 2、通过 Docker 部署域名续期脚本 - -##### 2.1 用 Docker 创建并启动容器 - -命令如下 -```shell -docker run -d --name freenom --restart always -v $(pwd):/conf -v $(pwd)/logs:/app/logs luolongfei/freenom -``` -或者,如果你想自定义脚本执行时间,则命令如下 -```shell -docker run -d --name freenom --restart always -v $(pwd):/conf -v $(pwd)/logs:/app/logs -e RUN_AT="11:24" luolongfei/freenom -``` - 上面这条命令只比上上条命令多了个` -e RUN_AT="11:24"`,其中`11:24`表示在北京时间每天的 11:24 执行续期任务,你可以自定义这个时间。 - 这里的`RUN_AT`参数同时也支持 CRON 命令里的时间形式,比如,` -e RUN_AT="9 11 * * *"`,表示每天北京时间 11:09 执行续期任务, - 如果你不想每天执行任务,只想隔几天执行,只用修改`RUN_AT`的值即可。 - - **注意:不推荐自定义脚本执行时间。因为你可能跟很多人定义的是同一个时间点,这样可能导致所有人都是同一时间向 Freenom 的服务器发起请求, - 使得 Freenom 无法稳定提供服务。而如果你不自定义时间,程序会自动指定北京时间 06 ~ 23 点全时段随机的一个时间点作为执行时间, - 每次重启容器都会自动重新指定。** - -
- 点我查看上方 Docker 命令的参数解释 -
- -| 命令 | 含义 | -| :--- | :--- | -| docker run | 开始运行一个容器 | -| -d 参数 | 容器以后台运行并输出容器 ID | -| --name 参数 | 给容器分配一个识别符,方便将来的启动,停止,删除等操作 | -| --restart 参数 | 配置容器启动类型,always 即为 docker 服务重新启动时自动启动本容器 | -| -v 参数 | 挂载卷(volume),冒号后面是容器的路径,冒号前面是宿主机的路径(只支持绝对路径),`$(pwd)`表示当前目录 | -| -e 参数 | 指定容器中的环境变量 | -| luolongfei/freenom | 这是从 docker hub 下载回来的镜像完整路径名 | - -
- -至此,你的自动续期容器就跑起来了,执行`ls -a`后你就可以看到在你的当前目录下,有一个`.env`文件和一个`logs`目录,`logs`目录里面存放的是程序日志, -而`.env`则是配置文件,现在直接执行`vim .env`将`.env`文件里的所有配置项改为你自己的并保存即可。然后重启容器,如果配置正确的话,便很快可以收到相关邮件。 - -
- 点我查看 .env 文件中部分配置项的含义 -
- -| 变量名 | 含义 | 默认值 | 是否必须 | 备注 | -| :---: | :---: | :---: | :---: | :---: | -| FREENOM_USERNAME | Freenom 账户 | - | 是 | 只支持邮箱账户,如果你是使用第三方社交账户登录的用户,请在 Freenom 管理页面绑定邮箱,绑定后即可使用邮箱账户登录 | -| FREENOM_PASSWORD | Freenom 密码 | - | 是 | 某些特殊字符可能需要转义,详见`.env`文件内注释 | -| MULTIPLE_ACCOUNTS | 多账户支持 | - | 否 | 多个账户和密码的格式必须是“`<账户1>@<密码1>\|<账户2>@<密码2>\|<账户3>@<密码3>`”,注意不要省略“<>”符号,否则无法正确匹配。如果设置了多账户,上面的`FREENOM_USERNAME`和`FREENOM_PASSWORD`可不设置 | -| MAIL_USERNAME | 机器人邮箱账户 | - | 是 | 支持`Gmail`、`QQ邮箱`以及`163邮箱`,尽可能使用`163邮箱`或者`QQ邮箱`而非`Gmail`。因为谷歌的安全机制,每次在新设备登录 `Gmail` 都会先被限制,需要手动解除限制才行。具体的配置方法参考「 [配置发信邮箱](#--配置发信邮箱) 」 | -| MAIL_PASSWORD | 机器人邮箱密码 | - | 是 | `Gmail`填密码,`QQ邮箱`或`163邮箱`填授权码 | -| TO | 接收通知的邮箱 | - | 是 | 你自己最常用的邮箱,推荐使用`QQ邮箱`,用来接收机器人邮箱发出的域名相关邮件 | -| MAIL_ENABLE | 是否启用邮件推送功能 | true | 否 | `true`:启用
`false`:不启用
默认启用,如果设为`false`,不启用邮件推送功能,则上面的`MAIL_USERNAME`、`MAIL_PASSWORD`、`TO`变量变为非必须,可不设置 | -| TELEGRAM_CHAT_ID | 你的`chat_id` | - | 否 | 通过发送`/start`给`@userinfobot`可以获取自己的`id` | -| TELEGRAM_BOT_TOKEN | 你的`Telegram bot`的`token` | - | 否 || -| TELEGRAM_BOT_ENABLE | 是否启用`Telegram Bot`推送功能 | false | 否 | `true`:启用
`false`:不启用
默认不启用,如果设为`true`,则必须设置上面的`TELEGRAM_CHAT_ID`和`TELEGRAM_BOT_TOKEN`变量 | -| NOTICE_FREQ | 通知频率 | 1 | 否 | `0`:仅当有续期操作的时候
`1`:每次执行 | - -*更多配置项含义,请参考`.env`文件中的注释。* - -
- -> 如何验证你的配置是否正确呢? -> - -修改并保存`.env`文件后,执行`docker restart freenom`重启容器,等待 5 秒钟左右,然后执行`docker logs freenom`查看输出内容, -观察输出内容中有`执行成功`字样,则表示配置无误。如果你还来不及配置送信邮箱等内容,可先停用邮件功能。 - -##### 2.2 后期容器处理常用命令 - -查看容器在线状态及大小 -```shell -docker ps -as -``` - -查看容器的运行输出日志 -```shell -docker logs freenom -``` - -重新启动容器 -```shell -docker restart freenom -``` - -停止容器的运行 -```shell -docker stop freenom -``` - -移除容器 -```shell -docker rm $name -``` - -查看 docker 容器占用 CPU,内存等信息 -```shell -docker stats --no-stream -``` - -*有关容器部署的内容结束。* - -### 🕹 方式二:通过腾讯云函数(SCF)部署 - -
- -#### 1、下载 SCF 版本的压缩包 - -此版本为特别版,支持通过腾讯云函数部署,与主分支版本不兼容,版本号为`v0.3_scf`,下载地址: -[https://github.com/luolongfei/freenom/archive/refs/tags/v0.3_scf.zip](https://github.com/luolongfei/freenom/archive/refs/tags/v0.3_scf.zip) - -下载后解压到你能找到的任意目录,你将得到一个文件夹,后期将通过文件夹的形式上传到腾讯云函数。 - -#### 2、创建腾讯云函数 - -直接访问腾讯云函数控制台创建云函数: [https://console.cloud.tencent.com/scf/list-create](https://console.cloud.tencent.com/scf/list-create) , -按照下图所示的说明进行创建。如果无法看清图片,可访问: [https://github.com/luolongfei/freenom/blob/master/resources/screenshot/scf.png](https://github.com/luolongfei/freenom/blob/master/resources/screenshot/scf.png) -或者 [https://z3.ax1x.com/2021/06/01/2nKCF0.png](https://z3.ax1x.com/2021/06/01/2nKCF0.png) 查看原图。 - -[![scf01](https://z3.ax1x.com/2021/06/01/2nKCF0.png)](https://imgtu.com/i/2nKCF0) - -按照上图所示部署完成后,可以点击云函数的名称进入云函数管理画面,管理画面往下翻可看到`部署`与`测试`按钮,点击`测试`,稍等几秒钟,即可看到输出日志, -根据输出日志判断配置以及部署是否正确。 - -[![scf02](https://z3.ax1x.com/2021/06/01/2nGZ3q.png)](https://imgtu.com/i/2nGZ3q) - -*有关腾讯云函数部署的内容结束。* - -### 🚧 方式三:直接拉取源码部署 - -
- -所有操作均在Centos7系统下进行,其它Linux发行版大同小异 -#### 1、获取源码 -创建文件夹 -```shell script -mkdir -p /data/wwwroot/freenom && cd /data/wwwroot/freenom -``` -clone 本仓库源码 -```shell script -git clone https://github.com/luolongfei/freenom.git ./ -``` - -#### 2、修改配置 -复制配置文件模板 -```shell script -cp .env.example .env -``` -编辑配置文件 -```shell script -vim .env -``` -```shell script -# 注意事项 -# .env 文件里每个项目都有详细的说明,这里不再赘述,简言之,你需要把里面所有项都改成你自己的。需要注意的是多账户配置的格式: -# e.g. MULTIPLE_ACCOUNTS='<账户1>@<密码1>|<账户2>@<密码2>|<账户3>@<密码3>' -# (注意不要省略“<>”符号,否则无法正确匹配) -# 当然,若你只有单个账户,只配置 FREENOM_USERNAME 和 FREENOM_PASSWORD 就够了,单账户和多账户的配置会被合并在一起读取并去重。 - -# 编辑完成后,按“Esc”回到命令模式,输入“:wq”回车即保存并退出,不会用 vim 编辑器的可以谷歌一下:) -``` - -#### 3、添加计划任务 - -##### 3.1 安装 crontabs 以及 cronie -```shell script -yum -y install cronie crontabs -``` -验证 crond 是否安装及启动 -```shell script -yum list cronie && systemctl status crond -``` -验证crontab是否安装 -```shell script -yum list crontabs $$ which crontab && crontab -l -``` - -##### 3.2 打开任务表单,并编辑 -```shell script -crontab -e -``` -```shell script -# 任务内容如下 -# 此任务的含义是在每天早上 9点 执行 /data/wwwroot/freenom/ 路径下的 run 文件,最佳实践是将这个时间修改为一个非整点的时间,防止与很多人在同一时间进行续期操作导致 freenom 无法稳定提供服务 -# 注意:某些情况下,crontab 可能找不到你的 php 路径,下面的命令执行后会在 freenom_crontab.log 文件输出错误信息,你应该指定 php 路径:把下面的 php 替换为 /usr/local/php/bin/php (根据实际情况,执行 whereis php 即可看到 php 执行文件的真实路径) -00 09 * * * cd /data/wwwroot/freenom/ && php run > freenom_crontab.log 2>&1 -``` - -##### 3.3 重启crond守护进程(每次编辑任务表单后都需此步,以使任务生效) -```shell script -systemctl restart crond -``` -若要检查`计划任务`是否正常,你可以将上面的任务执行时间设置在几分钟后,然后等到任务执行完成, -检查`/data/wwwroot/freenom/`目录下的`freenom_crontab.log`文件内容,是否有报错信息。常见的错误信息如下: -- /bin/sh: php: command not found -- /bin/sh: /usr/local/php: Is a directory - -*(点击即可展开或收起)* -
- 解决方案 -
- -> -> 执行 -> ```shell script -> whereis php -> ``` -> ```shell script -> # 上面的命令可确定 php 执行文件的位置,一般输出为“php: /usr/local/php /usr/local/php/bin/php”,选长的那个即:/usr/local/php/bin/php -> ``` -> -> 现在我们知道 php 执行文件的路径是`/usr/local/php/bin/php`(根据你自己系统的实际情况,可能不同),然后修改表单任务里的命令,把 -> -> `00 09 * * * cd /data/wwwroot/freenom/ && php run > freenom_crontab.log 2>&1` -> -> 改为 -> -> `00 09 * * * cd /data/wwwroot/freenom/ && /usr/local/php/bin/php run > freenom_crontab.log 2>&1` -> -> 更多参考:[点这里](https://stackoverflow.com/questions/7397469/why-is-crontab-not-executing-my-php-script) -> - -
- -当然,如果你的`计划任务`能正确找到`php路径`,没有错误,那你什么也不用做。 - -*至此,所有的配置都已经完成,下面我们验证一下整个流程是否走通。* - -##### 3.4 验证 -你可以先将`.env`中的`NOTICE_FREQ`的值改为1(即每次执行都推送通知),然后执行 -```shell script -cd /data/wwwroot/freenom/ && php run -``` -不出意外的话,你将收到一封关于域名情况的邮件。 - -*** - -遇到任何问题或 Bug 欢迎提 [issue](https://github.com/luolongfei/freenom/issues) (请按模板格式提`issue`,以便我快速复现你的问题,否则问题会被忽略), -如果`Freenom`改变算法导致此项目失效,请提 [issue](https://github.com/luolongfei/freenom/issues) 告知,我会及时修复,本项目长期维护。 -欢迎`star`~ - -### 📋 捐赠名单 Donate List -非常感谢「 [这些用户](https://github.com/luolongfei/freenom/wiki/Donate-List) 」对本项目的捐赠支持! - -### ❤ 捐赠 Donate -如果你觉得本项目真的有帮助到你并且想回馈作者,感谢你的捐赠。 -#### PayPal: [https://www.paypal.me/mybsdc](https://www.paypal.me/mybsdc) -> Every time you spend money, you're casting a vote for the kind of world you want. -- Anna Lappe - -![pay](https://s2.ax1x.com/2020/01/31/1394at.png "Donate") - -![每一次你花的钱都是在为你想要的世界投票。](https://s2.ax1x.com/2020/01/31/13P8cF.jpg) - -**你的 star 或者`小额打赏`是我长期维护此项目的动力所在,由衷感谢每一位支持者,“每一次你花的钱都是在为你想要的世界投票”。 -另外,将本项目推荐给更多的人,也是一种支持的方式,用的人越多更新的动力越足。** - -### 🚁 我正在用的 VPS - -走我的 Aff 地址购买,我可以获得一点返利,也算是一种支持方式,介意者复制官网地址访问即可。 - -| 名称 | 购买地址 | 备注 | -| :---: | :--- | :--- | -| 搬瓦工 | [https://bwh81.net/aff.php?aff=24499&pid=104](https://bwh81.net/aff.php?aff=24499&pid=104) (日本软银 VPS 限量版,`65美元`一年,优惠码:`BWH3HYATVBJW`)
[https://bwh81.net/aff.php?aff=24499&pid=94](https://bwh81.net/aff.php?aff=24499&pid=94) (CN2 GIA LIMITED EDITION,`DC 6`机房,`46.8美元`一年)
[https://bwh81.net/aff.php?aff=24499&pid=71](https://bwh81.net/aff.php?aff=24499&pid=71) (CN2 GIA 丐版,`DC 9`机房,`37.79美元`一年) | 稳定大厂,它们家`限量版 GIA`很香。目前是我的主力机型。 | -| Vultr | [https://www.vultr.com/?ref=7429134](https://www.vultr.com/?ref=7429134) (最低`2.5美元`每月)
[https://www.vultr.com/?ref=8399703-6G](https://www.vultr.com/?ref=8399703-6G) (新用户可得`100美元`体验金) | 随开随停,很方便。 | -| PacificRack | [https://pacificrack.com/portal/aff.php?aff=1150&pid=11](https://pacificrack.com/portal/aff.php?aff=1150&pid=11) (`9.9美元`一年) | 最便宜的机型`9.9美元`一年,QuadraNet 机房,我用了两年了目前感觉很稳。 | - -### 🍺 信仰 - -![南京市民李先生](https://s2.ax1x.com/2020/02/04/1Bm3Ps.jpg "南京市民李先生") -> -> 认真是我们参与这个社会的方式,认真是我们改变这个社会的方式。 ——李志 - -### 🌚 作者 -- 主程序以及框架:[@luolongfei](https://github.com/luolongfei) -- 英文版文档:[@肖阿姨](#) - -### 📰 更新日志 - -此处省略了很多较为久远的记录,以前的日志只记录了比较大的变更,以后的日志会尽可能详尽一些。 - -#### [Unreleased] - -##### Added - -- 支持通过 Server酱 以及 企业微信 推送通知 - -##### Changed - -- 多个账户的续期结果通知合并为同一条消息 -- 整合各种送信方式,优化相关逻辑 -- 支持交互式安装,免去手动修改配置的繁琐操作 - -#### [v0.3](https://github.com/luolongfei/freenom/releases/tag/v0.3) - 2021-05-27 - -##### Added - -- 追加 Docker 版本,支持通过 Docker 方式部署,简化部署流程 - -#### [v0.2.5](https://github.com/luolongfei/freenom/releases/tag/v0.2.5) - 2020-06-23 - -##### Added - -- 支持在 Github Actions 上执行(应 GitHub 官方要求,已移除此功能) - -#### [v0.2.2](https://github.com/luolongfei/freenom/releases/tag/v0.2.2) - 2020-02-06 - -##### Added - -- 新增通过 Telegram bot 送信 -- 各种送信方式支持单独开关 - -#### [v0.2](https://github.com/luolongfei/freenom/releases/tag/v0.2) - 2020-02-01 - -##### Added - -- 支持多个 Freenom 账户进行域名续期 - -##### Changed - -- 进行了彻底的重构,框架化 -- 优化邮箱模块,支持自动选择合适的邮箱配置 - - -*(版本在 v0.1 到 v0.2 期间代码有过很多次变更,之前没有发布版本,故此处不再赘述相关变更日志)* - -#### [v0.1](https://github.com/luolongfei/freenom/releases/tag/v0.1) - 2018-8-13 - -##### Added - -- 初版,开源,基础的续期功能 - -### 🎉 鸣谢 -- [PHPMailer](https://github.com/PHPMailer/PHPMailer/) (邮件发送功能依赖此库) -- [guzzle](https://github.com/guzzle/guzzle) (Curl库) -- [秋水逸冰](https://teddysun.com/569.html) (本项目 Docker 相关文档有参考秋水逸冰的文章) - -### 🥝 开源协议 -[MIT](https://opensource.org/licenses/mit-license.php) diff --git a/README_EN.md b/README_EN.md deleted file mode 100644 index 4351285f..00000000 --- a/README_EN.md +++ /dev/null @@ -1,196 +0,0 @@ -
-

Freenom: freenom domain name renews automatically

- -[![Build Status](https://img.shields.io/badge/build-passed-brightgreen?style=for-the-badge)](https://scrutinizer-ci.com/g/luolongfei/freenom/build-status/master) -[![Php Version](https://img.shields.io/badge/php-%3E=7.2-brightgreen.svg?style=for-the-badge)](https://secure.php.net/) -[![Scrutinizer Code Quality](https://img.shields.io/badge/scrutinizer-9.31-brightgreen?style=for-the-badge)](https://scrutinizer-ci.com/g/luolongfei/freenom/?branch=master) -[![MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge)](https://github.com/luolongfei/freenom/blob/master/LICENSE) - -Documentation: English version | [中文版](https://github.com/luolongfei/freenom) -
- -[📃 Why write this script](#--Why-write-this-script) - -[🍭 Demo](#--Demo) - -[🎁 Preparation](#--Preparation) - -[📪 Setting up Gmail](#--Setting-up-Gmail) - -[🤶 Telegram bot](#--Telegram-bot) - -[🚧 Configuration script](#--Configuration-script) - -[🎈 Add scheduled task](#--Add-scheduled-task) - -[☕ Verification](#--Verification) - -[❤ Donate](#--Donate) - -[🌚 Author](#--Author) - -[🎉 Acknowledgements](#--Acknowledgements) - -[🥝 Open source agreement](#--Open-source-agreement) - - -### 📃 Why write this script -As we all know, Freenom is the only merchant on the planet that provides free top-level domain names, but it needs to be renewed every year for up to one year at a time. Since I applied for a bunch of domain names, and not at the same time, -So I felt frustrated every time I renewed, so I wrote this automatic renewal script. - -### 🍭 Demo -![Email example](https://s2.ax1x.com/2020/01/31/139Rrd.png "Email content") - -Regardless of the success or failure of the renewal or the execution of the script, you will receive emails from the program. In the case of a renewal success or failure email, the email will include the number of days that the domain name has not been renewed. - -### 🎁 Preparation -- Email of robot: Used to send notification emails. -- Your email: Used to receive notification emails sent by robots. -- VPS: Any server can be used. The system recommends `Centos7`, and the PHP version must be` php7.1` or above. -- No more - -### 📪 Setting up Gmail -*** -1.In `Settings > Forwarding and POP/IMAP`, tick -- Enable POP for all messages -- Enable IMAP - -![gmail Configuration 01](https://s2.ax1x.com/2020/02/01/1GDsMR.png "gmail Configuration 01") - -Then save your changes. - -2.Allow less secure applications - -After logging into Google Mail, visit [this page](https://myaccount.google.com/u/0/lesssecureapps?pli=1&pageId=none) and enable the application that is not secure enough. - -Also, if prompted -> Do not allow access to account - -After logging in to Google Mail, go to [this page](https://accounts.google.com/b/0/DisplayUnlockCaptcha) and click Allow. This situation is relatively rare. - -### 🤶 Telegram bot -*** -If you don't want to use email push, you can also use Telegram bot. In the `.env` file, -Change the value of `TELEGRAM_BOT_ENABLE` to `true` to enable the Telegram bot. -Similarly, change the value of `MAIL_ENABLE` to `false` to disable the mail push method. -Telegram bot has two configuration items, one is `chatID` (corresponding to `TELEGRAM_CHAT_ID` in `.env` file), -You can get your own id by sending `/start` to `@userinfobot` using your Telegram account, -The other is `token` (corresponding to `TELEGRAM_BOT_TOKEN` in the `.env` file), -your Telegram bot token, how to create a Telegram bot and how to get the token please refer to: -[Official Document](https://core.telegram.org/bots#6-botfather) - -*This completes the settings related to notifications, followed by the configuration related to this program* :) - -### 🚧 Configuration script -All operations are performed under Centos7 system, other Linux distributions are similar -#### Get the source code -```bash -$ mkdir -p /data/wwwroot/freenom -$ cd /data/wwwroot/freenom - -# clone the repository source -$ git clone https://github.com/luolongfei/freenom.git ./ -``` - -#### Configuration process -```bash -# Copy configuration file template -$ cp .env.example .env - -# Edit configuration file -$ vim .env - -# .env Each item in the file has a detailed description, which will not be repeated here. In short, you need to change all the items in it to your own. Note the format of the multi-account configuration: -# e.g. MULTIPLE_ACCOUNTS='@|@|@' -# Of course, if you only have a single account, you only need to configure FREEENOM_USERNAME and FREEENOM_PASSWORD. The configurations of single account and multiple accounts will be read together and duplicated. - -# After editing, press "Esc" to return to the command mode, enter ":wq" and press Enter to save and exit. If you don't use vim editor, you can ask Uncle Google. :) -``` - -### 🎈 Add scheduled task -#### Install crontabs and cronie -```bash -$ yum -y install cronie crontabs - -# Verify if crond is installed and started -$ yum list cronie && systemctl status crond - -# Verify that crontab is installed -$ yum list crontabs $$ which crontab && crontab -l -``` - -#### Open the task form and edit -```bash -$ crontab -e - -# Task content is as follows -# The meaning of this task is to execute the run file under /data/wwwroot/freenom/ at 9 AM every day -# Note: In some cases, crontab may not find your php path. The following command will output an error message in the freenom_crontab.log file. You should specify the php path: replace the following php with /usr/local/php/bin/php (based on the actual situation) -00 09 * * * cd /data/wwwroot/freenom/ && php run > freenom_crontab.log 2>&1 -``` - -#### Restart the crond daemon (This step is required each time you edit the task form for the task to take effect) -```bash -$ systemctl restart crond -``` -To check if the `Task` is normal, you can set the execution time of the above task to a few minutes, and then wait until the task execution is completed, -check the contents of the `freenom_crontab.log` file in the `/data/wwwroot/freenom/` directory for errors. Common error messages are as follows: -- /bin/sh: php: command not found -- /bin/sh: /usr/local/php: Is a directory - -*(Click to expand or collapse)* -
- solution -
- -> -> execute -> ```bash -> $ whereis php -> # Determine the location of php, the general output is "php: /usr/local/php /usr/local/php/bin/php", we choose: /usr/local/php/bin/php -> ``` -> Now we know that php's path is `/usr/local/php/bin/php` (may be different according to the actual situation of your own system), -> and then modify the commands in the form task, change -> -> `00 09 * * * cd /data/wwwroot/freenom/ && php run > freenom_crontab.log 2>&1` -> -> to -> -> `00 09 * * * cd /data/wwwroot/freenom/ && /usr/local/php/bin/php run > freenom_crontab.log 2>&1` -> -> More information: [click here](https://stackoverflow.com/questions/7397469/why-is-crontab-not-executing-my-php-script) -> - -
- -Of course, if your `crontab` can correctly find the `php path` without error, you don't need to do anything. - -*So far, all the configurations have been completed, let's verify if the whole process works* :) - -### ☕ Verification -You can first change the value of `NOTICE_FREQ` in `.env` to 1 (Push notification every time the script is executed), and then execute -```bash -$ cd /data/wwwroot/freenom/ && php run -``` -If nothing else, you will receive an email about the domain name. - -If you encounter any problems or bugs, please mention [issues](https://github.com/luolongfei/freenom/issues). If freenom changes the algorithm and causes this project to fail, -Please mention [issues](https://github.com/luolongfei/freenom/issues) to inform me that I will fix it in time and maintain this project for a long time. Welcome star ~ - -### ❤ Donate - -#### PayPal: [https://www.paypal.me/mybsdc](https://www.paypal.me/mybsdc) -> Every time you spend money, you're casting a vote for the kind of world you want .-- Anna Lappe - -![Every time you spend your money, you are voting for the world you want. ](https://s2.ax1x.com/2020/01/31/13P8cF.jpg) - -### 🌚 Author -- Main program and framework: [@luolongfei](https://github.com/luolongfei) -- English document: [@肖阿姨](#) - -### 🎉 Acknowledgements -- [PHPMailer](https://github.com/PHPMailer/PHPMailer/) (Mail sending function depends on this library) -- [guzzle](https://github.com/guzzle/guzzle) (Curl library) - -### 🥝 Open source agreement -[MIT](https://opensource.org/licenses/mit-license.php) diff --git a/app/Console/FreeNom.php b/app/Console/FreeNom.php index 1a8c13c4..b1e4711f 100644 --- a/app/Console/FreeNom.php +++ b/app/Console/FreeNom.php @@ -19,7 +19,7 @@ class FreeNom { - const VERSION = 'v0.3'; + const VERSION = 'v0.3_scf'; const TIMEOUT = 34.52; diff --git a/composer.json b/composer.json deleted file mode 100644 index 3fb4ddbc..00000000 --- a/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "luolongfei/freenom", - "description": "freenom域名自动续期。", - "type": "project", - "require": { - "php": ">=7.1.0", - "ext-curl": "*", - "ext-openssl": "*", - "guzzlehttp/guzzle": "^6.3", - "monolog/monolog": "^1.24", - "bramus/monolog-colored-line-formatter": "~2.0", - "phpmailer/phpmailer": "^6.0", - "vlucas/phpdotenv": "^3.3", - "predis/predis": "^1.1", - "ext-json": "*", - "ext-bcmath": "*", - "ext-pdo": "*", - "kevinlebrun/colors.php": "^1.0" - }, - "license": "MIT", - "authors": [ - { - "name": "luolongfei", - "email": "mybsdc@gmail.com", - "homepage": "https://github.com/luolongfei/freenom" - } - ], - "autoload": { - "psr-4": { - "Luolongfei\\Lib\\": "libs", - "Luolongfei\\App\\": "app" - }, - "files": [ - "app/helpers.php" - ] - } -} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 298b7280..00000000 --- a/composer.lock +++ /dev/null @@ -1,844 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "1490a7a3df10963c3b2891841cfe0591", - "packages": [ - { - "name": "bramus/ansi-php", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/bramus/ansi-php.git", - "reference": "fb0be33f36053af7454d462e3ddc0a2ac0b2f311" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bramus/ansi-php/zipball/fb0be33f36053af7454d462e3ddc0a2ac0b2f311", - "reference": "fb0be33f36053af7454d462e3ddc0a2ac0b2f311", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Bramus\\Ansi\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bramus Van Damme", - "email": "bramus@bram.us", - "homepage": "https://www.bram.us/" - } - ], - "description": "ANSI Control Functions and ANSI Control Sequences (Colors, Erasing, etc.) for PHP CLI Apps", - "time": "2019-12-03T09:04:38+00:00" - }, - { - "name": "bramus/monolog-colored-line-formatter", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/bramus/monolog-colored-line-formatter.git", - "reference": "6bff15eee00afe2690642535b0f1541f10852c2b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bramus/monolog-colored-line-formatter/zipball/6bff15eee00afe2690642535b0f1541f10852c2b", - "reference": "6bff15eee00afe2690642535b0f1541f10852c2b", - "shasum": "" - }, - "require": { - "bramus/ansi-php": "~3.0", - "php": ">=5.4.0" - }, - "require-dev": { - "monolog/monolog": "~1.0", - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Bramus\\Monolog\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bramus Van Damme", - "email": "bramus@bram.us", - "homepage": "https://www.bram.us/" - } - ], - "description": "Colored Line Formatter for Monolog", - "time": "2015-01-07T22:12:35+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.5.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2019-12-23T11:57:10+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2019-07-01T23:21:34+00:00" - }, - { - "name": "kevinlebrun/colors.php", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/kevinlebrun/colors.php.git", - "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kevinlebrun/colors.php/zipball/cdda5eee41314b87cd5a8bb91b1ffc7c0210e673", - "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*", - "satooshi/php-coveralls": "1.0.*", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Colors": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kevin Le Brun", - "email": "lebrun.k@gmail.com", - "homepage": "http://kevinlebrun.fr", - "role": "developer" - } - ], - "description": "Colors for PHP CLI scripts", - "homepage": "https://github.com/kevinlebrun/colors.php", - "keywords": [ - "cli", - "color", - "colors", - "console", - "shell" - ], - "time": "2018-05-30T08:34:23+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.25.3", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2019-12-20T14:15:16+00:00" - }, - { - "name": "phpmailer/phpmailer", - "version": "v6.1.6", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-filter": "*", - "php": ">=5.5.0" - }, - "require-dev": { - "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" - }, - "suggest": { - "ext-mbstring": "Needed to send email in multibyte encoding charset", - "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", - "league/oauth2-google": "Needed for Google XOAUTH2 authentication", - "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPMailer\\PHPMailer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-only" - ], - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2020-05-27T12:24:03+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.7.2", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", - "reference": "77f7c4d2e65413aff5b5a8cc8b3caf7a28d81959", - "shasum": "" - }, - "require": { - "php": "^5.5.9 || ^7.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.3", - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "time": "2019-12-15T19:35:24+00:00" - }, - { - "name": "predis/predis", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/nrk/predis.git", - "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", - "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "suggest": { - "ext-curl": "Allows access to Webdis when paired with phpiredis", - "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" - }, - "type": "library", - "autoload": { - "psr-4": { - "Predis\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniele Alessandri", - "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net" - } - ], - "description": "Flexible and feature-complete Redis client for PHP and HHVM", - "homepage": "http://github.com/nrk/predis", - "keywords": [ - "nosql", - "predis", - "redis" - ], - "time": "2016-06-16T16:22:20+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/log", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2019-11-01T11:05:21+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08T08:55:37+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-11-27T13:56:44+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v3.6.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1bdf24f065975594f6a117f0f1f6cabf1333b156", - "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0", - "phpoption/phpoption": "^1.5", - "symfony/polyfill-ctype": "^1.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.6-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "homepage": "https://gjcampbell.co.uk/" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://vancelucas.com/" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2019-09-10T21:37:39+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1.0", - "ext-curl": "*", - "ext-openssl": "*", - "ext-json": "*", - "ext-bcmath": "*", - "ext-pdo": "*" - }, - "platform-dev": [] -} diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100644 index 6cca5249..00000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -#===================================================================# -# Author: mybsdc # -# Intro: https://github.com/luolongfei/freenom # -#===================================================================# - -set -e - -# 自定义颜色变量 -red='\033[0;31m' -green='\033[0;32m' -yellow='\033[0;33m' -plain='\033[0m' - -# 生成配置文件 -if [ ! -f /conf/.env ]; then - cp /app/.env.example /conf/.env - echo -e "[${green}Info${plain}] 已生成 .env 文件,请将 .env 文件中的配置项改为你自己的,然后重启容器" -fi -if [ ! -f /app/.env ]; then - ln -s /conf/.env /app/.env -fi - -# PHP 命令 -PHP_COMMAND='php /app/run > /app/logs/freenom_cron.log 2>&1' - -# 指定脚本执行时间 -if [ -z "${RUN_AT}" ]; then - minute=$( shuf -i 0-59 -n 1 ) - hour=$( shuf -i 6-23 -n 1 ) - CRON_COMMAND="${minute} ${hour} * * * ${PHP_COMMAND}" - echo -e "[${green}Info${plain}] 已自动指定执行时间,续期任务将在北京时间每天 「${hour}:${minute}」 执行" - echo -e "[${green}Info${plain}] 在没有手动指定 RUN_AT 环境变量的情况下,每次重启容器,程序都会重新在 06 ~ 23 点全时段中自动随机指定一个执行时间,目的是防止很多人在同一个时间点执行任务导致 Freenom 无法稳定提供服务" -else - if [[ "${RUN_AT}" =~ ^([01][0-9]|2[0-3]|[0-9]):([0-5][0-9]|[0-9])$ ]]; then - minute=$( echo ${RUN_AT} | egrep -o '([0-5][0-9]|[0-9])$' ) - hour=$( echo ${RUN_AT} | egrep -o '^([01][0-9]|2[0-3]|[0-9])' ) - CRON_COMMAND="${minute} ${hour} * * * ${PHP_COMMAND}" - echo -e "[${green}Info${plain}] 你已指定执行时间,续期任务将在北京时间每天 「${hour}:${minute}」 执行" - elif [[ "${RUN_AT}" =~ ^([0-9\/*-]+( |$)){5}$ ]]; then - CRON_COMMAND="${RUN_AT} ${PHP_COMMAND}" - else - echo -e "[${red}Error${plain}] RUN_AT 的值无效" - echo -e "${yellow}请输入一个有效的时间指令,其值可以为时分格式,如:11:24,也可以为 CRON 命令中的时间格式,如:'24 11 * * *',甚至可以不输入,让程序自动生成,推荐采用自动生成的方式,不建议手动指定此环境变量" - exit 1 - fi -fi - -# 添加计划任务 -sed -i '/freenom_cron/'d /etc/crontabs/root -echo -e "${CRON_COMMAND}" >> /etc/crontabs/root - -echo -e "[${green}Info${plain}] CRON_COMMAND: ${CRON_COMMAND}" - -php run - -exec "$@" diff --git a/resources/screenshot/scf.png b/resources/screenshot/scf.png deleted file mode 100644 index abfec117..00000000 Binary files a/resources/screenshot/scf.png and /dev/null differ diff --git a/run b/run.php similarity index 78% rename from run rename to run.php index e603c1f3..b61d2543 100644 --- a/run +++ b/run.php @@ -1,4 +1,3 @@ -#!/usr/bin/env php getMessage()); } -try { - system_check(); +function main_handler($event, $context) +{ + try { + system_check(); + + $class = sprintf('Luolongfei\App\Console\%s', get_argv('c', 'FreeNom')); + $fn = get_argv('m', 'handle'); - $class = sprintf('Luolongfei\App\Console\%s', get_argv('c', 'FreeNom')); - $fn = get_argv('m', 'handle'); + $class::instance()->$fn(); + + return '云函数执行成功。'; + } catch (\Exception $e) { + system_log(sprintf('执行出错:%s', $e->getMessage()), $e->getTrace()); + } - $class::instance()->$fn(); -} catch (\Exception $e) { - system_log(sprintf('执行出错:%s', $e->getMessage()), $e->getTrace()); + return '云函数执行失败。'; }