Skip to content

Instantly share code, notes, and snippets.

View p1mo's full-sized avatar

Martin p1mo

  • Germany
  • 05:26 (UTC +02:00)
View GitHub Profile
@p1mo
p1mo / enhance_tauri_plugin.rs
Last active February 17, 2024 23:10
wrap tauri's .plugin() into platform and os specific functions like .windows_plugin()
pub trait EnhancePlugin<R: tauri::Runtime> {
fn plugin_windows<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_linux<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_macos<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_android<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_ios<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_desktop<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
fn plugin_mobile<P: tauri::plugin::Plugin<R> + 'static>(self, plugin: P) -> Self;
}
@p1mo
p1mo / readlines.rs
Last active January 8, 2024 12:48
Read Logfiles line by line in rust
use std::fs::File;
use std::io::Seek;
use std::io::BufRead;
use std::io::SeekFrom;
use std::io::BufReader;
#[cfg(windows)]
const OS_STRING_ENDING: &'static str = "\r\n";
@p1mo
p1mo / tauri-stronghold-plugin.md
Last active February 22, 2024 23:45
Example for Tauri's stronghold plugin

example for tauri's stronghold-plugin

First go to plugin docs and add it to your project

Aragon create used: https://crates.io/crates/rust-argon2

src-tauri/main.rs

@p1mo
p1mo / tauri_custom_protocol.md
Created December 14, 2023 23:33
tauri v1 - custom protocol - example (read image)

very simple & ugly example for tauri's custom protocol

This example uses mdata as custom protocol and csp img-src

tauri.conf.json

{
    "tauri" : {
        "allowlist" : {
            "protocol": {