loathers / greenbox

Script for examining and sharing a player's loadout of skills and items in the Kingdom of Loathing
https://greenbox.loathers.net
Apache License 2.0
6 stars 7 forks source link

open greenbox.loathers.net within the relay browser #24

Open docrostov opened 1 year ago

docrostov commented 1 year ago

image

rinn had a dope ass idea to do this and i think it should be pretty easy but i am not figuring out how to do it right now, just posting it in issues

docrostov commented 1 year ago

https://github.com/Rinn/kolmafia-scripts/blob/release/RelaySnapshot/relay/relay_snapshot.ash

this is rinn's code to make cc_snapshot do it; very simple but i think we can do that supes easily

Rinn commented 1 year ago

Sample ash:

void main() {
    string output = cli_execute_output('call greenbox.js');
    matcher url_matcher = create_matcher('<a href="(.*?)">', output);
    string page = "";
    if (find(url_matcher)) {
        page += '<html>';
        page += '   <head>';
        page += '      <meta http-equiv = "refresh" content = "0; url = ' + url_matcher.group(1) + '" />';
        page += '   </head>';
        page += '   <body>';
        page += '      <p>Redirecting to Greenbox...</p>';
        page += '   </body>';
        page += '</html>';
    }
    write(page);
}