Would it be possible to implement obfuscatedFeatures toggles? #1189
Replies: 1 comment 2 replies
-
The obfuscation seems pretty light to me; I'm really not sure why it's done at all. I mean, why not, I guess, but. Re: is it a good idea/within the project scope: I think the major risk of modifying Tumblr feature flags is that one no longer has full control of what their web extension actually does. If (making up an example) Staff deprecates some version of the UI but doesn't yet remove it from the frontend, and enabling some combination of flags results in that UI screwing up post content, that's not a great situation. Obviously that's quite unlikely and the modifications XKit Rewritten does in the usual web extension way have the potential to screw things up too, but there is definitely a level of predictability and checking-for-the-unexpected that one can do when writing declarative code that doesn't apply to flipping a flag. I do think that, as compared to user scripts or more niche web extensions that more technical users can seek out, XKit is expected to cater to a wide audience and put a lot of effort into not breaking anything (although, I mean. I say that, but legacy XKit currently horribly breaks a bunch of the site and we don't put much effort into preventing that, so maybe it's not really about the XKit brand). Similarly, the code underlying those currently-unused flag options will of course go away at some point, and there's something to be said against putting in features with an expiration date. But, then, all XKit features have an expiration date in the grand scheme of things, whether that's from changes to the site or, you know, the heat death of the universe, and the point of this whole thing is to serve users' desires; if a flag-based feature would serve a lot of users' strong desires for a while, why not? tl;dr: I see upsides and downsides to this, if it's possible. Re: how one would actually do it: The major problem I can see with using the edit: oh—in an MV3 extension, you can dynamically register/unregister content scripts, which would definitely be one solution. Your flag changes would only occur after a page refresh, so you couldn't do XKit Rewritten's "all preference toggles apply immediately" thing. But I would love to see someone make that web extension, just since it sounds like a neat solution to a fun code problem. |
Beta Was this translation helpful? Give feedback.
-
window.___INITIAL_STATE___.obfuscatedFeatures
is a property set by Tumblr that contains a base64-encoded object with a list of enabled "hidden settings" likely not meant to be accessed by users. If these settings are set fromtrue
tofalse
between when the property is initialized and when its value is read, such as via changing the property to a getter that redirects to a proxy variable, you can effectively toggle these hidden settings.Among these hidden settings are keys such as

redpopDesktopVerticalNav
,activityRedesignM3
,messagingRedesign
experimentalBlockEditorIsOnlyEditor
. Modifying these settings is by far, the simplest way to revert cosmetic changes to site, and would allow resolving a whole slew of issues including but not limited to #972, #1149, #1151, and #1155. The list of cosmetic changes in these settings goes far enough back that you can make your dashboard look like this, if you really wanted to for whatever reason.Of course, there are difficulties with implementing toggles for these settings. I've ironed out a lot of kinks in my own experiments with it, but essentially the method for adding the getter differs based on how fast the page is loading. It has to be added before the property is accessed by the page regardless, but if
window.___INITIAL_STATE___
has not yet been set, such as when opening Tumblr in a new tab, It's necessary to add a setter as well so that when Tumblr defines it the value can be sent to the proxy variable. There are no doubt improvements that can be made to my method, but it's still a finicky property to work with.It's a minor drawback, but changing these settings obviously requires a reload to take effect.
I guess what I'm asking is if there is an efficient way to implement
obfuscatedFeatures
toggles that fits within the scope of the project. I couldn't find anything in the repo mentioningwindow.___INITIAL_STATE___
so I assumed it either hadn't been considered as a utility, or wasn't being used for a specific reason. There is likely a reason why Tumblr obfuscates these settings, but at the same time modifying at least the cosmetic ones doesn't seem to have any adverse effect.Beta Was this translation helpful? Give feedback.
All reactions