diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 51fe7e0..24a5874 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -40,7 +40,7 @@ pub fn run() { .setup(|app| { // allowed the given directory let scope = app.fs_scope(); - scope.allow_directory("/home/toxotes", true); + scope.allow_directory(tauri::path::BaseDirectory::Home.variable(), true); app.set_theme(Some(tauri::Theme::Dark)); Ok(()) diff --git a/src/main.js b/src/main.js index bc27a77..534efa2 100644 --- a/src/main.js +++ b/src/main.js @@ -1,13 +1,11 @@ -const { invoke } = window.__TAURI__.core; -const {readFile } = window.__TAURI__.fs; +const { convertFileSrc, invoke } = window.__TAURI__.core; +const { homeDir, join } = window.__TAURI__.path; +const { readFile } = window.__TAURI__.fs; -let greetInputEl; -let greetMsgEl; +const appDataDirPath = await homeDir(); +const filePath = await join(appDataDirPath, 'Pictures/wallpaper.png'); -async function greet() { - // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ - greetMsgEl.textContent = await invoke("greet", { name: "harald" }); -} +const assetUrl = convertFileSrc(filePath); let text = ""; window.addEventListener("DOMCharacterDataModified", () => { @@ -18,8 +16,8 @@ window.addEventListener("DOMCharacterDataModified", () => { invoke("parse_markdown", { document: text }).then( (ret)=>{ var tag_id = document.getElementById('rendered_markdown'); - tag_id.innerHTML = "
".concat("", ret).concat("", "");
- // tag_id.innerHTML = ret;
+ // tag_id.innerHTML = "".concat("", ret).concat("", "");
+ tag_id.innerText = assetUrl.concat("", ' \n