mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-05-18 07:40:35 +00:00
Merge pull request #5421 from edklesel/access-list-clients-ordered-insert
Access list clients ordered insert
This commit is contained in:
@@ -48,20 +48,17 @@ const internalAccessList = {
|
||||
return true;
|
||||
});
|
||||
|
||||
// Clients
|
||||
data.clients?.map((client) => {
|
||||
promises.push(
|
||||
accessListClientModel.query().insert({
|
||||
access_list_id: row.id,
|
||||
address: client.address,
|
||||
directive: client.directive,
|
||||
}),
|
||||
);
|
||||
return true;
|
||||
});
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
// Clients
|
||||
for (const client of data.clients ?? []) {
|
||||
await accessListClientModel.query().insert({
|
||||
access_list_id: row.id,
|
||||
address: client.address,
|
||||
directive: client.directive,
|
||||
});
|
||||
}
|
||||
|
||||
// re-fetch with expansions
|
||||
const freshRow = await internalAccessList.get(
|
||||
access,
|
||||
@@ -154,25 +151,17 @@ const internalAccessList = {
|
||||
|
||||
// Check for clients and add/update/remove them
|
||||
if (typeof data.clients !== "undefined" && data.clients) {
|
||||
const clientPromises = [];
|
||||
data.clients.map((client) => {
|
||||
if (client.address) {
|
||||
clientPromises.push(
|
||||
accessListClientModel.query().insert({
|
||||
access_list_id: data.id,
|
||||
address: client.address,
|
||||
directive: client.directive,
|
||||
}),
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
const query = accessListClientModel.query().delete().where("access_list_id", data.id);
|
||||
await query;
|
||||
// Add new clitens
|
||||
if (clientPromises.length) {
|
||||
await Promise.all(clientPromises);
|
||||
|
||||
for (const client of data.clients) {
|
||||
if (client.address) {
|
||||
await accessListClientModel.query().insert({
|
||||
access_list_id: data.id,
|
||||
address: client.address,
|
||||
directive: client.directive,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user