pfraze/phoenix — pull request #95 by pfraze (2014-10-17 02:32:27+00:00)
Title: 'gui' posts

Ok, this may not be a good idea in the long run, but I wanted to try it out and see what it's like

https://github.com/pfraze/phoenix/issues/82#issuecomment-59126565

> ` anyway, I'm wondering if we could get some fun early on out of hackability`
` like, what if you could publish a module, then a "reply" would import that module and run commands with it`
` you publish "exports.renderString", I reply with "parent.renderString('Hey this is fun!')" and then people that receive my reply see 'Hey this is fun!' get rendered on the canvas`
` hmm, that is interesting`
` so people could create small games etc`
` yeah exactly`
` we could do a code golf version where you have to use < 1k of code because that is all you are allowed in a message, until we have attachments`

So basically I added a "gui" message type which runs posted HTML in a CSPed + sandboxed iframe. Users can run/stop the GUI (you have to click 'run' first). Here's what it looks like:

![screenshot from 2014-10-16 19 31 57](https://cloud.githubusercontent.com/assets/1270099/4673585/4444088e-55a5-11e4-93ed-3a5dde8b21f3.png)
![screenshot from 2014-10-16 21 20 48](https://cloud.githubusercontent.com/assets/1270099/4673586/444526ba-55a5-11e4-80b0-7651335da562.png)

The next thing to do would be "code replies." I think the way they'd work is that, they'd also be toggled on/off, and each time you start one, its code is appended to the original post's code, and the iframe is restarted (so just a straight injection).

Then, we'd need to get a way to flag posts that are doing something ugly (like DoSing or spawning a million alerts).

This probably wouldn't go into v1 - it'd be v2. I just wanted to get the ball rolling on the idea and see what you guys think.