This commit is contained in:
2026-10-18 04:40:55 +07:00
parent c36d3fd314
commit 41d3e8ac5e
12 changed files with 4105 additions and 157 deletions
+7 -3
View File
@@ -90,9 +90,13 @@ module.exports = async function onlineSmoke({
}
if (path === '/api/games/6/screens/command') {
currentCommand = body.command
if (body.command === 8 || body.command === 10) timerState = 2
if (body.command === 9) timerState = 3
if (body.command === 11) timerState = 1
if (
body.command === 'SCREEN_COMMAND_TIMER_START' ||
body.command === 'SCREEN_COMMAND_TIMER_RESUME'
)
timerState = 2
if (body.command === 'SCREEN_COMMAND_TIMER_PAUSE') timerState = 3
if (body.command === 'SCREEN_COMMAND_TIMER_RESET') timerState = 1
version++
return send({})
}
+44
View File
@@ -0,0 +1,44 @@
const { execFileSync } = require('node:child_process')
const { existsSync, mkdirSync, mkdtempSync, cpSync, rmSync } = require('node:fs')
const { delimiter, join, resolve } = require('node:path')
const { tmpdir } = require('node:os')
const root = resolve(__dirname, '..')
const plugin = (process.env.PATH || '')
.split(delimiter)
.map((p) =>
join(
p,
process.platform === 'win32'
? 'protoc-gen-typescript-http.exe'
: 'protoc-gen-typescript-http',
),
)
.find(existsSync)
if (!plugin) throw new Error('Install protoc-gen-typescript-http v0.10.0; see README')
if (execFileSync('protoc', ['--version'], { encoding: 'utf8' }).trim() !== 'libprotoc 36.0')
throw new Error('protoc 36.0 is required')
if (
!execFileSync('go', ['version', '-m', plugin], { encoding: 'utf8' }).includes(
'go.einride.tech/protoc-gen-typescript-http\tv0.10.0\t',
)
)
throw new Error('protoc-gen-typescript-http v0.10.0 is required')
const source = resolve(root, '../evening_detective_server/api')
const temporary = mkdtempSync(join(tmpdir(), 'screen-proto-'))
try {
execFileSync(
'protoc',
[
`--plugin=protoc-gen-typescript-http=${plugin}`,
`--proto_path=${source}`,
`--typescript-http_out=${temporary}`,
join(source, 'main.proto'),
],
{ stdio: 'inherit' },
)
const target = join(root, 'electron/api/generated')
mkdirSync(target, { recursive: true })
cpSync(temporary, target, { recursive: true })
} finally {
rmSync(temporary, { recursive: true, force: true })
}