10 browsers: add b9 (Edge macOS) + b10 (Chrome Android Samsung)
- config.json: 10 browsers, 10 UA presets, vpsIp 49.128.189.254 - generate.js / server.js: id validation ^b(10|[1-9])$ - install.sh: loops seq 1..10, VPS_IP auto-detected via ifconfig.me, UFW ranges 18081:18090 / 52000:52999 - index.html: grid 5x2, subtitle 10 browser - paste-sync-test: 10 cells, 17/17 pass - README: 10-browser docs, manual add section now covers b11+
This commit is contained in:
1 parent
b600b92d76
commit
df4ae5a17a
7 files changed
+89
-74
No files matched your search
@@ -6,7 +6,7 @@
|
||||
// transparent <textarea>, exactly like the Neko client) into each cell
|
||||
// iframe, then proves:
|
||||
// T1 a paste in the master dispatches a paste with the SAME text into
|
||||
// all 7 followers (read back the way Neko's Overlay reads it:
|
||||
// all 9 followers (read back the way Neko's Overlay reads it:
|
||||
// e.clipboardData.getData('text/plain')), with no feedback loop
|
||||
// T2 the pasted-into cell becomes Master
|
||||
// T3 paste mirroring stops when Sync is OFF, and a real (untrusted)
|
||||
@@ -93,7 +93,7 @@ function sleep(ms) {
|
||||
}
|
||||
|
||||
const BROWSERS = [];
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
BROWSERS.push({
|
||||
id: 'b' + i,
|
||||
name: 'Browser ' + i,
|
||||
@@ -133,7 +133,7 @@ async function main() {
|
||||
pretendToBeVisual: true,
|
||||
beforeParse(window) {
|
||||
installClipboardPolyfill(window);
|
||||
// Stub the manager API: authenticated, one UA preset, 8 running
|
||||
// Stub the manager API: authenticated, one UA preset, 10 running
|
||||
// browsers with tokens (so every cell auto-connects).
|
||||
window.fetch = (url) => {
|
||||
if (url === '/api/me') {
|
||||
@@ -159,18 +159,18 @@ async function main() {
|
||||
// Wait for checkAuth -> startGrid -> loadPresets -> refresh to build the cells.
|
||||
await sleep(300);
|
||||
const cells = {};
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
const id = 'b' + i;
|
||||
const iframe = doc.querySelector('#cell-' + id + ' iframe');
|
||||
if (!iframe) throw new Error('cell ' + id + ' did not build');
|
||||
cells[id] = { iframe };
|
||||
}
|
||||
check('grid builds 8 cells', Object.keys(cells).length === 8);
|
||||
check('grid builds 10 cells', Object.keys(cells).length === 10);
|
||||
|
||||
// Inject a fake Neko overlay into each iframe and record what Neko
|
||||
// would receive: a 'paste' listener that reads clipboardData exactly
|
||||
// like Overlay.onPaste does, plus counters for loop detection.
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
const id = 'b' + i;
|
||||
const iframe = cells[id].iframe;
|
||||
const idoc = iframe.contentDocument;
|
||||
@@ -210,7 +210,7 @@ async function main() {
|
||||
// the injected textareas and attach the Sync listeners.
|
||||
await sleep(900);
|
||||
const attached = Object.keys(farm.cells).filter((id) => farm.cells[id].inputEl).length;
|
||||
check('grid found the Neko input in all 8 cells', attached === 8, 'found in ' + attached + '/8');
|
||||
check('grid found the Neko input in all 10 cells', attached === 10, 'found in ' + attached + '/10');
|
||||
|
||||
const syncBtn = doc.getElementById('syncBtn');
|
||||
function setSync(on) {
|
||||
@@ -253,7 +253,7 @@ async function main() {
|
||||
const found = farm.findNekoInput(cells.b1.ta.ownerDocument);
|
||||
check('findNekoInput returns the overlay textarea, not the decoy', found === cells.b1.ta);
|
||||
|
||||
// ---- T1: paste in the master reaches all 7 followers with the same text ----
|
||||
// ---- T1: paste in the master reaches all 9 followers with the same text ----
|
||||
console.log('T1: paste mirrors to all followers');
|
||||
setSync(true);
|
||||
check('Sync ON', syncBtn.textContent === 'Sinkron: ON');
|
||||
@@ -268,7 +268,7 @@ async function main() {
|
||||
if (JSON.stringify(c.nekoPastes) !== JSON.stringify(['hello paste'])) allSame = false;
|
||||
if (c.pasteCount !== 1) allOnce = false;
|
||||
}
|
||||
check('all 7 followers received the same text', allSame, JSON.stringify(followerPastes()));
|
||||
check('all 9 followers received the same text', allSame, JSON.stringify(followerPastes()));
|
||||
check('no feedback loop (each follower saw exactly 1 paste)', allOnce,
|
||||
Object.keys(followerPastes()).map((k) => k + ':' + cells[k].pasteCount).join(' '));
|
||||
|
||||
@@ -335,18 +335,18 @@ async function main() {
|
||||
for (let i = 2; i <= 8; i++) {
|
||||
if (JSON.stringify(cells['b' + i].keys) !== JSON.stringify(['a'])) keysOk = false;
|
||||
}
|
||||
check('keydown mirrors to all 7 followers', keysOk,
|
||||
check('keydown mirrors to all 9 followers', keysOk,
|
||||
Object.keys(cells).map((k) => k + ':' + JSON.stringify(cells[k].keys)).join(' '));
|
||||
|
||||
// ---- T6: fallback when a follower window lacks ClipboardEvent/DataTransfer ----
|
||||
console.log('T6: fallback without ClipboardEvent/DataTransfer');
|
||||
delete cells.b8.iwin.ClipboardEvent;
|
||||
delete cells.b8.iwin.DataTransfer;
|
||||
delete cells.b10.iwin.ClipboardEvent;
|
||||
delete cells.b10.iwin.DataTransfer;
|
||||
farm.onCellInput('b1', mockPaste('fallback text'));
|
||||
await sleep(50);
|
||||
check('b8 (no ClipboardEvent/DataTransfer) still received the text',
|
||||
JSON.stringify(cells.b8.nekoPastes) === JSON.stringify(['hello paste', 'fallback text']),
|
||||
'got ' + JSON.stringify(cells.b8.nekoPastes));
|
||||
check('b10 (no ClipboardEvent/DataTransfer) still received the text',
|
||||
JSON.stringify(cells.b10.nekoPastes) === JSON.stringify(['hello paste', 'fallback text']),
|
||||
'got ' + JSON.stringify(cells.b10.nekoPastes));
|
||||
let othersOk = true;
|
||||
for (let i = 2; i <= 7; i++) {
|
||||
if (JSON.stringify(cells['b' + i].nekoPastes) !== JSON.stringify(['hello paste', 'fallback text'])) othersOk = false;
|
||||
|
||||
Reference in new issue
Block a user