Skip to content

Commit

Permalink
window with less than 5min of fullscreen are no longer displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kensaa committed Sep 5, 2023
1 parent 9474ef4 commit 9d96d0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion background/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "game-activity",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "dist/main.js",
"bin": "dist/main.js",
Expand Down
15 changes: 11 additions & 4 deletions background/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import * as express from 'express'
import * as cors from 'cors'
import SysTray from 'systray2'
import { execSync } from 'child_process'

const PORT = 49072
const MINIMAL_VALUE = 5 * 60 // MINIMAL VALUE REQUIRED TO BE DISPLAYED IN THE WEBPAGE

const { width, height } = robotjs.getScreenSize()
const platorm = os.platform()
Expand Down Expand Up @@ -101,13 +103,18 @@ app.listen(PORT, 'localhost', () => console.log(`listening on port ${PORT}`))

app.get('/all', (req, res) => {
const files = fs.readdirSync(folder)
const data: Record<string, Record<string, number>> = {}
const response: Record<string, Record<string, number>> = {}
for (const file of files) {
data[path.parse(file).name] = JSON.parse(
const data = JSON.parse(
fs.readFileSync(path.join(folder, file), 'utf-8')
)
) as Record<string, number>
const selectedData: Record<string, number> = {}
for (const [key, value] of Object.entries(data)) {
if (value > MINIMAL_VALUE) selectedData[key] = value
}
response[path.parse(file).name] = selectedData
}
res.json(data)
res.json(response)
})

const publicPath = path.join(__dirname, '..', 'public')
Expand Down

0 comments on commit 9d96d0b

Please sign in to comment.