diff --git a/.github/workflows/pull-request-from-branch-check.yaml b/.github/workflows/pull-request-from-branch-check.yaml index 77d1970f..401de613 100644 --- a/.github/workflows/pull-request-from-branch-check.yaml +++ b/.github/workflows/pull-request-from-branch-check.yaml @@ -1,18 +1,18 @@ name: Main Branch Protection -on: - pull_request: - branches: - - main +#on: +# pull_request: +# branches: +# - main -jobs: - check-branch: - runs-on: ubuntu-latest - steps: - - name: Check branch - run: | - if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; - then - echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch" - exit 1 - fi +#jobs: +# check-branch: +# runs-on: ubuntu-latest +# steps: +# - name: Check branch +# run: | +# if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; +# then +# echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch" +# exit 1 +# fi diff --git a/appinfo/info.xml b/appinfo/info.xml index e1dcf26d..768b23e0 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -13,7 +13,7 @@ The OpenConnector Nextcloud app provides a ESB-framework to work together in an - 🆓 Map and translate API calls ]]> - 0.1.16 + 0.1.20 agpl integration Conduction diff --git a/lib/Migration/Version1Date20241111144800.php b/lib/Migration/Version1Date20241111144800.php index 9eb4651d..10a6768c 100644 --- a/lib/Migration/Version1Date20241111144800.php +++ b/lib/Migration/Version1Date20241111144800.php @@ -101,7 +101,7 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array && $table->hasColumn('source_id') === true && $table->hasColumn('source_hash') === true ) { $this->connection->executeQuery(" - UPDATE openconnector_synchronization_contracts + UPDATE oc_openconnector_synchronization_contracts SET origin_id = source_id, origin_hash = source_hash WHERE source_id IS NOT NULL "); diff --git a/lib/Service/CallService.php b/lib/Service/CallService.php index b86d1843..e40bc951 100644 --- a/lib/Service/CallService.php +++ b/lib/Service/CallService.php @@ -249,6 +249,8 @@ public function call( $time_end = microtime(true); + $body = $response->getBody()->getContents(); + // Let create the data array $data = [ 'request' => [ @@ -263,7 +265,8 @@ public function call( 'size' => $response->getBody()->getSize(), 'remoteIp' => $response->getHeaderLine('X-Real-IP') ?: $response->getHeaderLine('X-Forwarded-For') ?: null, 'headers' => $response->getHeaders(), - 'body' => $response->getBody()->getContents(), + 'body' => mb_check_encoding(value: $body, encoding: 'UTF-8') !== false ? $body : base64_encode($body), + 'encoding' => mb_check_encoding(value: $body, encoding: 'UTF-8') !== false ? 'UTF-8' : 'base64', ] ]; diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php index e9a4b42e..5e3f1838 100644 --- a/lib/Service/SynchronizationService.php +++ b/lib/Service/SynchronizationService.php @@ -311,7 +311,6 @@ public function synchronizeContract(SynchronizationContract $synchronizationCont // Let create a source hash for the object $originHash = md5(serialize($object)); - $synchronizationContract->setSourceLastChecked(new DateTime()); // Let's prevent pointless updates @todo account for omnidirectional sync, unless the config has been updated since last check then we do want to rebuild and check if the tagert object has changed if ($originHash === $synchronizationContract->getOriginHash() && $synchronization->getUpdated() < $synchronizationContract->getSourceLastChecked()) { @@ -322,6 +321,7 @@ public function synchronizeContract(SynchronizationContract $synchronizationCont // The object has changed, oke let do mappig and bla die bla $synchronizationContract->setOriginHash($originHash); $synchronizationContract->setSourceLastChanged(new DateTime()); + $synchronizationContract->setSourceLastChecked(new DateTime()); // Check if object adheres to conditions. // Take note, JsonLogic::apply() returns a range of return types, so checking it with '=== false' or '!== true' does not work properly. diff --git a/lib/Settings/OpenConnectorAdmin.php b/lib/Settings/OpenConnectorAdmin.php index e69de29b..4e35c3fa 100644 --- a/lib/Settings/OpenConnectorAdmin.php +++ b/lib/Settings/OpenConnectorAdmin.php @@ -0,0 +1,43 @@ +config = $config; + $this->l = $l; + } + + /** + * @return TemplateResponse + */ + public function getForm() { + $parameters = [ + 'mySetting' => $this->config->getSystemValue('open_connector_setting', true), + ]; + + return new TemplateResponse('openconnector', 'settings/admin', $parameters, ''); + } + + public function getSection() { + return 'openconnector'; // Name of the previously created section. + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 10; + } +}