mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 19:01:02 +01:00
fix: weird hmr env var behaviour for isDev on upgrades page resolved
This commit is contained in:
@@ -144,13 +144,11 @@ export const actions: Actions = {
|
||||
return fail(400, { error: `Upgrade not yet supported for ${instance.type}` });
|
||||
}
|
||||
|
||||
// Check for dev mode override
|
||||
const formData = await request.formData();
|
||||
const devOverride = formData.get('devOverride') === 'true';
|
||||
const isDev = import.meta.env.DEV;
|
||||
// Check for dev mode - in dev mode, allow manual runs even without dry run
|
||||
const isDev = import.meta.env.VITE_CHANNEL === 'dev';
|
||||
|
||||
// Only allow manual runs in dry run mode (or dev mode with override)
|
||||
if (!config.dryRun && !(isDev && devOverride)) {
|
||||
// Only allow manual runs in dry run mode (or dev mode)
|
||||
if (!config.dryRun && !isDev) {
|
||||
return fail(400, {
|
||||
error: 'Manual runs only allowed in Dry Run mode. Enable Dry Run first.'
|
||||
});
|
||||
@@ -159,7 +157,7 @@ export const actions: Actions = {
|
||||
try {
|
||||
await logger.debug(`Manual upgrade run triggered for "${instance.name}"`, {
|
||||
source: 'upgrades',
|
||||
meta: { instanceId: id, dryRun: config.dryRun, devOverride }
|
||||
meta: { instanceId: id, dryRun: config.dryRun, isDev }
|
||||
});
|
||||
|
||||
const result = await processUpgradeConfig(config, instance, true);
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
// Track if config exists
|
||||
$: isNewConfig = !data.config;
|
||||
|
||||
// Dev mode check
|
||||
const isDev = import.meta.env.DEV;
|
||||
// Dev mode check - use VITE_CHANNEL which is explicitly set in dev mode
|
||||
const isDev = import.meta.env.VITE_CHANNEL === 'dev';
|
||||
|
||||
let showInfoModal = false;
|
||||
let saving = false;
|
||||
@@ -118,7 +118,7 @@
|
||||
iconColor="text-red-600 dark:text-red-400"
|
||||
disabled={running || saving || $isDirty}
|
||||
on:click={() => {
|
||||
const runForm = document.getElementById('dev-run-form');
|
||||
const runForm = document.getElementById('run-form');
|
||||
if (runForm instanceof HTMLFormElement) {
|
||||
runForm.requestSubmit();
|
||||
}
|
||||
@@ -205,7 +205,7 @@
|
||||
<input type="hidden" name="filterMode" value={filterMode} />
|
||||
<input type="hidden" name="filters" value={JSON.stringify(filters)} />
|
||||
</form>
|
||||
{#if !isNewConfig && data.config?.dryRun}
|
||||
{#if !isNewConfig && (data.config?.dryRun || isDev)}
|
||||
<form
|
||||
id="run-form"
|
||||
method="POST"
|
||||
@@ -219,6 +219,8 @@
|
||||
};
|
||||
}}
|
||||
></form>
|
||||
{/if}
|
||||
{#if !isNewConfig && data.config?.dryRun}
|
||||
<form
|
||||
id="clear-cache-form"
|
||||
method="POST"
|
||||
@@ -232,22 +234,6 @@
|
||||
};
|
||||
}}
|
||||
></form>
|
||||
{:else if !isNewConfig && isDev}
|
||||
<form
|
||||
id="dev-run-form"
|
||||
method="POST"
|
||||
action="?/run"
|
||||
class="hidden"
|
||||
use:enhance={() => {
|
||||
running = true;
|
||||
return async ({ update }) => {
|
||||
await update({ reset: false });
|
||||
running = false;
|
||||
};
|
||||
}}
|
||||
>
|
||||
<input type="hidden" name="devOverride" value="true" />
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
<UpgradesInfoModal bind:open={showInfoModal} />
|
||||
|
||||
Reference in New Issue
Block a user