|
2025-03-19 02:03:36
|
<gry>
|
Hi, I would like to create a page from an external javascript app on a wiki. I have page title and content. How can I shove the suggested the content into a page creation article body content? Like https://test.wikipedia.org/w/index.php?title=Gryllida2&preload=Gryllida&action=edit but in my case I don't have the luxury of having content on an existing page yet.
|
|
2025-03-19 02:58:50
|
<moonmoon>
|
gry: you can't
|
|
2025-03-19 02:59:09
|
<gry>
|
moonmoon: how do others do it then? like for app which uploads from flickr to commons?
|
|
2025-03-19 02:59:09
|
<moonmoon>
|
well, let me clarify
|
|
2025-03-19 02:59:25
|
<moonmoon>
|
you can't pre-populate page content for a user to then amend and submit via the UI
|
|
2025-03-19 02:59:53
|
<moonmoon>
|
you *can* make a POST request to api.php and specify the content directly, provided you have the requisite tokens for the user you're editing as
|
|
2025-03-19 03:00:29
|
<moonmoon>
|
(the api.php method will create/save the page without user interaction/intervention)
|
|
2025-03-19 03:08:28
|
<gry>
|
moonmoon: OK, what api is this for post?
|
|
2025-03-19 03:08:53
|
<moonmoon>
|
https://www.mediawiki.org/wiki/API:Edit
|
|
2025-03-19 03:14:41
|
<gry>
|
moonmoon: i go https://test.wikipedia.org/w/api.php?action=query&meta=tokens take token to https://test.wikipedia.org/wiki/Special:ApiSandbox#action=edit&format=json&title=Gryllida2&text=Hello%20world%0AThis%20is%20a%20test.&summary=Created%20the%20page%20via%20api%20sandbox.&token=&formatversion=2 it says invalid token
|
|
2025-03-19 03:15:26
|
<moonmoon>
|
you either used the wrong token, or you aren't presenting cookies
|
|
2025-03-19 03:15:48
|
<moonmoon>
|
Special:ApiSandbox is going to be your friend here
|
|
2025-03-19 03:15:52
|
<moonmoon>
|
or apps like Postman
|
|
2025-03-19 03:19:29
|
<gry>
|
moonmoon: i'm using api sandbox, it provides me with these urls. you can try it if you like. i couldn't get the right token from it.
|
|
2025-03-19 03:22:42
|
<moonmoon>
|
what does the token you're putting in end with?
|
|
2025-03-19 03:22:54
|
<moonmoon>
|
(last 3 characters)
|
|
2025-03-19 03:28:52
|
<moonmoon>
|
the token should end with +\ (one backslash). The JSON representation contains 2 because backslashes need to be escaped in JSON, but passing 2 back will be invalid
|
|
2025-03-19 03:29:13
|
<moonmoon>
|
if the token is +\ without anything before it, then you're being treated as logged out/anonymous
|
|
2025-03-19 03:29:18
|
<gry>
|
ah two slashes
|
|
2025-03-19 03:29:19
|
<gry>
|
ok
|
|
2025-03-19 03:30:00
|
<gry>
|
works now thanks
|
|
2025-03-19 03:30:11
|
<moonmoon>
|
(the choice of +\ was intentional back in the day to act as a trap for misconfigured or miscoded scripts)
|
|
2025-03-19 03:30:37
|
<gry>
|
it's a pain for my script, i'll chop off one last symbol :-(
|
|
2025-03-19 03:30:47
|
<moonmoon>
|
use a proper JSON parser, and then it'll work just fine
|
|
2025-03-19 03:31:03
|
<moonmoon>
|
literally every programming language that isn't C has one
|
|
2025-03-19 03:31:12
|
<gry>
|
right, for example, https://test.wikipedia.org/w/api.php?action=query&meta=tokens&format=xml works ok
|
|
2025-03-19 03:31:17
|
<moonmoon>
|
(C has one too it just isn't stdlib)
|
|
2025-03-19 03:34:56
|
<gry>
|
thanks for your help moonmoon this wasn't obvious
|
|
2025-03-19 03:59:13
|
<gry>
|
if you have an example i'd appreciate it, i'm working outside of the wiki so mw.api stuff is not available
|
|
2025-03-19 04:33:31
|
<moonmoon>
|
example scripts are on the link, or you can use e.g. pywikipediabot
|
|
2025-03-19 04:37:12
|
<gry>
|
looking for js thanks i will check out the page
|
|
2025-03-19 20:36:31
|
<lucaswerkmeister>
|
dcausse: I finally have access to the server again where I saw all those cirrusSearchElasticaWrite jobs… and are you sure those only get created when there are errors? (our last discussion on this was on 10 march ^^)
|
|
2025-03-19 20:36:57
|
<lucaswerkmeister>
|
I see various cirrus jobs, including cirrusSearchLinksUpdatePrioritized, cirrusSearchIncomingLinkCount and cirrusSearchElasticaWrite, and they all seem to succeed
|
|
2025-03-19 20:37:33
|
<lucaswerkmeister>
|
and looking at the code in includes/Updater.php, it looks to me like cirrusSearchElasticaWrite should be queued in normal situations, including updatePages()
|
|
2025-03-19 20:37:50
|
<lucaswerkmeister>
|
(both in REL1_39 and REL1_43)
|
|
2025-03-19 20:47:42
|
<dcausse>
|
lucaswerkmeister: weird... in https://gerrit.wikimedia.org/g/mediawiki/extensions/CirrusSearch/+/553d9214143c0574cd0a47c3b8762554cf576bec/includes/Updater.php#464 ElasticaWrite jobs are only queued if $clusterSettings->isIsolated() otherwise they're run inline
|
|
2025-03-19 20:47:58
|
<dcausse>
|
haven't checked older mw version tho, but I don't think that behavior is new
|
|
2025-03-19 20:54:19
|
<dcausse>
|
1.39 should run inline (https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/CirrusSearch/+/refs/heads/REL1_39/includes/Updater.php#426), not sure what's happening...
|
|
2025-03-19 21:12:08
|
<lucaswerkmeister>
|
oh, I see, I didn’t look at that line
|
|
2025-03-19 21:12:39
|
<lucaswerkmeister>
|
let me see if I can figure out if it’s isolated or not for me
|
|
2025-03-19 21:17:46
|
<lucaswerkmeister>
|
dcausse: the default for $wgCirrusSearchWriteIsolateClusters is null, and according to https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/CirrusSearch/+/refs/heads/REL1_39/includes/ClusterSettings.php#98 null apparently means “all clusters are isolated” not “no clusters are isolated”
|
|
2025-03-19 21:18:31
|
<lucaswerkmeister>
|
whether that’s correct or a bug, I can’t say :)
|
|
2025-03-19 21:19:49
|
<dcausse>
|
lucaswerkmeister: oh my bad, sorry about that did not realize this was behaving like that...
|
|
2025-03-19 21:20:23
|
<lucaswerkmeister>
|
no problem! :D
|
|
2025-03-19 21:20:24
|
<dcausse>
|
that means I'm a bit puzzled about your jobqueue issue :)
|
|
2025-03-19 21:20:43
|
<lucaswerkmeister>
|
hm, why? I thought that means everything is basically fine
|
|
2025-03-19 21:21:15
|
<lucaswerkmeister>
|
except that the server isn’t running jobs quite fast enough, which https://www.mediawiki.org/wiki/Manual:Hooks/ApiMaxLagInfo#Example helps with a bit
|
|
2025-03-19 21:21:25
|
<lucaswerkmeister>
|
(and I’ll also try to add another job runner or two)
|
|
2025-03-19 21:22:02
|
<lucaswerkmeister>
|
but if I understand correctly, the cirrusSearchElasticaWrite are expected (since it’s treating the clusters as isolated ⇒ jobs are queued rather than ran inline)
|
|
2025-03-19 21:22:38
|
<dcausse>
|
lucaswerkmeister: if it's "just" throughput issue sure
|
|
2025-03-19 21:23:33
|
<dcausse>
|
lucaswerkmeister: yes they are, but unsure if this is what we intended... I wonder if we could skip this additional cirrusSearchElasticaWrite for "simple" setups
|
|
2025-03-19 21:23:43
|
<lucaswerkmeister>
|
I think it’s just throughput, yeah
|
|
2025-03-19 21:23:50
|
<lucaswerkmeister>
|
I can file a task if you like ^^
|
|
2025-03-19 21:23:59
|
<dcausse>
|
lucaswerkmeister: please do :)
|
|
2025-03-19 21:28:39
|
<lucaswerkmeister>
|
filed T389429 :)
|
|
2025-03-19 21:28:40
|
<stashbot>
|
T389429: Investigate whether it’s intentional / correct that default CirrusSearch setups run cirrusSearchElasticaWrite as separate jobs - https://phabricator.wikimedia.org/T389429
|
|
2025-03-19 21:28:51
|
<lucaswerkmeister>
|
thanks a lot for looking into it!
|
|
2025-03-19 21:31:46
|
<dcausse>
|
thanks! I'm pretty sure that extra hop is not necessary and will save some resource on non-wmf wikis
|
|
2025-03-19 21:32:34
|
<muqsit>
|
theres a lack of good 3D extensions for media wiki
|
|
2025-03-19 21:33:23
|
<Reedy>
|
3D extension being...?
|
|
2025-03-19 21:33:56
|
<muqsit>
|
extensions that can render 3D objects (.stl, .glb, etc. files)
|
|
2025-03-19 21:34:02
|
<dcausse>
|
https://www.mediawiki.org/wiki/Extension:3D ?
|
|
2025-03-19 21:34:25
|
<muqsit>
|
i checked Extension:3D, i suppose it is the best one
|
|
2025-03-19 21:34:52
|
<muqsit>
|
the thing is, Extension:3D has a laborious installation.. it asks you to download 3d2png
|
|
2025-03-19 21:35:22
|
<dcausse>
|
https://commons.wikimedia.org/wiki/File:Puchar_Wikipedia_10_cm.stl#/media/File:Puchar_Wikipedia_10_cm.stl
|
|
2025-03-19 21:35:22
|
<muqsit>
|
3d2png only runs in docker, so you have to setup a docker and everything (yes there is no alternative way without a docker container)
|
|
2025-03-19 21:35:56
|
<muqsit>
|
the other issue with it is .stl does not support textures
|
|
2025-03-19 21:36:17
|
<muqsit>
|
e.g., i am trying to render a minecraft build, and it doesnt look as pleasing without the textures (blocks cant be differentiated)
|
|
2025-03-19 21:36:39
|
<muqsit>
|
.glb/.gltf on the other hand seems rather the standard these days
|
|
2025-03-19 21:36:51
|
<muqsit>
|
.glb/.gltf on the other hand seems rather the standard these days (webgl)
|
|
2025-03-19 21:36:52
|
<moonmoon>
|
you don't need docker to run 3d2png
|
|
2025-03-19 21:37:54
|
<muqsit>
|
> The deploy repository needs to be built on a system as similar to the production hosts as possible. For this reason, we use the service-runner package, which spins up a Docker container based on the definition provided in the deploy stanza of package.json, installs the distribution packages needed, builds the node_modules directory and updates
|
|
2025-03-19 21:37:54
|
<muqsit>
|
the source repo submodule.
|
|
2025-03-19 21:37:55
|
<muqsit>
|
i suppose i misread the instruction
|
|
2025-03-19 21:37:55
|
<moonmoon>
|
it's just node.js
|
|
2025-03-19 21:38:00
|
<muqsit>
|
i see
|
|
2025-03-19 21:38:08
|
<muqsit>
|
yeah service-runner should take care of all that
|
|
2025-03-19 21:38:34
|
<muqsit>
|
but yeah only stl support is the other drawback
|
|
2025-03-19 21:38:47
|
<Reedy>
|
patches welcome
|
|
2025-03-19 21:39:12
|
<muqsit>
|
yes i am currently working on either improving the existing 3D extension or forking it
|
|
2025-03-19 21:39:29
|
<muqsit>
|
google has this really nice javascript library (modelviewer.dev) you can visit the site and see nice examples
|
|
2025-03-19 21:39:39
|
<muqsit>
|
and it supports webgl models
|
|
2025-03-19 21:40:30
|
<muqsit>
|
plan is to use the javascript library for rendering 3D models, but i have yet to get a grasp of the mediawiki extension landscape :(
|
|
2025-03-19 21:41:15
|
<muqsit>
|
from what i gathered, you have to register a MediaHandler of sorts?
|