tosher / Mediawiker

A plugin for Sublime Text editor that adds possibility to use it as Wiki Editor on MediaWiki-based sites like Wikipedia and many other.
Other
137 stars 27 forks source link

Cannot connect to wikis using UCP (Unified Community Platform) #162

Open moose-again opened 4 years ago

moose-again commented 4 years ago

Hello, sorry to bother you again. FANDOM is doing this new Unified Community Platform thingy that runs running MediaWiki 1.33, and after March 11th, 2020, they are forcing all new wikis to use it. Mediawiker can't seem to connect to a wiki that is using it.

I observed more, it seems that when I leave username and password empty and connect as anonymous, it works just fine,

but when I try to login to any account account, my output is:

Connecting to "https://wreckit-woodhouse.fandom.com" ..  done.
Login in with authorization type login..   >>>  failed: Failed

Maybe this is something I should contact fandom about..

tosher commented 4 years ago

I'll try to check it..

tosher commented 4 years ago

As i see, it needs some research and maybe coding :)

But with cookie authorization it works for me:

        "wreckit-woodhouse.fandom.com":
        {
            "host": "wreckit-woodhouse.fandom.com",
                "authorization_type": "cookies",
            "cookies_browser": "firefox",
            "is_ssl_cert_verify": true,
            "https": true,
            "pagepath": "/wiki/",
            "path": "/"
        }

cookies_browser maybe firefox or chrome - just login on the wiki's page in browser, after that you can open/edit pages with ST

No needs to define login/pass in the settings, plugin will try to read and use browser's cookie for wiki site.

moose-again commented 4 years ago

When I try cookies using the settings you used, I get:

Connecting to "https://wreckit-woodhouse.fandom.com" ..  done.
Login in with authorization type cookies..  done, without authorization.

When I have logged in fandom using Firefox.

tosher commented 4 years ago

Logged in wreckit-woodhouse.fandom.com or wikia? Domain must be the same.

moose-again commented 4 years ago

It is fandom, not wikia. Perhaps Firefox is blocking MediaWiker from collecting cookies? MediaWiker can't seem to find them.

tosher commented 4 years ago

When I have logged in wikia using Firefox. :)

So, you have logged in on wreckit-woodhouse.fandom.com, ок.

Firefox can't to block Mediawiker, it just a file read...

tosher commented 4 years ago

Please, set the debug option to true in settings, retry to open any page with cookies type and post the result in panel here (with remove real values from cookies values).

moose-again commented 4 years ago

The cookie values are the numbers right?

moose-again commented 4 years ago

Settings:

"wreckit-woodhouse.fandom.com":
{
    "authorization_type": "cookies",
    "cookies_browser": "firefox",
    "host": "wreckit-woodhouse.fandom.com",
    "https": true,
    "is_ssl_cert_verify": true,
    "pagepath": "/wiki/",
    "path": "/"
}

Output:

'''Setup new connection to "wreckit-woodhouse.fandom.com".'''
Connecting to "https://wreckit-woodhouse.fandom.com" ..  done.
Login in with authorization type cookies..  done, without authorization.
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Connection: <requests.sessions.Session object at [cookie value]>
Anonymous connection detected, forcing new connection.. 
Connecting to "https://wreckit-woodhouse.fandom.com" ..  done.
Login in with authorization type cookies..  done, without authorization.
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Connection: <requests.sessions.Session object at [cookie value]>
Page [[Test]] was opened successfully from "wreckit-woodhouse.fandom.com".
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
Anonymous connection detected, forcing new connection.. 
Connecting to "https://wreckit-woodhouse.fandom.com" ..  done.
Login in with authorization type cookies..  done, without authorization.
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Connection: <requests.sessions.Session object at [cookie value]>
tosher commented 4 years ago

It's on Windows or not?

moose-again commented 4 years ago

Yes, this is Windows.

moose-again commented 4 years ago

I've tried mediawiker_firefox_cookie_files, but I get the same results...

"wreckit-woodhouse.fandom.com":
{
    "authorization_type": "cookies",
    "cookies_browser": "firefox",
    "host": "wreckit-woodhouse.fandom.com",
    "https": true,
    "is_ssl_cert_verify": true,
    "pagepath": "/wiki/",
    "path": "/",
    "mediawiker_firefox_cookie_files": ["C:\\Users\\[USERNAME]\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\[PROFILE FOLDER]\\cookies.sqlite"]
}
tosher commented 4 years ago

Just firefox_cookie_files in the root of the config, not inside site settings.

moose-again commented 4 years ago

Oops. That fixed it. Thank you again.

tosher commented 4 years ago

Please, try the new version: https://github.com/tosher/Mediawiker/releases/tag/v3.6.3

Login/pass authorization didn't changed.. i don't now which type of auth used at fandom.com.. in this version clientlogin method was added and it works fine at mediawiki site, but not at fandom :(.

Maybe, firefox_cookie_files option not needed with this version.

BryghtShadow commented 4 years ago

Tested Mediawiker v3.6.3, Firefox v79.0. Changes successfully saved without firefox_cookie_files specified:

"wreckit-woodhouse.fandom.com":
{
  "authorization_type": "cookies",
  "cookies_browser": "firefox",
  "host": "wreckit-woodhouse.fandom.com",
  "https": true,
  "is_ssl_cert_verify": true,
  "pagepath": "/wiki/",
  "path": "/"
}
tosher commented 4 years ago

Thanks for the info!

moose-again commented 4 years ago

UCP officially took over every wiki I edit on :(

Apparently, a lot of people are having trouble with this api

BryghtShadow commented 4 years ago

For UCP, non-cookie version requires credentials generated via Special:BotPasswords (i.e. if your wiki has this special page, then you need to use this for API logins, edits, etc). Cookie version still works fine.

moose-again commented 4 years ago

Oh, that makes sense. I've never heard of Special:BotPasswords before. Thanks!

tosher commented 4 years ago

For UCP, non-cookie version requires credentials generated via Special:BotPasswords (i.e. if your wiki has this special page, then you need to use this for API logins, edits, etc).

For API:clientlogin too?

BryghtShadow commented 4 years ago

@tosher On UCP, clientlogin does not work. There's a relevant ticket for pywikibot (https://phabricator.wikimedia.org/T249403) where this is mentioned:

Hmm, it seems UCP does not support login through API currently: https://wreckit-woodhouse.fandom.com/api.php?action=query&meta=authmanagerinfo&amirequestsfor=login. canauthenticatenow response is empty, indicates login action is currently not possible.

Observations for UCP:

  • On Gamepedia, /Special:UserLogin goes to /signin (HTTP 302), which goes to https://fandomauth.gamepedia.com/signin (HTTP 301).
  • On Fandom, /wiki/Special:UserLogin goes to /signin (HTTP 302), which goes to https://www.fandom.com/signin (HTTP 301).
tosher commented 4 years ago

Thank you! Very-very useful info.