All your computers and your phone/iPhone, working as one desk. Screens, apps, files, clipboard, calls, texts, notifications, mouse and keyboard, shared between Mac, Windows, Linux , Android, Web and ios / ipados . Free and open source. No account, no cloud, and no shared network needed.
JavaScript androidapple-ecosystemconnectelectronfile-sharingintel-unison-alternativeiosios-windowskde-connect-alternativekvmlinuxmacbookmacosmouse-sharingphone-link-alternativeproductivityscreen-sharingsidecar-alternativesynergy-alternativewindows
// TwinDesk — Copyright (C) 2026 inukaasith. GPL-3.0, see LICENSE.
// shared/androidfull.js: the full Android APK comes from this version's release, checked against the
// SHA-256 GitHub gives and kept; a local copy wins; a wrong file or a missing release is refused.
// Run: node shared/test/androidfull.js
'use strict';
const assert = require('assert');
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const { fullApk } = require('../androidfull.js');
const body = Buffer.from('PK fake apk '.repeat(1000));
const sha = crypto.createHash('sha256').update(body).digest('hex');
const stream = (buf) => ({ getReader() { let done = false; return { read: async () => (done ? { done: true } : (done = true, { done: false, value: buf })) }; } });
function fakeFetch({ digest = `sha256:${sha}`, release = true, data = body } = {}) {
const calls = [];
const fetch = async (url) => {
calls.push(url);
if (url.includes('/releases/tags/')) {
if (!release) return { ok: false, status: 404 };
return { ok: true, status: 200, json: async () => ({ assets: [{ name: 'TwinDesk-3.3.3-full.apk', digest, size: data.length, browser_download_url: 'https://dl/full.apk' }] }) };
}
return { ok: true, status: 200, headers: { get: () => String(data.length) }, body: stream(data) };
};
return { fetch, calls };
}
(async () => {
const base = fs.mkdtempSync(path.join(os.tmpdir(), 'td-afull-'));
const cacheDir = path.join(base, 'cache');
const none = { vendor: path.join(base, 'nope.apk'), dist: path.join(base, 'nodist'), version: '3.3.3', cacheDir };
const f1 = fakeFetch();
const got = await fullApk({ ...none, fetch: f1.fetch });
assert.strictEqual(got, path.join(cacheDir, 'TwinDesk-3.3.3-full.apk'));
assert.ok(fs.readFileSync(got).equals(body));
assert.ok(f1.calls[0].endsWith('/releases/tags/v3.3.3'));
const f2 = fakeFetch();
assert.strictEqual(await fullApk({ ...none, fetch: f2.fetch }), got, 'kept');
assert.strictEqual(f2.calls.length, 0, 'no network the second time');
fs.rmSync(cacheDir, { recursive: true });
await assert.rejects(fullApk({ ...none, fetch: fakeFetch({ digest: `sha256:${'0'.repeat(64)}` }).fetch }), /didn’t match/);
assert.ok(!fs.existsSync(got), 'a wrong file is not kept');
await assert.rejects(fullApk({ ...none, fetch: fakeFetch({ release: false }).fetch }), /isn’t released/);
const vendor = path.join(base, 'vendor.apk');
fs.writeFileSync(vendor, 'x');
const f3 = fakeFetch();
assert.strictEqual(await fullApk({ ...none, vendor, fetch: f3.fetch }), vendor, 'a bundled copy wins');
assert.strictEqual(f3.calls.length, 0);
console.log('androidfull: ok');
})().catch((e) => { console.error(e); process.exit(1); });