npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

edgeless-bot

v1.0.51

Published

Edgeless 自动插件机器人

Downloads

4

Readme

Edgeless 自动插件机器人

workflow status

简介

用于从 PortableApps 网站自动抓取便携版软件更新信息,当存在更新时自动下载新版并制作成 Edgeless 插件包然后上传

特性

  • 支持自动识别和校对 MD5、自动检测简体中文版本、自动解析下载地址,甚至支持无需编写 make.cmd 脚本的全自动制作

  • 支持最近三次的构建状态记录和自动删除冗余历史构建,支持自动输出晴雨表

  • 得益于使用 rclone,远程上传功能支持本地存储、FTP、Onedrive、Google Drive等五十多种存储方式,详情请查看 rclone 官方介绍

环境

需要 Windows 10 环境,在默认路径安装 7-Zip 并添加到 PATH

如果需要启用远程上传功能请安装 rclone ,推荐使用 scoop 命令scoop install rclone进行安装

配置

创建并编辑 config.jsonc

{
  // 开启远程,使用rclone将构建成功的插件包上传至服务器
  "enableRemote": false,
  // 忽略远程警告,禁用远程时程序会输出Warning,启用此项可以忽略此Warning
  "ignoreRemote": false,
  // 任务文件夹,存放所有的任务描述
  "dirTask": "./tasks",
  // 工作文件夹,其子目录会作为make脚本工作目录使用
  "dirWorkshop": "./workshop",
  // 构建文件夹,存放构建成功的插件包
  "dirBuilds": "./builds",
  // 数据库路径,用于保存构建信息
  "pathDatabase": "./database.json",
  // 最大构建数,成功的构建总数超过此值时程序会尝试从本地和远程删除过期构建
  "maxBuildsNum": 3,
  // 远程主机名,需要在rclone中提前配置远程存储然后将远程存储名称填入此处
  "remoteName": "pineapple",
  // 远程根路径,远程存储中存放构建的根目录
  "remoteRoot": "/hdisk/edgeless/插件包",
  // aria2 RPC 端口,如果出现端口冲突导致的aria2启动失败请修改此值
  "aria2Port": 46800,
  // aria2 RPC 主机,理论上不允许修改
  "aria2Host": "localhost",
  // aria2 RPC 秘钥,必须与启动参数中"--rpc-secret"的值一致
  "aria2Secret": "edgeless",
  // 是否启动 aria2,如果已经有正在运行的aria2可以禁用此项阻止自带aria2运行
  "spawnAria2": true,
  // aria2 启动参数
  "aria2SpawnArgs": [
    // 配置代理 "--all-proxy=http://localhost:10089",
    "--enable-rpc",
    "--rpc-allow-origin-all=true",
    "--rpc-listen-all=true",
    "--rpc-listen-port=46800",
    "--rpc-secret=edgeless"
  ]
}

使用

# 安装
npm i -g edgeless-bot

# 运行全部 Tasks

# elbot 或 edgeless-bot 都可以
elbot

# 强制重新构建指定 Task
elbot -t <Task name> -f

参数

elbot[ -t TaskName][ -f][ -d][ -g]

-t

指定运行某个 Task,TaskName 为任务名称

-f

忽略与数据库的最新版本对比结果,强制重新构建任务

-d

debug模式,此模式下的远程操作会被自动禁用,且数据库不会被更新

-g

GitHub Actions 模式

开发

创建任务

为了创建一个任务,你需要提供一个名为 config.json 的文件,结构如下:

interface Task {
    name: string; //软件名(也作为任务名)
    category: string; //软件分类
    author: string; //打包者名称

    paUrl: string; //PortableApps网页链接
    releaseRequirement: Array<string>; //解压下载的exe后工作目录中应该出现的文件/文件夹,用于包校验
    buildRequirement: Array<string>; //构建成功时工作目录中应该出现的文件/文件夹,用于构建校验
    preprocess:boolean; //是否启用PortableApps预处理
    autoMake:boolean; //是否启用自动制作
}

示例(Firefox):

{
    "name":"Firefox",
    "category":"浏览器",
    "author":"Cno",

    "paUrl":"https://portableapps.com/apps/internet/firefox_portable",
    "releaseRequirement":["FirefoxPortable.exe","App/Firefox64/firefox.exe"],
    "buildRequirement": ["Firefox_bot.wcs","Firefox_bot/FirefoxPortable.exe"],
    "preprocess": true,
    "autoMake": true
}

释义:

name

软件名称,会体现在构建生成文件的文件名中。

category

软件分类,必须是Edgeless下载站现有分类中的一种,如果觉得需要新建分类请建立issue。

author

打包者名暨Task配置作者名,会体现在构建生成文件的文件名中;最终的构建文件名会在打包者后加上(bot)表示此插件包由Edgeless bot构建,未经过人工测试。

paUrl

PortableApps URL,页面中必须包含一个绿色的下载按钮 className="download-box"

releaseRequirement

将从PortableApps下载得到的.paf.exe文件直接使用7-Zip解压后得到的文件夹中需要包含的文件/文件夹,用于校验下载到的软件是否正确和适用此Task。

buildRequirement

运行make.cmd脚本或自动构建后build文件夹应该出现的文件/文件夹,用于校验make.cmd脚本或自动构建是否执行成功/

preprocess

预处理release目录,程序会执行两个步骤:

  1. 删除$PLUGINSDIR Other目录和help.html App/readme.txt文件。
  2. 修改pac_installer_log.ini以绕过首次运行会弹出的安全警告。

autoMake

使用自动制作,如果启用此项则不需要编写make.cmd脚本,程序会生成一个完成以下动作的外置批处理:

  1. 将依赖文件夹移动至X:\Users\PortableApps目录内以绕过部分PortableApps应用不允许在X:\Program Files中运行的限制。
  2. 在Edgeless桌面创建指向release目录的第一个可执行文件(通常为xxxPortable.exe)的快捷方式,快捷方式名称为项目名。

关于使用autoMake后如何配置 buildRequirement

理论上使用autoMake的task不需要配置 buildRequirement,不过为了确保安全在实际配置时还是需要带上 buildRequirement

autoMake完成后的 build 目录中会出现一个 taskName_bot 文件夹和一个 taskName_bot.wcs 外置批处理,taskName_bot 文件夹为经过预处理(或未经预处理)的 release 目录移动位置而来,因此 buildRequirement 可以配置为 ["taskName_bot.wcs","taskName_bot/appNamePortable.exe"] ,参考 傲游浏览器的config.json

编写脚本(*如果没有启用自动制作)

大部分的程序都可以直接使用autoMake选项自动制作(记得同时启用preprocess执行预处理),部分应用需要作者编写make.cmd以完成构建,例如在线版本的Chrome.

流程

和Edgeless插件包类似,make.cmd会在一个特定的目录中执行,称之为"Workshop"。Workshop的起始目录结构如下:

│  target.exe
├─build
└─release
    └─*

其中:

target.exe是PortableApps网站上下载得到的 *.paf.exe 文件.

build是一个空白目录,你编写的 make.cmd 脚本需要将插件包 压缩前 的内容提供在这个目录中.

release目录则是target.exe解压后得到的文件,例如:

└─release
    │  GoogleChromePortable.exe
    │  help.html
    ├─$PLUGINSDIR
    ├─7zTemp
    ├─App
    │  ├─AppInfo
    │  ├─Chrome-bin
    │  └─DefaultData
    │      └─profile
    │          └─Default
    └─Other
        ├─Help
        │  └─images
        └─Source
            ├─ChromePasswords
            │  ├─ChromePasswords
            │  └─Release
            └─Languages

在执行 make.cmd 时,你可能需要一些外部工具。我们允许你建立一个 utils 文件夹存放你需要的工具,因此在 make.cmd 运行时的Workshop 就会是这样:

如果你不需要外部工具,不要建立这个文件夹就行了.

│  target.exe
│  make.cmd
├─utils
│   └─*
├─build
└─release
    └─*

代码

以Firefox任务为例编写一个近似自动构建的等效脚本,make.cmd 内容如下:

::关闭回显以优化控制台输出
@echo off
::移动release文件夹到build目录下
move .\release .\build\FireFox_bot
::生成外置批处理脚本,创建快捷方式指向FirefoxPortable.exe
echo LINK X:\Users\Default\Desktop\Firefox,X:\Program Files\Edgeless\FireFox_bot\FirefoxPortable.exe >./build/firefox_bot.wcs

脚本运行结束后的build目录结构如下:

└─build
   │  Firefox_bot.wcs
   │
   └─Firefox_bot
       └─*

显然将此目录中的所有内容压缩成 .7z 压缩包即可完成插件包的制作,而 make.cmd 不需要完成压缩这一步,Edgeless bot会在验收完成之后将其压缩并完成后续工作.

更复杂一些的在线版Chrome的make.cmd可以 查看此处 ,涉及了按键模拟、utils内工具调用等.

替换

为了让使用自动制作的Task也能完成简单的文件替换操作,我们允许你建立一个cover文件夹来存放对release目录的覆盖文件.

例如需要替换release目录中的App/readme.txt,在cover文件夹中也同样建立一个App文件夹然后将你的readme.txt放在里面就行了,目录结构如下:

├─release
│   │  GoogleChromePortable.exe
│   ├─App
│   │  │  readme.txt
│   │  └─*
│   └─*
│   
└─cover
    └─App
       │  readme.txt

cover 目录中的所有内容会被覆盖复制到 release 文件夹,这项工作会在 make.cmd 或自动构建运行后完成.

测试

运行以下命令来测试你新增的任务:

elbot -d -t <Task Name>

贡献

你可以将自己编写的Task通过 Pull Request 的形式添加到自动构建仓库,Github Actions 会在PR通过时构建插件包;此外, Github Actions 也会每日定时调用 Edgeless Bot 构建插件包.