tauri shell, window controls, permissions
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "jellyfin-client"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
# `devtools` keeps the WebView2 inspector available in release builds
|
||||
# (F12 / right-click -> Inspect). Adds a few MB to the binary but is
|
||||
# essential while we're still verifying production behaviour.
|
||||
tauri = { version = "2", features = ["devtools"] }
|
||||
tauri-plugin-store = "2"
|
||||
tauri-plugin-window-state = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
||||
[lib]
|
||||
name = "jellyfin_client_lib"
|
||||
crate-type = ["lib", "cdylib", "staticlib"]
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:webview:allow-set-webview-zoom",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-is-maximized",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:event:allow-listen",
|
||||
"core:event:allow-unlisten",
|
||||
"store:default",
|
||||
"window-state:default"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main"],"permissions":["core:default","core:webview:allow-set-webview-zoom","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","core:window:allow-start-dragging","core:event:allow-listen","core:event:allow-unlisten","store:default","window-state:default"]}}
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 526 B |
|
After Width: | Height: | Size: 807 B |
|
After Width: | Height: | Size: 986 B |
|
After Width: | Height: | Size: 609 B |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 1023 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 767 B |
|
After Width: | Height: | Size: 994 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 753 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#fff</color>
|
||||
</resources>
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 295 B |
|
After Width: | Height: | Size: 539 B |
|
After Width: | Height: | Size: 539 B |
|
After Width: | Height: | Size: 706 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 992 B |
|
After Width: | Height: | Size: 539 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 845 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,67 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Resolve the directory the running EXE lives in. Falls back to the
|
||||
/// process working directory if for some reason we can't read
|
||||
/// `current_exe()` (sandboxed environments, etc.).
|
||||
fn exe_dir() -> PathBuf {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|p| p.to_path_buf()))
|
||||
.unwrap_or_else(|| std::env::current_dir().unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Configure all the env vars Tauri + WebView2 + the OS read when
|
||||
/// resolving "where do I put my data" so EVERYTHING lands in a single
|
||||
/// `./data/` folder next to the EXE - no AppData, no registry, no
|
||||
/// hidden state. Has to run BEFORE the Tauri builder constructs the
|
||||
/// webview, since WebView2 reads `WEBVIEW2_USER_DATA_FOLDER` only at
|
||||
/// startup.
|
||||
fn redirect_data_to_portable_folder() {
|
||||
let root = exe_dir().join("data");
|
||||
let _ = std::fs::create_dir_all(&root);
|
||||
|
||||
let appdata = root.join("appdata");
|
||||
let local_appdata = root.join("localappdata");
|
||||
let webview2 = root.join("webview2");
|
||||
let cache = root.join("cache");
|
||||
let temp = root.join("temp");
|
||||
|
||||
for d in [&appdata, &local_appdata, &webview2, &cache, &temp] {
|
||||
let _ = std::fs::create_dir_all(d);
|
||||
}
|
||||
|
||||
// Tauri's path resolver uses the `dirs` crate under the hood, which
|
||||
// reads APPDATA / LOCALAPPDATA on Windows. Redirecting these
|
||||
// catches every plugin that calls `app.path().app_config_dir()`,
|
||||
// `app_data_dir()`, `app_local_data_dir()`, etc. - including
|
||||
// tauri-plugin-store and tauri-plugin-window-state.
|
||||
std::env::set_var("APPDATA", &appdata);
|
||||
std::env::set_var("LOCALAPPDATA", &local_appdata);
|
||||
|
||||
// WebView2's own user data folder. This is where localStorage,
|
||||
// IndexedDB, cookies, the HTTP cache, and the GPU shader cache go.
|
||||
// Almost all our persisted state (zustand-persist stores) lives
|
||||
// here, so this is the most important one to redirect.
|
||||
std::env::set_var("WEBVIEW2_USER_DATA_FOLDER", &webview2);
|
||||
|
||||
// TEMP / TMP redirection so any temporary files (rare, but Tauri's
|
||||
// file dialog plugin uses these) don't leak to %TEMP%.
|
||||
std::env::set_var("TEMP", &temp);
|
||||
std::env::set_var("TMP", &temp);
|
||||
|
||||
// XDG variants for Linux portability if we ever ship there.
|
||||
std::env::set_var("XDG_DATA_HOME", &local_appdata);
|
||||
std::env::set_var("XDG_CONFIG_HOME", &appdata);
|
||||
std::env::set_var("XDG_CACHE_HOME", &cache);
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
redirect_data_to_portable_folder();
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
jellyfin_client_lib::run()
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/nicegram/nicegram-ios/refs/heads/nicegram/Tauri/tooling/cli/schema.json",
|
||||
"productName": "Jellyfin",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.jellyfin.desktop",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
"devUrl": "http://localhost:5173",
|
||||
"beforeBuildCommand": "npm run build",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Jellyfin",
|
||||
"width": 1280,
|
||||
"height": 720,
|
||||
"minWidth": 800,
|
||||
"minHeight": 500,
|
||||
"center": true,
|
||||
"decorations": false,
|
||||
"resizable": true,
|
||||
"transparent": false,
|
||||
"additionalBrowserArgs": "--autoplay-policy=no-user-gesture-required --disable-features=AutoplayIgnoreWebAudio,BlockInsecurePrivateNetworkRequests --allow-running-insecure-content"
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": "default-src 'self' tauri: asset: https://tauri.localhost; connect-src * data: blob:; img-src * data: blob:; media-src * data: blob:; frame-src 'self' https://www.youtube-nocookie.com https://www.youtube.com; child-src 'self' blob: https://www.youtube-nocookie.com https://www.youtube.com; script-src 'self' tauri: asset: https://tauri.localhost 'unsafe-inline'; style-src 'self' tauri: asset: https://tauri.localhost https://fonts.bunny.net 'unsafe-inline'; font-src 'self' https://fonts.bunny.net data:; worker-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';"
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": false,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"windows": {
|
||||
"webviewInstallMode": {
|
||||
"type": "downloadBootstrapper"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugins": {}
|
||||
}
|
||||