From f81fc6e32ee4125a74b3cb622d2ac45423fccf8b Mon Sep 17 00:00:00 2001 From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com> Date: Sat, 4 Jan 2025 02:24:11 -0500 Subject: [PATCH] Enhanced CreateContainer.cmd Made command line case insensitive. Added error handling incase use enters command option where stash port should be. Change command option for creating image from PULL to IMAGE, and left PULL so as to be backward compatible. --- Docker/CreateContainer.cmd | 72 ++++++++++++------- .../DupFileManager/DupFileManager_report.js | 39 ++++++++-- .../DupFileManager_report_header | 7 +- plugins/DupFileManager/README.md | 1 + 4 files changed, 88 insertions(+), 31 deletions(-) diff --git a/Docker/CreateContainer.cmd b/Docker/CreateContainer.cmd index 8a87753..858edb0 100644 --- a/Docker/CreateContainer.cmd +++ b/Docker/CreateContainer.cmd @@ -6,9 +6,10 @@ :: Example with shared mount paths: :: CreateContainer.cmd ContainerName1 "stashapp/stash:latest" 9991 C:\MySharedMountPath C:\Another\Shared\Folder :: Example adding Stash IMAGE and container: -:: CreateContainer.cmd v0.27.2 "stashapp/stash:v0.27.2" 9997 PULL +:: CreateContainer.cmd NewContainer27.2 "stashapp/stash:v0.27.2" 9997 IMAGE +:: Note: The image name (stashapp/stash:v0.27.2) must be an image name listed in following link: https://hub.docker.com/r/stashapp/stash/tags :: Example with DLNA: -:: CreateContainer.cmd v272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA +:: CreateContainer.cmd MyDLNA272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA :: Example skipping docker-compose: :: CreateContainer.cmd ContainerName "stashapp/stash:v0.26.2" 9992 C:\Videos SKIP set NewContainerName=%1 @@ -29,29 +30,40 @@ set SkipDockerCompose= set DLNAFunctionality="no" set PullDockerStashImage= set MountAccess=":ro" -if [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=) -if [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=) -if [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=) -if [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=) -if [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=) -if [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=) -if [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=) -if [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=) -if [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=) -if [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=) -if [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=) -if [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=) -if [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=) -if [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=) -if [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=) -if [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=) -if [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=) -if [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=) -if [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=) -if [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes) -if [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes) -if [%VariableArg%]==[PULL] (set PullDockerStashImage=yes) -if [%VariableArg%]==[WRITE] (set MountAccess=) +if /I [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=) +if /I [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=) +if /I [%SharedMountPath%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=) +if /I [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=) +if /I [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=) +if /I [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=) +if /I [%SharedMountPath2%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath2=) +if /I [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=) +if /I [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=) +if /I [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=) +if /I [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=) +if /I [%SharedMountPath3%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath3=) +if /I [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=) +if /I [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=) +if /I [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=) +if /I [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=) +if /I [%SharedMountPath4%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath4=) +if /I [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=) +if /I [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=) +if /I [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=) +if /I [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=) +if /I [%SharedMountPath5%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath5=) +if /I [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=) +if /I [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=) +if /I [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes) +if /I [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes) +if /I [%VariableArg%]==[IMAGE] (set PullDockerStashImage=yes) +if /I [%VariableArg%]==[PULL] (set PullDockerStashImage=yes) +if /I [%VariableArg%]==[WRITE] (set MountAccess=) +:: If user incorrectly enters below arguments instead of Stash-Port, fetch the values, and let CHECK_STASH_PORT get the required Stash-Port. +if /I [%STASH_PORT%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=) +if /I [%STASH_PORT%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=) +if /I [%STASH_PORT%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=) +if /I [%STASH_PORT%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=) echo SkipDockerCompose = %SkipDockerCompose% ; DLNAFunctionality = %DLNAFunctionality% set DockerComposeFile="docker-compose.yml" @@ -59,18 +71,28 @@ if [%NewContainerName%]==[] goto :MissingArgumentNewContainerName goto :HaveVariableNewContainerName :MissingArgumentNewContainerName set /p NewContainerName="Enter the new container name: " +if [%NewContainerName%]==[] goto :eof :HaveVariableNewContainerName if [%Image%]==[] goto :MissingArgumentImage goto :HaveVariableImage :MissingArgumentImage set /p Image="Enter the image name: " +if [%Image%]==[] goto :eof :HaveVariableImage +:CHECK_STASH_PORT if [%STASH_PORT%]==[] goto :MissingArgumentSTASH_PORT +IF 1%STASH_PORT% NEQ +1%STASH_PORT% goto STASH_PORT_NOT_NUMERIC goto :HaveVariableSTASH_PORT +:STASH_PORT_NOT_NUMERIC +echo Error ****************** +echo Argument #3 requires a numeric value for Stash-Port. You entered "%STASH_PORT%" instead. Please enter a numberic value for Stash Port. :MissingArgumentSTASH_PORT +set STASH_PORT= set /p STASH_PORT="Enter the Stash port number: " +if [%STASH_PORT%]==[] Goto :eof +goto :CHECK_STASH_PORT :HaveVariableSTASH_PORT if exist %NewContainerName%\ ( diff --git a/plugins/DupFileManager/DupFileManager_report.js b/plugins/DupFileManager/DupFileManager_report.js index c746091..2bf9ec6 100644 --- a/plugins/DupFileManager/DupFileManager_report.js +++ b/plugins/DupFileManager/DupFileManager_report.js @@ -3,21 +3,27 @@ var OrgNextPage = null; var OrgHomePage = null; var RemoveToKeepConfirmValue = null; var RemoveValidatePromptValue = null; +var DisableReloadPageValue = null; let thisUrl = "" + window.location; const isAxterCom = (thisUrl.search("axter.com") > -1); console.log("Cookies = " + document.cookie); const StrRemoveToKeepConfirm = "RemoveToKeepConfirm="; const StrRemoveValidatePrompt = "RemoveValidatePrompt="; +const StrDisableReloadPage = "DisableReloadPage="; function SetPaginateButtonChange(){ var chkBxRemoveValid = document.getElementById("RemoveValidatePrompt"); var chkBxDisableDeleteConfirm = document.getElementById("RemoveToKeepConfirm"); + var chkBxDisableReloadPage = document.getElementById("DisableReloadPage"); RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false"; RemoveValidatePromptValue = StrRemoveValidatePrompt + "false"; + DisableReloadPageValue = StrDisableReloadPage + "false"; if (chkBxRemoveValid.checked) RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "true"; if (chkBxDisableDeleteConfirm.checked) RemoveValidatePromptValue = StrRemoveValidatePrompt + "true"; - document.cookie = RemoveToKeepConfirmValue + "&" + RemoveValidatePromptValue + "; SameSite=None; Secure"; + if (chkBxDisableReloadPage != null && chkBxDisableReloadPage.checked) + DisableReloadPageValue = StrDisableReloadPage + "true"; + document.cookie = RemoveToKeepConfirmValue + "&" + RemoveValidatePromptValue + "&" + DisableReloadPageValue + "; SameSite=None; Secure"; console.log("Cookies = " + document.cookie); } function trim(str, ch) { @@ -48,9 +54,11 @@ function RunPluginOperation(Mode, ActionID, button, asyncAjax){ // Mode=Value an $('html').removeClass('wait'); $("body").css("cursor", "default"); } - if (Mode.startsWith("copyScene") || Mode.startsWith("renameFile") || Mode === "clearAllSceneFlags" || Mode.startsWith("clearFlag") || Mode.startsWith("mergeScene") || Mode.startsWith("mergeTags") || (Mode !== "deleteScene" && Mode.startsWith("deleteScene"))) - window.location.reload(); - else if (!chkBxRemoveValid.checked && Mode !== "flagScene") alert("Action " + Mode + " for scene(s) ID# " + ActionID + " complete.\\n\\nResults=" + result); + if (Mode.startsWith("copyScene") || Mode.startsWith("renameFile") || Mode === "clearAllSceneFlags" || Mode.startsWith("clearFlag") || Mode.startsWith("mergeScene") || Mode.startsWith("mergeTags") || (Mode !== "deleteScene" && Mode.startsWith("deleteScene"))){ + const chkBxDisableReloadPage = document.getElementById("DisableReloadPage"); + if (chkBxDisableReloadPage == null || !chkBxDisableReloadPage.checked) + window.location.reload(); + } else if (!chkBxRemoveValid.checked && Mode !== "flagScene") alert("Action " + Mode + " for scene(s) ID# " + ActionID + " complete.\\n\\nResults=" + result); }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log("Ajax failed with Status: " + textStatus + "; Error: " + errorThrown); if (asyncAjax){ @@ -118,6 +126,8 @@ $(document).ready(function(){ console.log("urlParams = " + urlParams); RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false"; RemoveValidatePromptValue = StrRemoveValidatePrompt + "false"; + DisableReloadPageValue = StrDisableReloadPage + "false"; + const chkBxDisableReloadPage = document.getElementById("DisableReloadPage"); var FetchCookies = true; if (urlParams.get('RemoveToKeepConfirm') != null && urlParams.get('RemoveToKeepConfirm') !== ""){ FetchCookies = false; @@ -136,6 +146,15 @@ $(document).ready(function(){ else $( "#RemoveValidatePrompt" ).prop("checked", false); } + if (chkBxDisableReloadPage != null && urlParams.get('DisableReloadPage') != null && urlParams.get('DisableReloadPage') !== ""){ + FetchCookies = false; + DisableReloadPageValue = StrDisableReloadPage + urlParams.get('DisableReloadPage'); + console.log("DisableReloadPageValue = " + DisableReloadPageValue); + if (urlParams.get('DisableReloadPage') === "true") + $( "#DisableReloadPage" ).prop("checked", true); + else + $( "#DisableReloadPage" ).prop("checked", false); + } if (FetchCookies){ console.log("Cookies = " + document.cookie); var cookies = document.cookie; @@ -157,6 +176,15 @@ $(document).ready(function(){ else $( "#RemoveValidatePrompt" ).prop("checked", false); } + if (chkBxDisableReloadPage != null && cookies.indexOf(StrDisableReloadPage) > -1){ + var idx = cookies.indexOf(StrDisableReloadPage) + StrDisableReloadPage.length; + var s = cookies.substring(idx); + console.log("StrDisableReloadPage Cookie = " + s); + if (s.startsWith("true")) + $( "#DisableReloadPage" ).prop("checked", true); + else + $( "#DisableReloadPage" ).prop("checked", false); + } } SetPaginateButtonChange(); function ProcessClick(This_){ @@ -254,4 +282,7 @@ $(document).ready(function(){ $("#RemoveToKeepConfirm").change(function() { SetPaginateButtonChange(); }); + $("#DisableReloadPage").change(function() { + SetPaginateButtonChange(); + }); }); diff --git a/plugins/DupFileManager/DupFileManager_report_header b/plugins/DupFileManager/DupFileManager_report_header index 67aee0e..9373897 100644 --- a/plugins/DupFileManager/DupFileManager_report_header +++ b/plugins/DupFileManager/DupFileManager_report_header @@ -120,8 +120,11 @@ var GraphQl_URL = "http://localhost:9999/graphql"; -