Lua functions in plugins

You can share your Lua Scripts with everybody here.

Lua functions in plugins

Postby thouel » Fri Jul 12, 2013 10:14 am

Hi all,

I'm coding a plugin for Wing FTP Server (webclient). This plugin is made to manage users and contacts.

I can't manage to use API's functions from my plugin. Is there any technics or tutorial to help me using the API? I don't understand how to use it properly.

I would like for exemple get all users from a domain.

I'm using Wing FTP Server 4.2.0 entreprise licence.
thouel
 
posts 2
 
joined Fri Jul 12, 2013 9:22 am

Re: Lua functions in plugins

Postby FTP » Sun Jul 14, 2013 3:14 pm

The Lua API in the help manual is for the web admin, not web client, and there is no API to get all users from a domain in the web client.
FTP
Site Admin
 
posts 1202
 
joined Tue Sep 29, 2009 6:09 am

Re: Lua functions in plugins

Postby thouel » Tue Jul 16, 2013 12:08 pm

Thank you for your help.

I understand my mistake and I found a new direction @ topic.

So I try to use the page "admin_webservice.html" but I don't understand why it doesn't work.
I use xmlhttp Javascript object : (in parameter command which is the lua script that I whant)

Code: Select all
function sabx_ajaxRequest(command)
{
    xmlhttp.open('get','https://xxxxx.xxx.xx:5466/admin_webservice.html?admin=xxx&pass=xxx&cmd='+command);
    xmlhttp.onreadystatechange = sabx_ajaxResponse;
    xmlhttp.send();
}

function sabx_ajaxResponse()
{
    if(xmlhttp.readyState == 4)
    {
        var response = xmlhttp.responseText;
        response = response.replace(/(\[nil value\])$/, "");
        alert(txt2html(response));
    }
}


The execution works well and the web browser recive a "200 HTTP OK" response. But the response from my command is empty, and the webpage is blank.

Do you know anything about my issue here?
Thanks!!
thouel
 
posts 2
 
joined Fri Jul 12, 2013 9:22 am

Re: Lua functions in plugins

Postby FTP » Tue Jul 16, 2013 1:13 pm

what's the command string?

BTW, using Lua webservice in the web client is very dangerous, clients can get your admin USER/PASS, and then they can execute any Lua scripts.
FTP
Site Admin
 
posts 1202
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest