I guess it would make sense to explain how this hack works... so for every request from Parsoid to MW API there is an extra GET parameter added: syncval. MediaWiki API in its entry point is looking for that parameter and checks if its value matches correctly - if it does then read permission is granted for given request.
Inez
On Tue, Jan 29, 2013 at 2:03 PM, Inez Korczyński inez@wikia-inc.com wrote:
Hi,
I have a dirty hack that should work for you (however I take no responsibility for any damage :)).
Changes to Parsoid:
- apply following diff with patch tool: http://pastebin.com/raw.php?i=rfaHyVRF (if it is not compatible with your Parsoid version then you can apply changes from it by hand)
- in js/api/localsettings.js just below line 'env.setInterwiki...' add another line: 'env.syncval = "<SECRETCODE>";'
Changes to MW:
- in api.php just above line '$processor = new ApiMain( $wgRequest, $wgEnableWriteAPI );' add this code:
if ( isset($_GET['syncval']) && $_GET['syncval'] === "<SECRETCODE>" ) { $wgGroupPermissions['*']['read'] = true; }
Make sure to replace <SECRETCODE> with some secure string/password - https://www.random.org/passwords/?num=1&len=24&format=html&rnd=n...
Inez
On Tue, Jan 29, 2013 at 1:08 AM, - - stadtpirat11@ymail.com wrote:
Hi Inez, hi Subbu
That's it! I didn't know about prefix as I could not find anything about that variable at http://www.mediawiki.org/wiki/Parsoid. Maybe you should add that to the page.
But that alone didn't help! The thing that made it work was "$wgGroupPermissions['*']['read'] = false;" I had it on FALSE and when I changed it to TRUE, everything worked! Splendid, thank you.
Will it be possible to use Parsoid in the future with the variable being FALSE?
Stadtpirat!
Message: 2 Date: Fri, 25 Jan 2013 11:39:49 -0800 From: Subramanya Sastry ssastry@wikimedia.org To: wikitext-l@lists.wikimedia.org Subject: Re: [Wikitext-l] No response to VisualEditor from Parsoid Message-ID: 5102DF85.7030002@wikimedia.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed
In addition to what Inez suggested, another place to check based on #mediawiki-parsoid discussion about this report. -Subbu.
... <RoanKattouw> Does he have $wgGroupPermissions['*']['read'] === false perhaps? <marktraceur> Hm, that might be it <RoanKattouw> Does he have a current version of MW? <marktraceur> RoanKattouw: The permissions thing is exactly right <marktraceur> RoanKattouw: I didn't ask about the version <RoanKattouw> The perms thing will do it ... <RoanKattouw> The API refuses to do pretty much everything if you're logged out and have denied anons read rights <RoanKattouw> Actually, I'm pretty sure the only modules available in that case are help and login :) ...
Hi,
In your localsettings.js (for Parsoid) you should have "parsoidConfig.setInterwiki( 'skwiki', 'http://skwiki'; );" instead of what you have now.
Also try setting $wgVisualEditorParsoidURL = 'http://skwiki:8000'; and $wgVisualEditorParsoidPrefix = 'skwiki' (make sure that nothing is overwritten in extensions/VisualEditor/VisualEditor.php).
Inez
On Fri, Jan 25, 2013 at 3:25 AM, - - stadtpirat11@ymail.com wrote:
Hi,
I just asked this in IRC, but in case I need to go before I get a reply, I will ask you here:
This really starts to bug me! I have no idea why Parsoid (and the VisualEditor) is not working! My wiki is working and the address is http://skwiki/w/Hauptseite ("Main_Page" is "Hauptseite" in German). I see the api page when I go to http://skwiki/api.php and I see the Parsoid page when I go to http://skwiki:8000. But I get errors when I click the VisualEditor link on http://skwiki/w/VisualEditor:Sandbox (no response).
- The wiki is located at /usr/local/var/www/mediawiki/.
- The webserver is configured to have the docroot for http://skwiki at /usr/local/var/www/mediawiki/
- It also internally rewrites "/w/(.+)" to "index.php?title=$1"
- /usr/local/var/www/mediawiki/extensions/Parsoid/js/api/localsettings.php is http://pastebin.com/BhB07BKY
- /usr/local/var/www/mediawiki/LocalSettings.php is http://pastebin.com/Y1wLnwiL
When I click the WYSIWYG-button at http://skwiki/w/VisualEditor:Sandbox, I get the following response in the web browser
{"error":{"code":"parsoidserver","info":"Error contacting the Parsoid server"}}
and node js throws an error:
/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.WikiConfig.js:25 var nkeys = Object.keys( names ); ^ TypeError: Object.keys called on non-object at Function.keys (native) at Object.WikiConfig (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.WikiConfig.js:25:21) at MWParserEnvironment.switchToConfig (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.parser.environment.js:215:21) at ApiRequest.processListeners.processSome (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.ApiRequest.js:53:4) at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I really would like to get this working!
Thanks,
Stadtpirat
---------- Forwarded message ---------- From: - - stadtpirat11@ymail.com To: "wikitext-l@lists.wikimedia.org" wikitext-l@lists.wikimedia.org Cc: Date: Fri, 25 Jan 2013 03:06:21 -0800 (PST) Subject: WG: No response to VisualEditor from Parsoid Hi,
I just asked this in IRC, but in case I need to go before I get a reply, I will ask you here:
This really starts to bug me! I have no idea why Parsoid (and the VisualEditor) is not working! My wiki is working and the address is http://skwiki/w/Hauptseite ("Main_Page" is "Hauptseite" in German). I see the api page when I go to http://skwiki/api.php and I see the Parsoid page when I go to http://skwiki:8000. But I get errors when I click the VisualEditor link on http://skwiki/w/VisualEditor:Sandbox (no response).
- The wiki is located at /usr/local/var/www/mediawiki/.
- The webserver is configured to have the docroot for http://skwiki at /usr/local/var/www/mediawiki/
- It also internally rewrites "/w/(.+)" to "index.php?title=$1"
- /usr/local/var/www/mediawiki/extensions/Parsoid/js/api/localsettings.php is http://pastebin.com/BhB07BKY
- /usr/local/var/www/mediawiki/LocalSettings.php is http://pastebin.com/Y1wLnwiL
When I click the WYSIWYG-button at http://skwiki/w/VisualEditor:Sandbox, I get the following response in the web browser
{"error":{"code":"parsoidserver","info":"Error contacting the Parsoid server"}}
and node js throws an error:
/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.WikiConfig.js:25 var nkeys = Object.keys( names ); ^ TypeError: Object.keys called on non-object at Function.keys (native) at Object.WikiConfig (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.WikiConfig.js:25:21) at MWParserEnvironment.switchToConfig (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.parser.environment.js:215:21) at ApiRequest.processListeners.processSome (/usr/local/var/www/mediawiki/extensions/Parsoid/js/lib/mediawiki.ApiRequest.js:53:4) at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I really would like to get this working!
Thanks,
Stadtpirat
Wikitext-l mailing list Wikitext-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitext-l