Skip to content

Commit 598c343

Browse files
committed
make addition of check_remote_access idempotent
1 parent 27eb583 commit 598c343

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

api/src/unraid-api/unraid-file-modifier/modifications/rc-nginx.modification.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export default class RcNginxModification extends FileModification {
3939
API_UTILS="/usr/local/share/dynamix.unraid.net/scripts/api_utils.sh"`
4040
);
4141

42-
newContent = newContent.replace(
43-
'# create listening ports',
44-
`# check if remote access should be enabled
42+
if (!newContent.includes('check_remote_access()')) {
43+
newContent = newContent.replace(
44+
'# create listening ports',
45+
`# check if remote access should be enabled
4546
check_remote_access(){
4647
# Check if connect plugin is enabled using api_utils.sh
4748
if [[ -f $API_UTILS ]] && $API_UTILS is_api_plugin_enabled "unraid-api-plugin-connect"; then
@@ -58,8 +59,9 @@ check_remote_access(){
5859
return 1
5960
}
6061
61-
# create listening ports`
62-
);
62+
# create listening ports`
63+
);
64+
}
6365

6466
newContent = newContent.replace(
6567
`if [[ -L /usr/local/sbin/unraid-api ]] && grep -qs 'wanaccess="yes"' $MYSERVERS && ! grep -qs 'username=""' $MYSERVERS; then`,

0 commit comments

Comments
 (0)