Skip to content
Open
11 changes: 6 additions & 5 deletions Cargo.lock

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

23 changes: 20 additions & 3 deletions crates/gitlawb-node/src/api/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,33 @@ pub async fn get_by_cid(

/// GET /api/v1/ipfs/pins
///
/// Returns all CIDs that have been pinned to the local IPFS node from git
/// objects received via push. Each entry includes the git SHA-256 hex, the
/// CIDv1 string, and the timestamp when it was pinned.
/// Returns all CIDs that have been pinned from git objects received via push.
/// Each entry includes the git SHA-256 hex, a CIDv1 string, and the timestamp
/// when it was pinned. For Pinata-only rows (no local IPFS pin), the `cid`
/// field carries `pinata_cid` so CLI consumers see a usable value. The raw
/// `pinata_cid` is also surfaced.
pub async fn list_pins(State(state): State<AppState>) -> Result<Json<serde_json::Value>> {
let pins = state
.db
.list_pinned_cids()
.await
.map_err(AppError::Internal)?;

let pins: Vec<serde_json::Value> = pins
.into_iter()
.map(|p| {
// Synthesize a usable CID from pinata_cid when this is a
// Pinata-only row (no local IPFS pin).
let display_cid = p.cid.clone().or_else(|| p.pinata_cid.clone());
serde_json::json!({
"sha256_hex": p.sha256_hex,
"cid": display_cid,
"pinned_at": p.pinned_at,
"pinata_cid": p.pinata_cid,
})
})
.collect();

Ok(Json(serde_json::json!({
"pins": pins,
"count": pins.len(),
Expand Down
11 changes: 11 additions & 0 deletions crates/gitlawb-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ pub struct Config {
#[arg(long, env = "GITLAWB_AUTO_SYNC", default_value_t = false)]
pub auto_sync: bool,

/// Enable the periodic reconciliation sweep that re-derives pin/seal sets
/// and fills durability gaps. Defaults to true; set to false to disable
/// the sweep even when a pin backend (IPFS/Pinata) is configured.
#[arg(
long,
env = "GITLAWB_RECONCILIATION_SWEEP",
default_value_t = true,
action = clap::ArgAction::Set
)]
pub reconciliation_sweep: bool,

/// Irys URL for Arweave permanent anchoring.
/// Leave empty to disable. Use https://devnet.irys.xyz for free devnet.
#[arg(long, env = "GITLAWB_IRYS_URL", default_value = "")]
Expand Down
Loading
Loading