Skip to content

Instantly share code, notes, and snippets.

@twilight-sparkle-irl
Last active February 5, 2023 05:46
Show Gist options
  • Save twilight-sparkle-irl/4dcdc1f3bde007a0237378334665a675 to your computer and use it in GitHub Desktop.
Save twilight-sparkle-irl/4dcdc1f3bde007a0237378334665a675 to your computer and use it in GitHub Desktop.
unlock polls on tumblr (click the Raw button with Tampermonkey installed!)
// ==UserScript==
// @name Poll Unlocker
// @version 0.1
// @description gives u polls
// @author Twilight Sparkle
// @license MIT
// @match https://www.tumblr.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tumblr.com
// @grant none
// @run-at document-start
// ==/UserScript==
// override tumblr intiial config
Object.defineProperty(window, '___INITIAL_STATE___', {
set(x) {
let state = x; // copy state
try {
let obf = JSON.parse(atob(state.obfuscatedFeatures)); // convert from base64, parse from string
obf.crowdsignalPollsNpf = true; // polls (new post format)
obf.crowdsignalPollsCreate = true; // poll creation
obf.allowAddingPollsToReblogs = true; // this one seems clear
state.obfuscatedFeatures = btoa(JSON.stringify(obf)); // compress back to string, convert to base64
} catch (e) {
console.error("failed to mod obfuscatedFeatures!!! trying to fail gracefully", e)
} finally {
window['I_LOVE_JS'] = state; // save to proxy variable
}
},
get() {
return window['I_LOVE_JS']; // return proxy variable
},
enumerable: true,
configurable: true
})
@nightpool
Copy link

nightpool commented Jan 22, 2023

encode and decode are just base64, you can use the atob and btoa built-in functions to replace them.

@twilight-sparkle-irl
Copy link
Author

twilight-sparkle-irl commented Jan 22, 2023

@nightpool i had some inkling that that might be the case but didn't think to check and then forgot. wagh. thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment