Advertisement
usamimi2323

JDownloader2 EventScript - self-modifying test code

Nov 11th, 2023
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.96 KB | Source Code | 0 0
  1. //
  2. // JDownloader2 EventScript - self-modifying test code
  3. //
  4.  
  5. const SCRIPT_ID='A6D9CB280A41BF7F47E8ACC76434394F';
  6. var f=false;
  7.  
  8.  
  9. var scripts = getScripts();
  10. scripts.some(function(s, idx) {
  11.     try {
  12.         if (s.script.indexOf("SCRIPT_ID='"+SCRIPT_ID) != -1) {
  13.             scripts[idx].script = s.script.replace(/\sf=false;/, ' f=true; // OK!!');
  14.             return true;
  15.         }
  16.     } catch (e) {};
  17. })
  18.  
  19. setScripts(scripts);
  20.  
  21. // by mgpai
  22. function getScripts() {
  23.     return callAPI(
  24.         "config", "get",
  25.         "org.jdownloader.extensions.eventscripter.EventScripterConfig",
  26.         "cfg/org.jdownloader.extensions.eventscripter.EventScripterExtension",
  27.         "Scripts"
  28.     );
  29. }
  30.  
  31. function setScripts(scripts) {
  32.     callAPI(
  33.         "config", "set",
  34.         "org.jdownloader.extensions.eventscripter.EventScripterConfig",
  35.         "cfg/org.jdownloader.extensions.eventscripter.EventScripterExtension",
  36.         "Scripts", scripts
  37.     );
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement