#Dynamically update the contentProtected field in the tauri config file
3 messages · Page 1 of 1 (latest)
I'm assuming the dashboard and the login are part of the same app. The recommended way would be to put the login window in your tauri.conf.json file and then use a #[tauri::command] to create the main content window when the user has successfully logged in. That way, you already know what kind of user it is and can set the content_protected field on the window before it is created.
If the login isn't part of the same app, you can set it before you even create the Tauri runtime.
let mut tauri_context = tauri::generate_context!();
if true {
for window in tauri_context.config_mut().tauri.windows.iter_mut() {
window.content_protected = true;
}
}