Scope disconnect matching to Feature column; gate 19/9 on PTW70 product.
PTW_* keywords match only in the Feature cell. Modules 19 and 9 match only when Product contains PTW70 (e.g. 1 PTW70) and Feature is exactly 19 or 9. Rebuild distributables. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d3d45d90c3
commit
4ef1f6849c
8 files changed
+41
-23
No files matched your search
Vendored
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:49724350d55473b19857b7fc0104fe00c089db182d65f04018ea208ef6ac5bc2
|
||||
size 75947045
|
||||
oid sha256:5839feabfe8b6f72f6505814f6b1510c685bd38804dfc9ee60e6403acb598bdd
|
||||
size 75947085
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dca07a190de862439b1aace80c0cd62fd41461f3fc52deceabe100a8b9dea49f
|
||||
size 76112782
|
||||
oid sha256:7d676846d57ce5ddc427bd9fa41ddd491e350dcd1df3ae2d68cff5db12f514f7
|
||||
size 76112818
|
||||
Binary file not shown.
Vendored
+1
-1
@@ -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-V7MDJL\\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 Line truncated
|
||||
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-v1KjYX\\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 Line truncated
|
||||
+3
-1
@@ -13,6 +13,8 @@ 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.
|
||||
|
||||
- PTW_DATAEXCHANGE
|
||||
- PTW_ARC_FLASH
|
||||
- PTW_DEVEVAL
|
||||
@@ -23,7 +25,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di
|
||||
- PTW_IEC_FAULT
|
||||
- PTW_IEC61363
|
||||
|
||||
**Modules 19 and 9:** Disconnect only when the **Product** or **Feature** column equals exactly `19` or `9` (whole cell, not a substring search on the row — searching the full row for `9` or `19` matches dates and other numbers and disconnects everyone).
|
||||
**Modules 19 and 9:** Disconnect when **Product** contains `PTW70` (e.g. `1 PTW70`) and **Feature** equals exactly `19` or `9`.
|
||||
|
||||
## Requirements
|
||||
|
||||
|
||||
+15
-8
@@ -7,8 +7,8 @@
|
||||
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363'
|
||||
];
|
||||
|
||||
/** Matched only against Product / Feature cells (exact text), never whole-row substring — bare "9"/"19" match almost every row. */
|
||||
const TARGET_PRODUCT_FEATURE_IDS = ['19', '9'];
|
||||
/** Exact match on Feature cell only; Product must look like PTW70 (e.g. "1 PTW70") so "9"/"19" do not fire on other lines. */
|
||||
const TARGET_FEATURE_IDS = ['19', '9'];
|
||||
|
||||
window.__ptw_logQueue = window.__ptw_logQueue || [];
|
||||
window.__ptw_running = window.__ptw_running !== false;
|
||||
@@ -26,10 +26,17 @@
|
||||
return { product: product, feature: feature };
|
||||
}
|
||||
|
||||
function matchesProductFeatureId(product, feature) {
|
||||
return TARGET_PRODUCT_FEATURE_IDS.some(function (id) {
|
||||
return product === id || feature === id;
|
||||
});
|
||||
function isPtw70Product(product) {
|
||||
return product.indexOf('PTW70') !== -1;
|
||||
}
|
||||
|
||||
function matchesKeywordInFeature(feature) {
|
||||
return TARGET_KEYWORDS.some(function (k) { return feature.indexOf(k) !== -1; });
|
||||
}
|
||||
|
||||
function matchesFeatureId(product, feature) {
|
||||
if (!isPtw70Product(product)) return false;
|
||||
return TARGET_FEATURE_IDS.some(function (id) { return feature === id; });
|
||||
}
|
||||
|
||||
function scanAndDisconnect() {
|
||||
@@ -38,8 +45,8 @@
|
||||
rows.forEach(function (row) {
|
||||
const rowText = row.innerText;
|
||||
var pf = productFeatureCells(row);
|
||||
const keywordMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
|
||||
const idMatch = matchesProductFeatureId(pf.product, pf.feature);
|
||||
const keywordMatch = matchesKeywordInFeature(pf.feature);
|
||||
const idMatch = matchesFeatureId(pf.product, pf.feature);
|
||||
if (keywordMatch || idMatch) {
|
||||
const disconnectLink = row.querySelector('a.sbutton');
|
||||
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
||||
|
||||
Reference in new issue
Block a user