From 4d73488f0c219efc249333fcc1510ddfdf3d87f2 Mon Sep 17 00:00:00 2001 From: Jan-Filip Grosse Date: Sun, 4 Jan 2026 17:13:29 +0100 Subject: [PATCH] updated the sync and creation of new rules objects to include priorities passed by blueprints. --- server/lib/blueprints/proxyResources.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/lib/blueprints/proxyResources.ts b/server/lib/blueprints/proxyResources.ts index a8f2f4b5..0ae4c529 100644 --- a/server/lib/blueprints/proxyResources.ts +++ b/server/lib/blueprints/proxyResources.ts @@ -587,13 +587,15 @@ export async function updateProxyResources( // Sync rules for (const [index, rule] of resourceData.rules?.entries() || []) { + const intendedPriority = rule.priority ?? index + 1; const existingRule = existingRules[index]; if (existingRule) { if ( existingRule.action !== getRuleAction(rule.action) || existingRule.match !== rule.match.toUpperCase() || existingRule.value !== - getRuleValue(rule.match.toUpperCase(), rule.value) + getRuleValue(rule.match.toUpperCase(), rule.value) || + existingRule.priority !== intendedPriority ) { validateRule(rule); await trx @@ -604,7 +606,8 @@ export async function updateProxyResources( value: getRuleValue( rule.match.toUpperCase(), rule.value - ) + ), + priority: intendedPriority }) .where( eq(resourceRules.ruleId, existingRule.ruleId) @@ -620,7 +623,7 @@ export async function updateProxyResources( rule.match.toUpperCase(), rule.value ), - priority: index + 1 // start priorities at 1 + priority: intendedPriority }); } } @@ -809,7 +812,7 @@ export async function updateProxyResources( action: getRuleAction(rule.action), match: rule.match.toUpperCase(), value: getRuleValue(rule.match.toUpperCase(), rule.value), - priority: index + 1 // start priorities at 1 + priority: rule.priority ?? index + 1 }); }