feat: Labs interface backend#5071
Conversation
|
Thanks for the PR! To ensure we're solving the right problems, we require all PRs to be linked to an open issue. Please open one describing the problem this PR addresses so we can discuss the implementation there first. You have 4 days to link an issue before this PR is automatically closed, it can be reopened at any time after that. Looking forward to the discussion!
|
|
After thinking about this a little more, It would probably be better to have a separate "labs.json" or "global_settings" file that is stored in the root folder of the Anki collection. (not the profile folder) a bit like the graphics driver: Lines 525 to 527 in 07c2b03 There is an existing Any thoughts? |
What's your reasoning here? I don't feel this warrants a new storage mechanism. |
I was worried about issues where the experimental changes might be partially loaded, especially in regards to #4289 (comment). If the user loads the profile then there might be a situation where an un-sandboxed main window has API access. However it might be better to leave the pr in its current state until we can confirm that this is an actual problem. Maybe loading a profile will have the same effect as restarting when it comes to the window having API access. |
|
This is my suggestion based on our discussion if we want to handle it here:
👍 |
|
@Luc-Mcgrady regarding your comment on the other PR:
As a simple solution, we could keep a string list in get_config_json() and clean up any keys not listed. A more type-safe option is to add a Protobuf type similar to ConfigKey.Bool |
Is there anything wrong with the current get_config_json() {key: bool} setup? |
I was just thinking it'd be easier to remove/add flags safely in the future if all valid keys were declared in a single place. Declaring the keys in Protobuf is to guard against typos or cases where we remove a flag but accidentally leave a usage of it in some place. It's also useful if we plan to use experimental features in other clients such as AnkiMobile. |
Oh I get it now. I'll try and do that. (done dc62d74)
Do you think I should replace the current get_config_json() {key: bool} setup with this though? |
|
I think this is looking good. Some notes:
|
|
|
||
| conf = self.mw.col.conf | ||
| if conf._get_experiments_dirty() != conf._experiments: | ||
| restart_required = True |
There was a problem hiding this comment.
for the future, we must think of improving Anki so we won't need it anymore
|
regarding this:
Maybe for the future we should use |
closes #5073
Saves the values set in
Saves it to the currently open collections json config. I'm not sure if this approach might have problems with #4289 (comment). A situation where the main window has Anki API access while also displaying user supplied JavaScript would be terrible so we should be careful with this.
Test by enabling the "ping" labs option and then reload Anki or switch profile to the same profile.