aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--cli/main.cpp2
-rw-r--r--diceparser.cpp5
-rw-r--r--parsingtoolbox.cpp3
-rw-r--r--webserver/diceserver.cpp10
4 files changed, 16 insertions, 4 deletions
diff --git a/cli/main.cpp b/cli/main.cpp
index 7a5ed97..1b9fdad 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -268,7 +268,7 @@ int main(int argc, char *argv[])
if(!cmd.isEmpty())
{
startDiceParsing(cmd,dotFileStr,colorb);
- if(cmd=="help")
+ if(optionParser.isSet(help))
{
usage();
}
diff --git a/diceparser.cpp b/diceparser.cpp
index e71a24c..f2e3104 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -682,7 +682,10 @@ bool DiceParser::readCommand(QString& str,ExecutionNode* & node)
if(str== QLatin1String("help"))
{
HelpNode* help = new HelpNode();
- help->setHelpPath(m_helpPath);
+ if(!m_helpPath.isEmpty())
+ {
+ help->setHelpPath(m_helpPath);
+ }
node = help;
}
diff --git a/parsingtoolbox.cpp b/parsingtoolbox.cpp
index 8bd52b7..1d5e7ef 100644
--- a/parsingtoolbox.cpp
+++ b/parsingtoolbox.cpp
@@ -334,7 +334,6 @@ bool ParsingToolBox::readString(QString &str, QString& strResult)
if(str.startsWith('"'))
{
str=str.remove(0,1);
- }
int i=0;
int j=0;
@@ -373,6 +372,8 @@ bool ParsingToolBox::readString(QString &str, QString& strResult)
return true;
}
}
+ }
+
return false;
}
diff --git a/webserver/diceserver.cpp b/webserver/diceserver.cpp
index 7332f81..c1e1ca0 100644
--- a/webserver/diceserver.cpp
+++ b/webserver/diceserver.cpp
@@ -9,6 +9,8 @@
DiceServer::DiceServer(int port)
: QObject(),m_diceParser(new DiceParser())
{
+
+ m_diceParser->setPathToHelp("<span><a href=\"https://github.com/Rolisteam/DiceParser/blob/master/HelpMe.md\">Documentation</a>");
// using namespace ;
m_server = new qhttp::server::QHttpServer(this);
m_server->listen( // listening on 0.0.0.0:8080
@@ -36,15 +38,21 @@ DiceServer::DiceServer(int port)
{
qDebug() << QUrl::fromPercentEncoding(m_hashArgs["cmd"].toLocal8Bit());
QString result = startDiceParsing(QUrl::fromPercentEncoding(m_hashArgs["cmd"].toLocal8Bit()));
+ qDebug() << result;
res->setStatusCode(qhttp::ESTATUS_OK);
+ res->addHeader("Access-Control-Allow-Origin", "*");
+ res->addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
+ res->addHeader("Access-Control-Allow-Headers", "x-requested-with");
+
+
QString html("<!doctype html>\n"
"<html>\n"
"<head>\n"
- "</head>\n"
" <meta charset=\"utf-8\">\n"
" <title>Rolisteam Dice System Webservice</title>\n"
" <style>.dice {color:#FF0000;font-weight: bold;}</style>"
+ "</head>\n"
"<body>\n"
"%1\n"
"</body>\n"