diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a0be2cb..9c6e400 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1615,6 +1615,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + [[package]] name = "httparse" version = "1.9.5" @@ -3789,6 +3795,7 @@ dependencies = [ "gtk", "heck 0.5.0", "http", + "http-range", "jni", "libc", "log", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c534c9b..d43d2c9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -18,7 +18,7 @@ crate-type = ["staticlib", "cdylib", "rlib"] tauri-build = { version = "2", features = [] } [dependencies] -tauri = { version = "2", features = [] } +tauri = { version = "2", features = ["protocol-asset"] } tauri-plugin-shell = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index c7be81d..312ca34 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -16,7 +16,14 @@ } ], "security": { - "csp": null + "csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost", + "assetProtocol": { + "enable": true, + "scope": [ + "$HOME/**" + ] + } + } }, "bundle": { diff --git a/src/main.js b/src/main.js index 534efa2..137ccac 100644 --- a/src/main.js +++ b/src/main.js @@ -7,6 +7,7 @@ const filePath = await join(appDataDirPath, 'Pictures/wallpaper.png'); const assetUrl = convertFileSrc(filePath); + let text = ""; window.addEventListener("DOMCharacterDataModified", () => { // window.addEventListener("DOMContentLoaded", () => { @@ -17,7 +18,7 @@ window.addEventListener("DOMCharacterDataModified", () => { (ret)=>{ var tag_id = document.getElementById('rendered_markdown'); // tag_id.innerHTML = "
".concat("", ret).concat("", "
"); - tag_id.innerText = assetUrl.concat("", ' \n Girl in a jacket')) + tag_id.innerHTML = assetUrl.concat(" ", ' \n Girl in a jacket')) } );