|
|
@ -195,74 +195,74 @@ Value stop(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const CRPCCommand vRPCCommands[] = |
|
|
|
static const CRPCCommand vRPCCommands[] = |
|
|
|
{ // name actor (function) okSafeMode threadSafe
|
|
|
|
{ // name actor (function) okSafeMode threadSafe allowOnPublicServer
|
|
|
|
// ------------------------ ----------------------- ---------- ----------
|
|
|
|
// ------------------------ ----------------------- ---------- ---------- -------------------
|
|
|
|
{ "help", &help, true, true }, |
|
|
|
{ "help", &help, true, true, true }, |
|
|
|
{ "stop", &stop, true, true }, |
|
|
|
{ "stop", &stop, true, true, false }, |
|
|
|
{ "getblockcount", &getblockcount, true, false }, |
|
|
|
{ "getblockcount", &getblockcount, true, false, false }, |
|
|
|
{ "getbestblockhash", &getbestblockhash, true, false }, |
|
|
|
{ "getbestblockhash", &getbestblockhash, true, false, true }, |
|
|
|
{ "getconnectioncount", &getconnectioncount, true, false }, |
|
|
|
{ "getconnectioncount", &getconnectioncount, true, false, false }, |
|
|
|
{ "getpeerinfo", &getpeerinfo, true, false }, |
|
|
|
{ "getpeerinfo", &getpeerinfo, true, false, false }, |
|
|
|
{ "addnode", &addnode, true, true }, |
|
|
|
{ "addnode", &addnode, true, true, false }, |
|
|
|
{ "adddnsseed", &adddnsseed, true, true }, |
|
|
|
{ "adddnsseed", &adddnsseed, true, true, false }, |
|
|
|
{ "getaddednodeinfo", &getaddednodeinfo, true, true }, |
|
|
|
{ "getaddednodeinfo", &getaddednodeinfo, true, true, false }, |
|
|
|
{ "getdifficulty", &getdifficulty, true, false }, |
|
|
|
{ "getdifficulty", &getdifficulty, true, false, false }, |
|
|
|
{ "getgenerate", &getgenerate, true, false }, |
|
|
|
{ "getgenerate", &getgenerate, true, false, false }, |
|
|
|
{ "setgenerate", &setgenerate, true, false }, |
|
|
|
{ "setgenerate", &setgenerate, true, false, false }, |
|
|
|
{ "gethashespersec", &gethashespersec, true, false }, |
|
|
|
{ "gethashespersec", &gethashespersec, true, false, false }, |
|
|
|
{ "getinfo", &getinfo, true, true }, |
|
|
|
{ "getinfo", &getinfo, true, true, true }, |
|
|
|
{ "getmininginfo", &getmininginfo, true, false }, |
|
|
|
{ "getmininginfo", &getmininginfo, true, false, false }, |
|
|
|
{ "createwalletuser", &createwalletuser, true, false }, |
|
|
|
{ "createwalletuser", &createwalletuser, true, false, false }, |
|
|
|
{ "listwalletusers", &listwalletusers, true, false }, |
|
|
|
{ "listwalletusers", &listwalletusers, true, false, true }, |
|
|
|
{ "backupwallet", &backupwallet, true, false }, |
|
|
|
{ "backupwallet", &backupwallet, true, false, false }, |
|
|
|
{ "walletpassphrase", &walletpassphrase, true, false }, |
|
|
|
{ "walletpassphrase", &walletpassphrase, true, false, false }, |
|
|
|
{ "walletpassphrasechange", &walletpassphrasechange, false, false }, |
|
|
|
{ "walletpassphrasechange", &walletpassphrasechange, false, false, false }, |
|
|
|
{ "walletlock", &walletlock, true, false }, |
|
|
|
{ "walletlock", &walletlock, true, false, false }, |
|
|
|
{ "encryptwallet", &encryptwallet, false, false }, |
|
|
|
{ "encryptwallet", &encryptwallet, false, false, false }, |
|
|
|
{ "getrawmempool", &getrawmempool, true, false }, |
|
|
|
{ "getrawmempool", &getrawmempool, true, false, false }, |
|
|
|
{ "getblock", &getblock, false, false }, |
|
|
|
{ "getblock", &getblock, false, false, true }, |
|
|
|
{ "getblockhash", &getblockhash, false, false }, |
|
|
|
{ "getblockhash", &getblockhash, false, false, false }, |
|
|
|
{ "gettransaction", &gettransaction, false, false }, |
|
|
|
{ "gettransaction", &gettransaction, false, false, false }, |
|
|
|
{ "listtransactions", &listtransactions, false, false }, |
|
|
|
{ "listtransactions", &listtransactions, false, false, false }, |
|
|
|
{ "signmessage", &signmessage, false, false }, |
|
|
|
{ "signmessage", &signmessage, false, false, false }, |
|
|
|
{ "verifymessage", &verifymessage, false, false }, |
|
|
|
{ "verifymessage", &verifymessage, false, false, false }, |
|
|
|
{ "getwork", &getwork, true, false }, |
|
|
|
{ "getwork", &getwork, true, false, false }, |
|
|
|
{ "getblocktemplate", &getblocktemplate, true, false }, |
|
|
|
{ "getblocktemplate", &getblocktemplate, true, false, false }, |
|
|
|
{ "submitblock", &submitblock, false, false }, |
|
|
|
{ "submitblock", &submitblock, false, false, false }, |
|
|
|
{ "listsinceblock", &listsinceblock, false, false }, |
|
|
|
{ "listsinceblock", &listsinceblock, false, false, false }, |
|
|
|
{ "dumpprivkey", &dumpprivkey, true, false }, |
|
|
|
{ "dumpprivkey", &dumpprivkey, true, false, false }, |
|
|
|
{ "dumppubkey", &dumppubkey, false, false }, |
|
|
|
{ "dumppubkey", &dumppubkey, false, false, false }, |
|
|
|
{ "dumpwallet", &dumpwallet, true, false }, |
|
|
|
{ "dumpwallet", &dumpwallet, true, false, false }, |
|
|
|
{ "importprivkey", &importprivkey, false, false }, |
|
|
|
{ "importprivkey", &importprivkey, false, false, false }, |
|
|
|
{ "importwallet", &importwallet, false, false }, |
|
|
|
{ "importwallet", &importwallet, false, false, false }, |
|
|
|
{ "getrawtransaction", &getrawtransaction, false, false }, |
|
|
|
{ "getrawtransaction", &getrawtransaction, false, false, false }, |
|
|
|
{ "createrawtransaction", &createrawtransaction, false, false }, |
|
|
|
{ "createrawtransaction", &createrawtransaction, false, false, false }, |
|
|
|
{ "decoderawtransaction", &decoderawtransaction, false, false }, |
|
|
|
{ "decoderawtransaction", &decoderawtransaction, false, false, false }, |
|
|
|
{ "sendrawtransaction", &sendrawtransaction, false, false }, |
|
|
|
{ "sendrawtransaction", &sendrawtransaction, false, false, false }, |
|
|
|
{ "sendnewusertransaction", &sendnewusertransaction, false, false }, |
|
|
|
{ "sendnewusertransaction", &sendnewusertransaction, false, false, false }, |
|
|
|
{ "verifychain", &verifychain, true, false }, |
|
|
|
{ "verifychain", &verifychain, true, false, false }, |
|
|
|
{ "getlastsoftcheckpoint", &getlastsoftcheckpoint, true, false }, |
|
|
|
{ "getlastsoftcheckpoint", &getlastsoftcheckpoint, true, false, false }, |
|
|
|
// twister dht network
|
|
|
|
// twister dht network
|
|
|
|
{ "dhtput", &dhtput, false, true }, |
|
|
|
{ "dhtput", &dhtput, false, true, false }, |
|
|
|
{ "dhtget", &dhtget, false, true }, |
|
|
|
{ "dhtget", &dhtget, false, true, true }, |
|
|
|
{ "newpostmsg", &newpostmsg, false, true }, |
|
|
|
{ "newpostmsg", &newpostmsg, false, true, false }, |
|
|
|
{ "newdirectmsg", &newdirectmsg, false, true }, |
|
|
|
{ "newdirectmsg", &newdirectmsg, false, true, false }, |
|
|
|
{ "newrtmsg", &newrtmsg, false, true }, |
|
|
|
{ "newrtmsg", &newrtmsg, false, true, false }, |
|
|
|
{ "getposts", &getposts, false, true }, |
|
|
|
{ "getposts", &getposts, false, true, false }, |
|
|
|
{ "getdirectmsgs", &getdirectmsgs, false, true }, |
|
|
|
{ "getdirectmsgs", &getdirectmsgs, false, true, false }, |
|
|
|
{ "setspammsg", &setspammsg, false, false }, |
|
|
|
{ "setspammsg", &setspammsg, false, false, false }, |
|
|
|
{ "getspammsg", &getspammsg, false, false }, |
|
|
|
{ "getspammsg", &getspammsg, false, false, false }, |
|
|
|
{ "follow", &follow, false, true }, |
|
|
|
{ "follow", &follow, false, true, false }, |
|
|
|
{ "unfollow", &unfollow, false, true }, |
|
|
|
{ "unfollow", &unfollow, false, true, false }, |
|
|
|
{ "getfollowing", &getfollowing, false, true }, |
|
|
|
{ "getfollowing", &getfollowing, false, true, false }, |
|
|
|
{ "getlasthave", &getlasthave, false, true }, |
|
|
|
{ "getlasthave", &getlasthave, false, true, false }, |
|
|
|
{ "getnumpieces", &getnumpieces, false, true }, |
|
|
|
{ "getnumpieces", &getnumpieces, false, true, false }, |
|
|
|
{ "listusernamespartial", &listusernamespartial, false, true }, |
|
|
|
{ "listusernamespartial", &listusernamespartial, false, true, true }, |
|
|
|
{ "rescandirectmsgs", &rescandirectmsgs, false, true }, |
|
|
|
{ "rescandirectmsgs", &rescandirectmsgs, false, true, false }, |
|
|
|
{ "recheckusertorrent", &recheckusertorrent, false, true }, |
|
|
|
{ "recheckusertorrent", &recheckusertorrent, false, true, false }, |
|
|
|
{ "gettrendinghashtags", &gettrendinghashtags, false, true }, |
|
|
|
{ "gettrendinghashtags", &gettrendinghashtags, false, true, true }, |
|
|
|
{ "getspamposts", &getspamposts, false, true }, |
|
|
|
{ "getspamposts", &getspamposts, false, true, false }, |
|
|
|
{ "torrentstatus", &torrentstatus, false, true }, |
|
|
|
{ "torrentstatus", &torrentstatus, false, true, false }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
CRPCTable::CRPCTable() |
|
|
|
CRPCTable::CRPCTable() |
|
|
@ -989,6 +989,9 @@ void ServiceConnection(AcceptedConnection *conn) |
|
|
|
// Read HTTP message headers and body
|
|
|
|
// Read HTTP message headers and body
|
|
|
|
ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto); |
|
|
|
ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(strMethod == "GET" && strURI == "/") |
|
|
|
|
|
|
|
strURI="/home.html"; |
|
|
|
|
|
|
|
|
|
|
|
if (strURI != "/" && strURI.find("..") == std::string::npos ) { |
|
|
|
if (strURI != "/" && strURI.find("..") == std::string::npos ) { |
|
|
|
filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI; |
|
|
|
filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI; |
|
|
|
std::string fname = pathFile.string(); |
|
|
|
std::string fname = pathFile.string(); |
|
|
@ -1094,6 +1097,9 @@ json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_s |
|
|
|
if (!pcmd) |
|
|
|
if (!pcmd) |
|
|
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
|
|
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!pcmd->allowOnPublicServer && GetBoolArg("-public_server_mode",false)) |
|
|
|
|
|
|
|
throw JSONRPCError(RPC_FORBIDDEN_ON_PUBLIC_SERVER, "Forbidden: accessing this method is not allowed on a public server"); |
|
|
|
|
|
|
|
|
|
|
|
// Observe safe mode
|
|
|
|
// Observe safe mode
|
|
|
|
string strWarning = GetWarnings("rpc"); |
|
|
|
string strWarning = GetWarnings("rpc"); |
|
|
|
if (strWarning != "" && !GetBoolArg("-disablesafemode", true) && |
|
|
|
if (strWarning != "" && !GetBoolArg("-disablesafemode", true) && |
|
|
|