michael-dev / dokuwikietherpadlite

Etherpad-Lite plugin for dokuwiki
13 stars 5 forks source link

JSON response could not be decoded #11

Open skupfer opened 9 years ago

skupfer commented 9 years ago

Ok. Installed the plugin through DokuWiki Manager. Configured it the following way:

Url of etherpad lite: http://localhost:9001/p/ APIKEY of etherpad lite: myAPI-Key Alias of etherpad lite group: etherpad (is this the user/group etherpad is running?) shared cookie-domain for etherpad lite: localhost or localhost:9001 or http://localhost or http://localhost:9001

I receive the following error when editing a page: JSON response could not be decoded

What is the code-tag to insert a pad?

michael-dev commented 9 years ago

There is no code-tag to insert a pad. The plugin hooks into the edit and locked pages. I'm not sure if the browser can share the cookies between http://localhost:80 and http://localhost:9001, but this is required the authenticate the browser when loading the etherpad iframe.

skupfer commented 9 years ago

Oh I see maybe I'm missing the apache config? Where to put these lines?

Sorry I'm just new to this and trying to setup everything and get into it before renting a server...

Any other idea to handle it on localhost?

EDIT: setup with mediawiki was easier :-( but somehow i prefer dokuwiki :D

michael-dev commented 9 years ago

Apache has mod_proxy or alike and putting etherpad lite behind a reverse proxy is the recommended way of operation anyway. Once etherpad lite is behind mod_proxy, you'll be able to access both dokuwiki and etherpadlite on the same port, and thus cookies will be shared between them, just as needed.

skupfer commented 9 years ago

I tried, but I cant get it to work...

<VirtualHost *:80>
  ServerName localhost

  LoadModule  proxy_module         /usr/lib/apache2/modules/mod_proxy.so
  LoadModule  proxy_http_module    /usr/lib/apache2/modules/mod_proxy_http.so
  LoadModule  headers_module       /usr/lib/apache2/modules/mod_headers.so
  LoadModule  deflate_module       /usr/lib/apache2/modules/mod_deflate.so
  LoadModule  rewrite_module       /usr/lib/apache2/modules/mod_rewrite.so

  RewriteEngine On
  RewriteRule ^/p$ /p/ [R]

  ProxyPass /p/ http://localhost:9001/
  ProxyPassReverse /p/ http://localhost:9001/
  ProxyPreserveHost on

  <Proxy http://localhost:9001/>
   Order allow,deny
   Allow from all
  </Proxy>

  ErrorLog /var/log/etherpad-lite/apache2/error.log
  LogLevel warn
  CustomLog /var/log/etherpad-lite/apache2/access.log combined
  ServerSignature Off

</VirtualHost>

I receive the following errors, but can access DokuWiki

Cannot GET /AdminPad

[Tue Jul 15 22:21:07 2014] [error] [client 127.0.0.1] File does not exist: /var/www/AdminPad

127.0.0.1 - - [15/Jul/2014:22:01:50 +0200] "GET /p/AdminPad HTTP/1.1" 404 323 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140610 Firefox/24.0 Iceweasel/24.6.0"

[Tue Jul 15 22:02:21 2014] [error] [client 127.0.0.1] File does not exist: /var/www/dokuwiki/0, referer: http://localhost/dokuwiki/doku.php?id=start

Whenever I use the following, I can access the pad via localhost/p/PadName but I cannot access Dokuwiki anymore

  ProxyPass / http://localhost:9001/
  ProxyPassReverse / http://localhost:9001/

EDIT: What is your configuration? It must be possible to do it on localhost. I mean, why not? Who wants to try new modules on a live configuration? God, tried so many configs now -.-

michael-dev commented 9 years ago

I'm running nginx with location /pad { rewrite /pad/(.*) /$1 break; proxy_pass http://localhost:9001/; proxy_redirect default;

be carefull, this line doesn't override any proxy_buffering on set in a conf.d/file.conf

            proxy_buffering off;
    }

and access the pad at https://host/pad/ (the last slash is important!). Maybe you need a location or directory directive in apache as well. On the other hand, your config looks like http://garrows.com/blog/running-node-js-and-apache-together-using-mod_proxy/ except for trailing slashes. So maybe they are important.

On the other hand, you could try to have the pad at 127.0.0.2:80 and assign (in /etc/hosts) pad.localhost to it, so cookies set for localhost will be transmitted when accessing pad.localhost as well (please check with firebug in firefox, maybe localhost is special).

skupfer commented 9 years ago

sigh... I have 4 upcoming exams starting tomorrow and I won't have time to try around at the moment. I'll do some further investigation later on. Maybe I ask in the etherpad IRC or apache IRC chan's later... Thanks for your help!

EDIT: If I'm able to find a solution I'll post it here

skupfer commented 9 years ago

Ok, I don't know why But I am now able to access etherpad via its URL and dokuwiki too. But now I am receiving the following errors

"You are not allowed to access this pad"

and this is what I got via a very fast screenshot when pressing "Save"

An error occurred
The error was reported with the following id: ID...

ErrorID: ID
URL http://localhost.etherpad/p/g.abcdefg...
UserAgent: Agent
Script error. in http://localhost.etherpad/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define at line 0
etherpad-lite log
[2014-07-21 22:21:41.339] [INFO] socket.io - handshake authorized 'u8pXNmvpaxrsFKNuTJx9'
[2014-07-21 22:21:41.346] [WARN] message - Authentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"g.dNlEicMiRPaKaJQm$fcf09f40fc607bd01b45589151deb570","sessionID":"null","password":null,"token":"t.1VS0t23P2g0OzBTisebh","protocolVersion":2}
[2014-07-21 22:21:41.372] [INFO] ueberDB - Flushed 2 values

requireSession & editOnly = false (not needed in a VM) and I want to run etherpad in both ways standalone and via dokuwiki plugin

ghost commented 9 years ago

Got the same error message "JSON response could not be decoded" when the users are not in the dokuwiki group set under plugin»etherpadlite»etherpadlite_group (Alias of etherpad lite group)

my working local test configuration (just running dokuwiki with an apache server accessible over http://127.0.0.1/dokuwiki/) looks like the following:

plugin»etherpadlite»etherpadlite_url: http://127.0.0.1:9001 plugin»etherpadlite»etherpadlite_apike: edd2b9..... plugin»etherpadlite»etherpadlite_group: mydokuwiki (that is the group of dokuwiki users allowed to use the pads) plugin»etherpadlite»etherpadlite_domain: 127.0.0.1

skupfer commented 9 years ago

Here the complete log of etherpad-lite when trying to access through dokuwiki I think there is a problem with the sessionID not being transmitted properly

[2014-07-23 23:18:48.088] [WARN] client - Script error. -- { errorId: 'xGPSZblDMASpNEtJRCNP',
  msg: 'Script error.',
  url: 'http://localhost.etherpad/p/g.rC5MAGHZg5qZwfVz$fcf09f40fc607bd01b45589151deb570',
  linenumber: 0,
  userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140610 Firefox/24.0 Iceweasel/24.6.0' }
[2014-07-23 23:18:48.147] [INFO] ueberDB - Flushed 1 values
[2014-07-23 23:18:48.603] [INFO] API - REQUEST, v1:createGroupIfNotExistsFor, {"groupMapper":"dokupad","apikey":"APIKEY"}
[2014-07-23 23:18:48.603] [INFO] API - RESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.rC5MAGHZg5qZwfVz"}}
[2014-07-23 23:18:48.649] [INFO] ueberDB - Flushed 1 values
[2014-07-23 23:18:48.680] [INFO] API - REQUEST, v1:createGroupIfNotExistsFor, {"groupMapper":"dokupad","apikey":"APIKEY"}
[2014-07-23 23:18:48.680] [INFO] API - RESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.rC5MAGHZg5qZwfVz"}}
[2014-07-23 23:18:48.749] [INFO] ueberDB - Flushed 1 values
[2014-07-23 23:18:49.512] [INFO] socket.io - transport end (close timeout)
[2014-07-23 23:18:49.610] [INFO] API - REQUEST, v1:createAuthorIfNotExistsFor, {"authorMapper":"admin","name":"kupfer","apikey":"APIKEY"}
[2014-07-23 23:18:49.610] [INFO] API - RESPONSE, createAuthorIfNotExistsFor, {"code":0,"message":"ok","data":{"authorID":"a.9EeS45kfuRAY7AW7"}}
[2014-07-23 23:18:49.613] [INFO] API - REQUEST, v1:createSession, {"groupID":"g.rC5MAGHZg5qZwfVz","authorID":"a.9EeS45kfuRAY7AW7","validUntil":"1406755129","apikey":"APIKEY"}
[2014-07-23 23:18:49.613] [INFO] API - RESPONSE, createSession, {"code":0,"message":"ok","data":{"sessionID":"s.ed46f63c6d96a6317d4fdbfe610783b6"}}
[2014-07-23 23:18:49.659] [INFO] ueberDB - Flushed 6 values
[2014-07-23 23:18:50.613] [INFO] API - REQUEST, v1:createGroupPad, {"groupID":"g.rC5MAGHZg5qZwfVz","padName":"fcf09f40fc607bd01b45589151deb570","text":"","apikey":"APIKEY"}
[2014-07-23 23:18:50.615] [INFO] API - RESPONSE, createGroupPad, {"code":1,"message":"padName does already exist","data":null}
[2014-07-23 23:18:50.617] [INFO] API - REQUEST, v1:isPasswordProtected, {"padID":"g.rC5MAGHZg5qZwfVz$fcf09f40fc607bd01b45589151deb570","apikey":"APIKEY"}
[2014-07-23 23:18:50.617] [INFO] API - RESPONSE, isPasswordProtected, {"code":0,"message":"ok","data":{"isPasswordProtected":false}}
[2014-07-23 23:18:50.678] [INFO] ueberDB - Flushed 3 values
[2014-07-23 23:18:50.779] [INFO] ueberDB - Flushed 1 values
[2014-07-23 23:18:50.879] [INFO] ueberDB - Flushed 1 values
[2014-07-23 23:18:50.890] [INFO] socket.io - handshake authorized 'PmpqXrzKmOexv11NqVyW'
[2014-07-23 23:18:50.897] [WARN] message - Authentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"g.rC5MAGHZg5qZwfVz$fcf09f40fc607bd01b45589151deb570","sessionID":"null","password":null,"token":"t.3w4mZ83CsprfjSrMQ8HU","protocolVersion":2}
[2014-07-23 23:18:50.979] [INFO] ueberDB - Flushed 1 values
michael-dev commented 9 years ago

If the sessionid is not transmitted propertly, it looks like the cookie domains are messed up.