Skip to content
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

[Sandbox] Handling of done.txt file #564

Closed
TriggerDingus opened this issue Nov 2, 2023 · 18 comments
Closed

[Sandbox] Handling of done.txt file #564

TriggerDingus opened this issue Nov 2, 2023 · 18 comments
Labels
enhancement New feature or request

Comments

@TriggerDingus
Copy link

TriggerDingus commented Nov 2, 2023

App Version: 2.0.1

Platform: Linux

Installation Method: Flathub

Bug Description:
Prior to the rewrite, my archive for both my Active and Done tasks was (and still is) located at /media/bob/TheDataHoard/ToDo.txt/todo_done.txt.
Upon installing version 2.0.1 and performing "ToDos > Archive completed todos", the app provided the following dialog box:
image

Assuming all is well, I clicked on "Archive". Problem is, I found it didn't archive to my chosen location. Assuming I needed to update a setting somewhere in the new version, I searched the Settings and found nowhere to indicate my Archive file storage location. The application apparently doesn't assume the same location as the currently-open ToDo list and assumes it gets stored in my flatpak app directory.

Here is a global search I performed where you'll find my old chosen archive along with the file created by the new version stored in my flatpak app directory:
image

@TriggerDingus TriggerDingus added the bug Something isn't working label Nov 2, 2023
@ransome1
Copy link
Owner

ransome1 commented Nov 2, 2023

@TriggerDingus The title of this bug reports implies, sleek did prompt for the storage location of the done file in the past. That has never been the case. Prior to 2.x sleek simply archived the done file into the same location as the todo.txt file.

Let me try to explain what is happening here: Prior to the rewrite sleek was simply accessing large parts of the file system. Like that sleek could just add /home/TriggerDingus/Todo/todo.txt to its config and work with it. This is not what Flatpak wants, since it requires the app to access large parts of your file system. From a security point of view, I understand. Since 2.0. sleek is now obeying the Flatpak sandbox system a bit more. It now does not access your file system directly any more. So when you use the file chooser (as part of the so called portals), it chooses the desired file, but as some kind of an alias, which mirrors the original with a copy in the sandbox ... or something like that ;) I havn't fully digged into how it works precisely. But since sleek is being distributed to so many platform, all having their own sandbox systems, it's hard to find the time to figure all these things out.

However, as for the done file sleek simply chooses the same location of the todo.txt file and just replaces the todo.txt with done.txt. Both is now located in the sandbox. But the todo.txt file is connected, with that alias, with the original file. The done file of course is not. It just lives in the sandbox.

I have to admit, that the current configuration of the Flatpak gives good reason to ask these questions and as soon as I find the time, I will look into how we can improve the user experience here.

As for a quick workaround: To change the location of the done.txt file, you can right click on the file tab, use the file chooser and select the desired done.txt file. Let me know if this already solves the issue at hand.
Bildschirmfoto 2023-11-02 um 7 37 41 PM

@TriggerDingus
Copy link
Author

TriggerDingus commented Nov 2, 2023

Thanks for the thoughtful response. To be honest, it was a year or two ago that I did my archive in the older versions so I didn't recall how it found the right folder, so it makes sense it put it in the same location as my ToDo.txt file.
I tried your workaround and just noticed the toggle for "show file tabs" isn't working for me. I tried both the toggle and the switch within settings but I can't get it to show the file tabs. Guessing it might be a permissions issue, I tried turning on all file system permissions for the Sleek Flatpak using Flatseal but that didn't work either. Ideas?

image

@ransome1
Copy link
Owner

ransome1 commented Nov 2, 2023

With the Show file tabs set to true, you need to hide the search in order to see the tabs again. Click on the magnifier icon or press Ctrl + F to do so. Otherwise just click into the search field and press Escape.

Maybe another thing, that needs to be improved from a UX perspective.

@TriggerDingus
Copy link
Author

With the Show file tabs set to true, you need to hide the search in order to see the tabs again. Click on the magnifier icon or press Ctrl + F to do so. Otherwise just click into the search field and press Escape.

Maybe another thing, that needs to be improved from a UX perspective.

Worked. Got my archive set to the existing archive filename/location.

@ransome1
Copy link
Owner

ransome1 commented Nov 2, 2023

Out of curiosity; If you do the right click on the tab and then hover over the Change path to done file button, does the tool tip, which then opens, tell you the absolute path to the file, or the path to the sandbox alias? And does archiving then move the todos to the actual done.txt file as expected?

@TriggerDingus
Copy link
Author

Here's the screen cap:
image

So, the path is showing as a flatpak translation? of the location though not using the naming convention I see in my directory tools or CLI.
I did run a test of the archive and it is putting new completed items in the proper file. Mucho thanks.

@ransome1 ransome1 changed the title "Done" archiving working differently in rewrite, not prompted for storage location of "Done.txt" archive [Sandbox] Handling of done.txt file Nov 2, 2023
@ransome1 ransome1 added enhancement New feature or request and removed bug Something isn't working labels Nov 2, 2023
@ransome1 ransome1 moved this to Backlog in sleek 2.x Nov 2, 2023
@ransome1
Copy link
Owner

ransome1 commented Nov 2, 2023

You're welcome. I morphed this bug report into an enhancement issue.

Aim is to find a proper way to get the done.txt file part of the sandboxed environments. This goes at least for Flatpak and Mac App Store apps.

I was thinking of not defining a default path to the done file, but on first archiving, to let the user choose the location of the done.txt file. Like that it would be properly handled in a sandboxed environment.

@andrei-a-papou
Copy link

Just upgraded to v2.0.2 from 1.x and got bitten by this. Archived TODOs ended up in a generic done.txt, which was not desirable. It's good to know you can right-click the tab and change the location of done.txt, but that, I think, is hardly discoverable.

I was thinking of not defining a default path to the done file, but on first archiving, to let the user choose the location of the done.txt file. Like that it would be properly handled in a sandboxed environment.

This sounds like a great idea, IMO!

@ransome1 ransome1 moved this from Backlog to In Progress in sleek 2.x Nov 27, 2023
@ransome1
Copy link
Owner

I was thinking of not defining a default path to the done file, but on first archiving, to let the user choose the location of the done.txt file. Like that it would be properly handled in a sandboxed environment.

@andrei-a-papou @TriggerDingus this has now been implemented and is available for testing via Flathub. Install it with: flatpak install --user https://dl.flathub.org/build-repo/66829/com.github.ransome1.sleek.flatpakref

The behavior is now:

  • Open sleek and use the file chooser to open a todo.txt file
  • In the navigation you will now find a button for archiving, but the keyboard shortcut and the option in window menu will trigger the same function
  • Since you did not select an archiving file yet, sleek should ask you to either open an archive file or to create one
  • Once you selected or created the archive file, sleek will immediately ask you if you want to archive
  • Archiving should be working now
  • Restart sleek and work with the files should still work

Since both files (todo.txt and done.txt) have been added to the app with the file chooser, the Flatpak sandbox now knows these files and will have access to them.

There is one aesthetic drawback. Although you will be working in the desired files, sleek will present you with the sandbox link of the file, which is some kind of alias. So if archiving was successful, sleek will show a cryptic path to which has been archived.

Can you please play around with this feature and let me know if it works on your side as well?

@andrei-a-papou
Copy link

andrei-a-papou commented Nov 29, 2023

@ransome1 I do not use Flatpak so can't test it, but I just played with the enhanced archiving feature using the latest AppImage and here are some thoughts:

  1. the toolbar button is great, it definitely helps discoverability -- thank you!
  2. when sleek asks for location of the done.txt file and I click "Create file", the prepopulated file name is todo.txt (see screenshot below). I propose making it done.txt and preferably switching to the same directory as todo.txt in the file picker (if possible with Electron)
    image
  3. when everything is archived and you have an empty file, the Filter and Archive buttons should be disabled, I think:
    image
    Currently the Filter button tries to open the left drawer and immediately closes it, which looks a bit jerky. And the Archive button allows you to "archive" non-existent toods and then the app happily reports they've been archived :)

@ransome1
Copy link
Owner

2. I propose making it done.txt and preferably switching to the same directory as todo.txt in the file picker (if possible with Electron)

Yep, makes sense and should be possible to implement.

when everything is archived and you have an empty file, the Filter and Archive buttons should be disabled, I think:

I agree, if the file is empty we should hide the button.

3. Currently the Filter button tries to open the left drawer and immediately closes it, which looks a bit jerky.

That might actually be a little bug, I'll look into it.

3. And the Archive button allows you to "archive" non-existent toods and then the app happily reports they've been archived :)

Technically this is correct, but of course this doesn't make a lot of sense. We have some potential here to improve the UX.

Thanks for the feedback.

@andrei-a-papou
Copy link

@ransome1 great, looking forward to a new release candidate, I'll be happy to help with testing

@TriggerDingus
Copy link
Author

I'm hoping I'll have some time this weekend to build a test environment in a VM to try it out.
I use the current version heavily every day but I don't want to risk installing the test build on my 'production' system.

@TriggerDingus
Copy link
Author

Just tried installing the flatpak but received the following error:

error: Can't load uri https://dl.flathub.org/build-repo/66829/com.github.ransome1.sleek.flatpakref: Server returned status 404

I may have missed my opportunity to test, so my apologies for that!

@ransome1
Copy link
Owner

ransome1 commented Dec 5, 2023

Just tried installing the flatpak but received the following error:

error: Can't load uri https://dl.flathub.org/build-repo/66829/com.github.ransome1.sleek.flatpakref: Server returned status 404

I may have missed my opportunity to test, so my apologies for that!

sorry I only now read your post. I rebuilt it and you should be able to install it with: flatpak install https://dl.flathub.org/build-repo/68396/com.github.ransome1.sleek.flatpakref

@TriggerDingus
Copy link
Author

Looks like it works. It also successfully displays the ToDo.txt file tab and is no longer hidden by the Search bar.

@ransome1
Copy link
Owner

@andrei-a-papou I think all your feedback should have been implemented in the latest pre-release: https://github.com/ransome1/sleek/releases/tag/v2.0.3-rc.5

Feel free to give it some testing, before I finally release all the changes with 2.0.3.

@andrei-a-papou
Copy link

@ransome1 Things seem to work fine now, thank you! I'll let you know if I notice anything in the future

@github-project-automation github-project-automation bot moved this from In Progress to Done in sleek 2.x Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

3 participants