Skip to content

Commit b6e3de8

Browse files
committed
Merge branch 'dev'
2 parents ba9a313 + 522f419 commit b6e3de8

25 files changed

+149
-21
lines changed

README.md

Lines changed: 144 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
2121

2222
[⛵ 通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式)(推荐,最简单的部署方式)
2323

24-
[🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署推荐无服务器的用户使用)(推荐无服务器的用户使用
24+
[🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署)(供无服务器的用户使用
2525

26-
[🚧 直接拉取源码部署](#-方式三直接拉取源码部署)
26+
[🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署)(同上,供无服务器的用户使用)
27+
28+
[🚧 直接拉取源码部署](#-方式四直接拉取源码部署)
2729

2830
[📋 捐赠名单 Donate List](#-捐赠名单-donate-list)
2931

@@ -47,7 +49,8 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
4749
仓库,然后在 [@Mattraks](https://github.com/Mattraks) 的提醒下,通过特别的方式恢复了本仓库。
4850
- 本次封禁导致的直接后果是以前的`issues`全部丢失,以及近`1.8k``star`数重新归零,在动力上面确实有受到影响,不过也不会有太大影响,本项目依然长期维护,如果项目有帮到你,欢迎 star。
4951
- 狡兔三窟,临时仓库 https://github.com/luolongfei/next-freenom 也是备用仓库,如若本仓库再次失联,可以移步到备用仓库获取最新消息,正常情况下以后的开发维护依然在本仓库进行。
50-
- 推荐 [通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式),或者参考下方文档直接搬运到 [腾讯云函数部署](#-方式二通过腾讯云函数部署推荐无服务器的用户使用) ,腾讯云函数不需要有自己的服务器。
52+
- 推荐 [⛵ 通过 Docker 方式部署](#-方式一通过-docker-部署推荐最简单的部署方式),也可以参考下方文档 [🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署)
53+
或者 [🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署),腾讯云函数和阿里云函数不需要你有自己的服务器。
5154

5255
### 📃 引言
5356

@@ -61,7 +64,8 @@ Documentation: [English version](https://github.com/luolongfei/freenom/blob/main
6164

6265
### 🎁 事前准备
6366

64-
- VPS:随便一台服务器都行,系统推荐`Centos7`或者`Debian`,另外 PHP 版本需在`php7.2`及以上。如果你没有服务器,推荐参考下方文档部署到 [腾讯云函数](#-方式二通过腾讯云函数部署推荐无服务器的用户使用)
67+
- VPS:随便一台服务器都行,系统推荐`Centos7`或者`Debian`,另外 PHP 版本需在`php7.2`及以上。如果你没有服务器,推荐参考下方文档
68+
[🕹 通过腾讯云函数部署](#-方式二通过腾讯云函数部署) 或者 [🧊 通过阿里云函数部署](#-方式三通过阿里云函数部署)
6569
- 送信邮箱(可选):为了方便理解又称机器人邮箱,用于发送通知邮件。目前针对`Gmail``QQ邮箱``163邮箱`以及`Outlook邮箱`,程序会自动判断送信邮箱类型并使用合适的配置。
6670
如果你使用的是其它第三方邮箱或者自建邮件服务,那么请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example)
6771
文件中与邮件配置相关的注释进行配置。
@@ -263,11 +267,11 @@ Bark 是一款 IOS 端用于推送自定义通知的 app,是个人开发者在
263267

264268
***
265269

266-
*与 配置送信功能 相关的篇幅完。下面开始讲本项目的三种使用方式,一种是通过 Docker,另一种是通过腾讯云函数,再一种是直接拉取源码部署,推荐使用 Docker 方式,无需纠结环境。*
270+
*与 配置送信功能 相关的篇幅完。下面开始讲本项目的几种使用方式。推荐使用 Docker 方式,无需纠结环境。*
267271

268-
### ⛵ 方式一:通过 Docker 部署(推荐,最简单的部署方式)
272+
***
269273

270-
<hr>
274+
### ⛵ 方式一:通过 Docker 部署(推荐,最简单的部署方式)
271275

272276
Docker 仓库地址为: [https://hub.docker.com/r/luolongfei/freenom](https://hub.docker.com/r/luolongfei/freenom) ,同样欢迎 star 。
273277
此镜像支持的架构为`linux/amd64``linux/arm64``linux/ppc64le``linux/s390x``linux/386``linux/arm/v7``linux/arm/v6`, 理论上支持`群晖`
@@ -440,42 +444,154 @@ docker stats --no-stream
440444
docker version
441445
```
442446

447+
重启 Docker(非容器)
448+
449+
```shell
450+
systemctl restart docker
451+
```
452+
443453
*有关容器部署的内容结束。*
444454

445-
### 🕹 方式二:通过腾讯云函数部署(推荐无服务器的用户使用)
455+
***
446456

447-
<hr>
457+
### 🕹 方式二:通过腾讯云函数部署
458+
459+
*推荐没有自己服务器的用户使用。*
460+
461+
**注意,由于下方文档中图片文件过大,可能会出现图片加载失败的情况,点击裂掉的图片名即可跳转到新页面打开原图。**
448462

449463
#### 1、下载腾讯云函数版的压缩包
450464

451-
腾讯云函数版将与主版同步维护更新,推荐没有自己服务器的用户使用,最新版本号为`v0.4.3`下载地址:
465+
腾讯云函数版将与主版同步维护更新,腾讯云函数和阿里云函数使用的是同一个压缩包,下载地址:
452466
[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)
467+
。本文档会在发布新版的时候同步更新此处的压缩包下载地址,所以不必担心,你看到的下载地址指向的包一定是最新版本。
453468

454469
下载后你将得到一个 zip 文件,将 zip 文件放到你能找到的任意目录,后面我们将以 zip 文件的形式上传到腾讯云函数。
455470

456471
#### 2、创建腾讯云函数
457472

458473
直接访问腾讯云函数控制台创建云函数: [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)
459-
,按照下图所示的说明进行创建。如果无法看清图片,可访问: [https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf.png](https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf.png)
460-
或者 [https://z3.ax1x.com/2021/10/14/5lMweU.png](https://z3.ax1x.com/2021/10/14/5lMweU.png) 查看原图,也可以直接点击图片查看原图。
474+
,按照下图所示的说明进行创建。如果无法看清图片,直接点击图片即可查看原图。
461475

462476
[![scf01](https://z3.ax1x.com/2021/10/14/5lMweU.png)](https://z3.ax1x.com/2021/10/14/5lMweU.png)
463477

464478
按照上图所示部署完成后,可以点击云函数的名称进入云函数管理画面,管理画面点击函数代码,然后往下翻可看到`部署``测试`按钮,点击`测试`,稍等几秒钟,即可看到输出日志, 根据输出日志判断配置以及部署是否正确。
465479

466480
[![scf02](https://z3.ax1x.com/2021/10/14/5l3oHf.png)](https://z3.ax1x.com/2021/10/14/5l3oHf.png)
467481

482+
> 如何在腾讯云函数修改或者新增环境变量呢?
483+
>
468484
如果你在创建腾讯云函数的时候,某些环境变量忘记填了,或者在创建腾讯云函数后想要修改或者新增某些环境变量,可以参考这里操作,无需重建:
469485

470-
[![scf03](https://z3.ax1x.com/2021/11/07/I13Ku8.png)](https://imgtu.com/i/I13Ku8)
486+
[![scf03](https://z3.ax1x.com/2021/11/07/I13Ku8.png)](https://z3.ax1x.com/2021/11/07/I13Ku8.png)
487+
488+
所有受支持的环境变量及其含义请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example) 文件。
489+
490+
> 如何在腾讯云函数更新部署的代码呢?
491+
>
492+
当有新版本可用时,想升级到最新版本,请按下图所示操作。更新代码包并部署后,可以点击测试查看部署是否成功。在更新完代码后,腾讯云函数编辑器里面可能会提示你同步代码,点击确定即可。
493+
494+
[![scf04.png](https://s4.ax1x.com/2021/12/14/ovruHf.png)](https://s4.ax1x.com/2021/12/14/ovruHf.png)
471495

472496
*有关腾讯云函数部署的内容结束。*
473497

474-
### 🚧 方式三:直接拉取源码部署
498+
***
499+
500+
### 🧊 方式三:通过阿里云函数部署
501+
502+
*推荐没有自己服务器的用户使用。*
503+
504+
**注意,由于下方文档中图片文件过大,可能会出现图片加载失败的情况,点击裂掉的图片名即可跳转到新页面打开原图。**
505+
506+
#### 1、下载阿里云函数版的压缩包
507+
508+
阿里云函数版将与主版同步维护更新,阿里云函数和腾讯云函数使用的是同一个压缩包,下载地址:
509+
[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)
510+
。本文档会在发布新版的时候同步更新此处的压缩包下载地址,所以不必担心,你看到的下载地址指向的包一定是最新版本。
511+
512+
下载后你将得到一个 zip 文件,将 zip 文件放到你能找到的任意目录,后面我们将以 zip 文件的形式上传到阿里云函数。
513+
514+
#### 2、在阿里云开通云函数服务
515+
516+
[https://common-buy.aliyun.com/?commodityCode=fc#/buy](https://common-buy.aliyun.com/?commodityCode=fc#/buy)
517+
可以免费开通阿里云函数服务。 详情请参考 [阿里云函数开通流程介绍](https://free.aliyun.com/product/fcfreetrial)
518+
以及 [阿里云函数官方指南](https://help.aliyun.com/product/50980.html)
519+
520+
[![aliyun00.png](https://s4.ax1x.com/2021/12/14/ovCauQ.png)](https://s4.ax1x.com/2021/12/14/ovCauQ.png)
521+
522+
#### 3、创建服务以及创建函数
523+
524+
##### 3.1 创建服务
525+
526+
直接访问 [https://fcnext.console.aliyun.com/cn-hongkong/services](https://fcnext.console.aliyun.com/cn-hongkong/services)
527+
,然后点击【创建服务】,地点推荐选择【香港】。此处我没有勾选【日志功能】,如果你需要【日志功能】请勾选后根据官方引导开启,否则跟下图配置一致即可。
528+
529+
[![aliyun01.png](https://s4.ax1x.com/2021/12/14/ovPFKg.png)](https://s4.ax1x.com/2021/12/14/ovPFKg.png)
530+
531+
##### 3.2 创建函数
532+
533+
上一步创建了服务,会跳到函数管理画面,点击创建函数,然后根据下面图示流程进行即可。
534+
535+
[![aliyun02.png](https://s4.ax1x.com/2021/12/14/ovinwd.png)](https://s4.ax1x.com/2021/12/14/ovinwd.png)
475536

476-
<hr>
537+
[![aliyun03.png](https://s4.ax1x.com/2021/12/14/ovidkn.png)](https://s4.ax1x.com/2021/12/14/ovidkn.png)
477538

478-
所有操作均在Centos7系统下进行,其它Linux发行版大同小异
539+
[![aliyun04.png](https://s4.ax1x.com/2021/12/14/ovig0J.png)](https://s4.ax1x.com/2021/12/14/ovig0J.png)
540+
541+
配置环境变量
542+
543+
[![aliyun05.png](https://s4.ax1x.com/2021/12/14/oviq7d.png)](https://s4.ax1x.com/2021/12/14/oviq7d.png)
544+
545+
在上图所在画面向下滚动,可以很容易找到【环境变量】的配置位置,注意此处我只示例了最简单的几个变量的配置,没有启用任何送信功能,
546+
建议你在配置时记得启用送信功能,以掌握脚本的执行情况以及续期相关讯息。如何配置以及启用送信功能可以参考本文档的 [配置送信功能](https://github.com/luolongfei/freenom#-%E9%85%8D%E7%BD%AE%E9%80%81%E4%BF%A1%E5%8A%9F%E8%83%BD)
547+
部分。所有受支持的环境变量及其含义请参考 [.env.example](https://github.com/luolongfei/freenom/blob/main/.env.example) 文件。
548+
549+
[![aliyun06.png](https://s4.ax1x.com/2021/12/14/ovFauD.png)](https://s4.ax1x.com/2021/12/14/ovFauD.png)
550+
551+
[![aliyun07.png](https://s4.ax1x.com/2021/12/14/ovkhQK.png)](https://s4.ax1x.com/2021/12/14/ovkhQK.png)
552+
553+
添加函数触发器,即计划任务。这里设置的 Cron 表达式为【CRON_TZ=Asia/Shanghai 49 24 11 * * *】,意为北京时间每天 11:24:49 执行,
554+
**注意,执行时间一定要记得改为你自定义的时间,不要跟我这里一模一样,尽可能跟大多数人的设置不一样,否则可能出现多人在同一时间向 freenom 的服务器发起请求的情况,导致 freenom 无法稳定提供服务,影响续期操作。**
555+
556+
[![aliyun08.png](https://s4.ax1x.com/2021/12/14/ovAnw4.png)](https://s4.ax1x.com/2021/12/14/ovAnw4.png)
557+
558+
上传压缩包(在上面步骤 1 中下载得到 zip 压缩包),部署代码
559+
560+
[![aliyun09.png](https://s4.ax1x.com/2021/12/14/ovmKRs.png)](https://s4.ax1x.com/2021/12/14/ovmKRs.png)
561+
562+
[![aliyun10.png](https://s4.ax1x.com/2021/12/14/ovmDL6.png)](https://s4.ax1x.com/2021/12/14/ovmDL6.png)
563+
564+
由于阿里云函数默认有一个示例文件,所以此处我们上传完 zip 文件后,会提示我们是否需要同步代码,点击【是】即可
565+
566+
[![aliyun11.png](https://s4.ax1x.com/2021/12/14/ovmqYQ.png)](https://s4.ax1x.com/2021/12/14/ovmqYQ.png)
567+
568+
然后点击部署代码
569+
570+
[![aliyun12.png](https://s4.ax1x.com/2021/12/14/ovnn0K.png)](https://s4.ax1x.com/2021/12/14/ovnn0K.png)
571+
572+
【可选】 延长执行超时时间。阿里云函数默认的执行超时时间为 60 s,满足大多数人的需求。如果你的账户或者域名特别多的话,可以考虑延长它, 在【函数配置】->【环境信息】处可以编辑配置
573+
574+
[![aliyun13.png](https://s4.ax1x.com/2021/12/14/ovumgs.png)](https://s4.ax1x.com/2021/12/14/ovumgs.png)
575+
576+
> 在阿里云函数如何修改或者新增环境变量呢?
577+
>
578+
请参考下图操作。
579+
580+
[![aliyun14.png](https://s4.ax1x.com/2021/12/14/ovRKQe.png)](https://s4.ax1x.com/2021/12/14/ovRKQe.png)
581+
582+
> 在阿里云函数如何更新代码或者升级代码到最新版本呢?
583+
>
584+
参考下图,上传新的代码包后,阿里云函数编辑器可能会提示你同步代码,点击【是】即可。然后记得点击【部署】并测试。
585+
586+
[![aliyun15.png](https://s4.ax1x.com/2021/12/14/ovW6HA.png)](https://s4.ax1x.com/2021/12/14/ovW6HA.png)
587+
588+
*有关阿里云函数部署的内容结束。*
589+
590+
***
591+
592+
### 🚧 方式四:直接拉取源码部署
593+
594+
*所有操作均在Centos7系统下进行,其它Linux发行版大同小异*
479595

480596
#### 1、获取源码
481597

@@ -601,6 +717,8 @@ cd /data/wwwroot/freenom/ && php run
601717
602718
不出意外的话,你将收到一封关于域名情况的邮件。
603719

720+
*有关 直接拉取源码部署 的内容结束。*
721+
604722
***
605723

606724
遇到任何问题或 Bug 欢迎提 [issue](https://github.com/luolongfei/freenom/issues) (请按模板格式提`issue`,以便我快速复现你的问题,否则问题会被忽略), 如果`Freenom`
@@ -649,8 +767,18 @@ cd /data/wwwroot/freenom/ && php run
649767

650768
##### Changed
651769

770+
- 解决 企业微信 因送信内容过长被截断问题
771+
772+
#### [v0.4.4](https://github.com/luolongfei/freenom/releases/tag/v0.4.4) - 2021-12-14
773+
774+
##### Changed
775+
652776
- 改进与 Cron 表达式验证相关的正则,兼容各种花里胡哨的表达式
777+
778+
##### Added
779+
653780
- 支持自动从 Bark url 中提取有效的 Bark key
781+
- 支持通过 阿里云函数 部署
654782

655783
#### [v0.4.3](https://github.com/luolongfei/freenom/releases/tag/v0.4.3) - 2021-11-07
656784

app/Console/FreeNom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class FreeNom extends Base
2020
{
21-
const VERSION = 'v0.4.3';
21+
const VERSION = 'v0.4.4';
2222

2323
const TIMEOUT = 33;
2424

app/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function system_check()
237237
// 如果是在云函数部署,则不需要检查这几项
238238
if (IS_SCF) {
239239
system_log('检测到运行环境为云函数,所有环境变量将直接从环境中读取,环境中找不到的变量,则直接从 .env.example 文件中读取');
240-
system_log('如果是在腾讯云函数,可以参考此处修改或新增环境变量,无需重建:https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf_env_modify.png');
240+
system_log('如果是在腾讯云函数,可以参考此处修改或新增环境变量,无需重建:https://github.com/luolongfei/freenom/blob/main/resources/screenshot/scf03.png');
241241
system_log('如果是在阿里云函数,可以直接在【函数详情】->【函数配置】->【环境信息】处编辑环境变量');
242242
} else {
243243
if (!function_exists('putenv')) {

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ini_set('display_errors', 1);
1818
set_time_limit(0);
1919

20-
define('IS_SCF', false); // 是否云函数环境
20+
define('IS_SCF', true); // 是否云函数环境
2121
define('IS_CLI', PHP_SAPI === 'cli');
2222
define('DS', DIRECTORY_SEPARATOR);
2323
define('ROOT_PATH', realpath(__DIR__));

libs/MessageServices/WeChat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct()
6060
/**
6161
* 获取 access_token 缓存
6262
*
63-
* 由于腾讯云函数环境中只有 /tmp 目录的读写权限,且每次运行结束后写入的内容不会被保留,故腾讯云函数无法真正做到通过文件缓存 access_token
63+
* 由于云函数环境中只有 /tmp 目录的读写权限,且每次运行结束后写入的内容不会被保留,故云函数无法真正做到通过文件缓存 access_token
6464
* 参考:https://cloud.tencent.com/document/product/583/9180
6565
*
6666
* @return string|null
@@ -285,7 +285,7 @@ public function send(string $content, string $subject = '', int $type = 1, array
285285
'msgtype' => 'text', // 消息类型,text 类型支持 a 标签以及 \n 换行,基本满足需求。由于腾讯要求 markdown 语法必须使用 企业微信APP 才能查看,不想安装,故弃之
286286
'agentid' => $this->agentId, // 企业应用的 ID,整型,可在应用的设置页面查看
287287
'text' => [
288-
'content' => $content, // 消息内容,最长不超过2048个字节,超过将截断
288+
'content' => $content, // 消息内容,最长不超过 2048 个字节,超过将截断
289289
],
290290
'enable_duplicate_check' => 1,
291291
'duplicate_check_interval' => 60,

resources/screenshot/aliyun00.png

5.03 MB
Loading

resources/screenshot/aliyun01.png

5.03 MB
Loading

resources/screenshot/aliyun02.png

986 KB
Loading

resources/screenshot/aliyun03.png

1.77 MB
Loading

resources/screenshot/aliyun04.png

2.6 MB
Loading

resources/screenshot/aliyun05.png

2.67 MB
Loading

resources/screenshot/aliyun06.png

1.13 MB
Loading

resources/screenshot/aliyun07.png

3.76 MB
Loading

resources/screenshot/aliyun08.png

5.03 MB
Loading

resources/screenshot/aliyun09.png

1.1 MB
Loading

resources/screenshot/aliyun10.png

1.05 MB
Loading

resources/screenshot/aliyun11.png

268 KB
Loading

resources/screenshot/aliyun12.png

1.13 MB
Loading

resources/screenshot/aliyun13.png

3.22 MB
Loading

resources/screenshot/aliyun14.png

5.03 MB
Loading

resources/screenshot/aliyun15.png

4.18 MB
Loading
File renamed without changes.

resources/screenshot/scf02.png

4.01 MB
Loading

resources/screenshot/scf04.png

2.15 MB
Loading

0 commit comments

Comments
 (0)