Embed Etherpad Lite pads into Discourse


(Bernhard Fürst) #1

I created a plugin to embed Etherpad Lite pads into Discourse posts using the Onebox mechanism. Would be glad if you give it a try:

Usage

After installation just insert Etherpad Lite links like Etherpad - Hosted by Rackspace into your Discourse posts or comments. The Etherpad will be embedded using the famous and beloved IFRAME tag and is fully operational.

Installation

Read Install a Plugin at meta.discourse.org.

The configuration line you have to add to your container’s app.yml file looks like:

- git clone https://github.com/fuerst/embed-etherpad-lite.git

Details

The plugin uses the “Brand new plugin interface” to change URL’s like http(s)://domain.tld/p/pad-id into HTML code like <iframe src='http(s)://domain.tld/p/pad-id'></iframe>.

That means it also changes your non-Etherpad URL’s which looks just like Etherpad Lite links. Please drop me a note if you got a better idea about how to avoid this.


Docu-centric Discourse: Docs, Spreadsheets, Math Editor, Charts, Forms?
Collude - a collaborative text editor for Discourse
(Michael Downey) #2

Interesting idea.

Do you have any screenshots of how this looks in practice? I’m not sure I fully understand the description?

As with other Oneboxes, does it take a one-time capture of the Etherpad document content and insert that as (static) content into the post? (i.e., if the pad changes or goes away, the onebox content stays?) Or is it more like the Google Doc UI, where it shows the actual “live” document?


(Bernhard Fürst) #3

It’s the “live” and editable document (pad). As I understand Onebox it not only capture a “moment” of a web page. For instance the lazyYT plugin is converting a Youtube link into a video player which you can use to watch the video. Even the Onebox readme is refering to that kind of application.

Here is how it looks like:


#4

This plugin is great, however I have a small issue : links from my etherpad instances are not detected as pads.

Inserting the example link works great (link on beta.etherpad.org), but my links are not replaced by the iframe…

My links have the following format :
https://sub.composed-domain.fr/p/xo0MvCGYhB

Going directly to the URL shows that the pad is working normally.

Could this be related to the “-” character in the domain name ? Would you have the regexp used to detect the link ?

Thank you for your work !
Nicolas


(Bernhard Fürst) #5

The regex checks for the path like /p/xo0MvCGYhB1 only. The part before doesn’t matter.

May be it is a cross-domain related issue?


#6

And does it blindly replaces this URL with an iFrame or does it checks if there is a running pad ?
Maybe it is the detection of my etherpad instance that does not work…

Also the discourse instance is on something.my-domain.tld and the etherpad instance is on somethingelse.my-domain.tld.
Could the fact that they are both subdomains of the same domain have any impact ?

Would you have any hint to check for cross domain issues ?

Edit : ah ! I have a 404 network call when inserting my link (from the preview screen I guess), on the following URL :
[mydiscourseURL]/onebox?url=[myEtherpadURL]&refresh=false&user_id=2
Strange… As it works for other links, and following the complete link that is in params works fine…

It looks like the onebox call is used to check if there is something behind the URL to replace the link with a onebox or not. So it would not detect my pad as a working pad… While going to the URL loads my pad exactly like these other platforms…

EDIT : ping @fuerst, would you have any insight ?


#7

Up ? @fuerst maybe ?


(Bernhard Fürst) #8

Insight to the Onebox behaviour? No, not exactly.


#9

Thank you for your answer Bernhard.
That is quite weird, but I actually just tried again, and it works now… So problem seems to be fixed !

The only config change I did to my server was providing the fullchain certificate for https instead of basic cert. No idea how this could have any impact…