react-native-windows 0.72.28 → 0.72.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Common.vcxproj +6 -1
- package/Common/Common.vcxproj.filters +3 -0
- package/Common/Utilities.cpp +59 -0
- package/Common/utilities.h +11 -0
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +4 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/BaseFileReaderResource.cpp +4 -16
- package/Shared/Modules/FileReaderModule.cpp +0 -6
- package/Shared/Networking/DefaultBlobResource.cpp +4 -5
- package/Shared/Networking/WinRTWebSocketResource.cpp +26 -5
- package/Shared/Shared.vcxitems.filters +0 -2
- package/package.json +1 -1
package/Common/Common.vcxproj
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
string literals. It prevents code like
|
|
65
65
|
wchar_t* str = L"hello";
|
|
66
66
|
from compiling. -->
|
|
67
|
-
<AdditionalOptions>%(AdditionalOptions) /Zc:strictStrings</AdditionalOptions>
|
|
67
|
+
<AdditionalOptions>%(AdditionalOptions) /Zc:strictStrings /await</AdditionalOptions>
|
|
68
68
|
</ClCompile>
|
|
69
69
|
<Link>
|
|
70
70
|
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
|
@@ -78,12 +78,17 @@
|
|
|
78
78
|
</ItemDefinitionGroup>
|
|
79
79
|
<ItemGroup>
|
|
80
80
|
<ClCompile Include="Unicode.cpp" />
|
|
81
|
+
<ClCompile Include="Utilities.cpp" />
|
|
81
82
|
</ItemGroup>
|
|
82
83
|
<ItemGroup>
|
|
83
84
|
<ClInclude Include="Unicode.h" />
|
|
84
85
|
<ClInclude Include="Utilities.h" />
|
|
85
86
|
</ItemGroup>
|
|
86
87
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
88
|
+
<ItemGroup>
|
|
89
|
+
<PackageReference Include="boost" Version="1.76.0.0" />
|
|
90
|
+
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
|
|
91
|
+
</ItemGroup>
|
|
87
92
|
<ImportGroup Label="ExtensionTargets">
|
|
88
93
|
</ImportGroup>
|
|
89
94
|
<Target Name="Deploy" />
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "Utilities.h"
|
|
5
|
+
|
|
6
|
+
// Boost Library
|
|
7
|
+
#include <boost/archive/iterators/base64_from_binary.hpp>
|
|
8
|
+
#include <boost/archive/iterators/binary_from_base64.hpp>
|
|
9
|
+
#include <boost/archive/iterators/ostream_iterator.hpp>
|
|
10
|
+
#include <boost/archive/iterators/transform_width.hpp>
|
|
11
|
+
|
|
12
|
+
// Windows API
|
|
13
|
+
#include <winrt/Windows.Security.Cryptography.h>
|
|
14
|
+
|
|
15
|
+
// Standard Library
|
|
16
|
+
#include <sstream>
|
|
17
|
+
|
|
18
|
+
using std::string;
|
|
19
|
+
using std::string_view;
|
|
20
|
+
using std::wstring_view;
|
|
21
|
+
using winrt::array_view;
|
|
22
|
+
|
|
23
|
+
using winrt::Windows::Security::Cryptography::BinaryStringEncoding;
|
|
24
|
+
using winrt::Windows::Security::Cryptography::CryptographicBuffer;
|
|
25
|
+
|
|
26
|
+
namespace Microsoft::React::Utilities {
|
|
27
|
+
|
|
28
|
+
string DecodeBase64(string_view base64) noexcept {
|
|
29
|
+
typedef array_view<char const> av_t;
|
|
30
|
+
auto bytes = av_t(base64.data(), static_cast<av_t::size_type>(base64.size()));
|
|
31
|
+
|
|
32
|
+
using namespace boost::archive::iterators;
|
|
33
|
+
typedef transform_width<binary_from_base64<const char *>, 8, 6> decode_base64;
|
|
34
|
+
std::ostringstream oss;
|
|
35
|
+
std::copy(decode_base64(bytes.cbegin()), decode_base64(bytes.cend()), ostream_iterator<char>(oss));
|
|
36
|
+
|
|
37
|
+
return oss.str();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// https://www.boost.org/doc/libs/1_76_0/libs/serialization/doc/dataflow.html
|
|
41
|
+
string EncodeBase64(string_view text) noexcept {
|
|
42
|
+
typedef array_view<char const> av_t;
|
|
43
|
+
auto bytes = av_t(text.data(), static_cast<av_t::size_type>(text.size()));
|
|
44
|
+
|
|
45
|
+
using namespace boost::archive::iterators;
|
|
46
|
+
typedef base64_from_binary<transform_width<const char *, 6, 8>> encode_base64;
|
|
47
|
+
std::ostringstream oss;
|
|
48
|
+
std::copy(encode_base64(bytes.cbegin()), encode_base64(bytes.cend()), ostream_iterator<char>(oss));
|
|
49
|
+
|
|
50
|
+
// https://unix.stackexchange.com/questions/631501
|
|
51
|
+
auto padLength = (4 - (oss.tellp() % 4)) % 4;
|
|
52
|
+
for (auto i = 0; i < padLength; ++i) {
|
|
53
|
+
oss << '=';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return oss.str();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
} // namespace Microsoft::React::Utilities
|
package/Common/utilities.h
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
|
+
|
|
6
|
+
// Standard Library
|
|
7
|
+
#include <string>
|
|
5
8
|
#include <type_traits>
|
|
6
9
|
#include <utility>
|
|
7
10
|
|
|
@@ -37,3 +40,11 @@ constexpr std::size_t ArraySize(T (&)[N]) noexcept {
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
} // namespace Microsoft::Common::Utilities
|
|
43
|
+
|
|
44
|
+
namespace Microsoft::React::Utilities {
|
|
45
|
+
|
|
46
|
+
std::string DecodeBase64(std::string_view text) noexcept;
|
|
47
|
+
|
|
48
|
+
std::string EncodeBase64(std::string_view text) noexcept;
|
|
49
|
+
|
|
50
|
+
} // namespace Microsoft::React::Utilities
|
|
@@ -278,7 +278,9 @@ void UISchedulerWinRT::Shutdown() noexcept {
|
|
|
278
278
|
|
|
279
279
|
void UISchedulerWinRT::AwaitTermination() noexcept {
|
|
280
280
|
Shutdown();
|
|
281
|
-
|
|
281
|
+
if (m_threadId != std::this_thread::get_id()) {
|
|
282
|
+
m_terminationEvent.Wait();
|
|
283
|
+
}
|
|
282
284
|
}
|
|
283
285
|
|
|
284
286
|
/*static*/ DispatchQueue UISchedulerWinRT::GetOrCreateUIThreadQueue() noexcept {
|
|
@@ -343,7 +345,7 @@ void UISchedulerWinRT::CleanupContext::CheckTermination() noexcept {
|
|
|
343
345
|
}
|
|
344
346
|
|
|
345
347
|
//=============================================================================
|
|
346
|
-
// DispatchQueueStatic::
|
|
348
|
+
// DispatchQueueStatic::GetCurrentUIThreadQueue implementation
|
|
347
349
|
//=============================================================================
|
|
348
350
|
|
|
349
351
|
DispatchQueue DispatchQueueStatic::GetCurrentUIThreadQueue() noexcept {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.72.
|
|
13
|
+
<ReactNativeWindowsVersion>0.72.30</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>72</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>30</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>26ed970fceeb6617477a575238c746aadf4a6a12</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "BaseFileReaderResource.h"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
#include <boost/archive/iterators/base64_from_binary.hpp>
|
|
8
|
-
#include <boost/archive/iterators/ostream_iterator.hpp>
|
|
9
|
-
#include <boost/archive/iterators/transform_width.hpp>
|
|
6
|
+
#include <utilities.h>
|
|
10
7
|
|
|
11
8
|
// Windows API
|
|
12
9
|
#include <winrt/base.h>
|
|
@@ -73,18 +70,9 @@ void BaseFileReaderResource::ReadAsDataUrl(
|
|
|
73
70
|
result += type;
|
|
74
71
|
result += ";base64,";
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
std::ostringstream oss;
|
|
80
|
-
std::copy(encode_base64(bytes.cbegin()), encode_base64(bytes.cend()), ostream_iterator<char>(oss));
|
|
81
|
-
result += oss.str();
|
|
82
|
-
|
|
83
|
-
// https://unix.stackexchange.com/questions/631501
|
|
84
|
-
auto padLength = 4 - (oss.tellp() % 4);
|
|
85
|
-
for (auto i = 0; i < padLength; ++i) {
|
|
86
|
-
result += '=';
|
|
87
|
-
}
|
|
73
|
+
auto chars = reinterpret_cast<const char *>(bytes.data());
|
|
74
|
+
auto view = std::string_view(chars, bytes.size());
|
|
75
|
+
result += Utilities::EncodeBase64(view);
|
|
88
76
|
|
|
89
77
|
resolver(std::move(result));
|
|
90
78
|
}
|
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
#include <CreateModules.h>
|
|
7
7
|
#include <ReactPropertyBag.h>
|
|
8
|
-
#include <sstream>
|
|
9
|
-
|
|
10
|
-
// Boost Library
|
|
11
|
-
#include <boost/archive/iterators/base64_from_binary.hpp>
|
|
12
|
-
#include <boost/archive/iterators/ostream_iterator.hpp>
|
|
13
|
-
#include <boost/archive/iterators/transform_width.hpp>
|
|
14
8
|
|
|
15
9
|
// React Native
|
|
16
10
|
#include <cxxreact/JsArgumentHelpers.h>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <Modules/IHttpModuleProxy.h>
|
|
7
7
|
#include <Modules/IWebSocketModuleProxy.h>
|
|
8
|
+
#include <utilities.h>
|
|
8
9
|
|
|
9
10
|
// Boost Libraries
|
|
10
11
|
#include <boost/uuid/uuid_io.hpp>
|
|
@@ -95,11 +96,9 @@ void DefaultBlobResource::SendOverSocket(string &&blobId, int64_t offset, int64_
|
|
|
95
96
|
return m_callbacks.OnError(e.what());
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
auto
|
|
99
|
-
auto
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
wsProxy->SendBinary(std::move(base64String), socketId);
|
|
99
|
+
auto chars = reinterpret_cast<const char *>(data.data());
|
|
100
|
+
auto view = std::string_view(chars, data.size());
|
|
101
|
+
wsProxy->SendBinary(Utilities::EncodeBase64(view), socketId);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
void DefaultBlobResource::CreateFromParts(msrn::JSValueArray &&parts, string &&blobId) noexcept /*override*/ {
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
#include <Utils/CppWinrtLessExceptions.h>
|
|
8
8
|
#include <Utils/WinRTConversions.h>
|
|
9
9
|
|
|
10
|
+
// Boost Libraries
|
|
11
|
+
#include <boost/algorithm/string.hpp>
|
|
12
|
+
|
|
10
13
|
// MSO
|
|
11
14
|
#include <dispatchQueue/dispatchQueue.h>
|
|
12
15
|
|
|
@@ -16,9 +19,6 @@
|
|
|
16
19
|
#include <winrt/Windows.Foundation.Collections.h>
|
|
17
20
|
#include <winrt/Windows.Security.Cryptography.h>
|
|
18
21
|
|
|
19
|
-
// Standard Library
|
|
20
|
-
#include <sstream>
|
|
21
|
-
|
|
22
22
|
using Microsoft::Common::Utilities::CheckedReinterpretCast;
|
|
23
23
|
|
|
24
24
|
using std::function;
|
|
@@ -352,8 +352,12 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
|
|
|
352
352
|
|
|
353
353
|
m_readyState = ReadyState::Connecting;
|
|
354
354
|
|
|
355
|
+
bool hasOriginHeader = false;
|
|
355
356
|
for (const auto &header : options) {
|
|
356
357
|
m_socket.SetRequestHeader(header.first, winrt::to_hstring(header.second));
|
|
358
|
+
if (boost::iequals(header.first, L"Origin")) {
|
|
359
|
+
hasOriginHeader = true;
|
|
360
|
+
}
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
winrt::Windows::Foundation::Collections::IVector<winrt::hstring> supportedProtocols =
|
|
@@ -362,11 +366,26 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
|
|
|
362
366
|
supportedProtocols.Append(winrt::to_hstring(protocol));
|
|
363
367
|
}
|
|
364
368
|
|
|
365
|
-
m_connectRequested = true;
|
|
366
|
-
|
|
367
369
|
Uri uri{nullptr};
|
|
368
370
|
try {
|
|
369
371
|
uri = Uri{winrt::to_hstring(url)};
|
|
372
|
+
|
|
373
|
+
// #12626 - If Origin header is not provided, set to connect endpoint.
|
|
374
|
+
if (!hasOriginHeader) {
|
|
375
|
+
auto scheme = uri.SchemeName();
|
|
376
|
+
auto host = uri.Host();
|
|
377
|
+
auto port = uri.Port();
|
|
378
|
+
|
|
379
|
+
if (scheme == L"ws") {
|
|
380
|
+
scheme = L"http";
|
|
381
|
+
} else if (scheme == L"wss") {
|
|
382
|
+
scheme = L"https";
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
auto origin = winrt::hstring{scheme + L"://" + host + L":" + winrt::to_hstring(port)};
|
|
386
|
+
m_socket.SetRequestHeader(L"Origin", std::move(origin));
|
|
387
|
+
}
|
|
388
|
+
|
|
370
389
|
} catch (hresult_error const &e) {
|
|
371
390
|
if (m_errorHandler) {
|
|
372
391
|
m_errorHandler({Utilities::HResultToString(e), ErrorType::Connection});
|
|
@@ -380,6 +399,8 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
|
|
|
380
399
|
return;
|
|
381
400
|
}
|
|
382
401
|
|
|
402
|
+
m_connectRequested = true;
|
|
403
|
+
|
|
383
404
|
PerformConnect(std::move(uri));
|
|
384
405
|
}
|
|
385
406
|
|
|
@@ -271,8 +271,6 @@
|
|
|
271
271
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\DefaultBlobResource.cpp">
|
|
272
272
|
<Filter>Source Files\Networking</Filter>
|
|
273
273
|
</ClCompile>
|
|
274
|
-
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewProps.cpp" />
|
|
275
|
-
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewEventEmitter.cpp" />
|
|
276
274
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\BlobCollector.cpp">
|
|
277
275
|
<Filter>Source Files\Modules</Filter>
|
|
278
276
|
</ClCompile>
|