ITADN

allow user to support multiple profiles: make paths module public & add functions for getting all cookie paths

#97Pull Requestjoe-conigliaro 创建于 2025-06-07
J
joe-conigliarocommented
This purpose of this PR is to allow a rookie user to support multiple profiles. ### Overview Lets say a rookie user wants to support multiple profiles in their code. They can simply call **paths::find_{browser}_based_paths**, and let the user choose one of the paths. Then they can call **rookie::{browser}_based** with the chosen path. ### Changes - Make the **common::paths** module public. - Changes the behaviour of the **find_{browser}_based_paths** functions to return a vector of all paths found. - Adds a new function **find_{browser}_based_path** which returns the first path from the result of **find_{browser}_based_paths**. - Replaces all the uses of **find_{browser}_based_paths** with **find_{browser}_based_path**. ### Example: Here is a chrome example, I have left out the code where a profile is actually chosen. You can imagine that bit. ```rust let config = config::get_browser_config("chrome"); let paths = paths::find_chrome_based_paths(config)?; // show paths to the user and let them pick one. // lets say they chose the first one. let choice = 0; let (key, db_path) = paths[choice]; let cookies = rookie::chromium_based(key, db_path, None) ```
合并状态:未合并 3 条评论