Skip to content

Commit

Permalink
cloud_py_api 0.1.1 changes (#33)
Browse files Browse the repository at this point in the history
* Removed armv7 OS Arch option

* Fixed regex

* Cloud_Py_API 0.1.1 changes

* Lint fix

* Added changelog

* Added settings texts sync with database

* [ci skip] Updated release date
  • Loading branch information
andrey18106 authored Dec 23, 2022
1 parent 871bf60 commit c79426b
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 38,997 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
IS_NIGHTLY=$(if [[ $APP_VERSION == *"beta"* ]]; then echo "true"; else echo "false"; fi)
echo "::set-output name=version::v${APP_VERSION}"
echo "::set-output name=tag::v${APP_VERSION}"
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION\s.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
if [ "$CHANGELOG" == "" ]; then
echo "changelog is empty!"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tmp
.phpdoc
clover.unit.xml
clover.integration.xml
proto/thrift/gen-*

# Python Part

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [0.1.1 - 2022-12-23]

### Changed

- Changed Admin settings list

## [0.1.0 - 2022-12-18]

This is the first `cloud_py_api` release
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You can support us in several ways:
[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/cloud_py_api/donate)
]]>
</description>
<version>0.1.0</version>
<version>0.1.1</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
Expand Down
38,683 changes: 3 additions & 38,680 deletions js/cloud_py_api-main.js

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions src/store/index.js → js/cloud_py_api-main.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
* @license MIT
*/

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*!
* Vue.js v2.7.14
* (c) 2014-2022 Evan You
* Released under the MIT License.
*/

/*! For license information please see NcCheckboxRadioSwitch.js.LICENSE.txt */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/**
* @copyright Copyright (c) 2022-2023 Andrey Borysenko <[email protected]>
*
Expand All @@ -21,18 +45,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import Vue from 'vue'
import Vuex, { Store } from 'vuex'

import settings from './settings.js'

Vue.use(Vuex)

export default new Store({
modules: {
settings,
},

strict: process.env.NODE_ENV !== 'production',
})
2 changes: 1 addition & 1 deletion js/cloud_py_api-main.js.map

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions lib/Migration/data/AppInitialData.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AppInitialData {
"name" => "python_command",
"value" => "/usr/bin/python3",
"displayName" => "Full path to python interpreter",
"description" => "Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command.",
"description" => "Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command. Used when pre-compiled binaries option is not selected.",
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
],
[
Expand All @@ -62,13 +62,6 @@ class AppInitialData {
"description" => "Absolute path to the PHP executable (e.g. \"/usr/bin/php7.4\"). Can be obtained by `which php` or `which php7.4` command",
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
],
[
"name" => "python_binary",
"value" => true,
"displayName" => "Use pre-compiled Python binaries",
"description" => "Use Python part in binary format (located in the appdata folder)",
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
],
[
"name" => "cpa_loglevel",
"value" => "WARNING",
Expand All @@ -86,7 +79,7 @@ public function __construct(\OCP\IL10N $l10n) {
private function _stringsForL10N(): void {
// TRANSLATORS Admin settings strings for localization (Eng versions stored in the database and translated on front-end)
$this->l10n->t("Full path to python interpreter");
$this->l10n->t("Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command.");
$this->l10n->t("Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command. Used when pre-compiled binaries option is not selected.");
$this->l10n->t("Remote/Encrypted file size limit to process");
$this->l10n->t("Maximum file size for requesting from php core. Used when file hosts on remote NC instance or have encrypted flag. Must be less then total available RAM size.");
$this->l10n->t("Use path to PHP interpreter for Python from settings");
Expand Down
17 changes: 8 additions & 9 deletions lib/Service/ThriftService.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
use Thrift\Server\TServerSocket;
use Thrift\Server\TSimpleServer;
use Thrift\Transport\TBufferedTransport;
use Thrift\Transport\THttpClient;
use Thrift\Transport\TSocket;

class ThriftService {
Expand All @@ -56,7 +55,7 @@ public function runThriftServer(array $params = []): array {
$tfactory = new TTransportFactory($transport);
$pfactory = new TBinaryProtocolFactory(true, true);
$server = new TSimpleServer($processor, $transport, $tfactory, $tfactory, $pfactory, $pfactory);
print('Running Thrift server...');
print('Running Thrift server...' . PHP_EOL);
$server->serve();
} catch (TException $e) {
return [
Expand All @@ -68,20 +67,20 @@ public function runThriftServer(array $params = []): array {

public function runThriftClient(array $params = []): array {
try {
if (isset($params['http'])) {
$socket = new THttpClient('0.0.0.0', 6080, '');
} else {
$socket = new TSocket('0.0.0.0', 7080);
}
$socket = new TSocket('0.0.0.0', 7080);
$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol = new TBinaryProtocol($transport);
$client = new \OCA\Cloud_Py_API\TProto\TestServiceClient($protocol);

$transport->open();
$result = $client->ping(\OCA\Cloud_Py_API\TProto\logLvl::DEBUG);
$client->exit(1);
$client->exit(0);
$transport->close();
return ['success' => $result === 0, 'recieved_ping_response' => $result];

return [
'success' => $result === 0,
'recieved_ping_response' => $result
];
} catch (TException $e) {
return [
'success' => false,
Expand Down
31 changes: 29 additions & 2 deletions lib/Service/UtilsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ public function getOsArch(): string {
return 'amd64';
} elseif (str_contains($machineType, 'arm64')) {
return 'arm64';
} else {
return 'armv7';
}
return $machineType;
}
Expand Down Expand Up @@ -364,6 +362,7 @@ public function getBinaryName(): string {
public function checkForSettingsUpdates($app_data) {
$settings = $this->settingMapper->findAll();
if (count($settings) > 0) {
$this->updateSettingsTexts($app_data, $settings);
$this->checkForNewSettings($app_data, $settings);
$this->checkForDeletedSettings($app_data, $settings);
}
Expand Down Expand Up @@ -417,4 +416,32 @@ private function checkForDeletedSettings(array $app_data, array $settings): void
}
}
}

private function updateSettingsTexts(array $app_data, array $settings) {
$newSettingsKeys = array_map(function ($setting) {
return $setting['name'];
}, $app_data['settings']);
foreach ($settings as $setting) {
if (in_array($setting->getName(), $newSettingsKeys)) {
$newSetting = null;
foreach ($app_data['settings'] as $s) {
if ($s['name'] == $setting->getName()) {
$newSetting = $s;
}
}
if (isset($newSetting)) {
if ($setting->getDescription() !== $newSetting['description']) {
$setting->setDescription($newSetting['description']);
}
if ($setting->getDisplayName() !== $newSetting['displayName']) {
$setting->setDisplayName($newSetting['displayName']);
}
if ($setting->getHelpUrl() !== $newSetting['helpUrl']) {
$setting->setHelpUrl($newSetting['helpUrl']);
}
$this->settingMapper->update($setting);
}
}
}
}
}
4 changes: 2 additions & 2 deletions lib/THandler/TestServiceHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TestServiceHandler implements TestServiceIf {
* @return int
*/
public function ping($logLvl): int {
print('Recieved ping: ' . $logLvl);
print('Recieved ping: ' . $logLvl . PHP_EOL);
return $logLvl;
}

Expand All @@ -45,7 +45,7 @@ public function ping($logLvl): int {
* @return void
*/
public function exit($resultCode): void {
print('Closing with ' . $resultCode . ' result code.');
print('Closing with ' . $resultCode . ' result code.' . PHP_EOL);
exit($resultCode);
}
}
33 changes: 2 additions & 31 deletions lib/TProto/TestServiceClient.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 1 addition & 17 deletions lib/TProto/TestServiceProcessor.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 0 additions & 68 deletions lib/TProto/TestService_exit_result.php

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c79426b

Please sign in to comment.