diff --git a/AI_DNA.md b/AI_DNA.md index 387f643..406185d 100644 --- a/AI_DNA.md +++ b/AI_DNA.md @@ -7,7 +7,7 @@ Short reference so an AI or new dev can understand and modify this project witho - **Electron** desktop app (Windows). One window; no browser opened. - Connects to **localhost:1947** sessions/config pages in a **hidden webview**. - **On startup:** Loads config page → ensures “Table Rows per Page” = 100 → submits if changed → loads sessions page. -- **When Monitor ON:** Every 60s reloads sessions page; scans table rows; **clicks Disconnect** on rows whose text contains any of the **target keywords**. +- **When Monitor ON:** Every 60s reloads sessions page; scans table rows; **clicks Disconnect** when **Product** contains **PTW70** and **Feature** matches **TARGET_KEYWORDS** (substring) or modules **19**/**9** (exact). - **UI:** Left = “Logged in” (by user); Right = “Activity log”; bottom = Monitor ON/OFF + Clear. Uses **powerSaveBlocker** so Windows/display don’t sleep while the app runs. ## Tech stack @@ -30,7 +30,7 @@ Short reference so an AI or new dev can understand and modify this project witho ## Important conventions -- **Keywords:** Edit **inject.js** only — array `TARGET_KEYWORDS`. Row is disconnected if `row.innerText` contains any keyword. +- **Keywords:** Edit **inject.js** — `TARGET_KEYWORDS` (Feature substring) and `TARGET_FEATURE_IDS`. Disconnect only if Product contains `PTW70` and Feature matches (see `matchesPtw70FeatureKeyword` / `matchesFeatureId`). - **Config check:** In **renderer.js**, `ensureConfigThenSessions()` runs on config.html load; sets `#linesperpage` to 100 and clicks Submit if needed, then navigates webview to sessions. - **URLs:** Config = `http://localhost:1947/_int_/config.html`, Sessions = `http://localhost:1947/_int_/sessions.html`. Defined in renderer.js. - **Log/sessions bridge:** Inject script pushes to `__ptw_logQueue` and exposes `__ptw_flushLogs()` / `__ptw_getSessions()`. Renderer polls via `webview.executeJavaScript()` and updates DOM. diff --git a/README.md b/README.md index 0d2b565..0b197b7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di ## Features -- **Auto-disconnect** — When Monitor is ON, scans the sessions table and clicks Disconnect on rows containing any of the target keywords. +- **Auto-disconnect** — When Monitor is ON, scans the sessions table and clicks Disconnect on **PTW70** product rows whose **Feature** matches the configured list (or modules 19 / 9). - **Logged in** — Left panel shows who is logged in, grouped by user, with product/feature per session. - **Activity log** — Right panel shows timestamps and disconnect/refresh events. - **Config on startup** — On launch, checks `http://localhost:1947/_int_/config.html` and ensures **Table Rows per Page** is set to **100** (and submits if changed). @@ -13,7 +13,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di ## Target keywords (disconnect when present) -Matching uses the **Feature** column only (not the whole row). Product text such as `1 PTW70` is not searched for keywords. +Applies only when **Product** contains **`PTW70`** (e.g. `1 PTW70`). Matching uses the **Feature** column only (substring for the list below; exact cell for modules 19 and 9). - PTW_DATAEXCHANGE - PTW_ARC_FLASH @@ -25,7 +25,7 @@ Matching uses the **Feature** column only (not the whole row). Product text such - PTW_IEC_FAULT - PTW_IEC61363 -**Modules 19 and 9:** Disconnect when **Product** contains `PTW70` (e.g. `1 PTW70`) and **Feature** equals exactly `19` or `9`. +**Modules 19 and 9:** Same **PTW70** product line; **Feature** equals exactly `19` or `9`. ## Requirements diff --git a/dist/PTW Auto-Disconnect 2.2.0.exe b/dist/PTW Auto-Disconnect 2.2.0.exe index 68c5dff..baa9ebe 100644 --- a/dist/PTW Auto-Disconnect 2.2.0.exe +++ b/dist/PTW Auto-Disconnect 2.2.0.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b260c75fa8daca6d82340cb27a6cebc72bcffad7ab2fa1e0c323b1cf3fdf17bc -size 75947276 +oid sha256:582e1076e64e5bb83b6536d59f18637857d06b444e6baf4b77429c02265805e2 +size 75947419 diff --git a/dist/PTW Auto-Disconnect Setup 2.2.0.exe b/dist/PTW Auto-Disconnect Setup 2.2.0.exe index 7418c18..1fba0a6 100644 --- a/dist/PTW Auto-Disconnect Setup 2.2.0.exe +++ b/dist/PTW Auto-Disconnect Setup 2.2.0.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e4b34356b1daf44c6a0aa67519cb9ab2ff0d54b13478a26cd70a8f481e8234f -size 76113012 +oid sha256:8a3c4bc7a0d5f6d67a9feae61c7cead903f8be53ab727a6aa65590d3ed054b2d +size 76113154 diff --git a/dist/PTW Auto-Disconnect Setup 2.2.0.exe.blockmap b/dist/PTW Auto-Disconnect Setup 2.2.0.exe.blockmap index d05020b..d6d4298 100644 Binary files a/dist/PTW Auto-Disconnect Setup 2.2.0.exe.blockmap and b/dist/PTW Auto-Disconnect Setup 2.2.0.exe.blockmap differ diff --git a/dist/builder-debug.yml b/dist/builder-debug.yml index a9344e2..8722ceb 100644 --- a/dist/builder-debug.yml +++ b/dist/builder-debug.yml @@ -13,4 +13,4 @@ x64: - '!.yarnrc.yml' nodeModuleFilePatterns: [] nsis: - script: "!include \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Michael Sloan\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\MICHAE~1\\AppData\\Local\\Temp\\t-jYP2Pc\\1-messages.nsh\"\n\n!include \"common.nsh\"\r\n!include \"extractAppPackage.nsh\"\r\n\r\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\r\nCRCCheck off\r\nWindowIcon Off\r\nAutoCloseWindow True\r\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\r\n\r\nFunction .onInit\r\n !ifndef SPLASH_IMAGE\r\n SetSilent silent\r\n !endif\r\n\r\n !insertmacro check64BitAndSetRegView\r\nFunctionEnd\r\n\r\nFunction .onGUIInit\r\n InitPluginsDir\r\n\r\n !ifdef SPLASH_IMAGE\r\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\r\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\r\n BgImage::Redraw\r\n !endif\r\nFunctionEnd\r\n\r\nSection\r\n !ifdef SPLASH_IMAGE\r\n HideWindow\r\n !endif\r\n\r\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\r\n !ifdef UNPACK_DIR_NAME\r\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\r\n !endif\r\n\r\n RMDir /r $INSTDIR\r\n SetOutPath $INSTDIR\r\n\r\n !ifdef APP_DIR_64\r\n !ifdef APP_DIR_ARM64\r\n !ifdef APP_DIR_32\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${elseif} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n {endIf}\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n ${if} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n !endif\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n !else\r\n !insertmacro extractEmbeddedAppPackage\r\n !endif\r\n !endif\r\n\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\r\n ${StdUtils.GetAllParameters} $R0 0\r\n\r\n !ifdef SPLASH_IMAGE\r\n BgImage::Destroy\r\n !endif\r\n\r\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\r\n SetErrorLevel $0\r\n\r\n SetOutPath $EXEDIR\r\n\tRMDir /r $INSTDIR\r\nSectionEnd\r\n" + script: "!include \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Michael Sloan\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\MICHAE~1\\AppData\\Local\\Temp\\t-bHvZJG\\1-messages.nsh\"\n\n!include \"common.nsh\"\r\n!include \"extractAppPackage.nsh\"\r\n\r\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\r\nCRCCheck off\r\nWindowIcon Off\r\nAutoCloseWindow True\r\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\r\n\r\nFunction .onInit\r\n !ifndef SPLASH_IMAGE\r\n SetSilent silent\r\n !endif\r\n\r\n !insertmacro check64BitAndSetRegView\r\nFunctionEnd\r\n\r\nFunction .onGUIInit\r\n InitPluginsDir\r\n\r\n !ifdef SPLASH_IMAGE\r\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\r\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\r\n BgImage::Redraw\r\n !endif\r\nFunctionEnd\r\n\r\nSection\r\n !ifdef SPLASH_IMAGE\r\n HideWindow\r\n !endif\r\n\r\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\r\n !ifdef UNPACK_DIR_NAME\r\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\r\n !endif\r\n\r\n RMDir /r $INSTDIR\r\n SetOutPath $INSTDIR\r\n\r\n !ifdef APP_DIR_64\r\n !ifdef APP_DIR_ARM64\r\n !ifdef APP_DIR_32\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${elseif} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n {endIf}\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n ${if} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n !endif\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n !else\r\n !insertmacro extractEmbeddedAppPackage\r\n !endif\r\n !endif\r\n\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\r\n ${StdUtils.GetAllParameters} $R0 0\r\n\r\n !ifdef SPLASH_IMAGE\r\n BgImage::Destroy\r\n !endif\r\n\r\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\r\n SetErrorLevel $0\r\n\r\n SetOutPath $EXEDIR\r\n\tRMDir /r $INSTDIR\r\nSectionEnd\r\n" diff --git a/dist/win-unpacked/resources/app/AI_DNA.md b/dist/win-unpacked/resources/app/AI_DNA.md index 0ec30a9..4f09fb7 100644 --- a/dist/win-unpacked/resources/app/AI_DNA.md +++ b/dist/win-unpacked/resources/app/AI_DNA.md @@ -7,7 +7,7 @@ Short reference so an AI or new dev can understand and modify this project witho - **Electron** desktop app (Windows). One window; no browser opened. - Connects to **localhost:1947** sessions/config pages in a **hidden webview**. - **On startup:** Loads config page → ensures “Table Rows per Page” = 100 → submits if changed → loads sessions page. -- **When Monitor ON:** Every 60s reloads sessions page; scans table rows; **clicks Disconnect** on rows whose text contains any of the **target keywords**. +- **When Monitor ON:** Every 60s reloads sessions page; scans table rows; **clicks Disconnect** when **Product** contains **PTW70** and **Feature** matches **TARGET_KEYWORDS** (substring) or modules **19**/**9** (exact). - **UI:** Left = “Logged in” (by user); Right = “Activity log”; bottom = Monitor ON/OFF + Clear. Uses **powerSaveBlocker** so Windows/display don’t sleep while the app runs. ## Tech stack @@ -30,7 +30,7 @@ Short reference so an AI or new dev can understand and modify this project witho ## Important conventions -- **Keywords:** Edit **inject.js** only — array `TARGET_KEYWORDS`. Row is disconnected if `row.innerText` contains any keyword. +- **Keywords:** Edit **inject.js** — `TARGET_KEYWORDS` (Feature substring) and `TARGET_FEATURE_IDS`. Disconnect only if Product contains `PTW70` and Feature matches (see `matchesPtw70FeatureKeyword` / `matchesFeatureId`). - **Config check:** In **renderer.js**, `ensureConfigThenSessions()` runs on config.html load; sets `#linesperpage` to 100 and clicks Submit if needed, then navigates webview to sessions. - **URLs:** Config = `http://localhost:1947/_int_/config.html`, Sessions = `http://localhost:1947/_int_/sessions.html`. Defined in renderer.js. - **Log/sessions bridge:** Inject script pushes to `__ptw_logQueue` and exposes `__ptw_flushLogs()` / `__ptw_getSessions()`. Renderer polls via `webview.executeJavaScript()` and updates DOM. diff --git a/dist/win-unpacked/resources/app/README.md b/dist/win-unpacked/resources/app/README.md index ed6475b..b8f9fc9 100644 --- a/dist/win-unpacked/resources/app/README.md +++ b/dist/win-unpacked/resources/app/README.md @@ -4,7 +4,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di ## Features -- **Auto-disconnect** — When Monitor is ON, scans the sessions table and clicks Disconnect on rows containing any of the target keywords. +- **Auto-disconnect** — When Monitor is ON, scans the sessions table and clicks Disconnect on **PTW70** product rows whose **Feature** matches the configured list (or modules 19 / 9). - **Logged in** — Left panel shows who is logged in, grouped by user, with product/feature per session. - **Activity log** — Right panel shows timestamps and disconnect/refresh events. - **Config on startup** — On launch, checks `http://localhost:1947/_int_/config.html` and ensures **Table Rows per Page** is set to **100** (and submits if changed). @@ -13,7 +13,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di ## Target keywords (disconnect when present) -Matching uses the **Feature** column only (not the whole row). Product text such as `1 PTW70` is not searched for keywords. +Applies only when **Product** contains **`PTW70`** (e.g. `1 PTW70`). Matching uses the **Feature** column only (substring for the list below; exact cell for modules 19 and 9). - PTW_DATAEXCHANGE - PTW_ARC_FLASH @@ -25,7 +25,7 @@ Matching uses the **Feature** column only (not the whole row). Product text such - PTW_IEC_FAULT - PTW_IEC61363 -**Modules 19 and 9:** Disconnect when **Product** contains `PTW70` (e.g. `1 PTW70`) and **Feature** equals exactly `19` or `9`. +**Modules 19 and 9:** Same **PTW70** product line; **Feature** equals exactly `19` or `9`. ## Requirements diff --git a/dist/win-unpacked/resources/app/inject.js b/dist/win-unpacked/resources/app/inject.js index 0802d33..97bce7f 100644 --- a/dist/win-unpacked/resources/app/inject.js +++ b/dist/win-unpacked/resources/app/inject.js @@ -7,7 +7,7 @@ 'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363' ]; - /** Exact match on Feature cell only; Product must look like PTW70 (e.g. "1 PTW70") so "9"/"19" do not fire on other lines. */ + /** Exact Feature cell match; only evaluated when Product contains PTW70 (same product gate as PTW_* keywords). */ const TARGET_FEATURE_IDS = ['19', '9']; window.__ptw_logQueue = window.__ptw_logQueue || []; @@ -54,6 +54,12 @@ return TARGET_KEYWORDS.some(function (k) { return feature.indexOf(k) !== -1; }); } + /** PTW_* strings must appear in Feature; Product must contain PTW70 (e.g. "1 PTW70") for any auto-disconnect. */ + function matchesPtw70FeatureKeyword(product, feature) { + if (!isPtw70Product(product)) return false; + return matchesKeywordInFeature(feature); + } + function matchesFeatureId(product, feature) { if (!isPtw70Product(product)) return false; return TARGET_FEATURE_IDS.some(function (id) { return feature === id; }); @@ -64,7 +70,7 @@ const rows = document.querySelectorAll('#mydata table.list tr'); rows.forEach(function (row) { var pf = productFeatureCells(row); - const keywordMatch = matchesKeywordInFeature(pf.feature); + const keywordMatch = matchesPtw70FeatureKeyword(pf.product, pf.feature); const idMatch = matchesFeatureId(pf.product, pf.feature); if (keywordMatch || idMatch) { const disconnectLink = row.querySelector('a.sbutton'); diff --git a/inject.js b/inject.js index 296a3f5..137b644 100644 --- a/inject.js +++ b/inject.js @@ -7,7 +7,7 @@ 'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363' ]; - /** Exact match on Feature cell only; Product must look like PTW70 (e.g. "1 PTW70") so "9"/"19" do not fire on other lines. */ + /** Exact Feature cell match; only evaluated when Product contains PTW70 (same product gate as PTW_* keywords). */ const TARGET_FEATURE_IDS = ['19', '9']; window.__ptw_logQueue = window.__ptw_logQueue || []; @@ -54,6 +54,12 @@ return TARGET_KEYWORDS.some(function (k) { return feature.indexOf(k) !== -1; }); } + /** PTW_* strings must appear in Feature; Product must contain PTW70 (e.g. "1 PTW70") for any auto-disconnect. */ + function matchesPtw70FeatureKeyword(product, feature) { + if (!isPtw70Product(product)) return false; + return matchesKeywordInFeature(feature); + } + function matchesFeatureId(product, feature) { if (!isPtw70Product(product)) return false; return TARGET_FEATURE_IDS.some(function (id) { return feature === id; }); @@ -64,7 +70,7 @@ const rows = document.querySelectorAll('#mydata table.list tr'); rows.forEach(function (row) { var pf = productFeatureCells(row); - const keywordMatch = matchesKeywordInFeature(pf.feature); + const keywordMatch = matchesPtw70FeatureKeyword(pf.product, pf.feature); const idMatch = matchesFeatureId(pf.product, pf.feature); if (keywordMatch || idMatch) { const disconnectLink = row.querySelector('a.sbutton');