Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [2.0.1](https://github.com/rdkcentral/rdkNativeScript/compare/2.0...2.0.1)

- RDKEMW-11507: Viper IPA not working with rdknative widget [`#100`](https://github.com/rdkcentral/rdkNativeScript/pull/100)
- Merge tag '2.0' into develop [`51a0410`](https://github.com/rdkcentral/rdkNativeScript/commit/51a04109cb17643687722ed8b96da89929791cfb)

#### [2.0](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.10...2.0)

- RDKEMW-9355: Add Support to run app widgets in different contexts wit… [`#90`](https://github.com/rdkcentral/rdkNativeScript/pull/90)
- RDKEMW-8844: Analyse and Improve L1 coverage [`#79`](https://github.com/rdkcentral/rdkNativeScript/pull/79)
- RDKEMW-9785: Increasing Test Coverage for L1 test [`#95`](https://github.com/rdkcentral/rdkNativeScript/pull/95)
- RDKEMW-11265: Migrate L1 and native build workflow to rdk-e [`#93`](https://github.com/rdkcentral/rdkNativeScript/pull/93)
- RDKEMW-9172: L2testcase for rdkNativeScript [`#91`](https://github.com/rdkcentral/rdkNativeScript/pull/91)
- RDKEMW-9461:Nativescript Minimal build for Coverity [`#84`](https://github.com/rdkcentral/rdkNativeScript/pull/84)
- RDKEMW-9355: Add Support to run app widgets in different contexts within a single process [`f2fbbe9`](https://github.com/rdkcentral/rdkNativeScript/commit/f2fbbe9eec146be3b91a8aa550dddb26ff43d2ff)
- RDKEMW-8844: Improve L1 coverage [`605e0ad`](https://github.com/rdkcentral/rdkNativeScript/commit/605e0ad2b4a9241aeceb5311ac4eaa53dd7b17fd)
- Update src/linux/KeyInput.cpp [`3e0f65c`](https://github.com/rdkcentral/rdkNativeScript/commit/3e0f65cf6a9d560b26e5a0ee6c26350d48046ded)

#### [1.0.10](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.9...1.0.10)

- RDKEMW-9765 : [BUG_FIX]UserAgent string need to be aligned with browser for diff… [`#77`](https://github.com/rdkcentral/rdkNativeScript/pull/77)
- RDKEMW-9765 : [BUG_FIX]UserAgent string need to be aligned with browser for different agents [`881b332`](https://github.com/rdkcentral/rdkNativeScript/commit/881b332528ae114f0a9c2f767c8a1436154d380c)
> 31 October 2025

- RDKEMW-9765 : UserAgent string need to be aligned with browser for diff… [`#77`](https://github.com/rdkcentral/rdkNativeScript/pull/77)
- RDKEMW-9765 : UserAgent string need to be aligned with browser for different agents [`881b332`](https://github.com/rdkcentral/rdkNativeScript/commit/881b332528ae114f0a9c2f767c8a1436154d380c)
- 1.0.10 release changelog updates [`6233823`](https://github.com/rdkcentral/rdkNativeScript/commit/62338232511edac45b4aa7c1a0c1622909c29098)
- Merge tag '1.0.9' into develop [`b60efc0`](https://github.com/rdkcentral/rdkNativeScript/commit/b60efc01bf49975196c7a55aa3e6736af753916b)

#### [1.0.9](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.8...1.0.9)
Expand All @@ -32,13 +52,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 30 September 2025

- DELIA-68967 : Switching between Xumo Fast Channels and Vipa activated… [`#68`](https://github.com/rdkcentral/rdkNativeScript/pull/68)
- RDKEMW-5610 : L1 test cases for jsruntime [`#66`](https://github.com/rdkcentral/rdkNativeScript/pull/66)
- Deploy fossid_integration_stateless_diffscan_target_repo action [`#67`](https://github.com/rdkcentral/rdkNativeScript/pull/67)
- Deploy cla action [`#40`](https://github.com/rdkcentral/rdkNativeScript/pull/40)
- Update CODEOWNERS [`#63`](https://github.com/rdkcentral/rdkNativeScript/pull/63)
- 1.0.7 release changelog updates [`0f3be4f`](https://github.com/rdkcentral/rdkNativeScript/commit/0f3be4fecad9213a4d86c828e978c29199e5d190)
- DELIA-68967 : Switching between Xumo Fast Channels and Vipa activated Channels [`228cf8b`](https://github.com/rdkcentral/rdkNativeScript/commit/228cf8bfdde6d7f7d991805193038b392bc0e89b)
- Merge tag '1.0.6' into develop [`afdf341`](https://github.com/rdkcentral/rdkNativeScript/commit/afdf341c4f81e7019d76f207c7b428dbd0ffc00d)

#### [1.0.6](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.5...1.0.6)
Expand Down Expand Up @@ -115,6 +133,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- RDKEMW-2469 : Merging latest changes of rdknativescript [`#4`](https://github.com/rdkcentral/rdkNativeScript/pull/4)
- RDKEMW-2469 : Merging latest changes of javascriptcore and rdknativescript for rdke build [`#3`](https://github.com/rdkcentral/rdkNativeScript/pull/3)
- Bring latest changes till 2024 [`#2`](https://github.com/rdkcentral/rdkNativeScript/pull/2)
- RDK-56154 Merging all rdknativescript latest changes to rdkcentral github from comcast rdke github [`2542b7c`](https://github.com/rdkcentral/rdkNativeScript/commit/2542b7cac0c0c0dd1aef7d8b158e5dd63b56347e)
- Import of Comcast source (develop) [`dfc9b89`](https://github.com/rdkcentral/rdkNativeScript/commit/dfc9b89df42fb0b844e04624b13808333afb19ce)
- RDK-56154: Merging all rdknativescript latest changes [`0d8189e`](https://github.com/rdkcentral/rdkNativeScript/commit/0d8189e76bdfa9f2cf619af300d95e5ec8f4def9)
29 changes: 27 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ set(JSRUNTIME_APP_FILES

if ( ENABLE_JSRUNTIME_SERVER )
add_definitions("-DENABLE_JSRUNTIME_SERVER")
add_definitions("-DWS_SERVER_PORT=9112")
set (JSRUNTIME_APP_FILES ${JSRUNTIME_APP_FILES}
add_definitions("-DWS_SERVER_PORT=5000")
set (JSRUNTIME_COMMON_FILES ${JSRUNTIME_COMMON_FILES}
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/JSRuntimeServer.cpp
)
endif ( ENABLE_JSRUNTIME_SERVER )
Expand All @@ -134,6 +134,16 @@ add_library(${JSRUNTIME_LIBRARY_NAME} SHARED
${JSRUNTIME_ENGINE_FILES}
)

#JSRUNTIMECLIENTCONTAINER CHANGES
option(BUILD_JSRUNTIME_CONTAINER "BUILD_JSRUNTIME_CONTAINER" ON)
set(JSRUNTIME_CONTAINER_FILES
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/JSRuntimeClientContainer.cpp
)
set(JSRUNTIME_FILES
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/JSRuntimeContainer.cpp
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/NativeJSLogger.cpp
)

set(JSRUNTIME_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include/${JSRUNTIME_ENGINE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include/linux ${CMAKE_CURRENT_SOURCE_DIR}/src/jsc/jsc_lib ${JSRUNTIME_ENGINE_INCLUDE_DIRECTORIES})

set(JSRUNTIME_LIBRARY_LINK_DIRECTORIES ${JSRUNTIME_ENGINE_LIBRARY_LINK_DIRECTORIES})
Expand Down Expand Up @@ -192,6 +202,21 @@ if (BUILD_JSRUNTIME_CLIENT)
target_link_libraries(jsruntime_client ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} ${JSRUNTIME_LINK_ETHANLIB} -lpthread)
endif (BUILD_JSRUNTIME_CLIENT)

set(JSRUNTIMECONTAINER_LIBRARY_NAME "JSRuntimeContainer")

if (BUILD_JSRUNTIME_CONTAINER)
add_library(${JSRUNTIMECONTAINER_LIBRARY_NAME} SHARED ${JSRUNTIME_FILES})
target_include_directories(${JSRUNTIMECONTAINER_LIBRARY_NAME} PRIVATE ${JSRUNTIME_INCLUDE_DIRECTORIES})
target_link_libraries(${JSRUNTIMECONTAINER_LIBRARY_NAME} ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -lpthread)

add_executable(jsruntime_container ${JSRUNTIME_CONTAINER_FILES})
add_dependencies(jsruntime_container ${JSRUNTIMECONTAINER_LIBRARY_NAME})
target_include_directories(jsruntime_container PRIVATE ${JSRUNTIME_INCLUDE_DIRECTORIES})
set_target_properties(jsruntime_container PROPERTIES OUTPUT_NAME "JSRuntimeContainer")
target_link_libraries(jsruntime_container ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -l${JSRUNTIMECONTAINER_LIBRARY_NAME} ${JSRUNTIME_LINK_ETHANLIB} -lpthread)

endif (BUILD_JSRUNTIME_CONTAINER)

set(UWEBSOCKETS_TARGET "Linux")
if (APPLE)
set(UWEBSOCKETS_TARGET "Darwin")
Expand Down
43 changes: 43 additions & 0 deletions include/JSRuntimeContainer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef JSRUNTIMECONTAINER_H
#define JSRUNTIMECONTAINER_H

#include <string>
#include <functional>
#include <map>

class JSRuntimeContainer
{
public:
enum Namespace {
NetworkNamespace = 0x01,
MountNamespace = 0x02,
IpcNamespace = 0x04,
PidNamespace = 0x08,
UserNamespace = 0x10,
UtsNamespace = 0x20
};

// Get container IP address
static std::string getContainerIpAddress(const std::string& containerId);

// Check if container exists
static bool isContainer(const std::string& containerId);

// Execute function in container namespace
static bool nsEnter(const std::string& containerId, Namespace type, const std::function<void()>& func);

// WebSocket client functions
static bool connectAndSend(const std::string& ip, const std::string& message);
static std::string buildLaunchMessage(const std::string& url, const std::string& options);
static std::string parseAppConfig(const std::string& configPath);

private:
// Internal implementation functions
static bool nsEnterImpl(const std::string& containerId, Namespace type, const std::function<void()>& func);
static pid_t findContainerPid(const std::string& containerId);
static bool nsEnterWithPid(pid_t pid, int nsType, const std::function<void()>& func);
static void nsThread(int newNsFd, int nsType, bool* success, const std::function<void()>& func);
};

#endif // JSRUNTIMECONTAINER_H

4 changes: 3 additions & 1 deletion include/JSRuntimeServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#pragma once
#include <NativeJSRenderer.h>
#include <IExternalApplicationHandler.h>

#ifdef USE_WEBSOCKET_MOCK
#include "websocketpp.hpp"
Expand All @@ -40,7 +41,7 @@ class JSRuntimeServer
static JSRuntimeServer *getInstance();
~JSRuntimeServer() = default;

void initialize(int serverport, std::shared_ptr<JsRuntime::NativeJSRenderer> renderer);
void initialize(int serverport, std::shared_ptr<JsRuntime::NativeJSRenderer> renderer, std::shared_ptr<IExternalApplicationHandler> externalHandler = nullptr);
bool start();
bool stop();

Expand Down Expand Up @@ -77,4 +78,5 @@ class JSRuntimeServer
ConnectionSet mConnections;
int mServerPort;
std::shared_ptr<JsRuntime::NativeJSRenderer> mRenderer;
std::shared_ptr<IExternalApplicationHandler> mExternalHandler;
};
31 changes: 31 additions & 0 deletions src/JSRuntimeClientContainer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "JSRuntimeContainer.h"
#include <iostream>
#include <string>
#include <vector>
#include <unistd.h>
#include "NativeJSLogger.h"
int main()
{
std::string containerId = "com.sky.as.apps_TestApp";
const std::string basePath = "/opt/twocontext"; // constant base path
const std::vector<std::string> apps = {"app1", "app2"};

std::string ipAddress = JSRuntimeContainer::getContainerIpAddress(containerId);
if (ipAddress.empty()) {
NativeJSLogger::log(ERROR, "Failed to retrieve IP address for container");
return 1;
}

for (const auto &app : apps) {
std::string url = basePath + std::string("/") + app + std::string("/index.html");
if (access(url.c_str(), F_OK) == 0) {
std::string pathAppConfig = basePath + std::string("/") + app + std::string("/app.config");
std::string options = JSRuntimeContainer::parseAppConfig(pathAppConfig);
std::string message = JSRuntimeContainer::buildLaunchMessage(url, options);
JSRuntimeContainer::connectAndSend(ipAddress, message);
}
}

return 0;
}

Loading