fix sparql update on tauri. had wrong base

master
Niko PLP 3 months ago
parent 465b43d88d
commit 09a0e83a21
  1. 12
      CHANGELOG.md
  2. 0
      RELEASE-NOTE.md
  3. 18
      ng-app/src-tauri/src/lib.rs
  4. 5
      ng-app/src/apps/ContainerView.svelte
  5. 4
      ng-app/src/locales/en.json
  6. 41
      ng-app/src/routes/WalletInfo.svelte
  7. 2
      ng-verifier/src/request_processor.rs

@ -0,0 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.0-preview.7]
### Added
-

@ -552,13 +552,23 @@ async fn branch_history(session_id: u64, nuri: String) -> Result<AppHistoryJs, S
}
#[tauri::command(rename_all = "snake_case")]
async fn sparql_update(session_id: u64, sparql: String, nuri: String) -> Result<(), String> {
let nuriv0 = NuriV0::new_from(&nuri).map_err(|e| e.to_string())?;
async fn sparql_update(
session_id: u64,
sparql: String,
nuri: Option<String>,
) -> Result<(), String> {
let (nuri, base) = if let Some(n) = nuri {
let nuri = NuriV0::new_from(&n).map_err(|e| e.to_string())?;
let b = nuri.repo();
(nuri, Some(b))
} else {
(NuriV0::new_private_store_target(), None)
};
let request = AppRequest::V0(AppRequestV0 {
command: AppRequestCommandV0::new_write_query(),
nuri: nuriv0,
payload: Some(AppRequestPayload::new_sparql_query(sparql, Some(nuri))),
nuri,
payload: Some(AppRequestPayload::new_sparql_query(sparql, base)),
session_id,
});

@ -18,7 +18,7 @@
import{ PencilSquare } from "svelte-heros-v2";
import { t } from "svelte-i18n";
import {
in_memory_discrete, open_viewer, set_viewer, set_editor, set_view_or_edit, cur_tab_branch_class, cur_tab_doc_can_edit
in_memory_discrete, open_viewer, set_viewer, set_editor, set_view_or_edit, cur_tab_branch_class, cur_tab_doc_can_edit, cur_tab
} from "../tab";
import {
openModalCreate
@ -29,7 +29,8 @@
let ret = [];
for (const g of graph) {
if (g.substring(57,90) === "http://www.w3.org/ns/ldp#contains") {
let nuri = g.substring(93,193);
let nuri = g.substring(93,146);
nuri = nuri + ":" + $cur_tab.store.overlay;
let hash = nuri.substring(9,16);
ret.push({nuri,hash});
}

@ -260,7 +260,6 @@
},
"wallet_info": {
"title": "Wallet",
"scan_qr": "Scan QR to export",
"download": "Download Wallet File",
"download_failed": "Download Failed:<br/>{error}",
"download_in_progress": "Download in progress...",
@ -502,7 +501,7 @@
"gen.button": "Generate QR-Code",
"gen.description": "To import your wallet from another device, you have to generate a QR-Code here on this device, and then scan it with your other device (the one where your wallet is located for now).<br/>If your other device does not have a camera, then you have to use another method for importing your wallet here.",
"offline_advice": "If you do not have internet on this device, you can use the \"Import a Wallet file\" method instead.",
"gen.letsgo": "Ready? On your other device, you first have to be logged-in (wallet is opened) and then you go to<br /><span class=\"path\">User Panel > Wallet > Scan QR to export</span>.<br />Then on this present device, click below on the<br/><span class=\"path\">Generate QR-Code</span> button.",
"gen.letsgo": "Ready? On your other device, you first have to be logged-in (wallet is opened) and then you go to<br /><span class=\"path\">User Panel > Wallet > Export by scanning a QR-code</span>.<br />Then on this present device, click below on the<br/><span class=\"path\">Generate QR-Code</span> button.",
"gen.generated": "Scan this QR-Code from the other device.<br/>You have 5 minutes to do so.",
"success_btn": "Continue to Login"
},
@ -601,6 +600,7 @@
"NotARendezVous": "You scanned an invalid QR-Code.",
"camera_unavailable": "Camera is unavailable.",
"ServerAlreadyRunningInOtherProcess": "App is already running on this device. Check it and close it.",
"WsError": "WebSocket error",
"cannot_load_this_file": "Cannot load this file",
"graph_not_found": "Graph not found",
"no_wasm_on_old_safari": "Your Safari browser is too old (version before 14.1). As a result we cannot load Automerge, needed for this document. Please upgrade your macOS or iOS system"

@ -172,7 +172,7 @@
};
async function remove_wallet_confirmed() {
if (!active_wallet) return;
if (!$active_wallet) return;
// TODO: Wait for implementation
// await ng.wallet_remove($active_wallet.id);
close_active_wallet();
@ -198,6 +198,7 @@
<SidebarGroup ulClass="space-y-2" class="text-left" role="menu">
<li>
<h2 class="text-xl mb-6">{$t("pages.wallet_info.title")}</h2>
<span class="break-all">ID: {$active_wallet?.id}</span>
</li>
<!-- Go Back -->
@ -250,6 +251,25 @@
<span class="ml-3">{$t("pages.wallet_info.gen_qr.title")}</span>
</li>
<!-- Copy Wallet TextCode -->
<li
tabindex="0"
role="menuitem"
class="text-left flex items-center p-2 text-base font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700"
on:keypress={open_textcode_menu}
on:click={open_textcode_menu}
>
<div>
<Link
tabindex="-1"
class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white"
/>
</div>
<span class="ml-3"
>{$t("pages.wallet_info.create_text_code")}</span
>
</li>
<!-- Download Wallet -->
{#if !downloading}
<li
@ -336,25 +356,6 @@
</li>
{/if}
<!-- Copy Wallet TextCode -->
<li
tabindex="0"
role="menuitem"
class="text-left flex items-center p-2 text-base font-normal text-gray-900 clickable rounded-lg dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700"
on:keypress={open_textcode_menu}
on:click={open_textcode_menu}
>
<div>
<Link
tabindex="-1"
class="w-7 h-7 text-black transition duration-75 dark:text-white group-hover:text-gray-900 dark:group-hover:text-white"
/>
</div>
<span class="ml-3"
>{$t("pages.wallet_info.create_text_code")}</span
>
</li>
<!-- Remove Wallet -->
<li
tabindex="0"

@ -267,7 +267,7 @@ impl Verifier {
// adding an ldp:contains triple to the store main branch
let overlay_id = doc_create.store.outer_overlay();
let nuri = NuriV0::repo_graph_name(&repo_id, &overlay_id);
let nuri = NuriV0::repo_id(&repo_id);
let store_nuri = NuriV0::from_store_repo(&doc_create.store);
let store_nuri_string = NuriV0::repo_id(doc_create.store.repo_id());
let query = format!("INSERT DATA {{ <{store_nuri_string}> <http://www.w3.org/ns/ldp#contains> <{nuri}>. }}");

Loading…
Cancel
Save