Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a quick and dirty fix to getToken #91

Closed
wants to merge 1 commit into from
Closed

Conversation

lagleki
Copy link
Contributor

@lagleki lagleki commented Jan 13, 2016

in newer versions of mediawiki action: " 'query', meta: 'tokens' " is required to get the token.

in newer versions of mediawiki action: " 'query', meta: 'tokens' " is required to get the token.
@macbre
Copy link
Owner

macbre commented Jan 14, 2016

@lagleki, can you be more specific on "newer version of mediawiki"?

nodemw is used for wikis that run MediaWiki 1.19 and the updated URL to get the token simply does not work - e.g. http://www.wikia.com/api.php?action=query&meta=tokens.

@lagleki
Copy link
Contributor Author

lagleki commented Jan 14, 2016

=1.24 as the official docs say.
https://www.mediawiki.org/wiki/API:Tokens

Looks like they implemented that in somewhere in August 2014:
https://www.mail-archive.com/mediawiki-api@lists.wikimedia.org/msg03286.html

But I agree that this fix makes older wikis not work so maybe a new flag in
options might be necessary. It would switch the behavior.

2016-01-14 20:11 GMT+03:00 Maciej Brencz notifications@github.com:

@lagleki https://github.com/lagleki, can you be more specific on "newer
version of mediawiki"?

nodemw is used for wikis that run MediaWiki 1.19 at the updated list of
URL parameters do not work - e.g.
http://www.wikia.com/api.php?action=query&meta=tokens.


Reply to this email directly or view it on GitHub
#91 (comment).

@smiley
Copy link

smiley commented Mar 26, 2016

If this is a breaking change, why not fetch the wiki's version on initial load via "query", meta: "siteinfo", siprop: "general"? That returns:

{
    "batchcomplete": "",
    "query": {
        "general": {
            "mainpage": "Main Page",
            "base": "https://en.wikipedia.org/wiki/Main_Page",
            "sitename": "Wikipedia",
            "logo": "//en.wikipedia.org/static/images/project-logos/enwiki.png",
            "generator": "MediaWiki 1.27.0-wmf.18", /* This corresponds to the version in "Special:Version" */
/* ... */

That way, nodemw could pick the correct behaviour per wiki. (It could even be done asynchronously and only delay token-requiring actions, so read-only actions would be unaffected)

@lagleki
Copy link
Contributor Author

lagleki commented Mar 27, 2016

Or even simpler. Fallback to the new behavior if the old one returns an
error

Em sábado, 26 de março de 2016, Smiley Barry notifications@github.com
escreveu:

If this is a breaking change, why not fetch the wiki's version on initial
load via "query", meta: "siteinfo", siprop: "general"? That returns:

{
"batchcomplete": "",
"query": {
"general": {
"mainpage": "Main Page",
"base": "https://en.wikipedia.org/wiki/Main_Page",
"sitename": "Wikipedia",
"logo": "//en.wikipedia.org/static/images/project-logos/enwiki.png",
"generator": "MediaWiki 1.27.0-wmf.18", /* This corresponds to the version in "Special:Version" // ... */

That way, nodemw could pick the correct behaviour per wiki. (It could
even be done asynchronously and only delay token-requiring actions, so
read-only actions would be unaffected)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#91 (comment)

@macbre
Copy link
Owner

macbre commented Apr 2, 2016

@smiley good idea. Let's detect the MW version (lazy fetch it once for each nodem instance) and act accordingly.

@macbre macbre closed this Apr 2, 2016
@lagleki
Copy link
Contributor Author

lagleki commented Apr 2, 2016

Has this already been implemented?

@macbre
Copy link
Owner

macbre commented Apr 2, 2016

Not yet, let's first implement the MW version detection (which I'm working on right now).

@macbre
Copy link
Owner

macbre commented Apr 2, 2016

@lagleki: done. Thanks for suggesting the change :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants