forked from Segs/Segs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Add initial version of SEGSAdmin script editor, allowing editing of
MOTD.smlx and Tutorial.smlx -Incorporating @nemerles AdminRPC changes -Add two more test methods to AdminRPC. helloServer and getVersion.
- Loading branch information
Showing
29 changed files
with
1,498 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
libname(jcon jcon) | ||
find_package(Qt5 COMPONENTS Network WebSockets Test REQUIRED) | ||
|
||
ExternalProject_Add( | ||
jcon_BUILD | ||
URL "" | ||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jcon-cpp | ||
UPDATE_COMMAND "" | ||
INSTALL_DIR ${ThirdParty_Install_Dir} | ||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_STAGING_PREFIX:PATH=${ThirdParty_Install_Dir} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
CMAKE_GENERATOR "${CMAKE_GENERATOR}" | ||
CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET} | ||
BUILD_BYPRODUCTS ${jcon_LIBRARY_STATIC} | ||
) | ||
add_library(jcon_IMP STATIC IMPORTED GLOBAL) | ||
add_dependencies(jcon_IMP jcon_BUILD) | ||
#TODO: cmake workaround | ||
file(MAKE_DIRECTORY ${ThirdParty_Install_Dir}/include) | ||
set_property(TARGET jcon_IMP PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ThirdParty_Install_Dir}/include) | ||
SET_PROPERTY(TARGET jcon_IMP APPEND PROPERTY IMPORTED_LOCATION ${jcon_LIBRARY_STATIC} ) | ||
set_property(TARGET jcon_IMP APPEND PROPERTY INTERFACE_LINK_LIBRARIES Qt5::Network Qt5::WebSockets Qt5::Test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "AdminRPC.h" | ||
#include "jcon/json_rpc_server.h" | ||
#include "jcon/json_rpc_websocket_server.h" | ||
|
||
#include "AuthHandler.h" | ||
#include "version.h" | ||
|
||
#include <QVariant> | ||
#include <QJsonDocument> | ||
|
||
using namespace jcon; | ||
AdminRPC::AdminRPC() | ||
{ | ||
} | ||
|
||
bool AdminRPC::heyServer() | ||
{ | ||
qDebug() << "Someone said hello !"; | ||
return true; | ||
} | ||
|
||
QString AdminRPC::helloServer() | ||
{ | ||
QString response = "Hello Web Browser!"; | ||
return response; | ||
} | ||
|
||
QString AdminRPC::getVersion() | ||
{ | ||
QString version = VersionInfo::getAuthVersionNumber() + QString(" ") + VersionInfo::getVersionName(); | ||
return version; | ||
} | ||
|
||
void startWebSocketServer(const char *addr, int port) | ||
{ | ||
static jcon::JsonRpcWebSocketServer *m_server; | ||
if(!m_server) | ||
{ | ||
m_server = new JsonRpcWebSocketServer(); | ||
} | ||
m_server->registerServices({ new AdminRPC() }); | ||
m_server->listen(QHostAddress(addr),port); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
#include <QVariant> | ||
|
||
class AdminRPC : public QObject | ||
{ | ||
Q_OBJECT | ||
friend void startWebSocketServer(const char *addr,int port); | ||
class AuthHandler *m_auth_handler; | ||
private: | ||
AdminRPC(); // restrict construction to startWebSocketServer | ||
public: | ||
|
||
Q_INVOKABLE bool heyServer(); | ||
Q_INVOKABLE QString helloServer(); | ||
Q_INVOKABLE QString getVersion(); | ||
}; | ||
|
||
void startWebSocketServer(const char *addr="127.0.0.1",int port=6001); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
Projects/CoX/Utilities/SEGSAdmin/Resources/corner-down-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
Projects/CoX/Utilities/SEGSAdmin/Resources/corner-down-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.