williamd1k0 / gdscript-playground

GDScript Playground Web App
https://gd.tumeo.space
Other
42 stars 10 forks source link

Allow passing script code in URL encoding to make it possible to integrate with Zulip #28

Open unfa opened 3 weeks ago

unfa commented 3 weeks ago

Hi!

Zulip is a self-hostable open-source team collaborative communication tool. It has a feature called code playgrounds.

For example, to configure a code playground for code blocks tagged as Rust, you can set:

Language: Rust Name: Rust playground URL template: https://play.rust-lang.org/?code={code} For more examples and technical details, see the help center documentation on adding code playgrounds.

Unfortunately Zulip doesn't support base64 encoding, and can't embed custom metadata that might be present there.

If this playground would allow passing the script code in uri-encoded format. Godot has tools to encode/decode text this way. Allowing to pass raw code text and have it placed inside the ready function of a Node would mean a user can do

    for i in range(0,10):
        print("this is the number %d" % [i])

Open it in the playground , and be able to hit Ctrl+Enter to evaluate their code immediatelly.

williamd1k0 commented 3 weeks ago

In the current implementation, you can already omit the extends Node and the _ready() method, so I guess the only thing I need to do is add support for script in uri-encoded format.

williamd1k0 commented 2 weeks ago

I have just deployed a new version with support for URI encoded code.

I don't have access to this Zulip platform, could you please test and confirm that everything works as intended? @unfa