#synology #github #api #devices #rewrite #spkrepo #com-syno-community-spkrepo

nightly app ruspk

Rust重写的spkrepo的/ GET API https://github.com/SynoCommunity/spkrepo

4个版本

0.1.4 2020年6月7日
0.1.3 2020年6月4日
0.1.1 2020年5月17日
0.1.0 2020年5月16日

#5 in #synology

GPL-3.0-only

96KB
3K SLoC

Rust 2K SLoC // 0.0% comments SQL 1K SLoC

spkrepo-rs

ruspk's current version badge

ruspk是一个简单快速的Synology仓库服务器。它使用来自spkrepo的现有数据库结构。

仅支持Synology设备的GET API。您必须自行更新数据库或与spkrepo和反向代理如nginx一起运行。

安装

cargo install diesel_cli
cargo install ruspk --features postgres
echo 'DATABASE_URL=postgresql://user:pass@localhost/dbname' > .env
diesel migration --migration-dir migrations/postgres/ run
ruspk

可用功能:mysqlpostgressqlite

测试API

curl -sv 'http://127.0.0.1:80/?package_update_channel=beta&unique=synology_apollolake_418play&build=24922&language=enu&major=6&micro=2&arch=apollolake&minor=2&timezone=Melbourne&nano=4' | jq

配置(《.env`文件)

## Log levels for each component
# RUST_LOG="ruspk=info,actix_web=info,actix_server=info"
## Or generic
RUST_LOG="info"
## For web server logs set one of
# RUST_LOG="info"
# RUST_LOG="actix_web=info"
## For verbose logs
# RUST_LOG="trace"

## Database connection
# DATABASE_URL=file:db/database.sqlite
# DATABASE_URL=mysql://user:pass@localhost/dbname
# DATABASE_URL=postgresql://user:pass@localhost/dbname

## IP adress to Bind to and listen for connections
LISTEN=0.0.0.0

## Port to Bind to and listen for connections
PORT=80

## URL to prepend for spk archive, icon and screenshot files
URL=https://packages.synocommunity.com

## Public key to advertise for signed packages
PUBLIC_KEY_FILE=pubkey.pem

## Time in seconds to allow stale responses to be served from memory cache
CACHE_TTL=600

开发指南

https://diesel.rs/

https://actix.rs/

https://github.com/SynoCommunity/spksrc/wiki/Package-Center-specifications

http://spkrepo.readthedocs.org/

依赖关系

~27–44MB
~791K SLoC