mirror of https://github.com/espruino/BangleApps
Add app to allow openhaystack to work on Bangle.js (hopefully)
parent
91649606f2
commit
c1b0738c47
|
@ -0,0 +1 @@
|
|||
0.01: New App!
|
|
@ -0,0 +1,18 @@
|
|||
# OpenHaystack (AirTag)
|
||||
|
||||
Copy a base64 key from https://github.com/seemoo-lab/openhaystack and make your Bangle.js trackable as if it's an AirTag
|
||||
|
||||
Based on https://github.com/seemoo-lab/openhaystack/issues/59
|
||||
|
||||
## Usage
|
||||
|
||||
* Follow the steps on https://github.com/seemoo-lab/openhaystack#how-to-use-openhaystack to install OpenHaystack and get a unique base64 code
|
||||
* Click the ≡ icon next to `OpenHaystack (AirTag)`
|
||||
* Paste in the base64 code
|
||||
* Click `Upload`
|
||||
|
||||
## Note
|
||||
|
||||
This code changes your Bangle's MAC address, so while it still advertises with
|
||||
the same `Bangle.js abcd` name, devices that were previously paired with it
|
||||
won't automatically reconnect it until you re-pair.
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../../css/spectre.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<p>Follow the steps on <a href="https://github.com/seemoo-lab/openhaystack#how-to-use-openhaystack">https://github.com/seemoo-lab/openhaystack</a> to install OpenHaystack and get a unique base64 code</p>
|
||||
<p>Then paste the key in below and click <b>Upload</b></p>
|
||||
|
||||
<p>Base64 key: <input type="text" id="key" class="form-input" value="..."></p>
|
||||
<p id="keyStatus"> </p>
|
||||
|
||||
<p>Click <button id="upload" class="btn btn-primary">Upload</button></p>
|
||||
|
||||
|
||||
<script src="../../core/lib/customize.js"></script>
|
||||
|
||||
<script>
|
||||
function keyChanged() {
|
||||
var keyValue = document.getElementById("key").value.trim();
|
||||
var status = "👍 Key Ok.."
|
||||
if (keyValue.length!=40) status = "⚠️ Key should be 40 characters long";
|
||||
if (!keyValue.match(/^[A-Za-z0-9+\/=]+$/)) status = "⚠️ Key contains non-base64 characters";
|
||||
document.getElementById("keyStatus").innerText = status;
|
||||
}
|
||||
document.getElementById("key").addEventListener("changed", keyChanged);
|
||||
document.getElementById("key").addEventListener("keyup", keyChanged);
|
||||
// When the 'upload' button is clicked...
|
||||
document.getElementById("upload").addEventListener("click", function() {
|
||||
// get the text to add
|
||||
var keyValue = document.getElementById("key").value.trim();
|
||||
// build the app's text using a templated String
|
||||
var appJS = `/*
|
||||
OPENHAYSTACK
|
||||
A framework for tracking personal Bluetooth devices via Apple's massive Find My network
|
||||
https://github.com/seemoo-lab/openhaystack/issues/59#issuecomment-1303236903
|
||||
*/
|
||||
{
|
||||
const key = E.toUint8Array(atob(${JSON.stringify(keyValue)})); // public key
|
||||
const mac = [ key[0] | 0b11000000, key[1], key[2], key[3], key[4], key[5] ].map(x => x.toString(16).padStart(2, '0')).join(':'); // mac address
|
||||
const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, 0x00, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet
|
||||
NRF.setAddress(mac);
|
||||
NRF.setAdvertising([adv,{}]); // advertise AirTag *and* normal device name (to remain connectable)
|
||||
}
|
||||
`;
|
||||
// send finished app
|
||||
sendCustomizedApp({
|
||||
storage:[
|
||||
{name:"openhaystack.boot.js", content:appJS},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -0,0 +1,14 @@
|
|||
{ "id": "openhaystack",
|
||||
"name": "OpenHaystack (AirTag)",
|
||||
"icon": "icon.png",
|
||||
"version":"0.01",
|
||||
"description": "Copy a base64 key from https://github.com/seemoo-lab/openhaystack and make your Bangle.js trackable as if it's an AirTag",
|
||||
"tags": "openhaystack,bluetooth,ble,tracking,airtag",
|
||||
"type": "bootloader",
|
||||
"custom": "custom.html",
|
||||
"readme": "README.md",
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"storage": [
|
||||
{"name":"openhaystack.boot.js"}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue