Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix: handle settings after backend upgrade #4371

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading