-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
all: Add configurable defaults (fixes #4224, fixes #6086) #7131
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
Conversation
That's not directly affected by this PR: The GUI didn't set it at all, like many other fields, which results in zero values. Handling that for |
a161746
to
d92f8a8
Compare
I adjusted the folder/device edit modals and accompanying JS to handle editing defaults too. Basically hid items for which defaults don't make sense (ids, remove buttons, ...). They are accessible through the settings modal: Clicking on a button opens another modal to edit the settings, and dismissing that modal drops you back to the settings modal. This is ready for review. Only thing left is mirroring the changes in the "untrusted GUI code". |
I have been trying to test, but nothing happens when trying to click any of those buttons. I have compiled from https://github.com/imsodin/syncthing/tree/all/defaultConfig and also checked a few different browsers (Chromium, IE, Palemoon), but there is no difference. No reaction at all, and no JS errors either. |
Works fine for me on firefox and chromium (linux) - no idea what the problem could be. There's no new source file I have forgotten to check in, nor do I have a "gui" dir in my config (you probably don't either, as you're seeing the new buttons). To debug you could inspect the buttons using developer tools, they should have attributes like The gui changes are now also applied to the untrusted files, i.e. this is fully ready now. Except of course we need to find out why it doesn't work for @tomasz1986 😬 |
I have recompiled with the newest commits, and it is working now! I am not sure what the problem was about. However, I have tried to fiddle around with the actual settings and something seems to be wrong…
Also, just a side question, but I can see the current device's ID included under the |
Thanks a lot @tomasz1986 ! I removed
The local directory always is part of every folder, so to me it makes sense that it's also part of the default folder. All the gui and go code would add the local device anyway immediately if it was missing (i.e. there would have to be special code just to keep it out of the "default folder"). |
62c2d39
to
53c2613
Compare
I am not sure whether this is a complete version, but I have tested the current state anyway. Right now, the File Versioning and Advanced settings seem to be applied fine. The folder ID is again placed in the proper field. The Folder Label is still empty though. There is also this strange glitch.
|
Except for the glitches you find - it is :)
I cannot reproduce. Steps I took:
Result: The path in both the add folder dialog and the default folder config dialog is still Probably unrelated: |
It must be Regardless of the relative paths, I think that I have found the culprit though.
The label is basically added to the path. Is this how it should behave? If yes, then why do we need both the label and the path? I have also found another problem. When trying to add a folder, nothing is displayed under Sharing, even though I have multiple devices connected. |
I have tested the commit in its current state. The folder path and folder sharing issues are gone 👏. The only remaining problem that I can see at the moment is that default folder label does not seem to work at all. When trying to add a folder, the label is just empty, regardless of the default one. |
I have tested the newest iteration, and everything seems to work as intended 👍. I have just two questions/comments.
|
|
|
$scope.editingDefaults = false; | ||
return $http.get(urlbase + '/config/defaults/folder').then(function(p) { | ||
$scope.currentFolder = p.data; | ||
for (var k in $scope.versioningDefaults) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these not stored in the folder config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two parts: One was a bug in the current PR, the other is a conscious omission:
Bug: The default versioning type including params is stored in config.defaults.folder.versioning
, however wasn't applied when adding a new folder. That's now fixed, along with moving the gui-only parameters into currentFolder._guiVersioning
.
Omission: Versioning parameters are currently "free-form" (map[string]string
), which prevents using ext.default
in proto. The consistent thing to do would be creating proto types for all of these and adding a Config.Defaults.VersioningParams
with a new map-like struct (type -> params). That just feels like a lot of work for little gain (defaults for something that's off by default).
Do you think that it would be safe to use this commit as it is in production right now? I have been doing a lot of folder reorganisation and such recently, and their configuration is a bit of a struggle. Do you expect any major changes in the future commits that could break the current state (e.g. changes to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
Sorry for the noise, GitHub just didn't refresh the page... |
The set of configurable options in the default settings dialog is somewhat limited; should these new pseudo-device/folders perhaps show up in the advanced config editor as well? |
Utilize the newly introduced "folder default configuration" [1] feature to preset the ignorePerms option to true. This will not touch any existing folders, but set the option when configuring a new folder to be synced. Specifically on DSM, the ignorePerms option should definitely be used with every Syncthing folder. Otherwise, it will possibly try to override the UNIX permissions on synced files, which will reset the ACL-based permissions on the content. Possibly making them unusable for the rest of the DSM services. Note that this also only applies for new installations, because config.xml is (and must be) kept during updates. [1]: syncthing/syncthing#7131
Utilize the newly introduced "folder default configuration" [1] feature to preset the ignorePerms option to true. This will not touch any existing folders, but set the option when configuring a new folder to be synced. Specifically on DSM, the ignorePerms option should definitely be used with every Syncthing folder. Otherwise, it will possibly try to override the UNIX permissions on synced files, which will reset the ACL-based permissions on the content. Possibly making them unusable for the rest of the DSM services. Note that this also only applies for new installations, because config.xml is (and must be) kept during updates. [1]: syncthing/syncthing#7131
…t. (#4527) * syncthing: Incorporate upstream release v1.14.0. Only package version and hashes updated. Built successfully for all-supported. Note that the previous package version should have already self-updated an installed Syncthing binary when the service was running long enough. * syncthing: Ignore permissions by default for new shared folders. Utilize the newly introduced "folder default configuration" [1] feature to preset the ignorePerms option to true. This will not touch any existing folders, but set the option when configuring a new folder to be synced. Specifically on DSM, the ignorePerms option should definitely be used with every Syncthing folder. Otherwise, it will possibly try to override the UNIX permissions on synced files, which will reset the ACL-based permissions on the content. Possibly making them unusable for the rest of the DSM services. Note that this also only applies for new installations, because config.xml is (and must be) kept during updates. [1]: syncthing/syncthing#7131 * syncthing: Do not cache .stignore file patterns by default. Change the default for the cacheIgnoredFiles option to false. From the Syncthing documentation [1]: Whether to cache the results of ignore pattern evaluation. Performance at the price of memory. Defaults to false as the cost for evaluating ignores is usually not significant. The DiskStations are usually rather tight on RAM, so deviating from Syncthing's default here is probably a bad idea for most users. It only matters when many (or very complex) ignore patterns are used in a folder, so usually for power users. Those will certainly be able to change the option manually. Note that this also only applies for new installations, because config.xml is (and must be) kept during updates. [1]: https://docs.syncthing.net/users/config.html * syncthing: Remove / update obsolete default options. Drop the symlinksEnabled and weakHashSelectionMethod entries from the default config file template. See [1] and [2]. Switch from the minHomeDiskFreePct option to the new syntax minHomeDiskFree unit="%". Note that this also only applies for new installations, because config.xml is (and must be) kept during updates. Syncthing migrates old configuration formats on its own. [1]: syncthing/docs@392dbd0b [2]: syncthing/syncthing#4767 * syncthing: Add myself (@acolomb) as maintainer. * Syncthing: Drop busybox and DSM 5 support Required to prepare for DSM 7.0 support * Syncthing: fixes * Framework: log the actual command after service_prestart() * syncthing: Incorporate upstream release v1.15.1. Only package version and hashes updated. Built successfully for all-supported. Note that the previous package version should have already self-updated an installed Syncthing binary when the service was running long enough. Co-authored-by: Sebastian Schmidt <publicarray@users.noreply.github.com>
The PR is still WIP because of the to-dos below, but it is usable as it is right now.
The branch lives on top of #7127 (first three commits at the time of writing) - I would suggest looking at that first, however if you'd rather have one huge diff, it's available here :)
The defaults in proto are represented as normal
FolderConfiguration
/DeviceConfiguration
messages. I added a newext.nodefault
proto extension/tag to mark fields which are not configurable (like the id). Those are used to ensure that they are at their zero value when committing a config change. Using the same type allows using it directly as a template for new folders/devices and means there's no duplication.The defaults can be obtained and set through the rest api on
rest/config/defaults/folder
resp..../device
and that endpoint is used instead of the hardcoded values in the GUI (fixes #6068).Changed defaults
If the defaults in the GUI did not match those in the config, I chose the GUI ones as those are the ones that were really in effect:
Folder:
To-do
GUI to modify defaults. Plan is to reuse existing folder and device modals. (Required to really fix Editable default values for folders, devices #4224).
Port gui to untrusted.
optional:
Testing
I extended the test checking defaults and did some manual fiddling around with config and UI, which looked good (but was likely far from comprehensive).