Frederisk / Wikitext-VSCode-Extension

A Visual Studio Code Extension that provides language support for Wikitext.
MIT License
89 stars 14 forks source link

Private wiki support? #89

Open heaveaxy opened 7 months ago

heaveaxy commented 7 months ago

Hi, Is it possible to use extension with private wiki where "all" group doesn't have read right? LocalSettings.php contains $wgGroupPermission['*']['read'] = false; which cause an error "readapidenied" when trying to use extension. If change it to true extensions works properly.

Steps to reproduce:

  1. I create a bot inside my account on MW.
  2. In extension settings I wrote username and password got on previous step.
  3. Check and correct all other settings - host name, usr schema, api endpoint etc.
  4. Open new tab, write some wikitext.
  5. Trying to preview - error "readapidenied".

MW 1.40

In logs of webserver I see one query to api.php every time I run preview. As I know mediawiki requires several queries - one to get token, another one to authorize and finally useful query.

Frederisk commented 7 months ago

First try Ctrl+Shift+P and then choose Wikitext:Login. Then perform a preview. This should solve the problem.

heaveaxy commented 7 months ago

Yes, it solved the problem. Thanks! It will be good to have a note about it in "Usage" section of README.

heaveaxy commented 7 months ago

Still, there is a problem with authentication when you open arcticle using Wikitext-Extension-Gadget it shows same error even if authentication has prepared using Ctrl+Shift+P and Wikitext:Login. Some additional actions needed?

Frederisk commented 7 months ago

This part can be a little complicated. Because I originally designed these extensions mainly to provide support for some public wikis.

You need to delete or comment out the following three lines here:

// RemoteBot: ...
// TransferProtocol: ...
// SiteHost: ...

Then recompile it and add the compiled snippet to your preferences.

Frederisk commented 7 months ago

I might consider releasing a private wiki version later.🤔

threddast commented 5 months ago

Would it be possible to use this with the OpenIDConnect extension?

Frederisk commented 2 months ago

@heaveaxy @threddast Sorry to bother you, but I would be very grateful if you cloud help me test it.

Instead of doing what I'm saying here. Just change this line to:

RemoteBot: 'false',

Compile and add it to the user script and check if it works properly in a private wiki. If any problems occur, please let me know. Thanks.