Skip to content

Commit c79426b

Browse files
authored
cloud_py_api 0.1.1 changes (#33)
* 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
1 parent 871bf60 commit c79426b

21 files changed

+139
-38997
lines changed

.github/workflows/create-release-draft.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
IS_NIGHTLY=$(if [[ $APP_VERSION == *"beta"* ]]; then echo "true"; else echo "false"; fi)
2323
echo "::set-output name=version::v${APP_VERSION}"
2424
echo "::set-output name=tag::v${APP_VERSION}"
25-
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
25+
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION\s.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
2626
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
2727
if [ "$CHANGELOG" == "" ]; then
2828
echo "changelog is empty!"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ tmp
2828
.phpdoc
2929
clover.unit.xml
3030
clover.integration.xml
31+
proto/thrift/gen-*
3132

3233
# Python Part
3334

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

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

5+
## [0.1.1 - 2022-12-23]
6+
7+
### Changed
8+
9+
- Changed Admin settings list
10+
511
## [0.1.0 - 2022-12-18]
612

713
This is the first `cloud_py_api` release

appinfo/info.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can support us in several ways:
3434
[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/cloud_py_api/donate)
3535
]]>
3636
</description>
37-
<version>0.1.0</version>
37+
<version>0.1.1</version>
3838
<licence>agpl</licence>
3939
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
4040
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>

js/cloud_py_api-main.js

+3-38,680
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/store/index.js renamed to js/cloud_py_api-main.js.LICENSE.txt

+24-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*!
2+
* The buffer module from node.js, for the browser.
3+
*
4+
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
5+
* @license MIT
6+
*/
7+
8+
/*!
9+
* The buffer module from node.js, for the browser.
10+
*
11+
* @author Feross Aboukhadijeh <https://feross.org>
12+
* @license MIT
13+
*/
14+
15+
/*!
16+
* Vue.js v2.7.14
17+
* (c) 2014-2022 Evan You
18+
* Released under the MIT License.
19+
*/
20+
21+
/*! For license information please see NcCheckboxRadioSwitch.js.LICENSE.txt */
22+
23+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
24+
125
/**
226
* @copyright Copyright (c) 2022-2023 Andrey Borysenko <[email protected]>
327
*
@@ -21,18 +45,3 @@
2145
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2246
*
2347
*/
24-
25-
import Vue from 'vue'
26-
import Vuex, { Store } from 'vuex'
27-
28-
import settings from './settings.js'
29-
30-
Vue.use(Vuex)
31-
32-
export default new Store({
33-
modules: {
34-
settings,
35-
},
36-
37-
strict: process.env.NODE_ENV !== 'production',
38-
})

js/cloud_py_api-main.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Migration/data/AppInitialData.php

+2-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AppInitialData {
3838
"name" => "python_command",
3939
"value" => "/usr/bin/python3",
4040
"displayName" => "Full path to python interpreter",
41-
"description" => "Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command.",
41+
"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.",
4242
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
4343
],
4444
[
@@ -62,13 +62,6 @@ class AppInitialData {
6262
"description" => "Absolute path to the PHP executable (e.g. \"/usr/bin/php7.4\"). Can be obtained by `which php` or `which php7.4` command",
6363
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
6464
],
65-
[
66-
"name" => "python_binary",
67-
"value" => true,
68-
"displayName" => "Use pre-compiled Python binaries",
69-
"description" => "Use Python part in binary format (located in the appdata folder)",
70-
"helpUrl" => "https://cloud-py-api.readthedocs.io/{todo-url:/settings/setting_name}"
71-
],
7265
[
7366
"name" => "cpa_loglevel",
7467
"value" => "WARNING",
@@ -86,7 +79,7 @@ public function __construct(\OCP\IL10N $l10n) {
8679
private function _stringsForL10N(): void {
8780
// TRANSLATORS Admin settings strings for localization (Eng versions stored in the database and translated on front-end)
8881
$this->l10n->t("Full path to python interpreter");
89-
$this->l10n->t("Absolute path to the python runnable (e.g. \"/usr/bin/python3\"). Can be obtained by `which python3` command.");
82+
$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.");
9083
$this->l10n->t("Remote/Encrypted file size limit to process");
9184
$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.");
9285
$this->l10n->t("Use path to PHP interpreter for Python from settings");

lib/Service/ThriftService.php

+8-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
use Thrift\Server\TServerSocket;
3939
use Thrift\Server\TSimpleServer;
4040
use Thrift\Transport\TBufferedTransport;
41-
use Thrift\Transport\THttpClient;
4241
use Thrift\Transport\TSocket;
4342

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

6968
public function runThriftClient(array $params = []): array {
7069
try {
71-
if (isset($params['http'])) {
72-
$socket = new THttpClient('0.0.0.0', 6080, '');
73-
} else {
74-
$socket = new TSocket('0.0.0.0', 7080);
75-
}
70+
$socket = new TSocket('0.0.0.0', 7080);
7671
$transport = new TBufferedTransport($socket, 1024, 1024);
7772
$protocol = new TBinaryProtocol($transport);
7873
$client = new \OCA\Cloud_Py_API\TProto\TestServiceClient($protocol);
7974

8075
$transport->open();
8176
$result = $client->ping(\OCA\Cloud_Py_API\TProto\logLvl::DEBUG);
82-
$client->exit(1);
77+
$client->exit(0);
8378
$transport->close();
84-
return ['success' => $result === 0, 'recieved_ping_response' => $result];
79+
80+
return [
81+
'success' => $result === 0,
82+
'recieved_ping_response' => $result
83+
];
8584
} catch (TException $e) {
8685
return [
8786
'success' => false,

lib/Service/UtilsService.php

+29-2
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ public function getOsArch(): string {
202202
return 'amd64';
203203
} elseif (str_contains($machineType, 'arm64')) {
204204
return 'arm64';
205-
} else {
206-
return 'armv7';
207205
}
208206
return $machineType;
209207
}
@@ -364,6 +362,7 @@ public function getBinaryName(): string {
364362
public function checkForSettingsUpdates($app_data) {
365363
$settings = $this->settingMapper->findAll();
366364
if (count($settings) > 0) {
365+
$this->updateSettingsTexts($app_data, $settings);
367366
$this->checkForNewSettings($app_data, $settings);
368367
$this->checkForDeletedSettings($app_data, $settings);
369368
}
@@ -417,4 +416,32 @@ private function checkForDeletedSettings(array $app_data, array $settings): void
417416
}
418417
}
419418
}
419+
420+
private function updateSettingsTexts(array $app_data, array $settings) {
421+
$newSettingsKeys = array_map(function ($setting) {
422+
return $setting['name'];
423+
}, $app_data['settings']);
424+
foreach ($settings as $setting) {
425+
if (in_array($setting->getName(), $newSettingsKeys)) {
426+
$newSetting = null;
427+
foreach ($app_data['settings'] as $s) {
428+
if ($s['name'] == $setting->getName()) {
429+
$newSetting = $s;
430+
}
431+
}
432+
if (isset($newSetting)) {
433+
if ($setting->getDescription() !== $newSetting['description']) {
434+
$setting->setDescription($newSetting['description']);
435+
}
436+
if ($setting->getDisplayName() !== $newSetting['displayName']) {
437+
$setting->setDisplayName($newSetting['displayName']);
438+
}
439+
if ($setting->getHelpUrl() !== $newSetting['helpUrl']) {
440+
$setting->setHelpUrl($newSetting['helpUrl']);
441+
}
442+
$this->settingMapper->update($setting);
443+
}
444+
}
445+
}
446+
}
420447
}

lib/THandler/TestServiceHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TestServiceHandler implements TestServiceIf {
3636
* @return int
3737
*/
3838
public function ping($logLvl): int {
39-
print('Recieved ping: ' . $logLvl);
39+
print('Recieved ping: ' . $logLvl . PHP_EOL);
4040
return $logLvl;
4141
}
4242

@@ -45,7 +45,7 @@ public function ping($logLvl): int {
4545
* @return void
4646
*/
4747
public function exit($resultCode): void {
48-
print('Closing with ' . $resultCode . ' result code.');
48+
print('Closing with ' . $resultCode . ' result code.' . PHP_EOL);
4949
exit($resultCode);
5050
}
5151
}

lib/TProto/TestServiceClient.php

+2-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/TProto/TestServiceProcessor.php

+1-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/TProto/TestService_exit_result.php

-68
This file was deleted.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)