Skip to content

Commit

Permalink
feat: use glob for pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Wurielle committed Jan 18, 2025
1 parent 97b62b7 commit af7898e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 37 deletions.
1 change: 1 addition & 0 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@packages/native-keymap": "3.3.2",
"@packages/win-mouse": "2.0.1",
"ffi-napi": "^4.0.3",
"micromatch": "^4.0.5",
"node-abi": "^3.40.0",
"node-global-key-listener": "^0.1.1",
"node-record-lpcm16": "1.0.1",
Expand Down
6 changes: 3 additions & 3 deletions apps/app/src/electron/game-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Window } from 'win-control'
import { Deferred } from '@packages/toolbox'
import { useGameOverlayStore } from '@/features/game-overlay/store'
import { onWatcherCleanup, watch } from 'vue'
import micromatch from 'micromatch'

type ProcessInfo = {
process: string
Expand Down Expand Up @@ -281,9 +282,8 @@ class GameOverlay {
child.on('message', (processInfo: ProcessEvent) => {
if (processInfo.type === 'process-creation') {
const { filepath } = processInfo.payload
const isGame = gameOverlayStore.allowlist
.some((path) => path.length && filepath.includes(path))
&& gameOverlayStore.denylist.every((path) => !(path.length && filepath.includes(path)))
const isGame = micromatch.isMatch(filepath, gameOverlayStore.allowlist.filter(Boolean))
&& !micromatch.isMatch(filepath, gameOverlayStore.denylist.filter(Boolean))
if (isGame) {
console.log('[game-overlay]: Game launched', filepath)
// require('windows-tlist').getProcessInfo(processInfo.payload.pid).then(({ modules }: any) => console.log(modules.map(({ path }: any) => path.substring(path.lastIndexOf('\\')+1))))
Expand Down
20 changes: 10 additions & 10 deletions apps/app/src/teams/messenger/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/messenger/main.ts" type="module"></script>
</body>
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Izabela Next</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/messenger/main.ts" type="module"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions apps/app/src/teams/overlay/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/overlay/main.ts" type="module"></script>
</body>
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Izabela Next</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/overlay/main.ts" type="module"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions apps/app/src/teams/speech-worker/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/speech-worker/main.ts" type="module"></script>
</body>
<head>
<meta charset="UTF-8" />
<link href="/vite.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Izabela Next</title>
</head>
<body>
<div id="app"></div>
<script src="/src/teams/speech-worker/main.ts" type="module"></script>
</body>
</html>
38 changes: 34 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10935,7 +10935,7 @@ ffi-napi@^4.0.3:
debug "^4.1.1"
get-uv-event-loop-napi-h "^1.0.5"
node-addon-api "^3.0.0"
node-gyp-build "^4.8.1"
node-gyp-build "^4.2.1"
ref-napi "^2.0.1 || ^3.0.2"
ref-struct-di "^1.1.0"

Expand Down Expand Up @@ -15039,6 +15039,11 @@ node-gyp-build@^4.3.0:
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5"
integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==

node-gyp-build@^4.8.1:
version "4.8.4"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz#8a70ee85464ae52327772a90d66c6077a900cfc8"
integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==

[email protected]:
version "7.1.2"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-7.1.2.tgz#21a810aebb187120251c3bcec979af1587b188ae"
Expand Down Expand Up @@ -18823,7 +18828,7 @@ string-hash@^1.1.1, string-hash@^1.1.3:
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -18841,6 +18846,15 @@ string-width@^1.0.1:
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
Expand Down Expand Up @@ -18922,7 +18936,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -18950,6 +18964,13 @@ strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -20512,7 +20533,7 @@ [email protected]:
emittery "^1.0.1"
koffi "^2.6.1"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -20530,6 +20551,15 @@ wrap-ansi@^6.0.1:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
Expand Down

0 comments on commit af7898e

Please sign in to comment.