Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has a unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets some local config and then requests the main code from Commons (JavaScript, CSS and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes, they are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following: https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID-FILE-dkx... The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a stable URL that serves the latest code with the proper MIME type heading. In other words, a CDN, which may or may not be integrated with Diffusion.
Thanks!
Hi Felipe,
What you are proposing does sound like it would be a nice and useful feature for hosting gadgets.
Could you explain a bit better how you do things currently? Maybe we can automate the steps to publish code to commons. I just need to better understand your workflow.
On Fri, Apr 7, 2017 at 9:46 AM, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has a unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets some local config and then requests the main code from Commons (JavaScript, CSS and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes, they are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following: https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID- FILE-dkxynh42aocsg5gmepxw/proveit.js The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a stable URL that serves the latest code with the proper MIME type heading. In other words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
For the record, I find Felipe's suggestion extremely helpful, I've been hosting a few scripts in GitHub for the ease of it and I find it not ideal due to the implications of using third party hosting for scripts.
Chico Venancio
2017-04-07 14:28 GMT-03:00 Mukunda Modell mmodell@wikimedia.org:
Hi Felipe,
What you are proposing does sound like it would be a nice and useful feature for hosting gadgets.
Could you explain a bit better how you do things currently? Maybe we can automate the steps to publish code to commons. I just need to better understand your workflow.
On Fri, Apr 7, 2017 at 9:46 AM, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has
a
unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets
some
local config and then requests the main code from Commons (JavaScript,
CSS
and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes, they are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following: https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID- FILE-dkxynh42aocsg5gmepxw/proveit.js The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a stable URL that serves the latest code with the proper MIME type heading. In
other
words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Friday, April 7, 2017, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has a unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets some local config and then requests the main code from Commons (JavaScript, CSS and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes, they are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following:
https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID-FILE-dkx...
The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a stable URL that serves the latest code with the proper MIME type heading. In
other
words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hmm, we should do something better for this. In the mean time, have you considered packaging the javascript as a mediawiki extension that just adds it as a module? Then the gadget could simply be a mw.loader.load( moduleName ) call.
-- bawolff
Brian, No, and I always felt there was a better way to do this. I'll look into that, thanks,
Chico Venancio
2017-04-07 15:45 GMT-03:00 Brian Wolff bawolff@gmail.com:
On Friday, April 7, 2017, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has
a
unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets
some
local config and then requests the main code from Commons (JavaScript,
CSS
and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes, they are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following:
https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID- FILE-dkxynh42aocsg5gmepxw/proveit.js
The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a stable URL that serves the latest code with the proper MIME type heading. In
other
words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hmm, we should do something better for this. In the mean time, have you considered packaging the javascript as a mediawiki extension that just adds it as a module? Then the gadget could simply be a mw.loader.load( moduleName ) call.
-- bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Brion, that's just brilliant. But wouldn't the extension need to be installed on each Wikipedia for the module to be available?
On Fri, Apr 7, 2017 at 4:12 PM Chico Venancio chicocvenancio@gmail.com wrote:
Brian, No, and I always felt there was a better way to do this. I'll look into that, thanks,
Chico Venancio
2017-04-07 15:45 GMT-03:00 Brian Wolff bawolff@gmail.com:
On Friday, April 7, 2017, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed
via
Gerrit, and served to the various Wikipedias from Commons. Each wiki
has
a
unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets
some
local config and then requests the main code from Commons (JavaScript,
CSS
and JSON). Every time I merge a new change via Gerrit, I need to
manually
update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes,
they
are immediately available (and we don't need interface rights or manual work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the main proveit.js file, and click on "View Raw File", I get to a URL like the following:
https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID- FILE-dkxynh42aocsg5gmepxw/proveit.js
The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a
stable
URL that serves the latest code with the proper MIME type heading. In
other
words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hmm, we should do something better for this. In the mean time, have you considered packaging the javascript as a mediawiki extension that just
adds
it as a module? Then the gadget could simply be a mw.loader.load( moduleName ) call.
-- bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Indeed, this scheme would require the resulting extension to be deployed, along with all the red tape that that entails. (The red tape isnt as bad as it used to be imo, but there still is some)
Im unsure if it would have to follow the usual rules for deployed extensions if it solely consisted of js modules that are never loaded by default (e.g. extension requires initial security review, all changes have to be code reviewed by someone other than the author of the patch)
-- Brian
On Friday, April 7, 2017, Felipe Schenone schenonef@gmail.com wrote:
Brion, that's just brilliant. But wouldn't the extension need to be installed on each Wikipedia for the module to be available?
On Fri, Apr 7, 2017 at 4:12 PM Chico Venancio chicocvenancio@gmail.com wrote:
Brian, No, and I always felt there was a better way to do this. I'll look into that, thanks,
Chico Venancio
2017-04-07 15:45 GMT-03:00 Brian Wolff bawolff@gmail.com:
On Friday, April 7, 2017, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed
via
Gerrit, and served to the various Wikipedias from Commons. Each wiki
has
a
unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets
some
local config and then requests the main code from Commons
(JavaScript,
CSS
and JSON). Every time I merge a new change via Gerrit, I need to
manually
update the Commons pages so that the Wikipedias have the latest code.
This is sub-optimal. Ideally, the Wikipedias should request the code directly from Diffusion, so that when developers merge new changes,
they
are immediately available (and we don't need interface rights or
manual
work in Commons). However, when I go to the Diffusion of the gadget https://phabricator.wikimedia.org/diffusion/1884/, click on the
main
proveit.js file, and click on "View Raw File", I get to a URL like
the
following:
https://phab.wmfusercontent.org/file/data/iapd7kogqo5x2naywwlq/PHID- FILE-dkxynh42aocsg5gmepxw/proveit.js
The URL of the raw file changes with every click and doesn't have the proper MIME type header, so it's useless for serving the code.
I think it would be very useful, for my case and others, to have a
stable
URL that serves the latest code with the proper MIME type heading. In
other
words, a CDN, which may or may not be integrated with Diffusion.
Thanks! _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hmm, we should do something better for this. In the mean time, have you considered packaging the javascript as a mediawiki extension that just
adds
it as a module? Then the gadget could simply be a mw.loader.load( moduleName ) call.
-- bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Fri, 2017-04-07 at 14:45 -0400, Brian Wolff wrote:
Hmm, we should do something better for this.
That might be https://phabricator.wikimedia.org/T121470 ("Central Global Repository for Templates, Lua modules, and Gadgets"). Which is complex...
andre
On Fri, Apr 7, 2017 at 1:32 PM, Andre Klapper aklapper@wikimedia.org wrote:
On Fri, 2017-04-07 at 14:45 -0400, Brian Wolff wrote:
Hmm, we should do something better for this.
That might be https://phabricator.wikimedia.org/T121470 ("Central Global Repository for Templates, Lua modules, and Gadgets"). Which is complex...
The result of https://phabricator.wikimedia.org/T22153 / https://phabricator.wikimedia.org/T71445 might be more appropiate for these kinds of Gadgets. Otherwise, importing raw files individually would hardly have any benefit compared to the current situation the thread opener describes.
-- Krinkle
On Fri, Apr 7, 2017 at 7:46 AM, Felipe Schenone schenonef@gmail.com wrote:
Hi all! I'm the main developer of the ProveIt gadget https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt, a reference manager for Wikipedia. The code is tracked via Phabricator, reviewed via Gerrit, and served to the various Wikipedias from Commons. Each wiki has a unique initialization code https://en.wikipedia.org/wiki/MediaWiki:Gadget-ProveIt.js that sets some local config and then requests the main code from Commons (JavaScript, CSS and JSON). Every time I merge a new change via Gerrit, I need to manually update the Commons pages so that the Wikipedias have the latest code.
While updating ("deploying") to the wiki is indeed an extra step, I don't think running in real-time from master is desirable, either. The wiki could be updated with a semi-automated build script you run locally from time to time (e.g. "npm run deloy" or some such). Alternatively, we could consider using a post-merge Jenkins job that would automatically run it (e.g. by storing a BotPassword in Jenkins secure env variables).
In addition, by keeping it stored on-wiki as a real gadget and loading with ResourceLoader there are various benefits. * Combining files into one request. * Minification and compression. * Automatic CSS flipping for LTR/RTL. * Localisation (in Gadgets 2.0).
The first three points you can get now already by loading it from Commons using load.php instead of individual action=raw requests. This can also perform CSSJanus directionality flipping for you when load.php?lang= is set to that of an RTL language.
For ProveIt: https://commons.wikimedia.org/w/load.php?debug=false&lang=en&modules...
Loading this one url with mw.loader.load (potentially using wgUserLanguage and skin from mw.config) would make it a bit more efficient already.
Example for RTRC (deployed to/loaded from mediawiki.org) https://meta.wikimedia.org/wiki/User:Krinkle/RTRC-dev.js.
-- Krinkle
wikitech-l@lists.wikimedia.org