mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:09:41 +01:00
Cookie jars per folder; pacman repository on Gitea; install guide per platform
- A folder can share its parent's cookie jar, keep its own, or use no cookies; sub folders follow. The Cookies tab shows the jar a request used. Jars are stored per collection and folder. - The release workflow builds knock-bin from the deb and uploads it to the Gitea pacman repository (needs the GITEA_PACKAGES_TOKEN secret) - knock-bin installs the desktop entry as knock-app.desktop - README: install for Arch (signed pacman repo), Ubuntu/Debian, Fedora/openSUSE, AppImage, macOS (quarantine) and Windows (SmartScreen) - release.sh works when the version is already set
This commit is contained in:
@@ -60,8 +60,8 @@ fn remember_recent(state: &AppState, root: &str) {
|
||||
|
||||
fn register(app: &AppHandle, state: &AppState, c: Collection) -> Res<CollectionView> {
|
||||
let v = view(&c);
|
||||
if let Ok(Some(json)) = db::jar_load(&state.db.lock().unwrap(), &v.id) {
|
||||
state.engine.load_jar(&v.id, &json);
|
||||
for (id, json) in db::jars_for(&state.db.lock().unwrap(), &v.id).unwrap_or_default() {
|
||||
state.engine.load_jar(&id, &json);
|
||||
}
|
||||
let root = c.root.clone();
|
||||
state.collections.write().unwrap().insert(v.id.clone(), c);
|
||||
@@ -433,9 +433,9 @@ pub async fn request_send(app: AppHandle, args: SendArgs) -> Res<SendResult> {
|
||||
state.set_runtime(&col_key, &x.var, Some(v.clone()), x.persist);
|
||||
}
|
||||
}
|
||||
if let Some(col) = &args.scope.col {
|
||||
let json = state.engine.save_jar(col);
|
||||
let _ = db::jar_save(&state.db.lock().unwrap(), col, &json);
|
||||
if let Some(jar) = &out.jar {
|
||||
let json = state.engine.save_jar(jar);
|
||||
let _ = db::jar_save(&state.db.lock().unwrap(), jar, &json);
|
||||
}
|
||||
|
||||
let mut body_id = None;
|
||||
@@ -666,8 +666,10 @@ pub async fn runner_run(
|
||||
for (k, v) in &report.runtime {
|
||||
state.set_runtime(&col, k, Some(v.clone()), false);
|
||||
}
|
||||
let json = state.engine.save_jar(&col);
|
||||
let _ = db::jar_save(&state.db.lock().unwrap(), &col, &json);
|
||||
for jar in state.engine.jar_ids(&col) {
|
||||
let json = state.engine.save_jar(&jar);
|
||||
let _ = db::jar_save(&state.db.lock().unwrap(), &jar, &json);
|
||||
}
|
||||
Ok(RunResult { json: knock_core::runner::to_json(&report), junit: knock_core::runner::to_junit(&report), report })
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -182,10 +182,11 @@ pub fn history_delete(c: &Connection, id: Option<i64>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn jar_load(c: &Connection, collection: &str) -> Result<Option<String>> {
|
||||
Ok(c
|
||||
.query_row("SELECT json FROM cookie_jars WHERE collection = ?1", [collection], |r| r.get(0))
|
||||
.optional()?)
|
||||
/// The collection's jar and the jars of its folders (`<collection>/<folder>`).
|
||||
pub fn jars_for(c: &Connection, collection: &str) -> Result<Vec<(String, String)>> {
|
||||
let mut stmt = c.prepare("SELECT collection, json FROM cookie_jars WHERE collection = ?1 OR collection LIKE ?1 || '/%'")?;
|
||||
let rows = stmt.query_map([collection], |r| Ok((r.get(0)?, r.get(1)?)))?;
|
||||
Ok(rows.collect::<Result<_, _>>()?)
|
||||
}
|
||||
|
||||
pub fn jar_save(c: &Connection, collection: &str, json: &str) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user