diff --git a/.gitignore b/.gitignore index 190247aac..c7dd43b96 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,6 @@ Cargo.lock # doing this because the task-runner (`mask prepare`) will clone gh:tauri-apps/examples /examples + +# ignore frida handlers +__handlers__/ diff --git a/tauri/examples/communication/dist/dialog.js b/tauri/examples/communication/dist/dialog.js index 450150b94..73d17291e 100644 --- a/tauri/examples/communication/dist/dialog.js +++ b/tauri/examples/communication/dist/dialog.js @@ -9,7 +9,25 @@ document.getElementById('open-dialog').addEventListener('click', function () { filter: filterInput.value || null, multiple: multipleInput.checked, directory: directoryInput.checked - }).then(registerResponse).catch(registerResponse) + }).then(function (res) { + console.log(res) + var pathToRead = res + var isFile = pathToRead.match(/\S+\.\S+$/g) + window.tauri.readBinaryFile(pathToRead).then(function (response) { + if (isFile) { + if (pathToRead.includes('.png') || pathToRead.includes('.jpg')) { + arrayBufferToBase64(new Uint8Array(response), function (base64) { + var src = 'data:image/png;base64,' + base64 + registerResponse('') + }) + } else { + registerResponse(res) + } + } else { + registerResponse(res) + } + }).catch(registerResponse(res)) + }).catch(registerResponse) }) document.getElementById('save-dialog').addEventListener('click', function () { diff --git a/tauri/examples/communication/dist/index.html b/tauri/examples/communication/dist/index.html index eb3e5f33a..80117c605 100644 --- a/tauri/examples/communication/dist/index.html +++ b/tauri/examples/communication/dist/index.html @@ -2,90 +2,241 @@
- -

GitHub Repository

-
-
- - - -
-
- - - -
+
+
+
+ + +
+ + + -
- - -
+
+ + +
+
+
+
+ + +
+
+ + + +
+
+ + +
+ + +
+
+ + +
-
- - -
+ + +
+
+
-
- - -
- - +
+ + +
+
+ + +
+ +
+ + +
+ +
+ +
+
+
-
- - -
- - -
- -
- - - - -
-
- +
\ No newline at end of file +


\ No newline at end of file diff --git a/tauri/examples/communication/src-tauri/tauri.conf.json b/tauri/examples/communication/src-tauri/tauri.conf.json index 697831ed0..cb8b4b8c6 100644 --- a/tauri/examples/communication/src-tauri/tauri.conf.json +++ b/tauri/examples/communication/src-tauri/tauri.conf.json @@ -6,7 +6,7 @@ "ctx": {}, "tauri": { "embeddedServer": { - "active": true + "active": false }, "bundle": { "active": true, @@ -19,7 +19,7 @@ "all": true }, "window": { - "title": "Tauri App" + "title": "Tauri API Validation" }, "security": { "csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'" @@ -31,4 +31,4 @@ "active": true } } -} +} \ No newline at end of file