[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Save view options asynchronously

Kasper (Sep 16, 2025, 6:15 AM +0200) 34965a18 8ef23235

+7 -8
+1 -1
ferrum-addon/addon.d.ts
··· 136 136 137 137 export declare function save(): FerrumStatus 138 138 139 - export declare function save_view_options(viewOptions: ViewOptions): void 139 + export declare function save_view_options(viewOptions: ViewOptions, filePath: string): Promise<void> 140 140 141 141 export declare function set_image(index: number, path: string): void 142 142
+4 -5
src-native/view_options.rs
··· 32 32 }, 33 33 } 34 34 } 35 - pub fn save(&self, paths: &Paths) -> Result<()> { 35 + pub fn save(&self, file_path: &str) -> Result<()> { 36 36 let json_str = serde_json::to_string(self).context("Error saving view.json")?; 37 - let af = AtomicFile::new(&paths.view_options_file, AllowOverwrite); 37 + let af = AtomicFile::new(&file_path, AllowOverwrite); 38 38 af.write(|f| f.write_all(json_str.as_bytes())) 39 39 .context("Error writing view.json")?; 40 40 Ok(()) ··· 49 49 } 50 50 #[napi(js_name = "save_view_options")] 51 51 #[allow(dead_code)] 52 - pub fn save_view_options(view_options: ViewOptions, env: Env) -> Result<()> { 53 - let data: &mut Data = get_data(&env); 54 - view_options.save(&data.paths)?; 52 + pub async fn save_view_options(view_options: ViewOptions, file_path: String) -> Result<()> { 53 + view_options.save(&file_path)?; 55 54 Ok(()) 56 55 }
+2 -2
src/lib/data.ts
··· 222 222 export function remove_image(index: number) { 223 223 return call_sync((data) => data.remove_image(index)) 224 224 } 225 - export let view_options = call((data) => data.load_view_options()) 225 + export let view_options = strict_call((data) => data.load_view_options()) 226 226 export function save_view_options(options: ViewOptions) { 227 227 view_options = options 228 - return call((data) => data.save_view_options(view_options)) 228 + return call_sync((data) => data.save_view_options(view_options, paths.viewOptionsFile)) 229 229 } 230 230 231 231 export const filter = writable('')