aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-09-24 23:15:49 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-09-24 23:15:49 +0200
commitbaeb89675e8d06266ea1fbfe287c2b9f839b3ce8 (patch)
tree8ac9ce9c927d831604f9c470f30d6c42adcef383
parentb92f3d1d6ad49881eb31ac911a8ad368743af108 (diff)
downloadSouthRPC-baeb89675e8d06266ea1fbfe287c2b9f839b3ce8.tar.gz
SouthRPC-baeb89675e8d06266ea1fbfe287c2b9f839b3ce8.zip
rebrand, fix comments, add thunderstore structure creation
-rw-r--r--README.md5
-rw-r--r--cmake/FindRapidJSON.cmake2
-rw-r--r--cmake/R2plugin.cmake59
-rw-r--r--icon.pngbin0 -> 12379 bytes
-rw-r--r--src/CMakeLists.txt9
5 files changed, 57 insertions, 18 deletions
diff --git a/README.md b/README.md
index fd4434b..d1e7c26 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,4 @@
-# South-RPC
+# SouthRPC
+
+SouthRPC is a plugin for Northstar that adds RPC over HTTP through JSON-RPC 2.0
+This allows for external programs to execute code within Northstar
diff --git a/cmake/FindRapidJSON.cmake b/cmake/FindRapidJSON.cmake
index 857bc9e..dd99b55 100644
--- a/cmake/FindRapidJSON.cmake
+++ b/cmake/FindRapidJSON.cmake
@@ -1,4 +1,4 @@
-### Get same spdlog as Northstar
+### Get same RapidJSON as Northstar
if (RapidJSON_FOUND)
return()
diff --git a/cmake/R2plugin.cmake b/cmake/R2plugin.cmake
index cb0496e..cd665a6 100644
--- a/cmake/R2plugin.cmake
+++ b/cmake/R2plugin.cmake
@@ -14,7 +14,7 @@ if (NOT WIN32)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
message(FATAL_ERROR "Northstar Plugins can only be build for x86_64")
elseif (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
- message(WARNING "Titanfall and Northstar are built using MSVC, other compilers may not work.")
+ message(WARNING "Titanfall and Northstar are built using MSVC, other compilers may not produce a working plugin.")
endif ()
if (__R2PLUGIN_CMAKE_INCLUDED)
@@ -129,26 +129,18 @@ BEGIN
END
")
-set(MANIFEST_TEMPLATE
- "{
+set(MANIFEST_TEMPLATE "
+ {
+ \"name\": \"NSPlugin\",
+ \"displayname\": \"Northstar Plugin\",
\"description\": \"\",
\"api_version\": \"2\",
\"version\": \"0\",
\"run_on_server\": false,
\"run_on_client\": false
- }"
+ }\n"
)
-list(APPEND
- REQUIRED_MANIFEST_KEYS
- name
- displayname
- description
- api_version
- version
- run_on_server
- run_on_client
-)
macro(plugin_manifest TARGET KEY VALUE)
if (NOT ${TARGET}_MANIFEST)
set(${TARGET}_MANIFEST "${MANIFEST_TEMPLATE}")
@@ -172,6 +164,10 @@ macro(plugin_manifest TARGET KEY VALUE)
endmacro()
macro(plugin_link TARGET)
+ if (NOT ${TARGET}_MANIFEST)
+ message(FATAL_ERROR "No Plugin manifest found")
+ endif()
+
if("C" IN_LIST languages)
target_link_libraries(${TARGET} ${PLUGIN_C_LINK_FLAGS})
endif()
@@ -191,3 +187,38 @@ macro(plugin_link TARGET)
file(WRITE "${MANIFEST_DIR}/manifest.rc" "${RESOURCE_TEMPLATE}")
target_sources(${TARGET} PUBLIC "${MANIFEST_DIR}/manifest.rc")
endmacro()
+
+macro(plugin_thunderstore TARGET WEBSITE_URL README ICON)
+ if (NOT ${TARGET}_MANIFEST)
+ message(FATAL_ERROR "No Plugin manifest found")
+ endif()
+
+ string(JSON PLUGIN_NAME GET "${${TARGET}_MANIFEST}" name)
+ string(JSON PLUGIN_DESCRIPTION GET "${${TARGET}_MANIFEST}" description)
+ string(JSON PLUGIN_VERSION GET "${${TARGET}_MANIFEST}" version)
+
+ set(THUNDERSTORE_TEMPLATE "
+ {
+ \"name\": \"kyurid\",
+ \"version_number\": \"\",
+ \"website_url\": \"${WEBSITE_URL}\",
+ \"description\": \"\",
+ \"dependencies\": []
+ }\n"
+ )
+ # do this to reformat the template
+ string(JSON THUNDERSTORE_TEMPLATE SET "${THUNDERSTORE_TEMPLATE}" name "\"${PLUGIN_NAME}\"")
+ string(JSON THUNDERSTORE_TEMPLATE SET "${THUNDERSTORE_TEMPLATE}" version_number "\"${PLUGIN_VERSION}\"")
+ string(JSON THUNDERSTORE_TEMPLATE SET "${THUNDERSTORE_TEMPLATE}" description "\"${PLUGIN_DESCRIPTION}\"")
+
+ set(MOD_DIR "${CMAKE_BINARY_DIR}/${TARGET}_mod/")
+ set(MOD_PLUG_DIR "${MOD_DIR}/plugins")
+
+ file(MAKE_DIRECTORY "${MOD_DIR}")
+ file(MAKE_DIRECTORY "${MOD_PLUG_DIR}")
+ file(WRITE "${MOD_DIR}/manifest.json" "${THUNDERSTORE_TEMPLATE}")
+ file(COPY_FILE ${README} "${MOD_DIR}/README.md")
+ file(COPY_FILE ${ICON} "${MOD_DIR}/icon.png")
+
+ install(TARGETS ${TARGET} RUNTIME DESTINATION "${MOD_PLUG_DIR}")
+endmacro() \ No newline at end of file
diff --git a/icon.png b/icon.png
new file mode 100644
index 0000000..63a30f5
--- /dev/null
+++ b/icon.png
Binary files differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 674d664..6e2ad25 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,8 +5,8 @@ find_package(RapidJSON REQUIRED)
plugin_manifest(SouthRPC name "SouthRPC")
plugin_manifest(SouthRPC displayname "SouthRPC")
-plugin_manifest(SouthRPC description "Implements JSON-RPC Bridge for Northstar over TCP/IP")
-plugin_manifest(SouthRPC run_on_server OFF)
+plugin_manifest(SouthRPC description "Implements JSON-RPC 2.0 Bridge for Northstar over HTTP 1.1")
+plugin_manifest(SouthRPC run_on_server ON) # Insecure but sure
plugin_manifest(SouthRPC run_on_client ON)
add_library(SouthRPC SHARED
@@ -23,3 +23,8 @@ target_link_libraries(SouthRPC ws2_32)
target_precompile_headers(SouthRPC PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ns_plugin.h)
plugin_link(SouthRPC)
+plugin_thunderstore(SouthRPC
+ "https://github.com/Jan200101/SouthRPC"
+ "${PROJECT_SOURCE_DIR}/README.md"
+ "${PROJECT_SOURCE_DIR}/icon.png"
+)