aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2 3 4

Author Topic: AJAX skin with xslt stylesheet  (Read 22736 times)

woutermense

  • Full Member
  • ***
  • Karma: 18
  • Offline Offline
  • Posts: 154
AJAX skin with xslt stylesheet
« on: March 14, 2010, 05:46:41 PM »

Been playing with this idea for quite some time now. As it is now this skin is just a proof-of-concept and nowhere near anything that can replace other skins.

How it works: The page requests a php script with ajax, this generates an xml file, which is transformed into html by an xslt stylesheet.

There is a problem with the default amuleweb that prevents it from working and a patch is needed which enables it to serve files with some other extensions as well.

Then there are some more problems: amuleweb php doesn't support the header() function, so this won't work in IE. Also in Opera there is another problem traversing DOM that I haven't figured out yet.

Actually, I only got it to work in Firefox.

Attached are the skin and a patch for amuleweb file src/webserver/src/WebServer.cpp

Please try it out :D

Also: Try clicking the column headers. There is some javascript that changes the stylesheet to modify the sort order.
« Last Edit: March 14, 2010, 05:49:03 PM by woutermense »
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: AJAX skin with xslt stylesheet
« Reply #1 on: March 14, 2010, 10:12:11 PM »

Webserver patch committed (10049).
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Vollstrecker

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 65
  • Offline Offline
  • Posts: 1471
  • Unofficial Debian Packager
    • http://vollstreckernet.de
Re: AJAX skin with xslt stylesheet
« Reply #2 on: March 15, 2010, 01:06:47 PM »

If the webserver can now deliver every type of file, the skins could offer to download completed files aswell. Or incomplete ones for preview.
Logged
Homefucking is killing prostitution

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 163
  • Offline Offline
  • Posts: 2688
Re: AJAX skin with xslt stylesheet
« Reply #3 on: March 15, 2010, 02:11:59 PM »

If the webserver can now deliver every type of file, the skins could offer to download completed files aswell. Or incomplete ones for preview.

That would introduce quite a number of security issues. Please note, that the webserver is not necessarily run under the same user account as amule(d), and might aswell be run on another computer. For example you might run amule on your home computer, amuleweb on the router...
Logged
concordia cum veritate

Vollstrecker

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 65
  • Offline Offline
  • Posts: 1471
  • Unofficial Debian Packager
    • http://vollstreckernet.de
Re: AJAX skin with xslt stylesheet
« Reply #4 on: March 15, 2010, 02:37:41 PM »

Right, so the daemon has to send the file via ec to amuleweb which resends it to the user. Or amuleweb can just check if it is run on the same machine, or if it was started from a core on startup and deactivate the download otherwise.
Logged
Homefucking is killing prostitution

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: AJAX skin with xslt stylesheet
« Reply #5 on: March 15, 2010, 07:40:52 PM »

If the webserver can now deliver every type of file
I added only 3 XML types.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

lfroen

  • Guest
Re: AJAX skin with xslt stylesheet
« Reply #6 on: March 16, 2010, 07:08:44 AM »

That would introduce quite a number of security issues. Please note, that the webserver is not necessarily run under the same user account as amule(d), and might aswell be run on another computer. For example you might run amule on your home computer, amuleweb on the router...

That's quite unusual circumstances. If someone succeed in such setup (left alone the mere idea of "run something on router"), he gotta understand security implications.
Logged

Vollstrecker

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 65
  • Offline Offline
  • Posts: 1471
  • Unofficial Debian Packager
    • http://vollstreckernet.de
Re: AJAX skin with xslt stylesheet
« Reply #7 on: March 16, 2010, 11:17:06 AM »

And that guy just writes a howto after his success that just explains how to get it running, Someone else follows it and open his net to attackers.

And after all it's our fault.
Logged
Homefucking is killing prostitution

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 163
  • Offline Offline
  • Posts: 2688
Re: AJAX skin with xslt stylesheet
« Reply #8 on: March 16, 2010, 03:15:42 PM »

That would introduce quite a number of security issues. Please note, that the webserver is not necessarily run under the same user account as amule(d), and might aswell be run on another computer. For example you might run amule on your home computer, amuleweb on the router...

That's quite unusual circumstances. If someone succeed in such setup (left alone the mere idea of "run something on router"), he gotta understand security implications.

Yes, I wanted an unusual example to show what difficulties might occur with Vollstrecker's idea. The security issues I was thinking of arise in normal conditions, i.e. webserver ran under the same user account as amule(d). I'm sure you know what I mean.
Logged
concordia cum veritate

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 163
  • Offline Offline
  • Posts: 2688
Re: AJAX skin with xslt stylesheet
« Reply #9 on: March 16, 2010, 03:26:10 PM »

And that guy just writes a howto after his success
No, I won't ;)
Logged
concordia cum veritate

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: AJAX skin with xslt stylesheet
« Reply #10 on: March 16, 2010, 10:30:39 PM »

And after all it's our fault.
It's all your fault
you called me beautiful
you turned me inside out and now I can't turn back
I held my breath
because you were perfect
but I'm running out of air
and it's not fair...


Man, I love that song.  :-*
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

woutermense

  • Full Member
  • ***
  • Karma: 18
  • Offline Offline
  • Posts: 154
Re: AJAX skin with xslt stylesheet
« Reply #11 on: March 17, 2010, 12:47:09 AM »

I never knew the webserver could be on another machine than the daemon. But it seems logical, they connect via EC. Learned something :)

Anyway, I found out that .getElementsByTagName("xsl:sort") doesn't work on Opera, but .getElementsByTagName("sort") does. Strange. But nothing a little if statement can't fix. When I find the time I'll build some more functionality in the skin other than just displaying what is currently downloading.

Many thanks to Stu for applying my patch, and I hope there are some people running the newest SVN webserver to try out the skin. Or maybe just read the code ;)
Logged

woutermense

  • Full Member
  • ***
  • Karma: 18
  • Offline Offline
  • Posts: 154
Re: AJAX skin with xslt stylesheet
« Reply #12 on: March 18, 2010, 03:55:44 AM »

So, I think I'm ready to show some screenshots :)

Right now, the skin can show what is up & downloading.

Made a colour theme loosely based on the colours of the amule logo.

Note: column headers/footers with totals :D
« Last Edit: March 18, 2010, 04:04:17 AM by woutermense »
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4379
Re: AJAX skin with xslt stylesheet
« Reply #13 on: March 18, 2010, 08:09:02 AM »

a.) Yay for Opera Users!
b.) Looks really good, my congratulations.
Logged

woutermense

  • Full Member
  • ***
  • Karma: 18
  • Offline Offline
  • Posts: 154
Re: AJAX skin with xslt stylesheet
« Reply #14 on: March 18, 2010, 04:27:35 PM »

Thanks wuischke

And finally, something more than just showing downloads & uploads.

New:
- Coloured category headers in front of every row
- Rounded progressbars, yay css3
- Click on a download to filter by its category, again to turn filtering off
- Click on a file's status to toggle pause/resume
- Click on a file's priority to increase it (wraps around, thanks amuleweb)

And all is ajaxified so no waiting for loading pages.

No screenshots this time :)

Logged
Pages: [1] 2 3 4