Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
toolchain: 1.98.0
- uses: Swatinem/rust-cache@v2
- run: brew install cmake
- run: cargo test --locked --manifest-path crates/system-apps/Cargo.toml
- run: bash tools/package-system-apps/check.sh
- run: python3 tools/test_package_octos.py
- run: cargo test --locked --features agent_chat --lib
- run: cargo build --locked --features agent_chat
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ version = "1.0.0-beta.1"
metadata.makepad-auto-version = "zqpv-Yj-K7WNVK2I8h5Okhho46Q="

[dependencies]
rinx-system-apps = { path = "crates/system-apps" }
article-core = { path = "crates/article-core", features = ["l0"] }
rinx-miniapp-core = { path = "crates/miniapp-core" }
uuid = { version = "1", features = ["v4"] }
Expand Down Expand Up @@ -239,6 +240,8 @@ askar-storage = { git = "https://github.com/openwallet-foundation/askar.git" }
ruma = { git = "https://github.com/project-robius/ruma.git", branch = "tsp" }

[build-dependencies]
rinx-system-apps = { path = "crates/system-apps" }
serde_json = "1"
toml = "1"

## On Windows, use the `winresource` crate to embed the app's icon and metadata into the executable.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Rinx

English | [简体中文](README.zh-CN.md)

A native Matrix messenger from [Upstream Labs](https://github.com/upstreamlabs), with a WeChat-style interface, English/Chinese support, Moments, and scoped mini apps.

Rinx is an independent continuation of [`OctoSense-org/robrix2`'s `wechat-ui` branch](https://github.com/OctoSense-org/robrix2/tree/wechat-ui), starting at `16913e0c6f0397b4ed1272b7dcd421935521d5f3`. That branch's commit history is preserved here. Development now lives on this repository's **`main`** branch.
Expand All @@ -15,6 +17,10 @@ Rinx is an independent continuation of [`OctoSense-org/robrix2`'s `wechat-ui` br

The renderer remains experimental: grayscale/sepia filters have known failures; arbitrary WeChat HTML import and complete WeChat compatibility are not claimed. See the [integration evidence](lab/article-html-integration/README.md) and [mini-app authority design](docs/adr/0002-octoscript-mini-app-authority.md).

## Built-in apps

Rinx bundles native and OctoScript apps through `system-apps.json`. The native article editor lives under `apps/article-editor/`; both deployments share its catalog and host-service contracts. See the [app development guide](apps/README.md) and [ADR 0008](docs/adr/0008-rinx-system-app-catalog.md).

## Build and run

Install Rust and CMake. The repository pins Rust 1.98.0. On macOS:
Expand Down
13 changes: 13 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Rinx

[English](README.md) | 简体中文

Rinx 是原生 Matrix 客户端,包含聊天、联系人、发现、朋友圈和文章编辑器,支持独立运行及作为 OctoSense 原生模块运行。完整构建与兼容性说明见 [英文文档](README.md)。

## 内置应用

`system-apps.json` 定义随 Rinx 发布的原生和 OctoScript 应用。原生文章编辑器位于 `apps/article-editor/`;共享文档和 Makepad 控件库保留在 `crates/`。

独立版由 Rinx 管理 Octos 运行时和提供商配置;托管版使用 OctoSense 注入的服务、共享内核与配置。小程序通过受限的宿主接口访问 Matrix 和 Octos,不启动自己的内核。

应用目录构建验证、开发和发布流程见 [应用开发指南](apps/README.zh-CN.md);架构决策见 [ADR 0008](docs/adr/0008-rinx-system-app-catalog.md)。
29 changes: 29 additions & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rinx system apps

English | [简体中文](README.zh-CN.md)

Apps listed in the root `system-apps.json` ship with both standalone and hosted
Rinx. The catalog is compiled into Rinx; a local import cannot change it.

- `article-editor/bundle/` contains the canonical App Hub manifest and catalog assets.
- `article-editor/native/` contains the native Makepad editor and publication workflows.
- Shared document/rendering code stays in `crates/article-core` and `crates/article-makepad`.
- Host Matrix and Octos adapters live in `src/host/`; grants remain account- and instance-scoped.

For a script app, create `apps/<name>/bundle/manifest.json`, `main.splash` and its
assets, then add `{"directory":"<name>"}` to the catalog. Declare exact service
capabilities. Do not collect Matrix credentials or AI provider keys. A native
app additionally needs a compiled registry variant; adding a JSON field alone
cannot introduce native code. Preserve existing app IDs when moving code.

Run from the repository root:

```sh
bash tools/package-system-apps/check.sh
cargo test --locked --manifest-path crates/system-apps/Cargo.toml
```

The check validates and computes digests without rewriting source manifests.
Normal Rinx builds embed the validated bytes automatically. Review source,
manifest permissions and tests in one Rinx PR; release built-ins with Rinx.
External apps remain App Hub packages. See [ADR 0008](../docs/adr/0008-rinx-system-app-catalog.md).
27 changes: 27 additions & 0 deletions apps/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Rinx 内置应用

[English](README.md) | 简体中文

根目录 `system-apps.json` 中列出的应用随独立版和 OctoSense 托管版 Rinx 一同发布。
目录编译进 Rinx,本地导入包不能修改它。

- `article-editor/bundle/` 保存 App Hub 标准清单及目录资源。
- `article-editor/native/` 保存原生 Makepad 编辑器和发布流程。
- 共享文档、渲染代码保留在 `crates/article-core` 和 `crates/article-makepad`。
- Matrix 和 Octos 宿主适配器位于 `src/host/`;授权仍绑定账号和应用实例。

新增脚本应用时,创建 `apps/<name>/bundle/manifest.json`、`main.splash` 及资源,
并在目录中添加 `{"directory":"<name>"}`。清单必须声明准确的服务权限。
应用不收集 Matrix 凭据或 AI 提供商密钥。原生应用还需要编译进宿主的注册项,
只修改 JSON 不能引入原生代码。移动代码时保留已有应用 ID。

在仓库根目录运行:

```sh
bash tools/package-system-apps/check.sh
cargo test --locked --manifest-path crates/system-apps/Cargo.toml
```

检查会验证清单并计算摘要,不改写源码清单。正常构建会自动嵌入已验证的内容。
应用代码、权限和测试在同一个 Rinx PR 中审查,内置应用随 Rinx 发布;外部应用继续
使用 App Hub 包格式和发布流程。参见 [ADR 0008](../docs/adr/0008-rinx-system-app-catalog.md)。
3 changes: 3 additions & 0 deletions apps/article-editor/bundle/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions apps/article-editor/bundle/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"schema": 1,
"id": "org.octosense.article-editor",
"version": "2.0.0",
"name": "Article editor",
"integrity": {
"bundle_blake3": ""
},
"capabilities": [
"storage",
"images",
"matrix.event",
"matrix.send_message"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ mod tests {

#[tokio::test]
async fn editor_markdown_fits_after_matrix_encryption() {
let source = include_str!("../../lab/article-editor/render-comparison/source.md");
let source = include_str!("../../../lab/article-editor/render-comparison/source.md");
let doc = Document::from_markdown("Markdown 格式测试", source).unwrap();
let stored = serde_json::to_vec(&doc).unwrap();
let transaction = "r".repeat(100);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ruma::{
use serde::{Deserialize, Serialize};

pub const MSGTYPE: &str = "rs.robius.robrix.article_app";
const APP_ID: &str = "org.octosense.article-editor";
const APP_ID: &str = crate::system_apps::ARTICLE_ID;
pub use article_core::bindings::SOURCE;
pub fn invalidate_sessions() { AUTHORITY.invalidate(); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ mod tests {
}
#[test]
fn editor_md_math_preview_grants_only_generated_images_and_preserves_source() {
let source = include_str!("../../lab/article-editor/render-comparison/evidence/09-math/source.md");
let source = include_str!("../../../lab/article-editor/render-comparison/evidence/09-math/source.md");
let doc = Document::from_markdown("Math fixture", source).unwrap();
let before = serde_json::to_string(&doc).unwrap();
let (html, resources) = bundle(&doc, &Default::default(), |_| panic!("No imported assets expected")).unwrap();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
fn main() {
println!("cargo:rerun-if-changed=system-apps.json");
println!("cargo:rerun-if-changed=apps");
let root = std::path::PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());
let catalog = rinx_system_apps::pack(&root).expect("validate Rinx system apps");
let catalog_path = std::path::PathBuf::from(std::env::var_os("OUT_DIR").unwrap()).join("system-apps.json");
std::fs::write(catalog_path, serde_json::to_vec(&catalog).unwrap()).expect("embed Rinx system apps");

// cargo-makepad discovers resources of Git/registry dependencies through
// a package-name.path file beside the compiled libraries. Rinx is also a
// hosted dependency, so publish its resource root like makepad-widgets.
Expand Down
186 changes: 186 additions & 0 deletions crates/system-apps/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions crates/system-apps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "rinx-system-apps"
version = "0.1.0"
edition = "2024"
license = "Apache-2.0"
[workspace]
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
octosense-app-policy = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "46d67e51b62827a1224b1aacddc2a7b9e69185fc" }
Loading
Loading