Skip to content

Commit

Permalink
feat: remove sensitive information from api call + version updates (#107
Browse files Browse the repository at this point in the history
)
  • Loading branch information
FlorianRuen authored Dec 10, 2024
2 parents 0c97e65 + 0655827 commit e56104d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"**/*tsconfig.json": true,
".cache": true,
"retool.config.json": true
}
},
"makefile.configureOnOpen": false
}
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>Cidgravity_Gateway</name>
<summary>An application to display files/directory metadata on decentralized web for CIDgravity storage files</summary>
<description>An application to display files/directory metadata on decentralized web for CIDgravity storage files</description>
<version>1.1.6</version>
<version>1.1.7</version>
<licence>agpl</licence>
<author homepage="https://cidgravity.com">CIDgravity</author>
<author>CIDgravity</author>
Expand Down
20 changes: 18 additions & 2 deletions lib/Service/ExternalStorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getMetadataForSpecificFile(IUser $nextcloudUser, int $fileId): a
* @return array
* @throws Exception
*/
public function getExternalStorageConfigurationForSpecificFile(IUser $nextcloudUser, int $fileId, bool $includeAuthSettings): array {
public function getExternalStorageConfigurationForSpecificFile(IUser $nextcloudUser, int $fileId, bool $includeSensitiveSettings): array {
try {
$mountsForFile = $this->userMountCache->getMountsForFileId($fileId, $nextcloudUser->getUID());

Expand All @@ -113,7 +113,11 @@ public function getExternalStorageConfigurationForSpecificFile(IUser $nextcloudU
return ['message' => 'external storage type for file ' . $fileId . ' is not a cidgravity storage', 'error' => 'external_storage_invalid_type'];
}

return $this->buildExternalStorageConfiguration($mountsForFile[0]->getInternalPath(), $externalStorage, $includeAuthSettings);
if ($includeSensitiveSettings) {
return $this->buildExternalStorageConfiguration($mountsForFile[0]->getInternalPath(), $externalStorage, $includeSensitiveSettings);
}

return $this->buildLightExternalStorageConfiguration($externalStorage);

} catch (Exception $e) {
return ['message' => 'error getting external storage config', 'error' => $e->getMessage()];
Expand Down Expand Up @@ -158,4 +162,16 @@ private function buildExternalStorageConfiguration(string $fileInternalPath, Sto

return $configuration;
}

/**
* Construct light specific configuration object from external storage configuration
* @param StorageConfig $externalStorage External storage to build configuration for
* @return array
*/
private function buildLightExternalStorageConfiguration(StorageConfig $externalStorage): array {
$configuration = [];
$configuration['is_cidgravity'] = $externalStorage->getBackend()->getIdentifier() == "cidgravity";
$configuration['default_ipfs_gateway'] = $externalStorage->getBackendOption('default_ipfs_gateway');
return $configuration;
}
}
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.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cidgravity_gateway",
"description": "An application to display files/directory metadata on decentralized web for CIDgravity storage files",
"version": "1.1.6",
"version": "1.1.7",
"author": "CIDgravity <support@cidgravity.com>",
"bugs": {
"url": "https://github.com/CIDgravity/nextcloud-cidgravity-gateway-app"
Expand Down Expand Up @@ -30,8 +30,8 @@
"@nextcloud/dialogs": "^6.0.1",
"@nextcloud/moment": "^1.3.1",
"@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.17.0",
"axios": "^1.7.5",
"@nextcloud/vue": "^8.21.0",
"axios": "^1.7.9",
"moment": "^2.30.1",
"nextcloud-l10n": "^0.1.1",
"stylelint-webpack-plugin": "^5.0.1",
Expand Down Expand Up @@ -59,13 +59,13 @@
"csp-html-webpack-plugin": "^5.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-webpack-plugin": "^4.2.0",
"node-polyfill-webpack-plugin": "^3.0.0",
"sass": "^1.80.6",
"sass-loader": "^13.3.2",
"node-polyfill-webpack-plugin": "^4.1.0",
"sass": "^1.82.0",
"sass-loader": "^16.0.4",
"url-loader": "^4.1.1",
"vue-loader": "^15.11.1",
"vue-template-compiler": "^2.7.16",
"webpack": "^5.96.1",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4",
"webpack-merge": "^6.0.1"
}
Expand Down

0 comments on commit e56104d

Please sign in to comment.