diff --git a/web/components/UserProfile/CallbackFeedback.vue b/web/components/UserProfile/CallbackFeedback.vue index eeabd0644..3c37a50ef 100644 --- a/web/components/UserProfile/CallbackFeedback.vue +++ b/web/components/UserProfile/CallbackFeedback.vue @@ -62,6 +62,7 @@ const { } = storeToRefs(serverStore); const { status: updateOsStatus, + callbackTypeDowngrade, callbackUpdateRelease, } = storeToRefs(updateOsActionStore); /** @@ -78,7 +79,7 @@ const isSettingsPage = ref(document.location.pathname === '/Settings/Ma const heading = computed(() => { if (updateOsStatus.value === 'confirming') { - return props.t('Update Unraid OS confirmation required'); + return callbackTypeDowngrade.value ? props.t('Downgrade Unraid OS confirmation required') : props.t('Update Unraid OS confirmation required'); } switch (callbackStatus.value) { case 'error': @@ -91,7 +92,7 @@ const heading = computed(() => { }); const subheading = computed(() => { if (updateOsStatus.value === 'confirming') { - return props.t('Please confirm the update details below'); + return callbackTypeDowngrade.value ? props.t('Please confirm the downgrade details below') : props.t('Please confirm the update details below'); } if (callbackStatus.value === 'error') { return props.t('Something went wrong'); /** @todo show actual error messages */ @@ -317,7 +318,7 @@ const showUpdateEligibility = computed(() => {

- {{ t('This update will require a reboot') }} + {{ callbackTypeDowngrade ? t('This downgrade will require a reboot') : t('This update will require a reboot') }}

@@ -367,7 +368,7 @@ const showUpdateEligibility = computed(() => { /> diff --git a/web/store/callback.ts b/web/store/callback.ts index a9b092d53..19f3492b9 100644 --- a/web/store/callback.ts +++ b/web/store/callback.ts @@ -23,6 +23,7 @@ export type Redeem = 'redeem'; export type Renew = 'renew'; export type Upgrade = 'upgrade'; export type UpdateOs = 'updateOs'; +export type DowngradeOs = 'downgradeOs'; export type Manage = 'manage'; export type MyKeys = 'myKeys'; export type LinkKey = 'linkKey'; @@ -119,7 +120,7 @@ export interface ExternalKeyActions { } export interface ExternalUpdateOsAction { - type: UpdateOs; + type: DowngradeOs | UpdateOs; sha256: string; } diff --git a/web/store/callbackActions.ts b/web/store/callbackActions.ts index a613c0b6f..075d3466d 100644 --- a/web/store/callbackActions.ts +++ b/web/store/callbackActions.ts @@ -86,9 +86,9 @@ export const useCallbackActionsStore = defineStore('callbackActions', () => { await accountStore.setQueueConnectSignOut(true); } - if (action.type === 'updateOs') { + if (action.type === 'updateOs' || action.type === 'downgradeOs') { updateOsActionsStore.setUpdateOsAction(action as ExternalUpdateOsAction); - await updateOsActionsStore.actOnUpdateOsAction(); + await updateOsActionsStore.actOnUpdateOsAction(action.type === 'downgradeOs'); if (array.length === 1) { // only 1 action, skip refresh server state console.debug('[redirectToCallbackType] updateOs done'); diff --git a/web/store/updateOsActions.ts b/web/store/updateOsActions.ts index 3e01a5bf0..31354f884 100644 --- a/web/store/updateOsActions.ts +++ b/web/store/updateOsActions.ts @@ -57,6 +57,7 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => { const updateOsAvailable = computed(() => updateOsStore.available); /** used when coming back from callback, this will be the release to install */ const status = ref<'confirming' | 'checking' | 'ineligible' | 'failed' | 'ready' | 'success' | 'updating' | 'downgrading'>('ready'); + const callbackTypeDowngrade = ref(false); const callbackUpdateRelease = ref(null); const rebootType = computed(() => serverStore.rebootType); const rebootTypeText = computed(() => { @@ -150,11 +151,14 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => { setStatus('confirming'); }; - const actOnUpdateOsAction = async () => { + const actOnUpdateOsAction = async (downgrade: boolean = false) => { const foundRelease = await getReleaseFromKeyServer({ keyfile: keyfile.value, sha256: updateAction.value?.sha256 ?? '', }); + if (downgrade) { + callbackTypeDowngrade.value = true; + } console.debug('[redirectToCallbackType] updateOs foundRelease', foundRelease); if (!foundRelease) { throw new Error('Release not found'); @@ -172,7 +176,7 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => { setStatus('updating'); installPlugin({ - modalTitle: `${callbackUpdateRelease.value.name} Update`, + modalTitle: callbackTypeDowngrade.value ? `${callbackUpdateRelease.value.name} Downgrade` : `${callbackUpdateRelease.value.name} Update`, pluginUrl: callbackUpdateRelease.value.plugin_url, update: false, }); @@ -211,6 +215,7 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => { return { // State + callbackTypeDowngrade, callbackUpdateRelease, osVersion, osVersionBranch,