Compare commits

...

2 Commits

Author SHA1 Message Date
a3e1cde3c0 get-startapp 2024-06-01 16:24:34 +10:00
2acea9cc02 changed get-installedApps to get-startApps 2024-06-01 16:22:22 +10:00
6 changed files with 38 additions and 6 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ out
.DS_Store .DS_Store
*.log* *.log*
electron.vite.config.1716830836044.mjs electron.vite.config.1716830836044.mjs
.eslintrc.cjs

22
package-lock.json generated
View File

@@ -12,6 +12,8 @@
"@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0", "@electron-toolkit/utils": "^3.0.0",
"get-installed-apps": "^1.1.0", "get-installed-apps": "^1.1.0",
"get-startapps": "^1.0.4",
"node-fetch": "^2.6.1",
"serialport": "^12.0.0" "serialport": "^12.0.0"
}, },
"devDependencies": { "devDependencies": {
@@ -4282,6 +4284,18 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/get-startapps": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/get-startapps/-/get-startapps-1.0.4.tgz",
"integrity": "sha512-xog+hIeyWCVP/9yriROL346qyqHIR0telniu7ukUypH2dE3KFt4xPriRcCkcMnbfpjUCOVWRivrAJRABN1QlWg==",
"deprecated": "This package is no longer maintained",
"os": [
"win32"
],
"engines": {
"node": ">=0.12"
}
},
"node_modules/get-stream": { "node_modules/get-stream": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
@@ -5233,6 +5247,14 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"engines": {
"node": "4.x || >=6.0.0"
}
},
"node_modules/node-gyp-build": { "node_modules/node-gyp-build": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz",

View File

@@ -21,6 +21,8 @@
"@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0", "@electron-toolkit/utils": "^3.0.0",
"get-installed-apps": "^1.1.0", "get-installed-apps": "^1.1.0",
"get-startapps": "^1.0.4",
"node-fetch": "^2.6.1",
"serialport": "^12.0.0" "serialport": "^12.0.0"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -3,7 +3,9 @@ import { join } from 'path'
import { electronApp, optimizer, is } from '@electron-toolkit/utils' import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/icon.png?asset' import icon from '../../resources/icon.png?asset'
import fs from 'node:fs/promises' import fs from 'node:fs/promises'
import {getInstalledApps} from 'get-installed-apps' // import {getInstalledApps} from 'get-installed-apps'
import getapps from 'get-startapps'
import { SerialPort } from 'serialport' import { SerialPort } from 'serialport'
import * as logTimestamp from 'log-timestamp' import * as logTimestamp from 'log-timestamp'
@@ -23,7 +25,11 @@ async function getSerialPorts() {
} }
async function getApps() { async function getApps() {
return await getInstalledApps() // return await getInstalledApps()
let appCollection = await getapps()
let filters = [(a) => a.appid.includes('.exe'), (a) => a.appid.includes('steam')]
console.log(` Total apps ${appCollection.length}`)
return appCollection.filter((app) => filters.some((fn) => fn(app)))
} }
function createWindow() { function createWindow() {

View File

@@ -8,7 +8,7 @@ const movies = ref([])
const apiKey = 'a0eb411ca9c81896004dce1d27a7245b' const apiKey = 'a0eb411ca9c81896004dce1d27a7245b'
const configuration = ref('Loading....') const configuration = ref('Loading....')
const serialPorts = ref('Loading Serial ports.... ') const serialPorts = ref('Loading Serial ports.... ')
const insatlledApps = ref({}); const insatlledApps = ref({})
const ipcHandle = () => window.electron.ipcRenderer.send('ping') const ipcHandle = () => window.electron.ipcRenderer.send('ping')
// const getConfigFileContents = async () => { // const getConfigFileContents = async () => {
@@ -51,7 +51,6 @@ onMounted(() => {
<div class="row"> <div class="row">
<button type="button" class="col-auto" @click="ipcHandle">Send Ping</button> <button type="button" class="col-auto" @click="ipcHandle">Send Ping</button>
<button type="button" class="col-auto" @click="getSerialPorts">Load config</button> <button type="button" class="col-auto" @click="getSerialPorts">Load config</button>
</div> </div>
<div>{{ configuration }}</div> <div>{{ configuration }}</div>
<!-- <!--

View File

@@ -37,8 +37,10 @@ function generateAppSelector() {
let optionsString = '' let optionsString = ''
for (let app in props.installedApps) { for (let app in props.installedApps) {
optionsString += `<option value=${props.installedApps[app].appName}> ${props.installedApps[app].appName} </option>` optionsString += `<option value=${props.installedApps[app].name}> ${props.installedApps[app].name} </option>`
} }
return `<div class="row mt-3"><select class="form-select"> ${optionsString} </select></div>` return `<div class="row mt-3">
<select class="form-select"> ${optionsString} </select></div>
`
} }
</script> </script>