@sirenodeck/sirenodeck 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config-ui/index.html +13 -0
- package/config-ui/src/App.tsx +675 -0
- package/config-ui/src/DeckFrame.tsx +445 -0
- package/config-ui/src/Shell.tsx +108 -0
- package/config-ui/src/SidePanel.tsx +96 -0
- package/config-ui/src/bridge-log-store.ts +115 -0
- package/config-ui/src/bridge.ts +303 -0
- package/config-ui/src/components/ActionValueEditor.tsx +209 -0
- package/config-ui/src/components/ButtonActionsEditor.tsx +84 -0
- package/config-ui/src/components/DisconnectedOverlay.tsx +77 -0
- package/config-ui/src/components/EmojiPicker.tsx +65 -0
- package/config-ui/src/components/IconPicker.tsx +264 -0
- package/config-ui/src/components/MacroPreview.tsx +22 -0
- package/config-ui/src/components/ReconnectingBanner.tsx +35 -0
- package/config-ui/src/gesture.ts +45 -0
- package/config-ui/src/index.css +8 -0
- package/config-ui/src/main.tsx +20 -0
- package/config-ui/src/pages/AboutPage.tsx +65 -0
- package/config-ui/src/pages/AddonsPage.tsx +232 -0
- package/config-ui/src/pages/BridgeLogsPage.tsx +94 -0
- package/config-ui/src/pages/ButtonConfigEditor/ButtonAppearanceFields.tsx +77 -0
- package/config-ui/src/pages/ButtonConfigEditor/ButtonTypePicker.tsx +80 -0
- package/config-ui/src/pages/ButtonConfigEditor/ConfigForm.tsx +50 -0
- package/config-ui/src/pages/ButtonConfigEditor/FormFieldParts.tsx +23 -0
- package/config-ui/src/pages/ButtonConfigEditor/PositionPicker.tsx +68 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ActionControl.tsx +27 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ArrayControl.tsx +77 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/BooleanControl.tsx +34 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/DeckSelectControl.tsx +47 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/EmojiControl.tsx +70 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/IconControl.tsx +31 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ObjectControl.tsx +52 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/RecordControl.tsx +104 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/SelectControl.tsx +46 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ShellControl.tsx +29 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/TextControl.tsx +36 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/UnionControl.tsx +96 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/registry.ts +17 -0
- package/config-ui/src/pages/ButtonConfigEditor/types.ts +67 -0
- package/config-ui/src/pages/ButtonConfigEditor/utils.ts +56 -0
- package/config-ui/src/pages/ButtonConfigEditor.tsx +226 -0
- package/config-ui/src/pages/ConfigPage.tsx +326 -0
- package/config-ui/src/pages/DecksPage.tsx +104 -0
- package/config-ui/src/pages/EditorPage.tsx +1697 -0
- package/config-ui/src/pages/ServiceLogsPage.tsx +130 -0
- package/config-ui/vite.config.ts +105 -0
- package/dist/main.mjs +299 -41557
- package/frontend/index.html +12 -0
- package/frontend/src/App.tsx +536 -0
- package/frontend/src/__mocks__/addons-registry.ts +2 -0
- package/frontend/src/__mocks__/theme.ts +1 -0
- package/frontend/src/__mocks__/themes-manifest.tsx +78 -0
- package/frontend/src/__mocks__/token.ts +2 -0
- package/frontend/src/bridge/client.ts +186 -0
- package/frontend/src/bridge/use-button-action.ts +31 -0
- package/frontend/src/bridge/ws-context.tsx +24 -0
- package/frontend/src/components/Deck.tsx +486 -0
- package/frontend/src/components/DisconnectedOverlay.tsx +82 -0
- package/frontend/src/components/ErrorBoundary.tsx +92 -0
- package/frontend/src/components/ReconnectingBanner.tsx +40 -0
- package/frontend/src/index.css +40 -0
- package/frontend/src/main.tsx +23 -0
- package/frontend/vite.config.ts +132 -0
- package/package.json +20 -6
- package/src/builtin-addons/internal-settings/index.ts +0 -1
- package/src/builtin-addons/internal-settings/logo72x72.png +0 -0
- package/src/cli/commands/emulator-mode.ts +26 -4
- package/src/cli/commands/service-manager.ts +53 -1
- package/src/device/black-frame.ts +3 -7
- package/src/vite/virtual-modules.ts +16 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "sirenodeck-theme";
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
color-scheme: dark light;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html,
|
|
9
|
+
body,
|
|
10
|
+
#root {
|
|
11
|
+
height: 100%;
|
|
12
|
+
margin: 0;
|
|
13
|
+
background-color: var(--color-bg);
|
|
14
|
+
color: var(--color-fg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Rich-text primitives — emitted by Text.tsx. Theme-agnostic so any
|
|
18
|
+
* theme gets them automatically. */
|
|
19
|
+
.sireno-rich-text-break {
|
|
20
|
+
display: block;
|
|
21
|
+
height: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.sireno-rich-text-strong {
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sireno-rich-text-blink {
|
|
29
|
+
animation: sireno-blink 1s step-end infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@keyframes sireno-blink {
|
|
33
|
+
0%,
|
|
34
|
+
100% {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
50% {
|
|
38
|
+
opacity: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StrictMode, type ReactNode } from "react"
|
|
2
|
+
import { createRoot } from "react-dom/client"
|
|
3
|
+
import { BrowserRouter } from "react-router-dom"
|
|
4
|
+
import { App } from "./App"
|
|
5
|
+
import { ErrorBoundary, useHmrResetKey } from "./components/ErrorBoundary"
|
|
6
|
+
import "./index.css"
|
|
7
|
+
|
|
8
|
+
const Root = (): ReactNode => {
|
|
9
|
+
const resetKey = useHmrResetKey()
|
|
10
|
+
return (
|
|
11
|
+
<StrictMode>
|
|
12
|
+
<ErrorBoundary resetKey={resetKey}>
|
|
13
|
+
<BrowserRouter>
|
|
14
|
+
<App />
|
|
15
|
+
</BrowserRouter>
|
|
16
|
+
</ErrorBoundary>
|
|
17
|
+
</StrictMode>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const container = document.getElementById("root")
|
|
22
|
+
if (container === null) throw new Error("#root not found")
|
|
23
|
+
createRoot(container).render(<Root />)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import react from "@vitejs/plugin-react"
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite"
|
|
4
|
+
import { dirname, resolve } from "node:path"
|
|
5
|
+
import { fileURLToPath } from "node:url"
|
|
6
|
+
import { readFileSync } from "node:fs"
|
|
7
|
+
import { sirenoDeck2 } from "../src/vite/index"
|
|
8
|
+
import { frontendBridgeUrl } from "../src/render/frontend-bridge-url"
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
|
|
12
|
+
const wsUrl = frontendBridgeUrl()
|
|
13
|
+
const proxyUrl = process.env["SIRENO_WS_PROXY_URL"] ?? ""
|
|
14
|
+
|
|
15
|
+
const addonsFromEnv = () => {
|
|
16
|
+
const blob = process.env["SIRENO_ADDONS"]
|
|
17
|
+
if (blob === undefined || blob.length === 0) return undefined
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(blob) as Array<{
|
|
20
|
+
name: string
|
|
21
|
+
frontend?: { main: string; styles?: string[] }
|
|
22
|
+
buttons?: Array<{ type: string }>
|
|
23
|
+
buttonTypes?: Record<string, string>
|
|
24
|
+
}>
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const themeFromEnv = ():
|
|
31
|
+
| { name: string; manifestPath: string; uiOverridesPath: string | null }
|
|
32
|
+
| undefined => {
|
|
33
|
+
const blob = process.env["SIRENO_THEME"]
|
|
34
|
+
if (blob === undefined || blob.length === 0) return undefined
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(blob) as {
|
|
37
|
+
name?: unknown
|
|
38
|
+
manifestPath?: unknown
|
|
39
|
+
uiOverridesPath?: unknown
|
|
40
|
+
}
|
|
41
|
+
if (
|
|
42
|
+
typeof parsed.name === "string" &&
|
|
43
|
+
typeof parsed.manifestPath === "string"
|
|
44
|
+
) {
|
|
45
|
+
return {
|
|
46
|
+
name: parsed.name,
|
|
47
|
+
manifestPath: parsed.manifestPath,
|
|
48
|
+
uiOverridesPath:
|
|
49
|
+
parsed.uiOverridesPath === null ||
|
|
50
|
+
typeof parsed.uiOverridesPath === "string"
|
|
51
|
+
? (parsed.uiOverridesPath as string | null)
|
|
52
|
+
: null,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
/* ignore */
|
|
57
|
+
}
|
|
58
|
+
return undefined
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default defineConfig({
|
|
62
|
+
plugins: [
|
|
63
|
+
react(),
|
|
64
|
+
tailwindcss(),
|
|
65
|
+
sirenoDeck2({
|
|
66
|
+
token: process.env["SIRENO_TOKEN"] ?? "",
|
|
67
|
+
...(themeFromEnv() ? { theme: themeFromEnv()! } : {}),
|
|
68
|
+
...(addonsFromEnv() !== undefined ? { addons: addonsFromEnv()! } : {}),
|
|
69
|
+
}),
|
|
70
|
+
{
|
|
71
|
+
name: "sireno-asset-proxy",
|
|
72
|
+
configureServer(server) {
|
|
73
|
+
const configDir =
|
|
74
|
+
process.env["SIRENO_CONFIG_DIR"] ?? resolve(__dirname, "../../..")
|
|
75
|
+
server.middlewares.use("/@sireno-asset", (req, res, next) => {
|
|
76
|
+
const url = req.url ?? ""
|
|
77
|
+
const safe = url.split("?")[0]!.replace(/^\/+/, "")
|
|
78
|
+
if (safe.includes("..")) {
|
|
79
|
+
next()
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
const filePath = resolve(configDir, safe)
|
|
83
|
+
try {
|
|
84
|
+
const body = readFileSync(filePath)
|
|
85
|
+
const ext = filePath.split(".").pop()?.toLowerCase() ?? ""
|
|
86
|
+
const mime =
|
|
87
|
+
ext === "svg"
|
|
88
|
+
? "image/svg+xml"
|
|
89
|
+
: ext === "png"
|
|
90
|
+
? "image/png"
|
|
91
|
+
: ext === "jpg" || ext === "jpeg"
|
|
92
|
+
? "image/jpeg"
|
|
93
|
+
: ext === "webp"
|
|
94
|
+
? "image/webp"
|
|
95
|
+
: "application/octet-stream"
|
|
96
|
+
res.setHeader("Content-Type", mime)
|
|
97
|
+
res.setHeader("Cache-Control", "no-cache")
|
|
98
|
+
res.end(body)
|
|
99
|
+
} catch {
|
|
100
|
+
next()
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
server: {
|
|
107
|
+
host: process.env["SIRENO_VITE_HOST"] ?? "127.0.0.1",
|
|
108
|
+
port: 5180,
|
|
109
|
+
strictPort: true,
|
|
110
|
+
},
|
|
111
|
+
resolve: {
|
|
112
|
+
alias: [
|
|
113
|
+
{ find: /^@\//, replacement: resolve(__dirname, "../src") + "/" },
|
|
114
|
+
{
|
|
115
|
+
find: /^@sirenodeck\/sirenodeck(\/.*)?$/,
|
|
116
|
+
replacement: resolve(__dirname, "../src") + "$1",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
find: /^sirenodeck\/react$/,
|
|
120
|
+
replacement: resolve(__dirname, "../src/api/react/index"),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
define: {
|
|
125
|
+
"import.meta.env.VITE_WS_URL": JSON.stringify(wsUrl),
|
|
126
|
+
"import.meta.env.VITE_WS_PROXY_URL": JSON.stringify(proxyUrl),
|
|
127
|
+
"import.meta.env.SIRENO_CONFIG_DIR": JSON.stringify(
|
|
128
|
+
process.env["SIRENO_CONFIG_DIR"] ?? resolve(__dirname, "../../.."),
|
|
129
|
+
),
|
|
130
|
+
},
|
|
131
|
+
assetsInclude: ["**/*.html"],
|
|
132
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sirenodeck/sirenodeck",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "CLI for managing Elgato Stream Deck devices via a config-driven deck system.",
|
|
5
5
|
"homepage": "https://deck.sireno.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -19,12 +19,20 @@
|
|
|
19
19
|
"bin",
|
|
20
20
|
"config",
|
|
21
21
|
"dist",
|
|
22
|
+
"frontend",
|
|
23
|
+
"config-ui",
|
|
22
24
|
"src",
|
|
23
25
|
"LICENSE",
|
|
24
26
|
"README.md",
|
|
25
27
|
"!src/**/*.test.ts",
|
|
26
28
|
"!src/**/*.test.tsx",
|
|
27
29
|
"!src/**/__tests__/**",
|
|
30
|
+
"!frontend/**/__tests__/**",
|
|
31
|
+
"!config-ui/**/__tests__/**",
|
|
32
|
+
"!frontend/.sireno-deck/**",
|
|
33
|
+
"!config-ui/.sireno-deck/**",
|
|
34
|
+
"!frontend/.sirenodeck/**",
|
|
35
|
+
"!config-ui/.sirenodeck/**",
|
|
28
36
|
"!**/*.snap"
|
|
29
37
|
],
|
|
30
38
|
"type": "module",
|
|
@@ -98,24 +106,34 @@
|
|
|
98
106
|
"@elgato-stream-deck/node": "^7.6.3",
|
|
99
107
|
"@heroui/react": "3.2.6",
|
|
100
108
|
"@heroui/styles": "3.2.6",
|
|
109
|
+
"@internationalized/date": "^3.12.4",
|
|
101
110
|
"@meteocons/svg-static": "^0.1.0",
|
|
111
|
+
"@react-aria/ssr": "^3.10.1",
|
|
112
|
+
"@react-aria/utils": "^3.34.1",
|
|
113
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
114
|
+
"@vitejs/plugin-react": "^6.0.0",
|
|
102
115
|
"chokidar": "^5.0.0",
|
|
103
116
|
"dbus-next": "^0.10.2",
|
|
104
117
|
"execa": "^9.6.0",
|
|
105
118
|
"jsonc-parser": "^3.3.1",
|
|
119
|
+
"lucide-react": "^1.22.0",
|
|
106
120
|
"pino": "^10.3.1",
|
|
107
121
|
"playwright": "^1.50.0",
|
|
108
122
|
"qrcode": "^1.5.4",
|
|
109
123
|
"react": "^19.0.0",
|
|
124
|
+
"react-aria": "^3.52.1",
|
|
125
|
+
"react-aria-components": "^1.21.1",
|
|
110
126
|
"react-dom": "^19.0.0",
|
|
127
|
+
"react-router-dom": "^7.18.1",
|
|
111
128
|
"sharp": "^0.34.0",
|
|
129
|
+
"tailwindcss": "^4.0.0",
|
|
130
|
+
"vite": "^8.0.0",
|
|
112
131
|
"ws": "^8.18.0",
|
|
113
132
|
"yaml": "^2.9.0",
|
|
114
133
|
"yargs": "^18.0.0",
|
|
115
134
|
"zod": "^4.4.3"
|
|
116
135
|
},
|
|
117
136
|
"devDependencies": {
|
|
118
|
-
"@tailwindcss/vite": "^4.0.0",
|
|
119
137
|
"@testing-library/dom": "^10.4.0",
|
|
120
138
|
"@testing-library/jest-dom": "^6.6.3",
|
|
121
139
|
"@testing-library/react": "^16.1.0",
|
|
@@ -125,17 +143,13 @@
|
|
|
125
143
|
"@types/react-dom": "^19.0.0",
|
|
126
144
|
"@types/ws": "^8.5.13",
|
|
127
145
|
"@types/yargs": "^17.0.35",
|
|
128
|
-
"@vitejs/plugin-react": "^6.0.0",
|
|
129
146
|
"jsdom": "^25.0.1",
|
|
130
|
-
"lucide-react": "^1.22.0",
|
|
131
147
|
"oxfmt": "latest",
|
|
132
148
|
"oxlint": "latest",
|
|
133
149
|
"pino-pretty": "^13.0.0",
|
|
134
|
-
"tailwindcss": "^4.0.0",
|
|
135
150
|
"tsdown": "^0.22.14",
|
|
136
151
|
"tsx": "^4.22.4",
|
|
137
152
|
"typescript": "7.0.1-rc",
|
|
138
|
-
"vite": "^8.0.0",
|
|
139
153
|
"vitest": "^4.1.9"
|
|
140
154
|
}
|
|
141
155
|
}
|
|
Binary file
|
|
@@ -51,13 +51,35 @@ export const findWorkspaceRoot = (): string => {
|
|
|
51
51
|
return here
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
const packageRoot = (): string | null => {
|
|
55
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
56
|
+
const root = dirname(here)
|
|
57
|
+
return existsSync(join(root, "frontend", "vite.config.ts")) ? root : null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const resolveViteBin = (): string => {
|
|
61
|
+
let dir = packageRoot() ?? findWorkspaceRoot()
|
|
62
|
+
for (;;) {
|
|
63
|
+
const bin = join(dir, "node_modules", ".bin", "vite")
|
|
64
|
+
if (existsSync(bin)) return bin
|
|
65
|
+
const parent = dirname(dir)
|
|
66
|
+
if (parent === dir) return bin
|
|
67
|
+
dir = parent
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
54
71
|
export const resolveConfigUiCwd = (override?: string): string => {
|
|
55
72
|
if (override !== undefined) return override
|
|
56
|
-
|
|
73
|
+
const root = packageRoot()
|
|
74
|
+
return root !== null
|
|
75
|
+
? join(root, "config-ui")
|
|
76
|
+
: resolvePath(findWorkspaceRoot(), "packages", "cli", "config-ui")
|
|
57
77
|
}
|
|
58
78
|
|
|
59
79
|
export const resolveFrontendCwd = (): string =>
|
|
60
|
-
|
|
80
|
+
packageRoot() !== null
|
|
81
|
+
? join(packageRoot()!, "frontend")
|
|
82
|
+
: resolvePath(findWorkspaceRoot(), "packages", "cli", "frontend")
|
|
61
83
|
|
|
62
84
|
interface ViteSpawnOptions {
|
|
63
85
|
port: number
|
|
@@ -124,7 +146,7 @@ const spawnViteAndWaitForReady = (
|
|
|
124
146
|
if (emulatorMode !== undefined) {
|
|
125
147
|
env["SIRENO_EMULATOR_MODE"] = String(emulatorMode)
|
|
126
148
|
}
|
|
127
|
-
const viteBin =
|
|
149
|
+
const viteBin = resolveViteBin()
|
|
128
150
|
const viteArgs = [
|
|
129
151
|
"--config",
|
|
130
152
|
resolvePath(cwd, "vite.config.ts"),
|
|
@@ -134,7 +156,7 @@ const spawnViteAndWaitForReady = (
|
|
|
134
156
|
if (host !== undefined) {
|
|
135
157
|
viteArgs.push("--host", host)
|
|
136
158
|
}
|
|
137
|
-
const child = spawn(viteBin, viteArgs, {
|
|
159
|
+
const child = spawn(process.execPath, [viteBin, ...viteArgs], {
|
|
138
160
|
cwd,
|
|
139
161
|
env,
|
|
140
162
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process"
|
|
2
|
-
import { existsSync } from "node:fs"
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs"
|
|
3
3
|
import { homedir } from "node:os"
|
|
4
4
|
import { join } from "node:path"
|
|
5
5
|
import { platform } from "node:process"
|
|
@@ -20,6 +20,33 @@ export interface InvokeManagerOptions {
|
|
|
20
20
|
|
|
21
21
|
const DAEMON_NAME = "sirenodeck"
|
|
22
22
|
|
|
23
|
+
export const refreshStaleUnit = (
|
|
24
|
+
content: string,
|
|
25
|
+
currentScript: string,
|
|
26
|
+
nodePath: string,
|
|
27
|
+
exists: (path: string) => boolean = existsSync,
|
|
28
|
+
): string => {
|
|
29
|
+
const match = content.match(
|
|
30
|
+
/^ExecStart="([^"]+)" "([^"]+\/dist\/main\.mjs)" start$/m,
|
|
31
|
+
)
|
|
32
|
+
const oldScript = match?.[2]
|
|
33
|
+
if (
|
|
34
|
+
match === null ||
|
|
35
|
+
oldScript === undefined ||
|
|
36
|
+
oldScript === currentScript ||
|
|
37
|
+
!exists(currentScript)
|
|
38
|
+
)
|
|
39
|
+
return content
|
|
40
|
+
const brewUpgrade =
|
|
41
|
+
oldScript.includes("/Cellar/sirenodeck/") &&
|
|
42
|
+
currentScript.includes("/Cellar/sirenodeck/")
|
|
43
|
+
if (exists(oldScript) && !brewUpgrade) return content
|
|
44
|
+
return content.replace(
|
|
45
|
+
match[0],
|
|
46
|
+
`ExecStart="${nodePath}" "${currentScript}" start`,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
23
50
|
const systemctl = (userLevel: boolean, args: ReadonlyArray<string>): void => {
|
|
24
51
|
const cmd = userLevel ? "systemctl" : "systemctl"
|
|
25
52
|
const fullArgs = userLevel ? ["--user", ...args] : [...args]
|
|
@@ -123,6 +150,31 @@ export const ensureInstalled = async (
|
|
|
123
150
|
const { logger, system = false } = options
|
|
124
151
|
const userLevel = !system
|
|
125
152
|
if (isUnitInstalled(userLevel)) {
|
|
153
|
+
if (currentOS() === "linux") {
|
|
154
|
+
const unitPath = userLevel
|
|
155
|
+
? join(
|
|
156
|
+
homedir(),
|
|
157
|
+
".config",
|
|
158
|
+
"systemd",
|
|
159
|
+
"user",
|
|
160
|
+
`${DAEMON_NAME}.service`,
|
|
161
|
+
)
|
|
162
|
+
: `/etc/systemd/system/${DAEMON_NAME}.service`
|
|
163
|
+
const content = readFileSync(unitPath, "utf8")
|
|
164
|
+
const currentScript = process.argv[1]
|
|
165
|
+
const updated =
|
|
166
|
+
currentScript === undefined
|
|
167
|
+
? content
|
|
168
|
+
: refreshStaleUnit(content, currentScript, process.execPath)
|
|
169
|
+
if (updated !== content) {
|
|
170
|
+
writeFileSync(unitPath, updated)
|
|
171
|
+
systemctl(userLevel, ["daemon-reload"])
|
|
172
|
+
logger.info(
|
|
173
|
+
{ unitPath },
|
|
174
|
+
"ensureInstalled: refreshed stale executable path",
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
126
178
|
logger.debug({ userLevel }, "ensureInstalled: unit already present")
|
|
127
179
|
return
|
|
128
180
|
}
|
|
@@ -8,20 +8,16 @@ import type pino from "pino"
|
|
|
8
8
|
// runPipeline's finally block; the helper is preserved for that single use
|
|
9
9
|
// site and stays best-effort because the device may be unplugged at the
|
|
10
10
|
// moment of exit.
|
|
11
|
-
const buildBlackBuffer = (
|
|
12
|
-
const stride = 3 * 8
|
|
13
|
-
const total = keyCount * stride * 8
|
|
14
|
-
return Buffer.alloc(total)
|
|
15
|
-
}
|
|
11
|
+
const buildBlackBuffer = (): Buffer => Buffer.alloc(72 * 72 * 3)
|
|
16
12
|
|
|
17
13
|
export const pushBlackFrame = async (
|
|
18
14
|
device: StreamDeckDevice,
|
|
19
15
|
logger: pino.Logger,
|
|
20
16
|
): Promise<void> => {
|
|
21
17
|
try {
|
|
22
|
-
const buf = buildBlackBuffer(
|
|
18
|
+
const buf = buildBlackBuffer()
|
|
23
19
|
for (let i = 0; i < device.getKeyCount(); i++) {
|
|
24
|
-
await device.fillKeyBuffer(i, buf
|
|
20
|
+
await device.fillKeyBuffer(i, buf)
|
|
25
21
|
}
|
|
26
22
|
// ponytail: allow queued image writes to drain before the caller closes
|
|
27
23
|
// the device; brightness is intentionally left unchanged.
|
|
@@ -270,7 +270,22 @@ const BROWSER_NODE_STUBS: ReadonlyArray<{
|
|
|
270
270
|
hasDefault: false,
|
|
271
271
|
names: ["readFile", "readdir", "stat"],
|
|
272
272
|
},
|
|
273
|
-
{
|
|
273
|
+
{
|
|
274
|
+
specifier: "node:path",
|
|
275
|
+
hasDefault: false,
|
|
276
|
+
names: [
|
|
277
|
+
"join",
|
|
278
|
+
"dirname",
|
|
279
|
+
"basename",
|
|
280
|
+
"isAbsolute",
|
|
281
|
+
"resolve",
|
|
282
|
+
"extname",
|
|
283
|
+
"relative",
|
|
284
|
+
"normalize",
|
|
285
|
+
"parse",
|
|
286
|
+
"sep",
|
|
287
|
+
],
|
|
288
|
+
},
|
|
274
289
|
]
|
|
275
290
|
|
|
276
291
|
const nodeStubSource = ({
|