Various fixes for iTwin API
This commit is contained in:
parent
57db116c51
commit
1f019e57b4
|
|
@ -22,6 +22,10 @@ bool parseErrorResponse(
|
|||
"error_description",
|
||||
"");
|
||||
|
||||
if (outError.empty() && outErrorDesc.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& detailsMember = doc.FindMember("details");
|
||||
if (detailsMember != doc.MemberEnd() && detailsMember->value.IsArray()) {
|
||||
for (const auto& value : detailsMember->value.GetArray()) {
|
||||
|
|
@ -42,4 +46,4 @@ bool parseErrorResponse(
|
|||
|
||||
return true;
|
||||
}
|
||||
} // namespace CesiumClientCommon
|
||||
} // namespace CesiumClientCommon
|
||||
|
|
|
|||
|
|
@ -155,7 +155,9 @@ CesiumAsync::Future<Result<OAuth2TokenResponse>> OAuth2PKE::authorize(
|
|||
if (clientOptions.redirectPort) {
|
||||
port = *clientOptions.redirectPort;
|
||||
if (!pServer->bind_to_port("127.0.0.1", port)) {
|
||||
promise.resolve(Result<OAuth2TokenResponse>(ErrorList::error(fmt::format("Internal HTTP server failed to bind to port {}.", port))));
|
||||
promise.resolve(Result<OAuth2TokenResponse>(ErrorList::error(fmt::format(
|
||||
"Internal HTTP server failed to bind to port {}.",
|
||||
port))));
|
||||
return promise.getFuture();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -76,6 +76,12 @@ struct CESIUMGLTFREADER_API GltfReaderOptions {
|
|||
*/
|
||||
bool resolveExternalImages = true;
|
||||
|
||||
/**
|
||||
* @brief Whether to use the query parameters from the base URL when
|
||||
* requesting external glTF assets.
|
||||
*/
|
||||
bool useBaseQuery = true;
|
||||
|
||||
/**
|
||||
* @brief Whether geometry compressed using the `KHR_draco_mesh_compression`
|
||||
* extension should be automatically decoded as part of the load process.
|
||||
|
|
|
|||
|
|
@ -537,7 +537,10 @@ void CesiumGltfReader::GltfReader::postprocessGltf(
|
|||
if (buffer.uri && buffer.uri->substr(0, dataPrefixLength) != dataPrefix) {
|
||||
resolvedBuffers.push_back(
|
||||
pAssetAccessor
|
||||
->get(asyncSystem, Uri::resolve(baseUrl, *buffer.uri), tHeaders)
|
||||
->get(
|
||||
asyncSystem,
|
||||
Uri::resolve(baseUrl, *buffer.uri, options.useBaseQuery),
|
||||
tHeaders)
|
||||
.thenInWorkerThread([pBuffer =
|
||||
&buffer](std::shared_ptr<IAssetRequest>&&
|
||||
pRequest) {
|
||||
|
|
@ -573,7 +576,8 @@ void CesiumGltfReader::GltfReader::postprocessGltf(
|
|||
if (options.resolveExternalImages) {
|
||||
for (Image& image : pResult->model->images) {
|
||||
if (image.uri && image.uri->substr(0, dataPrefixLength) != dataPrefix) {
|
||||
const std::string uri = Uri::resolve(baseUrl, *image.uri);
|
||||
const std::string uri =
|
||||
Uri::resolve(baseUrl, *image.uri, options.useBaseQuery);
|
||||
|
||||
auto getAsset =
|
||||
[&options](
|
||||
|
|
@ -646,7 +650,10 @@ void CesiumGltfReader::GltfReader::postprocessGltf(
|
|||
}
|
||||
};
|
||||
|
||||
std::string uri = Uri::resolve(baseUrl, *pStructuralMetadata->schemaUri);
|
||||
std::string uri = Uri::resolve(
|
||||
baseUrl,
|
||||
*pStructuralMetadata->schemaUri,
|
||||
options.useBaseQuery);
|
||||
|
||||
SharedFuture<ResultPointer<Schema>> future =
|
||||
getAsset(asyncSystem, pAssetAccessor, uri, tHeaders);
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ Connection::listIModels(const std::string& url) {
|
|||
|
||||
const std::vector<CesiumAsync::IAssetAccessor::THeader> headers{
|
||||
{"Authorization", fmt::format("Bearer {}", *tokenResult.value)},
|
||||
{"Accept", "application/vnd.bentley.itwin-platform.v1+json"},
|
||||
{"Accept", "application/vnd.bentley.itwin-platform.v2+json"},
|
||||
{"Prefer", "return=representation"}};
|
||||
|
||||
return pAssetAccessor->get(asyncSystem, url, headers)
|
||||
|
|
@ -453,7 +453,7 @@ Connection::listIModelMeshExports(const std::string& url) {
|
|||
|
||||
items.emplace_back(
|
||||
JsonHelpers::getStringOrDefault(item, "id", ""),
|
||||
JsonHelpers::getStringOrDefault(item, "value", ""),
|
||||
JsonHelpers::getStringOrDefault(item, "displayName", ""),
|
||||
iModelMeshExportStatusFromString(
|
||||
JsonHelpers::getStringOrDefault(item, "status", "")),
|
||||
exportType);
|
||||
|
|
@ -920,4 +920,4 @@ Connection::listAllAvailableResources(
|
|||
return this->_asyncSystem.all(std::move(futures))
|
||||
.thenImmediately(flattenResults);
|
||||
}
|
||||
} // namespace CesiumITwinClient
|
||||
} // namespace CesiumITwinClient
|
||||
|
|
|
|||
Loading…
Reference in New Issue