diff --git a/.gitattributes b/.gitattributes index bdd3961..fd4fad7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ # Generated and compared byte-for-byte by `daemon::openrpc::document_is_current`, # which builds its expectation with `\n`. A CRLF checkout would fail that test on # Windows. -docs/openrpc.json text eol=lf +soulseek-rs/docs/openrpc.json text eol=lf diff --git a/README.md b/README.md index e8820d0..ae21a75 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ the internet. Reach it over SSH instead, with a tunnel The daemon speaks newline-delimited JSON-RPC 2.0, described by an [OpenRPC](https://open-rpc.org) document, -[`docs/openrpc.json`](docs/openrpc.json), which it also serves over +[`soulseek-rs/docs/openrpc.json`](soulseek-rs/docs/openrpc.json), which it also serves over `rpc.discover`. Point a client generator at it for typed bindings in your language. Searches, transfers, rooms, private messages and shares are all on the interface this CLI uses, with no private back channel, and live updates are diff --git a/docs/daemon-protocol.md b/docs/daemon-protocol.md index 4f38af6..362ba18 100644 --- a/docs/daemon-protocol.md +++ b/docs/daemon-protocol.md @@ -2,7 +2,7 @@ `soulseek-rs daemon` stays logged in and answers JSON-RPC over a socket, so several clients can share one Soulseek session. The machine-readable contract -is [`openrpc.json`](openrpc.json), an [OpenRPC](https://open-rpc.org) +is [`openrpc.json`](../soulseek-rs/docs/openrpc.json), an [OpenRPC](https://open-rpc.org) document and the JSON-RPC counterpart to OpenAPI. Point a client generator at it, or at a running daemon via `rpc.discover`, and you have a client in your language. diff --git a/docs/openrpc.json b/soulseek-rs/docs/openrpc.json similarity index 100% rename from docs/openrpc.json rename to soulseek-rs/docs/openrpc.json diff --git a/soulseek-rs/src/daemon/openrpc.rs b/soulseek-rs/src/daemon/openrpc.rs index 90e6473..e58b9c4 100644 --- a/soulseek-rs/src/daemon/openrpc.rs +++ b/soulseek-rs/src/daemon/openrpc.rs @@ -348,10 +348,10 @@ fn document() -> Value { }) } -/// Where the published document lives, relative to this source file. +/// Where the published document lives. Inside this crate, not the repository's +/// docs/: `include_str!` has to find it in the published package too. fn document_path() -> std::path::PathBuf { std::path::Path::new(env!("CARGO_MANIFEST_DIR")) - .join("..") .join("docs") .join("openrpc.json") } diff --git a/soulseek-rs/src/daemon/proto/mod.rs b/soulseek-rs/src/daemon/proto/mod.rs index 37ccbd2..f91b83c 100644 --- a/soulseek-rs/src/daemon/proto/mod.rs +++ b/soulseek-rs/src/daemon/proto/mod.rs @@ -17,7 +17,7 @@ pub const PROTOCOL_VERSION: u32 = 1; /// The OpenRPC document, served by `rpc.discover` so a generator can point at /// a running daemon instead of needing this repository. -pub const OPENRPC: &str = include_str!("../../../../docs/openrpc.json"); +pub const OPENRPC: &str = include_str!("../../../docs/openrpc.json"); mod dto; mod envelope; diff --git a/website/src/pages/docs.tsx b/website/src/pages/docs.tsx index a8f7cac..a81aa33 100644 --- a/website/src/pages/docs.tsx +++ b/website/src/pages/docs.tsx @@ -360,8 +360,8 @@ const Daemon = () => ( OpenRPC document. The daemon serves that document itself through rpc.discover, so a client can ask it what it can do. The same document is checked in at{' '} - - docs/openrpc.json + + soulseek-rs/docs/openrpc.json {' '} on GitHub. auth answers with the protocol version, 1 today, so a client written against an older shape learns it at connect time.