Advertisement
Guest User

Untitled

a guest
May 9th, 2019
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Songsterr premium hack
  3. // @version 1.4
  4. // @description Patch redux state to get Songsterr premium features for free
  5. // @include *songsterr.com*
  6. // @include songsterr.com*
  7. // @include *songsterr.com
  8. // @include songsterr.com
  9. // @include www.songsterr.com*
  10. // @include http://songsterr.com/*
  11. // @include http://*.songsterr.com/*
  12. // ==/UserScript==
  13.  
  14. // New (React.JS based) songsterr
  15. function f6cf___INITIAL_STATE___applyPatch() {
  16.  
  17. setInterval(() => {
  18. // New patch \( ゚ヮ゚)/
  19. Object.keys(window)
  20. .filter(k => /^_+[a-z0-9]+_+$/i.test(k))
  21. .forEach(
  22. k =>
  23. window[k] &&
  24. window[k].user &&
  25. window[k].user.hasPlus === false &&
  26. (window[k].user.hasPlus = true)
  27. );
  28. }, 1000);
  29.  
  30. // Hook appendChild, to override added script (plus_features with demo_features)
  31. const _appendChild = Element.prototype.appendChild;
  32. let foundRootChunk = null;
  33. /// UNHARDCODE
  34. let demoChunkUrl = 'https://www.songsterr.com/static/js/demo-player-actions.9aebd905.js';
  35. let plusChunkId = 8;
  36. let demoEntry = 373;
  37. let plusEntry = 372;
  38. /// UNHARDCODE
  39. let plusChunkCode = null;
  40.  
  41. setInterval(async () => {
  42. if (!foundRootChunk) {
  43. foundRootChunk = [...document.getElementsByTagName('script')].filter(s => s.src.includes('/static/js/main')).map(s => s.src)[0];
  44. if (foundRootChunk) {
  45. console.log('Extracting action chunk ids');
  46. fetch(foundRootChunk).then(e => e.text()).then(e => {
  47. // TODO: Extract currently hardcoded constants from e
  48. fetch(demoChunkUrl).then(e => e.text()).then(e => {
  49. console.log(e);
  50. e = e.replace(/webpackJsonp\|\|\[\]\).push\(\[\[([0-9]+)\]/, `webpackJsonp||[]).push([[${plusChunkId}]`);
  51. e = e.replace(/demo/g, 'plus');
  52. e = e.replace(demoEntry, plusEntry);
  53. plusChunkCode = e;
  54. console.log(e);
  55. });
  56. });
  57. }
  58. }
  59. }, 2000);
  60. Element.prototype.appendChild = function (...a) {
  61.  
  62. if (a.length === 1) {
  63. let scriptNode = a[0];
  64. if (scriptNode.nodeName.toLowerCase() === 'script') {
  65. let src = scriptNode.src;
  66. console.log(`Loading script ${src}`);
  67. if (src.includes('plus-player-actions')) {
  68. console.log('PLUS ACTIONS LOADING! ALARM!!!');
  69. //const scriptCode = await fetch(src)
  70. // Simulate loading timeout
  71. if (plusChunkCode) {
  72. scriptNode.src = `data:application/javascript;charset=UTF-8,${encodeURIComponent(plusChunkCode)}`
  73. }
  74. }
  75. }
  76. }
  77. return _appendChild.call( ͡° ͜ʖ ͡°)_/¯;
  78. };
  79. }
  80. let patcher = document.createElement("script");
  81. patcher.innerHTML =
  82. f6cf___INITIAL_STATE___applyPatch + ";f6cf___INITIAL_STATE___applyPatch()";
  83. (document.head || document.documentElement).appendChild(patcher);
  84. // ==UserScript==
  85. // @name New Userscript
  86. // @namespace http://tampermonkey.net/
  87. // @version 0.1
  88. // @description try to take over the world!
  89. // @author You
  90. // @match https://github.com/CertainLach/SongAPI/blob/master/SongsterrPremium/release/extension.crx
  91. // @grant none
  92. // ==/UserScript==
  93.  
  94. (function() {
  95. 'use strict';
  96.  
  97. // Your code here...
  98. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement