i think i got step one working

This commit is contained in:
2026-03-25 01:22:30 -06:00
parent 4230ae6cb9
commit b4bcb8f3f2
14 changed files with 5932 additions and 32 deletions

5347
src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,11 +15,13 @@ name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.5.6" }
tauri-build = { version = "2.5.6", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.10.3" }
tauri = { version = "2.10.3", features = [] }
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-log = "2"

View File

@ -1,11 +1,19 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "enables the default permissions",
"description": "Default capabilities for TalkEdit desktop",
"windows": [
"main"
],
"permissions": [
"core:default"
"core:default",
"dialog:default",
"dialog:allow-open",
"dialog:allow-save",
"fs:default",
"fs:allow-read-text-file",
"fs:allow-write-text-file",
"fs:allow-app-read-recursive",
"fs:allow-app-write-recursive"
]
}

View File

@ -1,16 +1,66 @@
use tauri::Manager;
// --- Commands ---
/// Returns the backend URL. Stubbed for now; will be replaced once the
/// Python/Rust backend is fully wired up.
#[tauri::command]
fn get_backend_url() -> String {
// During development the Python backend still runs on 8642.
// In production this will be replaced with a local Rust server or IPC.
"http://localhost:8642".to_string()
}
/// Minimal encrypt: base64-encodes the string as a placeholder until a proper
/// OS keychain implementation is added (e.g. tauri-plugin-stronghold).
#[tauri::command]
fn encrypt_string(data: String) -> String {
use std::io::Write;
let encoded = data
.as_bytes()
.iter()
.fold(String::new(), |mut acc, b| {
use std::fmt::Write as FmtWrite;
let _ = write!(acc, "{:02x}", b);
acc
});
encoded
}
/// Companion decode for encrypt_string.
#[tauri::command]
fn decrypt_string(encrypted: String) -> Result<String, String> {
let bytes: Result<Vec<u8>, _> = (0..encrypted.len())
.step_by(2)
.map(|i| u8::from_str_radix(&encrypted[i..i + 2], 16))
.collect();
bytes
.map_err(|e| format!("decrypt error: {e}"))
.and_then(|b| String::from_utf8(b).map_err(|e| format!("utf8 error: {e}")))
}
// --- App entry point ---
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
tauri_plugin_log::Builder::default()
.level(log::LevelFilter::Info)
.build(),
)?;
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_fs::init())
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
tauri_plugin_log::Builder::default()
.level(log::LevelFilter::Info)
.build(),
)?;
}
Ok(())
})
.invoke_handler(tauri::generate_handler![
get_backend_url,
encrypt_string,
decrypt_string,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@ -1,19 +1,23 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "cutscript",
"productName": "TalkEdit",
"version": "0.1.0",
"identifier": "com.tauri.dev",
"identifier": "com.talkedit.app",
"build": {
"frontendDist": "../dist",
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build"
"frontendDist": "../frontend/dist",
"devUrl": "http://localhost:5173",
"beforeDevCommand": "cd frontend && npm run dev",
"beforeBuildCommand": "cd frontend && npm run build"
},
"app": {
"windows": [
{
"title": "cutscript",
"width": 800,
"height": 600,
"label": "main",
"title": "TalkEdit",
"width": 1400,
"height": 900,
"minWidth": 1024,
"minHeight": 700,
"resizable": true,
"fullscreen": false
}