Skip to content

Commit

Permalink
Merge pull request #4371 from LibreSign/backport/4366/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: handle settings after backend upgrade
  • Loading branch information
vitormattos authored Jan 16, 2025
2 parents e506b71 + 1e4f6af commit 846ffdb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions lib/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
use OCP\Files\File;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IAppConfig;
use OCP\IL10N;
use OCP\IPreview;
use OCP\IRequest;
Expand Down Expand Up @@ -80,6 +81,7 @@ public function __construct(
private RequestSignatureService $requestSignatureService,
private AccountService $accountService,
private IPreview $preview,
private IAppConfig $appConfig,
private IMimeIconProvider $mimeIconProvider,
private FileService $fileService,
private ValidateHelper $validateHelper,
Expand Down Expand Up @@ -194,6 +196,10 @@ public function validateBinary(): DataResponse {
#[ApiRoute(verb: 'GET', url: '/api/{apiVersion}/file/validate/', requirements: ['apiVersion' => '(v1)'])]
public function validate(?string $type = null, $identifier = null): DataResponse {
try {
$isValidationUrlPrivate = (bool)$this->appConfig->getValueBool(Application::APP_ID, 'make_validation_url_private', false);
if ($isValidationUrlPrivate) {
throw new LibresignException($this->l10n->t('You are not logged in. Please log in.'));
}
if ($type === 'Uuid' && !empty($identifier)) {
try {
$this->fileService
Expand Down
4 changes: 2 additions & 2 deletions src/views/CreatePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<template #actions>
<NcButton :disabled="hasLoading"
native-type="submit"
@click="send()"
type="primary">
type="primary"
@click="send()">
<template #icon>
<NcLoadingIcon v-if="hasLoading" :size="20" />
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/views/ReadCertificate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<template v-if="Object.keys(certificateData).length === 0" #actions>
<NcButton :disabled="hasLoading"
native-type="submit"
@click="send()"
type="primary">
type="primary"
@click="send()">
<template #icon>
<NcLoadingIcon v-if="hasLoading" :size="20" />
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/views/ResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<NcButton :disabled="!canSave"
:class="hasLoading ? 'btn-load loading primary btn-confirm' : 'primary btn-confirm'"
native-type="submit"
@click="send()"
type="primary">
type="primary"
@click="send()">
<template #icon>
<NcLoadingIcon v-if="hasLoading" :size="20" />
</template>
Expand Down
3 changes: 2 additions & 1 deletion src/views/Settings/CollectMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default {
methods: {
async getData() {
const responseCollectMetadata = await axios.get(generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/collect_metadata'))
this.collectMetadataEnabled = !!responseCollectMetadata.data.ocs.data.data
const value = responseCollectMetadata?.data?.ocs?.data?.data
this.collectMetadataEnabled = value === true || value === 'true'
},
saveCollectMetadata() {
OCP.AppConfig.setValue('libresign', 'collect_metadata', this.collectMetadataEnabled ? 1 : 0)
Expand Down
9 changes: 6 additions & 3 deletions src/views/Settings/Validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,22 @@ export default {
const response = await axios.get(
generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/make_validation_url_private'),
)
this.makeValidationUrlPrivate = response.data.ocs.data.data === true
const value = response?.data?.ocs?.data.data
this.makeValidationUrlPrivate = value === true || value === 'true'
},
async getAddFooterData() {
const response = await axios.get(
generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/add_footer'),
)
this.addFooter = response.data.ocs.data.data !== '0'
const value = response?.data?.ocs?.data.data
this.addFooter = value === true || value === 'true'
},
async getWriteQrcodeOnFooter() {
const response = await axios.get(
generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/write_qrcode_on_footer'),
)
this.writeQrcodeOnFooter = response.data.ocs.data.data !== '0'
const value = response?.data?.ocs?.data.data
this.writeQrcodeOnFooter = value === true || value === 'true'
},
async getValidationUrlData() {
const response = await axios.get(
Expand Down

0 comments on commit 846ffdb

Please sign in to comment.