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.
eranroz created this task.Aug 29 2014, 8:15 AM
Petrb added a comment.Aug 29 2014, 8:23 AM

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 moved this task from Backlog to Need volunteer on the Huggle board.Nov 25 2014, 3:05 PM
Se4598 removed a subscriber: Se4598.Jan 14 2015, 11:52 PM
Restricted Application added subscribers: Luke081515, Aklapper. · View Herald TranscriptAug 17 2015, 3:03 PM
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.

Petrb claimed this task.May 13 2018, 7:57 PM
Petrb added a comment.May 19 2018, 9:42 AM

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

Restricted Application added a subscriber: RichSmith. · View Herald TranscriptMay 19 2018, 9:42 AM

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

Petrb closed this task as Resolved.May 23 2018, 8:44 PM