flow-frame-core 0.1.6 → 0.1.11
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/README.md +32 -0
- package/TOOLS.md +1080 -0
- package/dist/inference/capturescreenshot.d.ts +10 -9
- package/dist/inference/capturescreenshot.d.ts.map +1 -1
- package/dist/inference/capturescreenshot.js +94 -118
- package/dist/inference/capturescreenshot.js.map +1 -1
- package/dist/operations.d.ts +17 -1
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +34 -20
- package/dist/operations.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Take a full
|
|
3
|
-
* into a tightly‑packed RGBA buffer, write out a GUID.png, and return
|
|
4
|
-
* just the filename.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} targetFolder – Where to save the PNG.
|
|
7
|
-
* @returns {Promise<string>} – The generated <guid>.png filename.
|
|
2
|
+
* Take a full-screen shot, write out a GUID.png, and return just the filename.
|
|
8
3
|
*/
|
|
9
|
-
export declare function captureFullScreenshot(targetFolder:
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export declare function captureFullScreenshot(targetFolder: string): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Capture a screenshot and return it as a data:image/png;base64 URL.
|
|
7
|
+
*/
|
|
8
|
+
export declare function captureScreenshotBase64(region?: any): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Capture a screenshot and save to targetFolder/filename.
|
|
11
|
+
*/
|
|
12
|
+
export declare function captureScreenshot(targetFolder: string, filename: string, region?: any): Promise<string>;
|
|
12
13
|
//# sourceMappingURL=capturescreenshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capturescreenshot.d.ts","sourceRoot":"","sources":["../../src/inference/capturescreenshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capturescreenshot.d.ts","sourceRoot":"","sources":["../../src/inference/capturescreenshot.ts"],"names":[],"mappings":"AA6FA;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQjF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ7G"}
|
|
@@ -1,157 +1,133 @@
|
|
|
1
|
-
// screenshot.mjs
|
|
1
|
+
// screenshot.mjs — uses macOS screencapture on darwin to avoid robotjs segfaults
|
|
2
2
|
import robot from 'robotjs';
|
|
3
3
|
import { promises as fs } from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import os from 'os';
|
|
5
6
|
import sharp from 'sharp';
|
|
6
7
|
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
const IS_MAC = os.platform() === 'darwin';
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* just the filename.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} targetFolder – Where to save the PNG.
|
|
13
|
-
* @returns {Promise<string>} – The generated <guid>.png filename.
|
|
11
|
+
* Use macOS screencapture command (safe, no segfault risk).
|
|
12
|
+
* Returns path to a temporary PNG file.
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { width, height, byteWidth, bytesPerPixel, image: bgra } = bmp;
|
|
22
|
-
// allocate a tight RGBA buffer
|
|
23
|
-
const rgba = Buffer.alloc(width * height * 4);
|
|
24
|
-
// unpack row by row accounting for stride
|
|
25
|
-
for (let row = 0; row < height; row++) {
|
|
26
|
-
const rowStartSrc = row * byteWidth;
|
|
27
|
-
const rowStartDst = row * width * 4;
|
|
28
|
-
for (let col = 0; col < width; col++) {
|
|
29
|
-
const srcIdx = rowStartSrc + col * bytesPerPixel;
|
|
30
|
-
const dstIdx = rowStartDst + col * 4;
|
|
31
|
-
// BGRA → RGBA
|
|
32
|
-
rgba[dstIdx] = bgra[srcIdx + 2]; // R
|
|
33
|
-
rgba[dstIdx + 1] = bgra[srcIdx + 1]; // G
|
|
34
|
-
rgba[dstIdx + 2] = bgra[srcIdx]; // B
|
|
35
|
-
rgba[dstIdx + 3] = bgra[srcIdx + 3]; // A
|
|
14
|
+
async function macosCapture(x, y, w, h) {
|
|
15
|
+
const tmpDir = os.tmpdir();
|
|
16
|
+
const tmpFile = path.join(tmpDir, `woodbury-cap-${Date.now()}-${Math.random().toString(36).slice(2)}.png`);
|
|
17
|
+
try {
|
|
18
|
+
if (x === 0 && y === 0 && w === undefined) {
|
|
19
|
+
execSync(`screencapture -x "${tmpFile}"`, { timeout: 10000 });
|
|
36
20
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const filename = `${uuidv4()}.png`;
|
|
40
|
-
const outPath = path.join(targetFolder, filename);
|
|
41
|
-
await sharp(rgba, {
|
|
42
|
-
raw: { width, height, channels: 4 }
|
|
43
|
-
})
|
|
44
|
-
.png()
|
|
45
|
-
.toFile(outPath);
|
|
46
|
-
return filename;
|
|
47
|
-
}
|
|
48
|
-
export async function captureScreenshotBase64(region) {
|
|
49
|
-
// Get screen size for bounds checking
|
|
50
|
-
const screenSize = robot.getScreenSize();
|
|
51
|
-
// Use region if provided, otherwise capture full screen
|
|
52
|
-
let captureX = 0;
|
|
53
|
-
let captureY = 0;
|
|
54
|
-
let captureWidth;
|
|
55
|
-
let captureHeight;
|
|
56
|
-
if (region && region.x !== undefined && region.y !== undefined && region.width && region.height) {
|
|
57
|
-
// Validate and clamp region to screen bounds, rounding to integers
|
|
58
|
-
captureX = Math.max(0, Math.min(Math.round(region.x), screenSize.width - 1));
|
|
59
|
-
captureY = Math.max(0, Math.min(Math.round(region.y), screenSize.height - 1));
|
|
60
|
-
captureWidth = Math.max(1, Math.min(Math.round(region.width), screenSize.width - captureX));
|
|
61
|
-
captureHeight = Math.max(1, Math.min(Math.round(region.height), screenSize.height - captureY));
|
|
62
|
-
// If the region is completely outside screen bounds, return early with error
|
|
63
|
-
if (captureWidth < 1 || captureHeight < 1) {
|
|
64
|
-
throw new Error(`Region is outside screen bounds: ${JSON.stringify(region)} (screen: ${screenSize.width}x${screenSize.height})`);
|
|
21
|
+
else {
|
|
22
|
+
execSync(`screencapture -x -R${x},${y},${w},${h} "${tmpFile}"`, { timeout: 10000 });
|
|
65
23
|
}
|
|
24
|
+
return tmpFile;
|
|
66
25
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
26
|
+
catch (err) {
|
|
27
|
+
try {
|
|
28
|
+
await fs.unlink(tmpFile);
|
|
29
|
+
}
|
|
30
|
+
catch (e) { }
|
|
31
|
+
throw new Error(`macOS screencapture failed: ${err.message}`);
|
|
71
32
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* robotjs capture with BGRA->RGBA conversion (used on Windows/Linux).
|
|
36
|
+
*/
|
|
37
|
+
function robotjsCapture(x, y, w, h) {
|
|
38
|
+
const bmp = robot.screen.capture(x, y, w, h);
|
|
75
39
|
const { width, height, byteWidth, bytesPerPixel, image: bgra } = bmp;
|
|
76
|
-
// allocate a tight RGBA buffer
|
|
77
40
|
const rgba = Buffer.alloc(width * height * 4);
|
|
78
|
-
// unpack row by row accounting for stride
|
|
79
41
|
for (let row = 0; row < height; row++) {
|
|
80
42
|
const rowStartSrc = row * byteWidth;
|
|
81
43
|
const rowStartDst = row * width * 4;
|
|
82
44
|
for (let col = 0; col < width; col++) {
|
|
83
45
|
const srcIdx = rowStartSrc + col * bytesPerPixel;
|
|
84
46
|
const dstIdx = rowStartDst + col * 4;
|
|
85
|
-
// BGRA → RGBA
|
|
86
47
|
rgba[dstIdx] = bgra[srcIdx + 2]; // R
|
|
87
48
|
rgba[dstIdx + 1] = bgra[srcIdx + 1]; // G
|
|
88
49
|
rgba[dstIdx + 2] = bgra[srcIdx]; // B
|
|
89
50
|
rgba[dstIdx + 3] = bgra[srcIdx + 3]; // A
|
|
90
51
|
}
|
|
91
52
|
}
|
|
92
|
-
|
|
93
|
-
const pngBuffer = await sharp(rgba, {
|
|
94
|
-
raw: { width, height, channels: 4 }
|
|
95
|
-
})
|
|
96
|
-
.png()
|
|
97
|
-
.toBuffer();
|
|
98
|
-
const base64 = pngBuffer.toString('base64');
|
|
99
|
-
const dataUrl = `data:image/png;base64,${base64}`;
|
|
100
|
-
return dataUrl;
|
|
53
|
+
return { rgba, width, height };
|
|
101
54
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Resolve capture region from params, clamped to screen bounds.
|
|
57
|
+
*/
|
|
58
|
+
function resolveRegion(region) {
|
|
106
59
|
const screenSize = robot.getScreenSize();
|
|
107
|
-
|
|
108
|
-
let captureX = 0;
|
|
109
|
-
let captureY = 0;
|
|
110
|
-
let captureWidth;
|
|
111
|
-
let captureHeight;
|
|
60
|
+
let x = 0, y = 0, w, h;
|
|
112
61
|
if (region && region.x !== undefined && region.y !== undefined && region.width && region.height) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// If the region is completely outside screen bounds, return early with error
|
|
119
|
-
if (captureWidth < 1 || captureHeight < 1) {
|
|
62
|
+
x = Math.max(0, Math.min(Math.round(region.x), screenSize.width - 1));
|
|
63
|
+
y = Math.max(0, Math.min(Math.round(region.y), screenSize.height - 1));
|
|
64
|
+
w = Math.max(1, Math.min(Math.round(region.width), screenSize.width - x));
|
|
65
|
+
h = Math.max(1, Math.min(Math.round(region.height), screenSize.height - y));
|
|
66
|
+
if (w < 1 || h < 1) {
|
|
120
67
|
throw new Error(`Region is outside screen bounds: ${JSON.stringify(region)} (screen: ${screenSize.width}x${screenSize.height})`);
|
|
121
68
|
}
|
|
122
69
|
}
|
|
123
70
|
else {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
captureHeight = screenSize.height;
|
|
71
|
+
w = screenSize.width;
|
|
72
|
+
h = screenSize.height;
|
|
127
73
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
74
|
+
return { x, y, w, h };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Capture to a PNG buffer.
|
|
78
|
+
* macOS: uses screencapture command (avoids robotjs native segfault).
|
|
79
|
+
* Windows/Linux: uses robotjs with BGRA→RGBA conversion.
|
|
80
|
+
*/
|
|
81
|
+
async function captureToPng(x, y, w, h) {
|
|
82
|
+
if (IS_MAC) {
|
|
83
|
+
const tmpFile = await macosCapture(x, y, w, h);
|
|
84
|
+
try {
|
|
85
|
+
return await fs.readFile(tmpFile);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
try {
|
|
89
|
+
await fs.unlink(tmpFile);
|
|
90
|
+
}
|
|
91
|
+
catch (e) { }
|
|
146
92
|
}
|
|
147
93
|
}
|
|
148
|
-
|
|
94
|
+
else {
|
|
95
|
+
const { rgba, width, height } = robotjsCapture(x, y, w, h);
|
|
96
|
+
return await sharp(rgba, { raw: { width, height, channels: 4 } }).png().toBuffer();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Take a full-screen shot, write out a GUID.png, and return just the filename.
|
|
101
|
+
*/
|
|
102
|
+
export async function captureFullScreenshot(targetFolder) {
|
|
103
|
+
await fs.mkdir(targetFolder, { recursive: true });
|
|
104
|
+
const screenSize = robot.getScreenSize();
|
|
105
|
+
const pngBuffer = await captureToPng(0, 0, screenSize.width, screenSize.height);
|
|
106
|
+
const filename = `${uuidv4()}.png`;
|
|
107
|
+
const outPath = path.join(targetFolder, filename);
|
|
108
|
+
await fs.writeFile(outPath, pngBuffer);
|
|
109
|
+
return filename;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Capture a screenshot and return it as a data:image/png;base64 URL.
|
|
113
|
+
*/
|
|
114
|
+
export async function captureScreenshotBase64(region) {
|
|
115
|
+
const { x, y, w, h } = resolveRegion(region);
|
|
116
|
+
console.log(`Capturing screenshot for base64 at (${x},${y}) ${w}x${h}`);
|
|
117
|
+
const pngBuffer = await captureToPng(x, y, w, h);
|
|
118
|
+
const base64 = pngBuffer.toString('base64');
|
|
119
|
+
return `data:image/png;base64,${base64}`;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Capture a screenshot and save to targetFolder/filename.
|
|
123
|
+
*/
|
|
124
|
+
export async function captureScreenshot(targetFolder, filename, region) {
|
|
125
|
+
await fs.mkdir(targetFolder, { recursive: true });
|
|
126
|
+
const { x, y, w, h } = resolveRegion(region);
|
|
127
|
+
console.log(`Capturing screenshot at (${x},${y}) ${w}x${h}`);
|
|
128
|
+
const pngBuffer = await captureToPng(x, y, w, h);
|
|
149
129
|
const outPath = path.join(targetFolder, filename);
|
|
150
|
-
await
|
|
151
|
-
raw: { width, height, channels: 4 }
|
|
152
|
-
})
|
|
153
|
-
.png()
|
|
154
|
-
.toFile(outPath);
|
|
130
|
+
await fs.writeFile(outPath, pngBuffer);
|
|
155
131
|
return filename;
|
|
156
132
|
}
|
|
157
133
|
//# sourceMappingURL=capturescreenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capturescreenshot.js","sourceRoot":"","sources":["../../src/inference/capturescreenshot.ts"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AiB,CAAC,YAAoB,EAAE,QAAgB,EAAE,MAAY;IAC1F,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update the Chrome UI offsets used for viewport-to-screen coordinate conversion.
|
|
3
|
+
* @param offsets - Partial offsets to merge (e.g., { y: 95 })
|
|
4
|
+
*/
|
|
5
|
+
export declare function setChromeOffsets(offsets: Partial<{
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}>): void;
|
|
9
|
+
/**
|
|
10
|
+
* Get the current Chrome UI offsets.
|
|
11
|
+
* @returns A copy of the current offsets { x, y }
|
|
12
|
+
*/
|
|
13
|
+
export declare function getChromeOffsets(): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
1
17
|
export declare function moveMouse(position: any): Promise<void>;
|
|
2
|
-
export declare function mouseClick(): Promise<void>;
|
|
18
|
+
export declare function mouseClick(delayMs?: number): Promise<void>;
|
|
3
19
|
export declare function pressEscapeAsync(): Promise<void>;
|
|
4
20
|
export declare function moveMouseDesktop(position: any): Promise<void>;
|
|
5
21
|
export declare function moveMouseRelative(relative: any): Promise<void>;
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAiDA,wBAAsB,SAAS,CAAC,QAAQ,KAAA,iBAmBvC;AACD,wBAAsB,UAAU,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,QAE1E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB;;;EAE/B;AAED,wBAAsB,SAAS,CAAC,QAAQ,KAAA,iBAmBvC;AACD,wBAAsB,UAAU,CAAC,OAAO,SAAO,iBAI9C;AAMD,wBAAsB,gBAAgB,kBAIrC;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,KAAA,iBAmB9C;AACD,wBAAsB,iBAAiB,CAAC,QAAQ,KAAA,iBAkB/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,YAGxB;AAcD,wBAAsB,oCAAoC,kBAgIzD;AAED,wBAAsB,8BAA8B,kBAyGnD;AAID,wBAAsB,yBAAyB,kBAqH9C;AAqFD,wBAAsB,QAAQ,CAAC,MAAM,KAAA,iBAoBpC;AAGD,wBAAsB,QAAQ,CAAC,MAAM,KAAA,iBAepC;AA0BD,wBAAsB,wBAAwB,kBAa7C;AAED,wBAAsB,qBAAqB,CAAC,GAAG,UAAO,iBA0BrD;AAwCD,wBAAsB,mBAAmB,kBAmVxC;AAGD,wBAAsB,gBAAgB,CAAC,QAAQ,KAAA,iBAc9C;AA0BD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAI,EAAE,CAAC,SAAI,QAElC;AAiBD,wBAAsB,oBAAoB,kBA4QzC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,KAAA,iBAyH1C;AAqBD,wBAAgB,iBAAiB,YAEhC;AAED,wBAAgB,gBAAgB,YAE/B;AAGD,wBAAsB,YAAY,CAAC,QAAQ,KAAA,EAAE,MAAM,CAAC,KAAA,EAAE,QAAQ,CAAC,KAAA,iBA+G9D;AAgBD,wBAAgB,qBAAqB,CAAC,IAAI,KAAA,UAGzC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,KAAA,UAGzC"}
|
package/dist/operations.js
CHANGED
|
@@ -11,7 +11,21 @@ import { getFiles, findVideoJobs, sanitizeFileName, getDetectOrientation, readPr
|
|
|
11
11
|
import { MODES, SUNO_SELECTORS, YOUTUBE_SELECTORS } from './constants.js';
|
|
12
12
|
import { safeExtractJSON } from './jsonHandler.js';
|
|
13
13
|
const WAIT_FACTOR = 0.25;
|
|
14
|
-
|
|
14
|
+
let chrome_offsets = { x: 1, y: 125 };
|
|
15
|
+
/**
|
|
16
|
+
* Update the Chrome UI offsets used for viewport-to-screen coordinate conversion.
|
|
17
|
+
* @param offsets - Partial offsets to merge (e.g., { y: 95 })
|
|
18
|
+
*/
|
|
19
|
+
export function setChromeOffsets(offsets) {
|
|
20
|
+
chrome_offsets = { ...chrome_offsets, ...offsets };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the current Chrome UI offsets.
|
|
24
|
+
* @returns A copy of the current offsets { x, y }
|
|
25
|
+
*/
|
|
26
|
+
export function getChromeOffsets() {
|
|
27
|
+
return { ...chrome_offsets };
|
|
28
|
+
}
|
|
15
29
|
export async function moveMouse(position) {
|
|
16
30
|
const { left, top, height, width } = position;
|
|
17
31
|
// {
|
|
@@ -22,7 +36,7 @@ export async function moveMouse(position) {
|
|
|
22
36
|
// }
|
|
23
37
|
// Define the target coordinates (x, y)
|
|
24
38
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
25
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
39
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
26
40
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
27
41
|
// Move the mouse smoothly to the target coordinates
|
|
28
42
|
if (isWindows()) {
|
|
@@ -31,10 +45,10 @@ export async function moveMouse(position) {
|
|
|
31
45
|
else
|
|
32
46
|
robot.moveMouseSmooth(targetX, targetY);
|
|
33
47
|
}
|
|
34
|
-
export async function mouseClick() {
|
|
48
|
+
export async function mouseClick(delayMs = 1000) {
|
|
35
49
|
await pause(() => {
|
|
36
50
|
robot.mouseClick(); // Performs a left-click.
|
|
37
|
-
},
|
|
51
|
+
}, delayMs);
|
|
38
52
|
}
|
|
39
53
|
function sleep(ms) {
|
|
40
54
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -1050,7 +1064,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1050
1064
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles);
|
|
1051
1065
|
if (left && top) {
|
|
1052
1066
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1053
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1067
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1054
1068
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1055
1069
|
scroll(0, -1000); // Scroll down to make sure the styles are visible
|
|
1056
1070
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1060,7 +1074,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1060
1074
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles_tags);
|
|
1061
1075
|
if (left && top) {
|
|
1062
1076
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1063
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1077
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1064
1078
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1065
1079
|
scroll(0, -1000); // Scroll down to make sure the styles are visible
|
|
1066
1080
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1070,7 +1084,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1070
1084
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.title);
|
|
1071
1085
|
// Define the target coordinates (x, y)
|
|
1072
1086
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1073
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1087
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1074
1088
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1075
1089
|
// Move the mouse smoothly to the target coordinates
|
|
1076
1090
|
console_log_it(`name`, 'Suno Film [state]');
|
|
@@ -1087,7 +1101,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1087
1101
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles);
|
|
1088
1102
|
if (left && top) {
|
|
1089
1103
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1090
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1104
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1091
1105
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1092
1106
|
scroll(0, 1000); // Scroll down to make sure the styles are visible
|
|
1093
1107
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1097,7 +1111,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1097
1111
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles_tags);
|
|
1098
1112
|
if (left, top) {
|
|
1099
1113
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1100
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1114
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1101
1115
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1102
1116
|
scroll(0, 1000); // Scroll down to make sure the styles are visible
|
|
1103
1117
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1108,7 +1122,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1108
1122
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.lyrics);
|
|
1109
1123
|
// Define the target coordinates (x, y)
|
|
1110
1124
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1111
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1125
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1112
1126
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1113
1127
|
console_log_it(`lyrics`, 'Suno Film [state]');
|
|
1114
1128
|
// Move the mouse smoothly to the target coordinates
|
|
@@ -1125,7 +1139,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1125
1139
|
{
|
|
1126
1140
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles);
|
|
1127
1141
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1128
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1142
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1129
1143
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1130
1144
|
scroll(0, 1000); // Scroll down to make sure the styles are visible
|
|
1131
1145
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1134,7 +1148,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1134
1148
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles_tags);
|
|
1135
1149
|
if (left, top) {
|
|
1136
1150
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1137
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1151
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1138
1152
|
robot.moveMouseSmooth(targetX, targetY);
|
|
1139
1153
|
scroll(0, 1000); // Scroll down to make sure the styles are visible
|
|
1140
1154
|
await pause(() => { }, SPEED * 2); // Wait for the scroll to complete
|
|
@@ -1145,7 +1159,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1145
1159
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles);
|
|
1146
1160
|
if (left && top) {
|
|
1147
1161
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1148
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1162
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1149
1163
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1150
1164
|
console_log_it(`styles`, 'Suno Film [state]');
|
|
1151
1165
|
// Move the mouse smoothly to the target coordinates
|
|
@@ -1162,7 +1176,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1162
1176
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.styles_tags);
|
|
1163
1177
|
if (left && top) {
|
|
1164
1178
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1165
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1179
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1166
1180
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1167
1181
|
console_log_it(`styles`, 'Suno Film [state]');
|
|
1168
1182
|
// Move the mouse smoothly to the target coordinates
|
|
@@ -1180,7 +1194,7 @@ export async function operateSunoFilmMouse() {
|
|
|
1180
1194
|
const { left, top, height, width } = getSunoPosition(SUNO_SELECTORS.createbtn);
|
|
1181
1195
|
// Define the target coordinates (x, y)
|
|
1182
1196
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1183
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1197
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1184
1198
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1185
1199
|
// Move the mouse smoothly to the target coordinates
|
|
1186
1200
|
let clickcount = Math.max(0, (count - song_states.length) / 2);
|
|
@@ -1274,7 +1288,7 @@ export async function operateSunoMouse(body) {
|
|
|
1274
1288
|
const { left, top, height, width } = body[SUNO_SELECTORS.title];
|
|
1275
1289
|
// Define the target coordinates (x, y)
|
|
1276
1290
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1277
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1291
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1278
1292
|
console_log_it(`title`, 'operateSunoMouse[state]');
|
|
1279
1293
|
// Move the mouse smoothly to the target coordinates
|
|
1280
1294
|
robot.moveMouseSmooth(targetX, targetY);
|
|
@@ -1291,7 +1305,7 @@ export async function operateSunoMouse(body) {
|
|
|
1291
1305
|
const { left, top, height, width } = body[SUNO_SELECTORS.lyrics];
|
|
1292
1306
|
// Define the target coordinates (x, y)
|
|
1293
1307
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1294
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1308
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1295
1309
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1296
1310
|
console_log_it(`lyrics`, 'operateSunoMouse[state]');
|
|
1297
1311
|
// Move the mouse smoothly to the target coordinates
|
|
@@ -1310,7 +1324,7 @@ export async function operateSunoMouse(body) {
|
|
|
1310
1324
|
const { left, top, height, width } = body[SUNO_SELECTORS.styles];
|
|
1311
1325
|
// Define the target coordinates (x, y)
|
|
1312
1326
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1313
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1327
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1314
1328
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1315
1329
|
console_log_it(`styles`, 'operateSunoMouse[state]');
|
|
1316
1330
|
// Move the mouse smoothly to the target coordinates
|
|
@@ -1327,7 +1341,7 @@ export async function operateSunoMouse(body) {
|
|
|
1327
1341
|
const { left, top, height, width } = body[SUNO_SELECTORS.createbtn];
|
|
1328
1342
|
// Define the target coordinates (x, y)
|
|
1329
1343
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1330
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1344
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1331
1345
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1332
1346
|
// Move the mouse smoothly to the target coordinates
|
|
1333
1347
|
robot.moveMouseSmooth(targetX, targetY);
|
|
@@ -1416,7 +1430,7 @@ export async function operateMouse(position, signal, progress) {
|
|
|
1416
1430
|
// }
|
|
1417
1431
|
// Define the target coordinates (x, y)
|
|
1418
1432
|
const targetX = left + chrome_offsets.x + (width / 2);
|
|
1419
|
-
const targetY = top + chrome_offsets.y + (height /
|
|
1433
|
+
const targetY = top + chrome_offsets.y + (height / 2);
|
|
1420
1434
|
console_log_it(`Moving mouse to (${targetX}, ${targetY})...`);
|
|
1421
1435
|
// Move the mouse smoothly to the target coordinates
|
|
1422
1436
|
robot.moveMouseSmooth(targetX, targetY);
|