-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings Sync #2684
Comments
Flow Launcher can be used in portable mode allowing the use of cloud drives, git, syncthing, etc. |
It's true but it really costs my space and time. Sync the whole app in cloud might have some problem for too many files. Flowlauncher was packed with runtime. Can they be deleted if I installed .net? I think just sync a folder wasn't difficult. In C#,we can use Microsoft.Graph. This is an example (bad code): using Microsoft.Graph;
using Microsoft.Identity.Client;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace OneDriveAppFolderExample{
class Program{
private static GraphServiceClient graphClient;
private static string clientId = "*#*#*#*#*";
private static string[] scopes = new string[] { "Files.ReadWrite.AppFolder" };
static async Task Main(string[] args){
var authProvider = new InteractiveAuthenticationProvider(clientId, scopes);
graphClient = new GraphServiceClient(authProvider);
var appFolder = await CreateAppFolder();
await UploadFileToAppFolder(appFolder, @"UserData/settings");
//This need keep flow's working directory not change
//In file search plugin, if user use the position of the executable file as the working directory, it will not work. We need not change the working directory of the main process.
}
private static async Task<DriveItem> CreateAppFolder(){
try{
var appFolder = await graphClient.Me.Drive.Special.AppRoot
.Request()
.GetAsync();
return appFolder;
}
catch (ServiceException ex){
if (ex.StatusCode == System.Net.HttpStatusCode.NotFound){
var folderToCreate = new DriveItem{
Name = "Flow.Launcher",
Folder = new Folder()
};
var appFolder = await graphClient.Me.Drive.Special.AppRoot
.Children
.Request()
.AddAsync(folderToCreate);
return appFolder;
}
else{
throw;
}
}
}
private static async Task UploadFileToAppFolder(DriveItem appFolder, string localFilePath){
using (var fileStream = System.IO.File.OpenRead(localFilePath)){
var uploadedFile = await graphClient.Me.Drive.Items[appFolder.Id]
.ItemWithPath(System.IO.Path.GetFileName(localFilePath))
.Content
.Request()
.PutAsync<DriveItem>(fileStream);
Console.WriteLine("Uploaded file ID: " + uploadedFile.Id);
}
}
}
public class InteractiveAuthenticationProvider : IAuthenticationProvider {
private IPublicClientApplication _msalClient;
private string[] _scopes;
public InteractiveAuthenticationProvider(string clientId, string[] scopes){
_msalClient = PublicClientApplicationBuilder.Create(clientId).Build();
_scopes = scopes;
}
public async Task AuthenticateRequestAsync(HttpRequestMessage request){
var authResult = await _msalClient.AcquireTokenInteractive(_scopes).ExecuteAsync();
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", authResult.AccessToken);
}
}
} |
We want to create this feature, but we don't have anyone to work on it now. If you know how to write code, please make a PR. |
We definitely won't be hosting this solution ourselves. It will have to be a third-party solution but everyone's got their own preferred sync platform, e.g. OneDrive, GoogleDrive or etc. Maybe should consider allowing the UserData folder be relocated to a separate location so only that folder gets synced, and user data is also loaded from the new location. |
The aText program uses two quite good solutions:
|
The problem with that is how to handle a conflict if modified by both side? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Garulf (or anyone), if I use Everything Search on each local machine for powering the search indexes, and switched over to running Flow in portable mode, located on Microsoft OneDrive, is there anything that could go wrong, any downsides? I should add I frequently Remote Desktop into the other machines, so I could easily be activating Flow on my local machine and a few moments later be activating Flow on a remote machine, and all of these would be the same Flow (if I were to do the portable mode on OneDrive). I'm in the midst of setting up a third machine, so am just thinking about this (and the desire for Settings Sync) as I am about to install and configure Flow again. |
I place them in onedrive, too. It works fine if in the same directory, different directory isn't tested. |
Thanks much for the reply! Pardon me for being obtuse, but what would be a "different directory" vs "same directory" example? I would probably do something like OneDrive>Apps>FlowLauncher and then each computer would be using that Flow. This is obviously a different directory than the normal install path, but I think you must mean something else. Just want to be sure I'm understand the parameters/constraints. :) |
As for me: PC A: Win10 LTSC19 D:\OneDrive\ PC B: Win11 24H2 D:\OneDrive\ PC C: Win10 23H2 C:\Users\1208nn\OneDrive\ A & B works well. C is not tested. |
Ah, I understand! Yes, I will be doing something like |
How do you avoid getting your settings overwritten by the various installations? I'm under the impression that Flow saves various user settings when it exits (I notice this when I am manually editing a settings file), so I would think that if you changed a setting via Flow on Computer A, and then go to Computer B (already on and running Flow) and shutdown Computer B, that Computer B's Flow will save its settings when it closes, overwriting the shared settings between the two (on OneDrive). Does that not happen for you and/or how do you mitigate this? I Remote Desktop regularly into the computers that will all be sharing the same Flow portable installation, so I'm just trying to think through how this will work. I just posted #3113 as one route I am looking into. |
@1208nn, how do you handle the Program plugin when using portable Flow across multiple computers (since the data is specific to each machine), or do you just not use that plugin? Is there a command line way to tell that plugin to Reindex (because if so, I could script that for each time I login to a given computer)? |
Sharing just for the sake of others who may attempt this in the future: I have ended up writing a little script that runs when I unlock my computer and which deletes It is a bit of a clunky solution, but it works -- now when I unlock each computer it runs this script and thus searching for Programs in Flow gives me local results. I suspect this method/approach is not foolproof and that I'll still run into some instances of not getting the results I'm looking for, but it is an improvement over what was happening previously. |
I'm sorry. In fact I use my computers mostly not at the same time. For programs, there is few difference on my two computers(they are just for different places to use), and .exe files are indexed by Everything(settings is in OneDrive and database is in %PROGRAMDATA%), so it's enough. |
Ah sure. Well, at the very least, hopefully our conversation here will be useful to future people considering going the portable syncing route, as well as be informative for whenever true settings sync support is added. |
This comment has been minimized.
This comment has been minimized.
i would love to see that feature :) maybe similar to home assistant where you can setup regular backups of settings to different cloud/local storages and then import those settings if you are setting up flow launcher on another pc would be a first step towards actually syncing settings. a full automatic sync would also be nice to have |
Setting up sync is a good feature to use Flow between devices, which make our experience better.
If flowlaunchher has no plans to create an account system or buy a server, syncing through OneDrive, GoogleDrive, WebDav is also acceptable and a good solution. For example, tampermonkey, violentmonkey use these methods.
I think we can sync the settings folder, themes folder, and a list of plugins.
It's a ok to sync like
vscode
, only a json file with the list of plugins.The text was updated successfully, but these errors were encountered: