pijul: GET change works, now clone and pull works too Pull/Clone depends on routes already implemented for content negotiation, and thus was easy to get working. Again, this route lacks authentication and authorization.
Dependencies
- [2]
WSHUT37Cpijul: Pushes now work completely While still missing authn and authz, the flow of pushing now works. This enables validation of at least storing data. Later changes will show the data on the project page. - [3]
DSWQKJRHusers: Introduce User guard for routes Rockets guards are very powerful to disallow users for certain routes. This far this wasn't implemented, and allowed no-one other than the first user to sign up. This change introduces the User guard and employs it for a few routes. The guard works by checking the encrypted cookie for the user_id, and perform a database lookup on it. - [4]
W2ZEVC64pijul: HTTP push now works While missing Auth{n,z}, one can now push to the main channel. The patches are stored and normal Pijul command can be run in the repository on disk. - [5]
FS2NWBVNpijul: Start of push/pull work This change includes one API endpoint, .pijul. It allows for getting a channels remote ID. A lot of plumbing around repositories is added too, from init to opening pristine and actions like it.
Change contents
- edit in src/pijul.rs at line 4
use rocket::fs::NamedFile; - edit in src/pijul.rs at line 44
println!("changelist"); - replacement in src/pijul.rs at line 105
struct IdentitiesReq {struct Identities { - replacement in src/pijul.rs at line 110
#[derive(Serialize)]struct Identities {#[derive(Serialize, FromForm)]struct IdentitieRes { - replacement in src/pijul.rs at line 117
#[get("/<org_path>/<proj_path>/.pijul?<id_req>", rank = 3)]fn identities(org_path: String, proj_path: String, id_req: IdentitiesReq) -> Json<Identities> {println!("{:?}", id_req.identities);#[get("/<org_path>/<proj_path>/.pijul?<identities>", rank = 4)]fn identities(org_path: String, proj_path: String, identities: Identities) -> Json<IdentitieRes> {Json(IdentitieRes { id: vec![], rev: 0 })}#[get("/<org_path>/<proj_path>/.pijul?<change>", rank = 3)]async fn change(db: &State<Database>,repoman: &State<RepoMan>,org_path: String,proj_path: String,change: String,) -> Option<NamedFile> {let p = projects::find(db, org_path, proj_path).await?; - replacement in src/pijul.rs at line 132
Json(Identities { id: vec![], rev: 0 })let hash = crate::models::pijul::changestores::Changestore::hash_from_string(change)?;let repo = p.repository(&repoman.storage_root).ok()?;let path = repo.changestore().change_file(hash);NamedFile::open(path).await.ok() - replacement in src/pijul.rs at line 140
routes![remote_id, changelist, apply, identities]routes![remote_id, changelist, apply, identities, change] - edit in src/models/pijul/repositories.rs at line 150
println!("loaded channel, changes for: {}, from: {}", channel, from); - edit in src/models/pijul/repositories.rs at line 151
println!("found change"); - edit in src/models/pijul/repositories.rs at line 156
println!("{}.{}.{}", offset, h.to_base32(), m.to_base32());