Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
31 changes: 31 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on: [push, pull_request]

jobs:
lint_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]

steps:
- name: Set up Rust toolchain
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}

- name: Check out the code
uses: actions/checkout@v4

- name: Install Clippy
run: rustup component add clippy

- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run tests
env:
RUST_MIN_STACK: 8388608
run: cargo test --verbose -- --test-threads=1 --nocapture
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,56 @@ Bindings to the save-dweb-backend for the Save Android app.
- Have `save-android` set up in the parent folder
- Set up the `ANDROID_NDK_HOME` variable
- `./build-android.sh`
- You can now recompile the android app.
- You can now recompile the android app.

# API Endpoints

available HTTP API endpoints.

## general

* `GET /status` - Returns the server status and version.

* `GET /health` - Returns the server health status.

* `POST /api/memberships` - Joins a group.

## Groups

base path: `/api/groups`

* `GET /` - Lists all groups.

* `POST /` - Creates a new group.

* `POST /join_from_url` - Joins a group using a URL.

* `GET /{group_id}` - Retrieves a specific group by its ID.

* `DELETE /{group_id}` - Deletes a group by its ID.

* `POST /{group_id}/refresh` - Refreshes a group by its ID.

## Repositories

base path: `/api/groups/{group_id}/repos`

* `GET /` - Lists all repositories within a group.

* `POST /` - Creates a new repository within a group.

* `GET /{repo_id}` - Retrieves a specific repository within a group.

## Media

base path: `/api/groups/{group_id}/repos/{repo_id}/media`

* `GET /` - Lists all files in a repository.

* `POST /{file_name}` - Uploads a file to a repository.

* `GET /{file_name}` - Downloads a specific file from a repository.

* `DELETE /{file_name}` - Deletes a specific file from a repository.


12 changes: 6 additions & 6 deletions src/groups.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use actix_web::{web, delete, get, post, Responder, HttpResponse};
use save_dweb_backend::common::DHTEntity;
use serde_json::json;
use crate::error::AppResult;
use crate::log_debug;
use crate::models::IntoSnowbirdGroupsWithNames;
use crate::models::{RequestName, SnowbirdGroup, RequestUrl};
use crate::models::{IntoSnowbirdGroupsWithNames, RequestName, RequestUrl, SnowbirdGroup};
use crate::repos;
use crate::constants::TAG;
use crate::server::server::get_backend;
use crate::constants::{TAG};

use crate::server::get_backend;
use crate::utils::create_veilid_cryptokey_from_base64;
use save_dweb_backend::common::DHTEntity;

pub fn scope() -> actix_web::Scope {
web::scope("/groups")
Expand Down Expand Up @@ -160,7 +160,7 @@ async fn refresh_group(group_id: web::Path<String>) -> AppResult<impl Responder>
"all_files": json!(Vec::<String>::new()) // Initialize empty
});
let mut refreshed_files_vec = Vec::new();
let mut all_files_vec = Vec::new();
let mut all_files_vec: Vec<String> = Vec::new();

// Get current repo hash and collection info
match repo.get_hash_from_dht().await {
Expand Down
Loading
Loading