ether / ep_file_menu_toolbar

File Menu Toolbar plugin for Etherpad
Other
4 stars 8 forks source link

New Page won't open / get created because the subfolder path is missing! #17

Closed lisandi closed 3 years ago

lisandi commented 3 years ago

When clicking on "New Page" the complete subpath for the new page is missing when the installation proxied to a subfolder.

https://my.domain/pad/

Screen Shot 2021-09-25 at 23 41 32

when clicking "New Page" it opens up

Screen Shot 2021-09-25 at 23 41 16

https://my.domain/p/1234567 instead correct would be https://my.domain/pad/p/1234567

Even better (in General would be) being able to strip away that "p" when the installation is a proxied subfolder installation. as in that case "pad" already fulfills the function of a unique path segment and "admin" could be excluded (being a name already taken and therefore can't be chosen a second time)

https://my.domain/pad/1234567 would be the result.

JohnMcLear commented 3 years ago

Please see https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy

JohnMcLear commented 3 years ago

apologies for closing. do docs help? if not will need to modify uri generation logic

lisandi commented 3 years ago

You can easily replace the /p/ with a ./ and it will take the current directory which is always the same no matter if located in a sub path or in a root path.

in ep_aa_file_menu_toolbar/static/js/index.js Line 13

change

  $('#newPad').attr('href', `/p/${randomPadName()}`);

to

    $('#newPad').attr('href', `./${randomPadName()}`);

problem solved! as a reference for writing code in node.js - docs did not help at all as they pointed actually in the wrong direction. https://flaviocopes.com/node-get-current-folder/

JohnMcLear commented 3 years ago

do you want to send a pull request with this change please?

JohnMcLear commented 3 years ago

btw nodejs docs wont help because afaik this code is running on the client