Skip to content

Commit 68f6463

Browse files
committed
Merge branch 'release/1.0.9'
2 parents ff5fffb + 85fcc69 commit 68f6463

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@ All notable changes to this project will be documented in this file. Dates are d
44

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

7+
#### [1.0.9](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.8...1.0.9)
8+
9+
- RDK-59629 : UserAgent string need to be aligned with browser for diff… [`#74`](https://github.com/rdkcentral/rdkNativeScript/pull/74)
10+
- RDK-59629 : UserAgent string need to be aligned with browser for different agents [`55af0ec`](https://github.com/rdkcentral/rdkNativeScript/commit/55af0ec4471fa402421f3dd29370712e23e452b9)
11+
- Merge tag '1.0.8' into develop [`bad6257`](https://github.com/rdkcentral/rdkNativeScript/commit/bad62579572069c5a3f06bb70c0152022ddc7ce7)
12+
713
#### [1.0.8](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.7...1.0.8)
814

15+
> 8 October 2025
16+
917
- RDKEMW-8952 : Switching between Xumo Fast Channels and Vipa activated… [`#71`](https://github.com/rdkcentral/rdkNativeScript/pull/71)
1018
- RDKEMW-8952 : Switching between Xumo Fast Channels and Vipa activated Channels [`505914d`](https://github.com/rdkcentral/rdkNativeScript/commit/505914dbfa6dbe842c7ec46e169ccca47ca6032b)
19+
- 1.0.8 release changelog updates [`ca57a38`](https://github.com/rdkcentral/rdkNativeScript/commit/ca57a38905f7004614ded25722f1769e0f117ca0)
1120
- Merge tag '1.0.7' into develop [`d367c14`](https://github.com/rdkcentral/rdkNativeScript/commit/d367c14f8efa22be9632ba692ed658321402a0e3)
1221

1322
#### [1.0.7](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.6...1.0.7)
1423

1524
> 30 September 2025
1625
17-
- RDKEMW-8952 : Switching between Xumo Fast Channels and Vipa activated… [`#68`](https://github.com/rdkcentral/rdkNativeScript/pull/68)
26+
- DELIA-68967 : Switching between Xumo Fast Channels and Vipa activated… [`#68`](https://github.com/rdkcentral/rdkNativeScript/pull/68)
1827
- RDKEMW-5610 : L1 test cases for jsruntime [`#66`](https://github.com/rdkcentral/rdkNativeScript/pull/66)
1928
- Deploy fossid_integration_stateless_diffscan_target_repo action [`#67`](https://github.com/rdkcentral/rdkNativeScript/pull/67)
2029
- Deploy cla action [`#40`](https://github.com/rdkcentral/rdkNativeScript/pull/40)
2130
- Update CODEOWNERS [`#63`](https://github.com/rdkcentral/rdkNativeScript/pull/63)
2231
- 1.0.7 release changelog updates [`0f3be4f`](https://github.com/rdkcentral/rdkNativeScript/commit/0f3be4fecad9213a4d86c828e978c29199e5d190)
23-
- RDKEMW-8952 : Switching between Xumo Fast Channels and Vipa activated Channels [`228cf8b`](https://github.com/rdkcentral/rdkNativeScript/commit/228cf8bfdde6d7f7d991805193038b392bc0e89b)
32+
- DELIA-68967 : Switching between Xumo Fast Channels and Vipa activated Channels [`228cf8b`](https://github.com/rdkcentral/rdkNativeScript/commit/228cf8bfdde6d7f7d991805193038b392bc0e89b)
2433
- Merge tag '1.0.6' into develop [`afdf341`](https://github.com/rdkcentral/rdkNativeScript/commit/afdf341c4f81e7019d76f207c7b428dbd0ffc00d)
2534

2635
#### [1.0.6](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.5...1.0.6)
@@ -44,7 +53,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4453
> 7 September 2025
4554
4655
- RDKEMW-7489: Adding Href support [`#54`](https://github.com/rdkcentral/rdkNativeScript/pull/54)
47-
- RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
56+
- Ticket:RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
4857
- 1.0.4 release changelog updates [`2e56742`](https://github.com/rdkcentral/rdkNativeScript/commit/2e56742d0adda04fe61277fa0782e2b5b2dde19c)
4958
- Merge tag '1.0.3' into develop [`e15828d`](https://github.com/rdkcentral/rdkNativeScript/commit/e15828d5a330b072753e682f5c446b0f9ae14531)
5059

include/NativeJSRenderer.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace JsRuntime {
9292

9393
struct ApplicationRequest
9494
{
95-
ApplicationRequest(uint32_t id, RequestType requestType, std::string url="", bool enableHttp=false, bool enableXHR=false, bool enableWebSocket=false, bool enableWebSocketEnhanced=false, bool enableFetch=false, bool enableJSDOM=false, bool enableWindow=false, bool enablePlayer=false): mId(id), mRequestType(requestType), mUrl(url), mEnableHttp(enableHttp), mEnableXHR(enableXHR), mEnableWebSocket(enableWebSocket), mEnableWebSocketEnhanced(enableWebSocketEnhanced), mEnableFetch(enableFetch), mEnableJSDOM(enableJSDOM), mEnableWindow(enableWindow), mEnablePlayer(enablePlayer)
95+
ApplicationRequest(uint32_t id, RequestType requestType, std::string url="", bool enableHttp=false, bool enableXHR=false, bool enableWebSocket=false, bool enableWebSocketEnhanced=false, bool enableFetch=false, bool enableJSDOM=false, bool enableWindow=false, bool enablePlayer=false, std::string userAgent=""): mId(id), mRequestType(requestType), mUrl(url), mEnableHttp(enableHttp), mEnableXHR(enableXHR), mEnableWebSocket(enableWebSocket), mEnableWebSocketEnhanced(enableWebSocketEnhanced), mEnableFetch(enableFetch), mEnableJSDOM(enableJSDOM), mEnableWindow(enableWindow), mEnablePlayer(enablePlayer), mUserAgent(userAgent)
9696
{
9797
}
9898
uint32_t mId;
@@ -106,6 +106,8 @@ namespace JsRuntime {
106106
bool mEnableJSDOM;
107107
bool mEnableWindow;
108108
bool mEnablePlayer;
109+
std::string mUserAgent;
110+
109111
};
110112
struct ApplicationData{
111113
std::string url;
@@ -123,10 +125,11 @@ namespace JsRuntime {
123125
void setEnvForConsoleMode(ModuleSettings& moduleSettings);
124126
bool runApplication(uint32_t id, std::string url);
125127
bool runJavaScript(uint32_t id, std::string code);
126-
uint32_t createApplication(ModuleSettings& moduleSettings) ;
128+
uint32_t createApplication(ModuleSettings& moduleSettings, std::string userAgent) ;
127129
bool terminateApplication(uint32_t id);
128130
std::list<ApplicationDetails> getApplications();
129131
void setExternalApplicationHandler(std::shared_ptr<IExternalApplicationHandler> handler);
132+
std::string getBaseUserAgent();
130133
private:
131134
bool downloadFile(std::string& url, MemoryStruct& chunk);
132135
void processDevConsoleRequests();
@@ -151,5 +154,6 @@ namespace JsRuntime {
151154
std::map<uint32_t, ApplicationData> mContextMap;
152155
std::vector<ApplicationRequest> gPendingRequests;
153156
std::shared_ptr<IExternalApplicationHandler> mExternalApplicationHandler;
157+
std::string mBaseUserAgent;
154158
};
155159
};

src/JSRuntimeServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void JSRuntimeServer::onMessage(websocketpp::connection_hdl hdl, message_ptr msg
217217
std::string options = jParams.getString("moduleSettings", error);
218218
ModuleSettings moduleSettings;
219219
moduleSettings.fromString(options);
220-
uint32_t id = mRenderer->createApplication(moduleSettings);
220+
uint32_t id = mRenderer->createApplication(moduleSettings, mRenderer->getBaseUserAgent());
221221
mRenderer->runApplication(id, url);
222222
std::ostringstream oss;
223223
oss<< "ID : " << id;
@@ -237,7 +237,7 @@ void JSRuntimeServer::onMessage(websocketpp::connection_hdl hdl, message_ptr msg
237237
}
238238
ModuleSettings moduleSettings;
239239
moduleSettings.fromString(options);
240-
uint32_t id = mRenderer->createApplication(moduleSettings);
240+
uint32_t id = mRenderer->createApplication(moduleSettings,mRenderer->getBaseUserAgent());
241241
std::ostringstream oss;
242242
oss<< "ID : " << id;
243243
result = oss.str();

src/NativeJSRenderer.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ NativeJSRenderer::NativeJSRenderer(std::string waylandDisplay): mEngine(nullptr)
103103
}
104104

105105
const char* levelFromEnv = getenv("NATIVEJS_LOG_LEVEL");
106+
107+
//setting the base userAgent value
108+
mBaseUserAgent = "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15 ";
109+
106110
// checking for ethan log env
107111
#ifdef USE_ETHANLOG
108112
NativeJSLogger::isEthanLogEnabled();
@@ -214,12 +218,12 @@ uint32_t NativeJSRenderer::createApplicationIdentifier()
214218
return ret;
215219
}
216220

217-
uint32_t NativeJSRenderer::createApplication(ModuleSettings& moduleSettings)
221+
uint32_t NativeJSRenderer::createApplication(ModuleSettings& moduleSettings, std::string userAgent)
218222
{
219223
uint32_t id=0;
220224
mUserMutex.lock();
221225
id = createApplicationIdentifier();
222-
ApplicationRequest request(id, CREATE, "", moduleSettings.enableHttp, moduleSettings.enableXHR, moduleSettings.enableWebSocket, moduleSettings.enableWebSocketEnhanced, moduleSettings.enableFetch, moduleSettings.enableJSDOM, moduleSettings.enableWindow, moduleSettings.enablePlayer);
226+
ApplicationRequest request(id, CREATE, "", moduleSettings.enableHttp, moduleSettings.enableXHR, moduleSettings.enableWebSocket, moduleSettings.enableWebSocketEnhanced, moduleSettings.enableFetch, moduleSettings.enableJSDOM, moduleSettings.enableWindow, moduleSettings.enablePlayer, userAgent);
223227
gPendingRequests.push_back(request);
224228
mUserMutex.unlock();
225229
return id;
@@ -289,15 +293,20 @@ void NativeJSRenderer::createApplicationInternal(ApplicationRequest& appRequest)
289293
settings.enableWindow = appRequest.mEnableWindow;
290294
settings.enablePlayer = appRequest.mEnablePlayer;
291295
uint32_t id= appRequest.mId;
292-
296+
std::string userAgent = appRequest.mUserAgent;
293297
JavaScriptContextFeatures features(mEmbedThunderJS, mEmbedRdkWebBridge, mEnableWebSocketServer, settings);
294298
JavaScriptContext* context = new JavaScriptContext(features, "" , mEngine);
295299
if(NULL == context)
296300
{
297301
NativeJSLogger::log(DEBUG, "Context not created for ID: %d\n", id);
298302
return ;
299303
}
300-
NativeJSLogger::log(DEBUG, "Context created for ID: %d\n", id);
304+
305+
std::stringstream uagent;
306+
uagent << "window.navigator.userAgent = \"" << userAgent << "\";";
307+
context->runScript(uagent.str().c_str(),true, userAgent, nullptr, true);
308+
309+
NativeJSLogger::log(DEBUG, "Context created for ID: %d\n", id);
301310
if (mExternalApplicationHandler) {
302311
context->setExternalApplicationHandler(mExternalApplicationHandler);
303312
}
@@ -619,3 +628,9 @@ void NativeJSRenderer::setExternalApplicationHandler(std::shared_ptr<IExternalAp
619628
{
620629
mExternalApplicationHandler = handler;
621630
}
631+
632+
std::string NativeJSRenderer::getBaseUserAgent()
633+
{
634+
return mBaseUserAgent;
635+
}
636+

src/jsruntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int main(int argc, char* argv[])
134134

135135
applicationThreads.emplace_back([renderer, url, &moduleSettings]() {
136136
NativeJSLogger::log(INFO, "Application URL is %s\n", (url.size() ? url.c_str() : "empty"));
137-
uint32_t id = renderer->createApplication(moduleSettings);
137+
uint32_t id = renderer->createApplication(moduleSettings,renderer->getBaseUserAgent());
138138
renderer->runApplication(id, url);
139139
//renderer->runJavaScript(id,url);
140140
#if defined(NATIVEJS_DEVELOPER_MODE)

0 commit comments

Comments
 (0)