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

[stable28] Check config status after generate certificate #2494

Merged
merged 3 commits into from
Mar 8, 2024
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
3 changes: 3 additions & 0 deletions lib/Service/InstallService.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ public function isDownloadWip(): bool {
}
$pid = isset($progressData['pid']) ? $progressData['pid'] : 0;
if ($this->getInstallPid($pid) === 0) {
if (!array_key_exists('error', $progressData)) {
$this->removeDownloadProgress();
}
continue;
}
return true;
Expand Down
12 changes: 6 additions & 6 deletions src/views/Account/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<h3>{{ t('libresign', 'Certificate') }}</h3>
<LockIcon :size="20" />
<div class="user-display-password">
<NcButton @click="uploadCertificate()"
:wide="true">
<NcButton :wide="true"
@click="uploadCertificate()">
{{ t('libresign', 'Upload certificate') }}
<template #icon>
<CloudUploadIcon :size="20" />
</template>
</NcButton>
<NcButton v-if="signMethodsStore.hasSignatureFile()"
@click="deleteCertificate()"
:wide="true">
:wide="true"
@click="deleteCertificate()">
{{ t('libresign', 'Delete certificate') }}
<template #icon>
<DeleteIcon :size="20" />
Expand All @@ -33,8 +33,8 @@
{{ t('libresign', 'Create certificate') }}
</NcButton>
<NcButton v-else-if="signMethodsStore.hasSignatureFile()"
@click="handleModal(true)"
:wide="true">
:wide="true"
@click="handleModal(true)">
{{ t('librsign', 'Change password') }}
<template #icon>
<FileReplaceIcon :size="20" />
Expand Down
48 changes: 19 additions & 29 deletions src/views/Settings/DownloadBinaries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js'
import { showError } from '@nextcloud/dialogs'
import { generateOcsUrl } from '@nextcloud/router'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import axios from '@nextcloud/axios'
import { set } from 'vue'
import { useConfigureCheckStore } from '../../store/configureCheck.js'
Expand Down Expand Up @@ -66,38 +66,28 @@ export default {
}
},
mounted() {
this.$root.$on('after-config-check', data => {
if (this.downloadInProgress) {
return
}
const java = data.filter((o) => o.resource === 'java' && o.status === 'error').length === 0
const jsignpdf = data.filter((o) => o.resource === 'jsignpdf' && o.status === 'error').length === 0
const cfssl = data.filter((o) => o.resource === 'cfssl' && o.status === 'error').length === 0
if (!java
|| !jsignpdf
|| !cfssl
) {
this.changeState('need download')
} else {
this.changeState('done')
}
})
subscribe('libresign:config-check', this.configureCheck)
},
beforeUnmount() {
unsubscribe('libresign:config-check')
},
methods: {
async downloadAllBinaries() {
async configureCheck() {
this.changeState('in progress')
axios.get(
generateOcsUrl('/apps/libresign/api/v1/admin/download-binaries'),
)
.then(() => {
this.installAndValidate()
})
.catch(({ response }) => {
showError(t('libresign', 'Could not download binaries.'))
if (typeof response?.data === 'object' && response?.data.message.length > 0) {
showError(t('libresign', response.data.message))
axios.get(generateOcsUrl('/apps/libresign/api/v1/admin/configure-check'))
.then(({ data }) => {
this.configureCheckStore.items = data
const java = data.filter((o) => o.resource === 'java' && o.status === 'error').length === 0
const jsignpdf = data.filter((o) => o.resource === 'jsignpdf' && o.status === 'error').length === 0
const cfssl = data.filter((o) => o.resource === 'cfssl' && o.status === 'error').length === 0
if (!java
|| !jsignpdf
|| !cfssl
) {
this.changeState('need download')
} else {
this.changeState('done')
}
this.changeState('need download')
})
},
changeState(state) {
Expand Down
4 changes: 2 additions & 2 deletions src/views/Settings/RootCertificateCfssl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
import CertificateCustonOptions from './CertificateCustonOptions.vue'
import { selectCustonOption } from '../../helpers/certification.js'
Expand Down Expand Up @@ -226,7 +226,7 @@ export default {
}
this.certificate = response.data.data
this.afterCertificateGenerated()
this.$root.$emit('config-check')
emit('libresign:config-check')
return
} catch (e) {
console.error(e)
Expand Down
4 changes: 2 additions & 2 deletions src/views/Settings/RootCertificateOpenSsl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
import CertificateCustonOptions from './CertificateCustonOptions.vue'
import { selectCustonOption } from '../../helpers/certification.js'
Expand Down Expand Up @@ -212,7 +212,7 @@ export default {
}
this.certificate = response.data.data
this.afterCertificateGenerated()
this.$root.$emit('config-check')
emit('libresign:config-check')
return
} catch (e) {
console.error(e)
Expand Down
Loading