#rss #imap #脚本 #atom #命令行

app rrss2imap

一个简单的脚本,将RSS条目作为邮件消息直接通过IMAP推送

60个版本

0.5.2 2023年6月27日
0.4.1 2023年6月11日
0.3.6 2021年10月19日
0.3.0 2020年10月27日
0.1.3 2019年2月20日

#19 in 电子邮件

Download history 20/week @ 2024-03-09 7/week @ 2024-03-30

每月164次下载

GPL-3.0-or-later

78KB
1K SLoC

rrss2imap

Built with cargo-make Build Status

rrss2imap是经典的Python脚本rss2imap的Rust重实现

本项目目标包括

  • ✅ 实现一个性能合理的rss2imap(性能合理意味着能够在我的Raspberry Pi上正常运行)
  • ✅ 学习Rust
  • ✅ 探索并行机制(感谢Rayon)
  • ✅ 可能提供一些图像嵌入功能(已完成)

入门指南

下载rrss2imap

rrss2imap可以从发布页面下载。如果您的平台没有发布版本,您可以提交一个问题...或者如果您了解Travis,您甚至可以将您的平台添加到.travis.yml中。

作为用户

该应用程序通过直接将条目推送到IMP文件夹,将rss源转换为电子邮件。该应用程序是将rss2imap Python脚本适配到Rust的一个例子。

如何使用?

了解要做什么的最简单方法是运行rrss2imap --help

它应该输出类似以下内容

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    add       Adds a new feed given its url
    delete    Delete the given feed
    email     Changes email address used in feed file to be the given one
    export    Export subscriptions as opml file
    help      Prints this message or the help of the given subcommand(s)
    import    import the given opml file into subscriptions
    list      List all feeds configured
    new       Creates a new feedfile with the given email address
    reset     Reset feedfile (in other words, remove everything)
    run       Run feed parsing and transformation

这为您提供了一个大致的了解将要发生什么

每个命令在运行时使用相同的--help标志也会提供一些帮助信息。

需要记住的重要操作显然是

rrss2imap new

创建一个新的config.json文件。在初始化时,配置文件将只包含包含已设置电子邮件地址的settings元素。您必须设置

  • 使用的IMAP服务器 ** 用户登录和密码 ** 以及安全设置(安全应包含 {"Yes": secure port} 用于imap/s或 {"No": unsecure port} 用于简单imap)
  • 默认配置 ** 文件夹将是条目将落入的imap文件夹的完整路径 ** 邮件将是收件人电子邮件地址(可能不是您的地址,以便更容易过滤) ** Base64图像内联
  • Feeds是可以添加的所有RSS源列表

rrss2imap add

此命令将向您的配置中添加一个新的源。您可以直接在此处设置电子邮件收件人以及文件夹(但不能设置base64图像内联参数)

rrss2imap run

这是主要命令。

  1. 获取所有RSS/Atom源的内容
  2. 列出这些源中的所有新条目
  3. 将这些条目转换为有效的电子邮件消息
  4. 直接将邮件消息推送到IMAP服务器

rrss2imap list

显示RSS源列表。以下是一个示例

0 : http://tontof.net/?rss (to: Nicolas Delsaux <[email protected]> (default)) RSS/rrss2imap (default)
1 : https://www.brothers-brick.com/feed/ (to: Nicolas Delsaux <[email protected]> (default)) RSS/rrss2imap (default)
2 : https://nicolas-delsaux.hd.free.fr/rss-bridge/?action=display&bridge=LesJoiesDuCode&format=AtomFormat (to: Nicolas Delsaux <[email protected]> (default)) RSS/rrss2imap (default)

请注意,每个条目都有一个关联的编号,这是在运行 rrss2imap delete <NUMBER> 时要输入的编号

config.json 格式

一个典型的feedfile看起来像这样

    {
      "settings": {
        "email": {
          "server": "the imap server of your mail provider",
          "user": "your imap user name",
          "password": "your imap user password",
          "secure": {
            "Yes": 993 // Set to "Yes": port for imaps or "No": port for unsecure imap
          }
        },
        // This config is to be used for all feeds
        "config": {
            // This is the email address written in each mail sent. It can be different from the email user
            "email": "Nicolas Delsaux <[email protected]>",
            // This is the imap folder in which mails will be written
            "folder": "RSS/rrss2imap"
            // Setting this to true will force rrss2imap to transform all images into
            // base64. This prevents images from beind downloaded (and is really cool when reading feeds from a smartphone)
            // But largely increase each mail size (which can be quite bothering)
            "inline_image_as_data": true
        }
      },
      "feeds": [
        {
          "url": "http://tontof.net/?rss",
          // This last updated is updated for each entry and should be enough to have rss items correctly read
          "last_updated": "2019-05-04T16:53:15",
          "config": {
              // each config element can be overwritten at the feed level
          }
        },

作为开发者

  • 克隆此存储库
  • 运行 cargo run

先决条件

您需要一个完整的Rust构建链

要执行发布,您还需要

发布
  1. 安装cargo release (cargo install cargo-release) 和git-journal (cargo install git-journal)
  2. 运行 cargo release。这将构建代码版本,将其推送到crates.io并标记存储库。多亏了GitHub Actions(更具体的是 on_tag.yml),一旦标签推送到GitHub,就会创建一个发布。
  3. 发布发布。这将触发 on_release_created.yml,该文件将为目标平台构建可执行文件并将它们附加到发布中。

发布完成了!很简单,不是吗?

安装

  1. GitHub发布页面 下载最新版本
  2. 运行 rrss2imap new,这将创建 config.json
  3. 填写缺失的部分(通常包括电子邮件配置)
  4. 使用 rrss2imap run 运行

运行测试

可以使用 cargo test 运行自动测试。覆盖率是通过 tarpaulin 实现的。覆盖率也在拉取请求运行期间计算

构建使用

查看Cargo依赖项

贡献

请阅读 CONTRIBUTING.md 了解我们的行为准则以及向我们提交拉取请求的流程。

版本控制

我们使用 SemVer 进行版本控制。有关可用的版本,请参阅此存储库的 标签

作者

  • Nicolas Delsaux - 初始工作 - Riduidel

也可以查看参与此项目的 贡献者列表

许可证

本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE.md 文件。

致谢

依赖

~26–40MB
~747K SLoC