Lua functions in plugins

You can share your Lua Scripts with everybody here.
Post Reply
thouel
Posts: 2
Joined: Fri Jul 12, 2013 9:22 am

Lua functions in plugins

Post by thouel »

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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Lua functions in plugins

Post by FTP »

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.
thouel
Posts: 2
Joined: Fri Jul 12, 2013 9:22 am

Re: Lua functions in plugins

Post by thouel »

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!!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Lua functions in plugins

Post by FTP »

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.
Post Reply