Skip to content

Add new setting for storing user data inside app folder for windows #7513

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

PikachuEXE
Copy link
Collaborator

@PikachuEXE PikachuEXE commented Jun 4, 2025

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

#746

Description

It's common for a portable app to store user data (settings and other data files)

https://portableapps.com/about/what_is_a_portable_app#definition

A portable app is a computer program that doesn't need to be installed into Windows like traditional apps so you can carry it with you on a portable device or synced cloud folder and use on any Windows computer. When your USB flash drive, portable hard drive, or other portable device is plugged in or your cloud drive is synced, you have access to your software and personal data just as you would on your own PC. And when you unplug the device, none of your personal data is left behind.

Screenshots

image

Testing

** Backup data before testing **
Suggest to test with non dev version to be accurate (I have never tested this with dev on windows)
Custom build: https://github.com/PikachuEXE/FreeTube/actions/runs/15481269896

A1. Windows - 7z/zip version

  • Open app
  • Ensure all data like subscribed channels/profiles, sub cache, playlist, settings, etc. are still present
  • Ensure new setting DOES appear and disabled
  • Turn OFF Replace HTTP Cache (for later special setting sync test)
  • Close app
  • Create folder userData under the app folder (if you want to test auto folder creation you can do that later)
    e.g. if executable is at C:\FreeTube\Freetube.exe, create C:\FreeTube\userData
  • Create empty file experiment-replace-http-cache inside that folder (which should be absent when Replace HTTP Cache disabled)
  • Open app, turn ON new setting
  • Ensure all data like subscribed channels/profiles, sub cache, playlist, settings, etc. are still present
  • Ensure Replace HTTP Cache still OFF (and empty file experiment-replace-http-cache is gone)
  • Ensure data files (*.db) now present in new userData folder in app folder
  • Turn ON Replace HTTP Cache
  • Ensure no empty file experiment-replace-http-cache present in default user data folder
  • Optionally do some updates and ensure only files in app folder updated not those in default folder
  • DELETE data files in default user data folder
  • Turn OFF new setting
  • Ensure all data like subscribed channels/profiles, sub cache, playlist, settings, etc. are still present
  • Ensure Replace HTTP Cache still ON
  • Ensure data files now present in default userData folder (%APPDATA%\FreeTube, see https://www.electronjs.org/docs/latest/api/app#appgetpathname)

A2. Windows - portable version (single executable)
Similar to A1 but userData folder and new flag file are both in the same folder as the portable executable file

A3. Windows - NSIS installer version

  • Install to a new folder
  • Ensure all data like subscribed channels/profiles, sub cache, playlist, settings, etc. are still present
  • Ensure new setting does NOT appear

B. Non windows (macOS/Linux)

  • Open app
  • Ensure all data like subscribed channels/profiles, sub cache, playlist, settings, etc. are still present
  • Ensure new setting does NOT appear

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jun 4, 2025
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 4, 2025 01:28
Copy link
Member

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting is available in all Windows builds, not just the zip and 7zip ones, which is highly problematic for the following reasons:

  • It is not uncommon for people using installers to place the install in an admin protected folder such as Program Files, so if someone tried to turn on this setting which such an install it wouldn't work, thankfully it would just error with permission errors but not lose any data.
  • The installer overwrites everything in the install folder when it runs, as it doesn't keep track of which files were installed by the previous installer run and makes the decent assumption that nobody would place anything else in that folder. Previously that wasn't a big deal as only a few users made the mistake of selecting the user data folder as the install location, so we could just tell them to not do that. However by adding this setting and allowing people to use it with the installer builds, we are adding support for people to lose their data when updating FreeTube and it will be our fault when the data is deleted and no it being in the experimental settings with a "use at your own risk" message is not enough, the setting has to hidden and inactive in installer builds.

I rarely do a blocking review on a pull request but this really should not be merged until that major issue is fixed, we should not be making losing your data when updating FreeTube thanks to a FreeTube setting a supported use case.

@PikachuEXE
Copy link
Collaborator Author

Ya also this doesn't work with portable version
I admit I have never thought about those 2 versions coz I have never used/tried them (as a user)
Marking as WIP

@PikachuEXE PikachuEXE added PR: WIP and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Jun 4, 2025
@PikachuEXE
Copy link
Collaborator Author

Updated for portable version and NSIS installer version, custom build updated

@PikachuEXE PikachuEXE added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: WIP labels Jun 5, 2025
@PikachuEXE PikachuEXE requested a review from absidue June 5, 2025 03:24
@absidue
Copy link
Member

absidue commented Jun 5, 2025

Not sure patching the installer is the right approach. I think if we add this, it should only be available in the portable version/zip files, as it doesn't make much sense to show and allow it with the installer version, as the installer is inherently not portable and the entire point of this is to make FreeTube more portable.

@PikachuEXE
Copy link
Collaborator Author

Updated installer version (by detecting the existence of uninstaller executable) to have new setting hidden and disabled (even with flag file created)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: waiting for review For PRs that are complete, tested, and ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants