diff --git a/README.md b/README.md
index 0409be51..f3c7939b 100644
--- a/README.md
+++ b/README.md
@@ -21,9 +21,11 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
[⛵ 通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式)(推荐,最简单的部署方式)
-[🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署推荐无服务器的用户使用)(推荐无服务器的用户使用)
+[🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署)(供无服务器的用户使用)
-[🚧 直接拉取源码部署](#-方式三直接拉取源码部署)
+[🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署)(同上,供无服务器的用户使用)
+
+[🚧 直接拉取源码部署](#-方式四直接拉取源码部署)
[📋 捐赠名单 Donate List](#-捐赠名单-donate-list)
@@ -47,7 +49,8 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
仓库,然后在 [@Mattraks](https://github.com/Mattraks) 的提醒下,通过特别的方式恢复了本仓库。
- 本次封禁导致的直接后果是以前的`issues`全部丢失,以及近`1.8k`的`star`数重新归零,在动力上面确实有受到影响,不过也不会有太大影响,本项目依然长期维护,如果项目有帮到你,欢迎 star。
- 狡兔三窟,临时仓库 https://github.com/luolongfei/next-freenom 也是备用仓库,如若本仓库再次失联,可以移步到备用仓库获取最新消息,正常情况下以后的开发维护依然在本仓库进行。
-- 推荐 [通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式),或者参考下方文档直接搬运到 [腾讯云函数部署](#-方式二通过腾讯云函数部署推荐无服务器的用户使用) ,腾讯云函数不需要有自己的服务器。
+- 推荐 [⛵ 通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式),也可以参考下方文档 [🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署)
+ 或者 [🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署),腾讯云函数和阿里云函数不需要你有自己的服务器。
### 📃 引言
@@ -61,7 +64,8 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
### 🎁 事前准备
-- VPS:随便一台服务器都行,系统推荐`Centos7`或者`Debian`,另外 PHP 版本需在`php7.2`及以上。如果你没有服务器,推荐参考下方文档部署到 [腾讯云函数](#-方式二通过腾讯云函数部署推荐无服务器的用户使用) 。
+- VPS:随便一台服务器都行,系统推荐`Centos7`或者`Debian`,另外 PHP 版本需在`php7.2`及以上。如果你没有服务器,推荐参考下方文档
+ [🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署) 或者 [🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署) 。
- 送信邮箱(可选):为了方便理解又称机器人邮箱,用于发送通知邮件。目前针对`Gmail`、`QQ邮箱`、`163邮箱`以及`Outlook邮箱`,程序会自动判断送信邮箱类型并使用合适的配置。
如果你使用的是其它第三方邮箱或者自建邮件服务,那么请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example)
文件中与邮件配置相关的注释进行配置。
@@ -263,11 +267,11 @@ Bark 是一款 IOS 端用于推送自定义通知的 app,是个人开发者在
***
-*与 配置送信功能 相关的篇幅完。下面开始讲本项目的三种使用方式,一种是通过 Docker,另一种是通过腾讯云函数,再一种是直接拉取源码部署,推荐使用 Docker 方式,无需纠结环境。*
+*与 配置送信功能 相关的篇幅完。下面开始讲本项目的几种使用方式。推荐使用 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`, 理论上支持`群晖`
@@ -440,24 +444,34 @@ docker stats --no-stream
docker version
```
+重启 Docker(非容器)
+
+```shell
+systemctl restart docker
+```
+
*有关容器部署的内容结束。*
-### 🕹 方式二:通过腾讯云函数部署(推荐无服务器的用户使用)
+***
-
+### 🕹 方式二:通过腾讯云函数部署
+
+*推荐没有自己服务器的用户使用。*
+
+**注意,由于下方文档中图片文件过大,可能会出现图片加载失败的情况,点击裂掉的图片名即可跳转到新页面打开原图。**
#### 1、下载腾讯云函数版的压缩包
-腾讯云函数版将与主版同步维护更新,推荐没有自己服务器的用户使用,最新版本号为`v0.4.3`。下载地址:
+腾讯云函数版将与主版同步维护更新,腾讯云函数和阿里云函数使用的是同一个压缩包,下载地址:
[https://github.com/luolongfei/freenom/releases/download/v0.4.3/freenom_scf.zip](https://github.com/luolongfei/freenom/releases/download/v0.4.3/freenom_scf.zip)
+。本文档会在发布新版的时候同步更新此处的压缩包下载地址,所以不必担心,你看到的下载地址指向的包一定是最新版本。
下载后你将得到一个 zip 文件,将 zip 文件放到你能找到的任意目录,后面我们将以 zip 文件的形式上传到腾讯云函数。
#### 2、创建腾讯云函数
直接访问腾讯云函数控制台创建云函数: [https://console.cloud.tencent.com/scf/list-create?rid=5&ns=default&createType=empty](https://console.cloud.tencent.com/scf/list-create?rid=5&ns=default&createType=empty)
-,按照下图所示的说明进行创建。如果无法看清图片,可访问: [https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf.png](https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf.png)
-或者 [https://z3.ax1x.com/2021/10/14/5lMweU.png](https://z3.ax1x.com/2021/10/14/5lMweU.png) 查看原图,也可以直接点击图片查看原图。
+,按照下图所示的说明进行创建。如果无法看清图片,直接点击图片即可查看原图。
[![scf01](https://z3.ax1x.com/2021/10/14/5lMweU.png)](https://z3.ax1x.com/2021/10/14/5lMweU.png)
@@ -465,17 +479,119 @@ docker version
[![scf02](https://z3.ax1x.com/2021/10/14/5l3oHf.png)](https://z3.ax1x.com/2021/10/14/5l3oHf.png)
+> 如何在腾讯云函数修改或者新增环境变量呢?
+>
如果你在创建腾讯云函数的时候,某些环境变量忘记填了,或者在创建腾讯云函数后想要修改或者新增某些环境变量,可以参考这里操作,无需重建:
-[![scf03](https://z3.ax1x.com/2021/11/07/I13Ku8.png)](https://imgtu.com/i/I13Ku8)
+[![scf03](https://z3.ax1x.com/2021/11/07/I13Ku8.png)](https://z3.ax1x.com/2021/11/07/I13Ku8.png)
+
+所有受支持的环境变量及其含义请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example) 文件。
+
+> 如何在腾讯云函数更新部署的代码呢?
+>
+当有新版本可用时,想升级到最新版本,请按下图所示操作。更新代码包并部署后,可以点击测试查看部署是否成功。在更新完代码后,腾讯云函数编辑器里面可能会提示你同步代码,点击确定即可。
+
+[![scf04.png](https://s4.ax1x.com/2021/12/14/ovruHf.png)](https://s4.ax1x.com/2021/12/14/ovruHf.png)
*有关腾讯云函数部署的内容结束。*
-### 🚧 方式三:直接拉取源码部署
+***
+
+### 🧊 方式三:通过阿里云函数部署
+
+*推荐没有自己服务器的用户使用。*
+
+**注意,由于下方文档中图片文件过大,可能会出现图片加载失败的情况,点击裂掉的图片名即可跳转到新页面打开原图。**
+
+#### 1、下载阿里云函数版的压缩包
+
+阿里云函数版将与主版同步维护更新,阿里云函数和腾讯云函数使用的是同一个压缩包,下载地址:
+[https://github.com/luolongfei/freenom/releases/download/v0.4.3/freenom_scf.zip](https://github.com/luolongfei/freenom/releases/download/v0.4.3/freenom_scf.zip)
+。本文档会在发布新版的时候同步更新此处的压缩包下载地址,所以不必担心,你看到的下载地址指向的包一定是最新版本。
+
+下载后你将得到一个 zip 文件,将 zip 文件放到你能找到的任意目录,后面我们将以 zip 文件的形式上传到阿里云函数。
+
+#### 2、在阿里云开通云函数服务
+
+在 [https://common-buy.aliyun.com/?commodityCode=fc#/buy](https://common-buy.aliyun.com/?commodityCode=fc#/buy)
+可以免费开通阿里云函数服务。 详情请参考 [阿里云函数开通流程介绍](https://free.aliyun.com/product/fcfreetrial)
+以及 [阿里云函数官方指南](https://help.aliyun.com/product/50980.html) 。
+
+[![aliyun00.png](https://s4.ax1x.com/2021/12/14/ovCauQ.png)](https://s4.ax1x.com/2021/12/14/ovCauQ.png)
+
+#### 3、创建服务以及创建函数
+
+##### 3.1 创建服务
+
+直接访问 [https://fcnext.console.aliyun.com/cn-hongkong/services](https://fcnext.console.aliyun.com/cn-hongkong/services)
+,然后点击【创建服务】,地点推荐选择【香港】。此处我没有勾选【日志功能】,如果你需要【日志功能】请勾选后根据官方引导开启,否则跟下图配置一致即可。
+
+[![aliyun01.png](https://s4.ax1x.com/2021/12/14/ovPFKg.png)](https://s4.ax1x.com/2021/12/14/ovPFKg.png)
+
+##### 3.2 创建函数
+
+上一步创建了服务,会跳到函数管理画面,点击创建函数,然后根据下面图示流程进行即可。
+
+[![aliyun02.png](https://s4.ax1x.com/2021/12/14/ovinwd.png)](https://s4.ax1x.com/2021/12/14/ovinwd.png)
-
+[![aliyun03.png](https://s4.ax1x.com/2021/12/14/ovidkn.png)](https://s4.ax1x.com/2021/12/14/ovidkn.png)
-所有操作均在Centos7系统下进行,其它Linux发行版大同小异
+[![aliyun04.png](https://s4.ax1x.com/2021/12/14/ovig0J.png)](https://s4.ax1x.com/2021/12/14/ovig0J.png)
+
+配置环境变量
+
+[![aliyun05.png](https://s4.ax1x.com/2021/12/14/oviq7d.png)](https://s4.ax1x.com/2021/12/14/oviq7d.png)
+
+在上图所在画面向下滚动,可以很容易找到【环境变量】的配置位置,注意此处我只示例了最简单的几个变量的配置,没有启用任何送信功能,
+建议你在配置时记得启用送信功能,以掌握脚本的执行情况以及续期相关讯息。如何配置以及启用送信功能可以参考本文档的 [配置送信功能](https://github.com/luolongfei/freenom#-%E9%85%8D%E7%BD%AE%E9%80%81%E4%BF%A1%E5%8A%9F%E8%83%BD)
+部分。所有受支持的环境变量及其含义请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example) 文件。
+
+[![aliyun06.png](https://s4.ax1x.com/2021/12/14/ovFauD.png)](https://s4.ax1x.com/2021/12/14/ovFauD.png)
+
+[![aliyun07.png](https://s4.ax1x.com/2021/12/14/ovkhQK.png)](https://s4.ax1x.com/2021/12/14/ovkhQK.png)
+
+添加函数触发器,即计划任务。这里设置的 Cron 表达式为【CRON_TZ=Asia/Shanghai 49 24 11 * * *】,意为北京时间每天 11:24:49 执行,
+**注意,执行时间一定要记得改为你自定义的时间,不要跟我这里一模一样,尽可能跟大多数人的设置不一样,否则可能出现多人在同一时间向 freenom 的服务器发起请求的情况,导致 freenom 无法稳定提供服务,影响续期操作。**
+
+[![aliyun08.png](https://s4.ax1x.com/2021/12/14/ovAnw4.png)](https://s4.ax1x.com/2021/12/14/ovAnw4.png)
+
+上传压缩包(在上面步骤 1 中下载得到 zip 压缩包),部署代码
+
+[![aliyun09.png](https://s4.ax1x.com/2021/12/14/ovmKRs.png)](https://s4.ax1x.com/2021/12/14/ovmKRs.png)
+
+[![aliyun10.png](https://s4.ax1x.com/2021/12/14/ovmDL6.png)](https://s4.ax1x.com/2021/12/14/ovmDL6.png)
+
+由于阿里云函数默认有一个示例文件,所以此处我们上传完 zip 文件后,会提示我们是否需要同步代码,点击【是】即可
+
+[![aliyun11.png](https://s4.ax1x.com/2021/12/14/ovmqYQ.png)](https://s4.ax1x.com/2021/12/14/ovmqYQ.png)
+
+然后点击部署代码
+
+[![aliyun12.png](https://s4.ax1x.com/2021/12/14/ovnn0K.png)](https://s4.ax1x.com/2021/12/14/ovnn0K.png)
+
+【可选】 延长执行超时时间。阿里云函数默认的执行超时时间为 60 s,满足大多数人的需求。如果你的账户或者域名特别多的话,可以考虑延长它, 在【函数配置】->【环境信息】处可以编辑配置
+
+[![aliyun13.png](https://s4.ax1x.com/2021/12/14/ovumgs.png)](https://s4.ax1x.com/2021/12/14/ovumgs.png)
+
+> 在阿里云函数如何修改或者新增环境变量呢?
+>
+请参考下图操作。
+
+[![aliyun14.png](https://s4.ax1x.com/2021/12/14/ovRKQe.png)](https://s4.ax1x.com/2021/12/14/ovRKQe.png)
+
+> 在阿里云函数如何更新代码或者升级代码到最新版本呢?
+>
+参考下图,上传新的代码包后,阿里云函数编辑器可能会提示你同步代码,点击【是】即可。然后记得点击【部署】并测试。
+
+[![aliyun15.png](https://s4.ax1x.com/2021/12/14/ovW6HA.png)](https://s4.ax1x.com/2021/12/14/ovW6HA.png)
+
+*有关阿里云函数部署的内容结束。*
+
+***
+
+### 🚧 方式四:直接拉取源码部署
+
+*所有操作均在Centos7系统下进行,其它Linux发行版大同小异*
#### 1、获取源码
@@ -601,6 +717,8 @@ cd /data/wwwroot/freenom/ && php run
不出意外的话,你将收到一封关于域名情况的邮件。
+*有关 直接拉取源码部署 的内容结束。*
+
***
遇到任何问题或 Bug 欢迎提 [issue](https://github.com/luolongfei/freenom/issues) (请按模板格式提`issue`,以便我快速复现你的问题,否则问题会被忽略), 如果`Freenom`
@@ -649,8 +767,18 @@ cd /data/wwwroot/freenom/ && php run
##### Changed
+- 解决 企业微信 因送信内容过长被截断问题
+
+#### [v0.4.4](https://github.com/luolongfei/freenom/releases/tag/v0.4.4) - 2021-12-14
+
+##### Changed
+
- 改进与 Cron 表达式验证相关的正则,兼容各种花里胡哨的表达式
+
+##### Added
+
- 支持自动从 Bark url 中提取有效的 Bark key
+- 支持通过 阿里云函数 部署
#### [v0.4.3](https://github.com/luolongfei/freenom/releases/tag/v0.4.3) - 2021-11-07
diff --git a/app/Console/FreeNom.php b/app/Console/FreeNom.php
index 36b7a18e..e37e55ce 100644
--- a/app/Console/FreeNom.php
+++ b/app/Console/FreeNom.php
@@ -18,7 +18,7 @@
class FreeNom extends Base
{
- const VERSION = 'v0.4.3';
+ const VERSION = 'v0.4.4';
const TIMEOUT = 33;
diff --git a/app/helpers.php b/app/helpers.php
index 39264005..463047f4 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -237,7 +237,7 @@ function system_check()
// 如果是在云函数部署,则不需要检查这几项
if (IS_SCF) {
system_log('检测到运行环境为云函数,所有环境变量将直接从环境中读取,环境中找不到的变量,则直接从 .env.example 文件中读取');
- system_log('如果是在腾讯云函数,可以参考此处修改或新增环境变量,无需重建:https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf_env_modify.png');
+ system_log('如果是在腾讯云函数,可以参考此处修改或新增环境变量,无需重建:https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf03.png');
system_log('如果是在阿里云函数,可以直接在【函数详情】->【函数配置】->【环境信息】处编辑环境变量');
} else {
if (!function_exists('putenv')) {
diff --git a/index.php b/index.php
index 8918a03f..71c596f9 100644
--- a/index.php
+++ b/index.php
@@ -17,7 +17,7 @@
ini_set('display_errors', 1);
set_time_limit(0);
-define('IS_SCF', false); // 是否云函数环境
+define('IS_SCF', true); // 是否云函数环境
define('IS_CLI', PHP_SAPI === 'cli');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT_PATH', realpath(__DIR__));
diff --git a/libs/MessageServices/WeChat.php b/libs/MessageServices/WeChat.php
index f5be8240..f66684c8 100644
--- a/libs/MessageServices/WeChat.php
+++ b/libs/MessageServices/WeChat.php
@@ -60,7 +60,7 @@ public function __construct()
/**
* 获取 access_token 缓存
*
- * 由于腾讯云函数环境中只有 /tmp 目录的读写权限,且每次运行结束后写入的内容不会被保留,故腾讯云函数无法真正做到通过文件缓存 access_token
+ * 由于云函数环境中只有 /tmp 目录的读写权限,且每次运行结束后写入的内容不会被保留,故云函数无法真正做到通过文件缓存 access_token
* 参考:https://cloud.tencent.com/document/product/583/9180
*
* @return string|null
@@ -285,7 +285,7 @@ public function send(string $content, string $subject = '', int $type = 1, array
'msgtype' => 'text', // 消息类型,text 类型支持 a 标签以及 \n 换行,基本满足需求。由于腾讯要求 markdown 语法必须使用 企业微信APP 才能查看,不想安装,故弃之
'agentid' => $this->agentId, // 企业应用的 ID,整型,可在应用的设置页面查看
'text' => [
- 'content' => $content, // 消息内容,最长不超过2048个字节,超过将截断
+ 'content' => $content, // 消息内容,最长不超过 2048 个字节,超过将截断
],
'enable_duplicate_check' => 1,
'duplicate_check_interval' => 60,
diff --git a/resources/screenshot/aliyun00.png b/resources/screenshot/aliyun00.png
new file mode 100644
index 00000000..5c265c84
Binary files /dev/null and b/resources/screenshot/aliyun00.png differ
diff --git a/resources/screenshot/aliyun01.png b/resources/screenshot/aliyun01.png
new file mode 100644
index 00000000..19441b12
Binary files /dev/null and b/resources/screenshot/aliyun01.png differ
diff --git a/resources/screenshot/aliyun02.png b/resources/screenshot/aliyun02.png
new file mode 100644
index 00000000..ceb991fe
Binary files /dev/null and b/resources/screenshot/aliyun02.png differ
diff --git a/resources/screenshot/aliyun03.png b/resources/screenshot/aliyun03.png
new file mode 100644
index 00000000..977f08b7
Binary files /dev/null and b/resources/screenshot/aliyun03.png differ
diff --git a/resources/screenshot/aliyun04.png b/resources/screenshot/aliyun04.png
new file mode 100644
index 00000000..2c134583
Binary files /dev/null and b/resources/screenshot/aliyun04.png differ
diff --git a/resources/screenshot/aliyun05.png b/resources/screenshot/aliyun05.png
new file mode 100644
index 00000000..ead83ad5
Binary files /dev/null and b/resources/screenshot/aliyun05.png differ
diff --git a/resources/screenshot/aliyun06.png b/resources/screenshot/aliyun06.png
new file mode 100644
index 00000000..2faae279
Binary files /dev/null and b/resources/screenshot/aliyun06.png differ
diff --git a/resources/screenshot/aliyun07.png b/resources/screenshot/aliyun07.png
new file mode 100644
index 00000000..4fbb864b
Binary files /dev/null and b/resources/screenshot/aliyun07.png differ
diff --git a/resources/screenshot/aliyun08.png b/resources/screenshot/aliyun08.png
new file mode 100644
index 00000000..fb18f93d
Binary files /dev/null and b/resources/screenshot/aliyun08.png differ
diff --git a/resources/screenshot/aliyun09.png b/resources/screenshot/aliyun09.png
new file mode 100644
index 00000000..08e0eef1
Binary files /dev/null and b/resources/screenshot/aliyun09.png differ
diff --git a/resources/screenshot/aliyun10.png b/resources/screenshot/aliyun10.png
new file mode 100644
index 00000000..5f263420
Binary files /dev/null and b/resources/screenshot/aliyun10.png differ
diff --git a/resources/screenshot/aliyun11.png b/resources/screenshot/aliyun11.png
new file mode 100644
index 00000000..bf245759
Binary files /dev/null and b/resources/screenshot/aliyun11.png differ
diff --git a/resources/screenshot/aliyun12.png b/resources/screenshot/aliyun12.png
new file mode 100644
index 00000000..a144dfc9
Binary files /dev/null and b/resources/screenshot/aliyun12.png differ
diff --git a/resources/screenshot/aliyun13.png b/resources/screenshot/aliyun13.png
new file mode 100644
index 00000000..df2217cb
Binary files /dev/null and b/resources/screenshot/aliyun13.png differ
diff --git a/resources/screenshot/aliyun14.png b/resources/screenshot/aliyun14.png
new file mode 100644
index 00000000..66590112
Binary files /dev/null and b/resources/screenshot/aliyun14.png differ
diff --git a/resources/screenshot/aliyun15.png b/resources/screenshot/aliyun15.png
new file mode 100644
index 00000000..2ec6cc07
Binary files /dev/null and b/resources/screenshot/aliyun15.png differ
diff --git a/resources/screenshot/scf.png b/resources/screenshot/scf01.png
similarity index 100%
rename from resources/screenshot/scf.png
rename to resources/screenshot/scf01.png
diff --git a/resources/screenshot/scf02.png b/resources/screenshot/scf02.png
new file mode 100644
index 00000000..9b38bcf8
Binary files /dev/null and b/resources/screenshot/scf02.png differ
diff --git a/resources/screenshot/scf_env_modify.png b/resources/screenshot/scf03.png
similarity index 100%
rename from resources/screenshot/scf_env_modify.png
rename to resources/screenshot/scf03.png
diff --git a/resources/screenshot/scf04.png b/resources/screenshot/scf04.png
new file mode 100644
index 00000000..c43f7b5e
Binary files /dev/null and b/resources/screenshot/scf04.png differ