Skip to content

Commit

Permalink
Merge pull request #84 from MamaShip/dev
Browse files Browse the repository at this point in the history
Beta 测试版本发布
  • Loading branch information
MamaShip authored Jun 29, 2020
2 parents 1ff58ca + fcb3481 commit 7311868
Show file tree
Hide file tree
Showing 32 changed files with 728 additions and 163 deletions.
30 changes: 30 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})

{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
31 changes: 31 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/MamaShip/Observer
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- ci
- docs
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
ci: Continuous Integration
docs: Documents
header:
pattern: "^(\\w*)\\:\\s(.*)$"
pattern_maps:
- Type
- Subject
notes:
keywords:
- BREAKING CHANGE
4 changes: 2 additions & 2 deletions .github/workflows/pythonCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python package

on:
push:
branches: [ master ]
branches: [ master, dev ]
pull_request:
branches: [ master ]
branches: [ master, dev ]

jobs:
build:
Expand Down
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

<a name="Beta"></a>
## [Beta](https://github.com/MamaShip/Observer/compare/alpha...Beta) (2020-06-19)

### Bug Fixes

* 发送回复前判断消息长度,超长时截断,避免用户端显示故障
* 修正list命令输出方式,保证向后兼容
* 解决存储文章标题后备份功能异常的问题
* 返回用户输入时先执行转义,防止跨站脚本攻击
* 通知邮件内现在可以正确显示停止原因
* 用户收到的备份内容缺失
* 修正dev分支不能触发CI的bug

### Continuous Integration

* 添加自动生成 change log 的设定

### Documents

* 指南页添加订阅号星标指引

### Features

* mail 寄送改由独立线程处理
* 完善备份流程,用户现在可以看到备份文章标题了
* 临时备份文件存至单独的路径,不与代码混在一起
* 数据库现在存储了文章标题
* 用户初次绑定邮箱时会收到通知邮件
* 管理员命令功能增强
* 完善文章状态的定义,在文章失效时根据失效原因记录不同状态
* 允许用户发送article_id删除观察目标
* 修改命令识别方式:不区分大小写,允许接受带参数的命令

### BREAKING CHANGE


当文章停止观察时必须填写原因,否则会触发状态更新异常


<a name="alpha"></a>
## alpha (2020-06-01)

### Code Refactoring

* move db function to db_operator
* 把事件处理搬移到主逻辑

### Documents

* update .all-contributorsrc [skip ci]
* update README.md [skip ci]
* update .all-contributorsrc [skip ci]
* update README.md [skip ci]
* update .all-contributorsrc [skip ci]
* update README.md [skip ci]
* update .all-contributorsrc [skip ci]
* update README.md [skip ci]
* update .all-contributorsrc [skip ci]
* update README.md [skip ci]
* create .all-contributorsrc [skip ci]
* update README.md [skip ci]

29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg)](#contributors)
![Python package](https://github.com/MamaShip/Observer/workflows/Python%20package/badge.svg)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/MamaShip/Observer.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/MamaShip/Observer/context:python)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

A simple tool for checking accessibility of specific articles
Expand All @@ -16,21 +17,43 @@ A simple tool for checking accessibility of specific articles

开发文档见:[plan](dev_docs/plan.md)

更新历史:[change log](CHANGELOG.md)
## Usage
### 作为用户
直接关注公众号:
![时间从来不回答](static/qrcode.jpg)
![时间从来不回答](src/static/qrcode.jpg)

向其发送文章链接,即可开始观察。(暂时只支持观察微信公众号文章,其他平台待开发)

更多详细介绍参见[用户指南页面](http://wx.twisted-meadows.com/)

### 作为开发者
如果想要部署自己的微信公众号备份服务,你需要:
* 一个微信公众号,且完成开发者权限配置
* 一台80端口闲置且有固定IP的 Linux 服务器
* 服务器上已部署 sendmail、MySQL 服务(已创建数据库并赋予相应权限)
* 以上全部服务的账号和设置信息已写入**系统环境变量**,具体名称参考项目代码

git clone 本项目,在 `src` 目录下执行:

`pip3 install -r requirements.txt`

安装完所有依赖的库后,在 `src/database/` 路径下执行 `db_operator.py`,选 1 执行数据库表的初始化创建。

然后回到 `src` 目录,用 python3 执行程序入口 `app.py` 即可:

`sudo python3 app.py`

(我们之后会提供详细一些的文档指引,也许在 Beta 测试完成后)

## Background

受启发于[端点星计划](https://github.com/Terminus2049/Terminus2049.github.io)
(该项目已被破坏,参见[维基词条](https://zh.wikipedia.org/wiki/%E7%AB%AF%E7%82%B9%E6%98%9F%E4%BA%8B%E4%BB%B6))
(该项目已被破坏,参见维基词条:[端点星事件](https://zh.wikipedia.org/wiki/%E7%AB%AF%E7%82%B9%E6%98%9F%E4%BA%8B%E4%BB%B6))

本项目仅为个人用户提供关注文章的备份,不致力于进行被审查文章的全备份。

~~被审查文章的全备份工作已有香港大学的 [WeChatSCOPE](https://wechatscope.jmsc.hku.hk/) 项目在做。~~
被审查文章的全备份工作已有香港大学的 [WeChatSCOPE](https://wechatscope.jmsc.hku.hk/) 项目在做。(请主动向他们提交值得备份的公众号,帮助完善备份工程)

## Contributors ✨

Expand Down
1 change: 1 addition & 0 deletions dev_docs/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ mail:
* [WeChatSCOPE](https://wechatscope.jmsc.hku.hk/)
* [使用 linux screen 在后台运行程序](https://www.cnblogs.com/mchina/archive/2013/01/30/2880680.html)
* [Mail::RFC822::Address: regexp-based address validation](http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html)
* [用于自动生成 change log 的 commit 提交规范](https://github.com/git-chglog/git-chglog/blob/master/CONTRIBUTING.md)
6 changes: 3 additions & 3 deletions app.py → src/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os
import logging
from flask import Flask, request, abort, render_template
from flask import Flask, request, abort, render_template, escape
from wechatpy import parse_message, create_reply
from wechatpy.utils import check_signature
from wechatpy.exceptions import (
Expand Down Expand Up @@ -40,7 +40,7 @@ def wechat():
abort(403)
if request.method == "GET":
echo_str = request.args.get("echostr", "")
return echo_str
return escape(echo_str)

# POST request
if encrypt_type == "raw":
Expand Down Expand Up @@ -74,5 +74,5 @@ def wechat():


if __name__ == "__main__":
app.run("0.0.0.0", 80, debug=True, use_reloader=False)
app.run("0.0.0.0", 80, debug=False, use_reloader=False)
logging.info(">> service start!")
1 change: 1 addition & 0 deletions src/article_checker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ["article_checker", "update_reason"]
Loading

0 comments on commit 7311868

Please sign in to comment.