yarl / vicuna

Tool for uploading files to Wikimedia Commons and other Wikimedia projects
http://yarl.github.io/vicuna/
42 stars 24 forks source link

Update org.wikipedia.Wiki #166

Closed f2k1de closed 2 years ago

f2k1de commented 2 years ago

Update org.wikipedia.Wiki to a version that supports gzip so that login works again. Should resolve #165

michal-josef-spacek commented 2 years ago

@f2k1de Great, thanks But i cannot run in Linux (class file has wrong version 60.0, should be 55.0)

michal-josef-spacek commented 2 years ago

After recompiling of Wiki.java, Vicuna run, not fail with API, but not working. (Linux, OpenJDK 11.0.12)

f2k1de commented 2 years ago

It works on my Linux (Arch Linux 5.14.11 with openjdk version "16.0.2" 2021-07-20). Which Linux Setup are you using, so that I can test it for this?

michal-josef-spacek commented 2 years ago

@f2k1de First "issue" is how to deliver Wiki.java? I don't want deliver copy of source code from other project. In ideal way we need use https://github.com/MER-C/wiki-java as library and build Vicuna with it.

As i understand with your change, there are versions of compiled java bytecode and this version don't work with my installed java :-D. This mean that i don't know with which versions is Vicuna working. Sic!

I am looking for some resolution for this.

michal-josef-spacek commented 2 years ago

Second issue: When i fill category, Wiki->listPages don't work because there is "Category:" string on begin Patch:

diff --git a/src/main/java/cuploader/CategoryHint.java b/src/main/java/cuploader/CategoryHint.java
index a179c00..e95fbb5 100644
--- a/src/main/java/cuploader/CategoryHint.java
+++ b/src/main/java/cuploader/CategoryHint.java
@@ -108,7 +108,7 @@ public class CategoryHint extends Thread {

             try {
                 //get list
-                String[] listPages = wiki.listPages("Category:"+text, null, Wiki.CATEGORY_NAMESPACE).toArray(new String[0]);
+                String[] listPages = wiki.listPages(text, null, Wiki.CATEGORY_NAMESPACE).toArray(new String[0]);^M

                 //remove loading
                 mCatHint.removeAll();
michal-josef-spacek commented 2 years ago

Third issue: I cannot upload. There is log:

Oct 14, 2021 1:49:59 PM Wiki getToken
INFO: Fetching URL https://commons.wikimedia.org/w/api.php?&maxlag=5&meta=tokens&format=xml&action=query&type=csrf
Oct 14, 2021 1:50:00 PM Wiki upload
INFO: Fetching URL https://commons.wikimedia.org/w/api.php?&maxlag=5&format=xml&action=upload

No error. Result in GUI: image

michal-josef-spacek commented 2 years ago

Exception with upload is:

java.lang.UnknownError: MW API error. Server response was: <?xml version="1.0"?><api servedby="mw1343"><error code="missingparam" info="The &quot;token&quot; parameter must be set." xml:space="preserve">See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &amp;lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&amp;gt; for notice of API deprecations and breaking changes.</error></api>
michal-josef-spacek commented 2 years ago

I found issue in wiki-java and waiting for merge (https://github.com/MER-C/wiki-java/pull/185) After this fix vicuna is working on my java 11 in Debian

michal-josef-spacek commented 2 years ago

@f2k1de I created updated PR (https://github.com/yarl/vicuna/pull/172). Could you test it?