This little function will fetch and eval gists from github given your username and the hash

PHOTO EMBED

Mon Dec 05 2022 04:13:20 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

var GithubGist = user => async (hash, evalResult = true) => {
  const now = new Date();
  const uri = `https://gist.githubusercontent.com/${user}/${hash}/raw?v=${now}`;
  const client = new HttpClient();
  const response  = await  client.GetStringAsync(uri);
  const source = response.Result;

  if (evalResult) { eval(source) } else { return `${source}` }
}

//
// https://gist.github.com/kevinkhill/d88cfad2e9b8578ba046cfcf6f803f47
//
(async () => {
  const gist = GithubGist("kevinkhill");
  
  try {    
    const script = await gist("d88cfad2e9b8578ba046cfcf6f803f47", false);
    
    sp.MessageBox(script, "Remote Script Source");
    sp.MessageBox(
      "This is just a POC, so if you want to eval a remote script...\n"+
      "...THIS IS DANGEROUS BTW...\nRemove `false` from the method call :)",
      "THAR MIGHT BE DRAGONS!"
    );
  } catch (err) {
    sp.MessageBox(`${err}`, "Oops!");
  }
})();
content_copyCOPY

Hi everyone, just wanted to share something I made this morning for fun. BE CAREFUL! eval-ing a remote source is dangerous, so use at your own peril. I wanted it for my own purposes, but maybe someone else here thinks is useful or neat too.

https://forum.strokesplus.net/posts/t8343-Remote-Scripts