Skip to content

Add import/export settings buttons#9123

Open
Shadorc wants to merge 19 commits into
FreeTubeApp:developmentfrom
Shadorc:feat/export-settings
Open

Add import/export settings buttons#9123
Shadorc wants to merge 19 commits into
FreeTubeApp:developmentfrom
Shadorc:feat/export-settings

Conversation

@Shadorc

@Shadorc Shadorc commented May 10, 2026

Copy link
Copy Markdown
Contributor

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

#1018 (comment)
#7345

Description

This pull request adds support for importing and exporting FreeTube settings.

Some settings are not exportable, they are represented by the settingsNotTransferrable set inside settings.js. They are OS/user-specific settings, experimental settings, and settings that depend on process.env.

I'm not entirely satisfied with having to duplicate setting keys, but the other solution that I thought of was to replace the state object values with a more complex structure, having additional fields like isExportable. However, in my opinion, it would have required too much refactoring.

Screenshots

image image image

Testing

Basic test

  1. Change some settings (a and b)
  2. Export settings
  3. Change some other settings (c and d)
  4. Import settings
  5. Check that a and b have the same values as step 2 and that changes made on c & d in steps 3 have been reverted

Non-exportable setting test

  1. Changes value of proxy settings
  2. Export settings
  3. Revert change made on step 1
  4. Import settings
  5. Check that proxy settings are the same as step 3

UI test

  1. Minimize the window to make it similar in size to a phone
  2. Go to Settings > Data
  3. Check that the title, tooltip button and import/export buttons are correctly displayed
  4. Check that the tooltip bubble is not hidden by anything

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 10, 2026 15:56
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 10, 2026
@absidue

absidue commented May 10, 2026

Copy link
Copy Markdown
Member

absidue was warning that it could be an issue with some settings, but I didn't experience problems with the mentioned settings.

You won't see a warning, it will purposefully silently drop them because they are not meant to be writeable by the window and you won't see any issues in the same window because in the same window you are showing the stuff in-memory in that window but it won't be saved to disk, synced to other windows or actually get used.

While I don't want to discourage new contributors, could I please ask that you put a bit more thought into your pull requests or at the very least put more effort into testing them, as this is the second one that you have submitted that doesn't actually work in practice.

@absidue absidue added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels May 10, 2026
@Shadorc

Shadorc commented May 10, 2026

Copy link
Copy Markdown
Contributor Author

You're right, I'm sorry. I'm a bit too eager to contribute. I did test my changes, but I saw your warning about the folder fields a bit late, and I only tested the settings value after import rather than actually testing whether the folders were correct.
I'll put this MR as draft and see if I can fix it and test it properly. I'll either close it if I can't fix it properly or mark it as ready otherwise.
Sorry for wasting your time, I know that's not cool!

@Shadorc Shadorc marked this pull request as draft May 10, 2026 18:09
auto-merge was automatically disabled May 10, 2026 18:09

Pull request was converted to draft

@Shadorc

Shadorc commented May 10, 2026

Copy link
Copy Markdown
Contributor Author

Maybe folder paths should not be allowed to be imported, does it really make sense? It is user and OS dependent, in most case the imported path would be invalid.
It could be an exception, with a little help icon indicating which settings (corresponding to paths) would not be part of the export / import process
What do you think?

@PikachuEXE

Copy link
Copy Markdown
Member

What probably should not be transferred:

@Shadorc

Shadorc commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

I checked all the settings, I think that settings impacted by env like process.env.SUPPORTS_LOCAL_API and process.env.IS_ELECTRON should also be ignored. A custom logic for those settings could be implemented during import, but it's probably safer to not export them and it only concern one settings currently (if we consider that screenshotAskPath would be not exported anyway because it is a path).

Concerning passwords, they are not encrypted, so exporting them as plain text would not be an issue. As for whether this is relevant, I’d tend to say yes, but it could be changed if needed.

There are also settings that need the app to be restarted. I've made the implementation similar to the list of non-exportable settings for the declaration, and when they are imported, the user is prompted to restart the app or to revert the settings that needed a restart. It works but I will see if I find something more "elegant"

@Shadorc Shadorc marked this pull request as ready for review May 15, 2026 21:51
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 15, 2026
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 15, 2026 21:52
@Shadorc

Shadorc commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

I'm now satisfied with the state of this MR!
I have updated my initial MR description accordingly.
I have also written and tested all the test cases that I could think of, they all pass.

auto-merge was automatically disabled May 15, 2026 21:54

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 15, 2026 21:54
auto-merge was automatically disabled May 15, 2026 22:01

Head branch was pushed to by a user without write access

auto-merge was automatically disabled May 18, 2026 11:49

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 18, 2026 11:49
auto-merge was automatically disabled May 18, 2026 14:38

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 18, 2026 14:38
@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc removed the PR: waiting for review For PRs that are complete, tested, and ready for review label May 18, 2026
@Shadorc Shadorc marked this pull request as draft May 18, 2026 16:14
auto-merge was automatically disabled May 18, 2026 16:14

Pull request was converted to draft

@Shadorc Shadorc marked this pull request as ready for review May 18, 2026 21:18
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 18, 2026 21:18
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 18, 2026
@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc removed the PR: waiting for review For PRs that are complete, tested, and ready for review label May 19, 2026
auto-merge was automatically disabled May 19, 2026 18:09

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 19, 2026 18:09
auto-merge was automatically disabled May 19, 2026 19:09

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 19, 2026 19:09
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@PikachuEXE PikachuEXE added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: stale PR: changes requested labels Jun 3, 2026
'screenshotAskPath',
'screenshotFolderPath',

/* Depends on process.env.SUPPORTS_LOCAL_API */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll let others chime in but I think we could keep the SUPPORTS_LOCAL_API settings transferable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are many references to these values and quite easy for the code to miss SUPPORTS_LOCAL_API check before using them
Better be safe first

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.

5 participants