Page MenuHomePhabricator

Hackathon sprint: Deprecate Python backend and replace it with JS
Closed, ResolvedPublic

Description

It should be possible to write extensions to Huggle also in JS rather than c++ and python. Some advantages of doing so:

  1. It could be awesome to reuse gadgets and user-scripts code. (such as twinkle)
  2. It can be deployed/installed in much more dynamic sense

Design

  1. User:MyUseName/huggle3.css - add some section for "JS extensions"
  2. On application load those extensions JS
  3. Use some JS engine (V8??) to run them independently of the view (or dependently with the browser object?) and once regular extensions are called, evaluate in the JS engine to call the scripts.

An example to JS:
huggle.hook('delete').add(function(e){
var api=new mw.Api({...});//or huggle.Api that already fills the tokens?
api.post({

		action: 'edit',
		...
		text: e.title,
		token: e.token
		})
		});
		e.preventDefault();//override default behavior of huggle delete

});


Version: unspecified
Severity: enhancement

Details

Reference
bz70160

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 3:35 AM
bzimport added a project: Huggle.
bzimport set Reference to bz70160.

some suggestion how would that be done? is there some open source cross platform JS interpretor library for C or C++?

Petrb removed Petrb as the assignee of this task.Nov 25 2014, 9:30 AM
Petrb set Security to None.
Petrb raised the priority of this task from Lowest to High.Apr 8 2018, 6:46 PM

I recently implemented JS scripting to other application I made: https://github.com/grumpy-irc/grumpy

The source code of that is here:

It's Qt based on top of QtScript, so let's do this, it works much better than Python backend I created long time ago for Huggle and it's much easier to integrate

Petrb renamed this task from Writing extensions in JS to Hackathon sprint: Deprecate Python backend and replace it with JS.Apr 8 2018, 6:49 PM

I will make this my priority this years hackathon, anyone is welcome to join me.

JS engine was implemented and is working pretty well, but there is a need to add huge amount of API's to make it really usefull

Thank you very much for your hard work at WMHack! Please make sure to close this task once everything has been wrapped up! :)