Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding etherpad-lite without cookies? #4447

Open
sumpfralle opened this issue Oct 29, 2020 · 19 comments
Open

Embedding etherpad-lite without cookies? #4447

sumpfralle opened this issue Oct 29, 2020 · 19 comments

Comments

@sumpfralle
Copy link


name: Feature request
about: Suggest an idea for this project
title: Embedding etherpad-lite without cookies?
labels: enhancement
assignees:


Is your feature request related to a problem? Please describe.

I am using etherpad-lite as an integration widget in Matrix/element. Thus etherpad-lite (provided by some external service provider, e.g. pad.disroot.org) is embedded via iframe into the website.

Sadly this fails to work, if the browser is configured to block 3rd party cookies.

Privacy oriented browsers (Tor browser, Brave) block 3rd party cookies by default.

Since March 2020 even Safari blocks 3rd party cookies by default. The announcement also contains some hints, how services can handle this change.

Thus it will probably become harder and harder to embed etherpad-lite into external websites. This would be a pity.

Describe the solution you'd like

I can image the following ways to work around the 3rd party cookie blocking:

  • A) use the Storage Access API instead
  • B) gracefully ignore cookie rejections (not storing a session)

But I have little knowledge in this field. Thus feel free to ignore my suggestions.

@JohnMcLear
Copy link
Member

I swear this is a duplicate. I'm sure I addressed this a bunch of times before and the conclusion is for a good experience you should use reverse proxy of same domain.. did you look through previous issues before creating a new one?

@JohnMcLear
Copy link
Member

#4157 some details here..

@JohnMcLear
Copy link
Member

https://github.com/ether/etherpad-lite/issues?q=is%3Aissue+is%3Aclosed+embed is general history of this issue..

@ptandler
Copy link

even if this might be a duplicate: I just experienced a lot of issues when trying to embed etherpad cross-domain ... so I +1 for this.

Without reading the referenced issues yet some thoughts: in fact you only need the cookies for reload or when navigating. If you could avoid app internal need for navigation (as currently to the pad history page, not sure is somewhere else) and also do this as single page app, then it might not be a (big) issue if no cookies can be stored.

@stale
Copy link

stale bot commented Jan 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Wont Fix these things, no hate. label Jan 11, 2021
@webzwo0i webzwo0i removed the wontfix Wont Fix these things, no hate. label Jan 11, 2021
@webzwo0i
Copy link
Member

I would also love this feature

@stale
Copy link

stale bot commented Mar 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Wont Fix these things, no hate. label Mar 14, 2021
@ptandler
Copy link

To prevent it from closing: This is still something that I regard as very useful

@stale stale bot removed the wontfix Wont Fix these things, no hate. label Mar 18, 2021
@stale
Copy link

stale bot commented May 18, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Wont Fix these things, no hate. label May 18, 2021
@stale stale bot closed this as completed May 28, 2021
@ptandler
Copy link

hm, reopen again ...?

@rhansen rhansen reopened this Sep 23, 2021
@stale stale bot removed the wontfix Wont Fix these things, no hate. label Sep 23, 2021
@luukschipperheyn
Copy link

luukschipperheyn commented Mar 14, 2022

I encountered the same problem. An etherpad in an iframe on safari would fail to load because of an unhandled promise rejection:

TypeError: null is not an object (evaluating 'this.readPrefs_()[e]') -- {
  errorId: 'zztHuOF6QUx2ckIIep3v',
  type: 'Unhandled Promise rejection',
  msg: "TypeError: null is not an object (evaluating 'this.readPrefs_()[e]')",
  url: 'https://redacted/p/testpad',
  source: 'unknown',
  linenumber: -1,
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15',
  stack: 'getPref@https://[redacted]/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define&v=64b43bca:13:756\n' +
    '@https://[redacted]/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define&v=64b43bca:1:6216\n' +
    'promiseReactionJob@[native code]'
}

I don't have time atm to make a proper pull request but here's how I fixed it.
in src/static/js/pad_cookie.js I changed getPref and setPref to handle cases where readPrefs would return null:

  getPref(prefName) {
    console.log('getPref', prefName);
    const prefs = this.readPrefs_()
    return prefs ? prefs[prefName] : null;
  }

  setPref(prefName, value) {
    const prefs = this.readPrefs_();
    if(!prefs) {return}
    prefs[prefName] = value;
    this.writePrefs_(prefs);
  }

squiddle pushed a commit to ZUMTeam/etherpad-lite that referenced this issue Aug 19, 2022
@kfogel
Copy link

kfogel commented Nov 21, 2022

Is commit ada245affa118 in the ZUMTeam fork of Etherpad Lite a reasonable improvement? I.e., does it at least get Etherpad to the point where if someone who has configured their browser to disallow sites from setting cookies just wants to view a public Etherpad document, they could do so without error?

Right now, they would get an error like this:

An error occurred

Please press and hold Ctrl and press F5 to reload this page

If the problem persists, please send this error message to your webmaster:
TypeError: this.readPrefs_() is null
at https://pad.example.com/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define&v=243ef3a8 at line 13
ErrorId: IpumQRweOwBH22fKEEjU
Unhandled Promise rejection
URL: https://pad.example.com/p/some-pad
UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0

We haven't tested that patch ourselves yet, but we might (CC @smpsnr). I'm not competent to review it, but if it at least allows the above then it might make sense to try to get it -- or something like it -- into stock Etherpad Lite.

@lislis
Copy link

lislis commented Jan 23, 2024

Second what @kfogel says, it would be nice if people could just look at the pad without getting bombarded by messages
Screenshot 2024-01-23 at 18 49 54

@paubou
Copy link

paubou commented Oct 23, 2024

facing the same issue here using Safari 18.0 on a Macintosh. The embeds are not working.

@SamTV12345
Copy link
Member

facing the same issue here using Safari 18.0 on a Macintosh. The embeds are not working.

May I know what you are trying to do :) ? Etherpad needs cookies to remember which author is which.

@paubou
Copy link

paubou commented Oct 23, 2024

Hey Sam, thanks for you reply, sorry for the vague follow up earlier.
I’m trying to embed a pad and i’m facing the same messages as @lislis.
A simple embed from framapad using an iframe. Working fine with Chromium & Firefox browsers, but safari (mobile and desktop) returns this error.

An error occurred

Please press and hold Ctrl and press F5 to reload this page
If the problem persists, please send this error message to your webmaster:
TypeError: null is not an object (evaluating 'this.readPrefs_()[e]')
at unknown at line -1
ErrorId: tOzVY7SUpAogNPsR8StW
Unhandled Promise rejection
URL: https://annuel2.framapad.org/p/framaurl?showControls=false&showChat=false&showLineNumbers=true&useMonospaceFont=true
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15

@SamTV12345
Copy link
Member

@paubou Could you please send me the html for embedding the pad? I'll try it out locally and check if I find a solution to this. Did it work on Safari 17?

@paubou
Copy link

paubou commented Oct 23, 2024

Didn’t had a chance to check with safari 17; it’s my first time using an embeded etherpad.

<iframe name="embed_readwrite" src="https://mensuel.framapad.org/p/vxdw8qajs5-aaqb?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width="100%" height="600" frameborder="0"></iframe>

Here is a simple embed generated from framapad.
Thanks Sam.

@kfogel
Copy link

kfogel commented Oct 29, 2024

Joining the thanks from @paubou -- glad to see you're having a chance to look at this, @SamTV12345.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants