label: source 'phone' → 'web' (page works from any browser)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -135,7 +135,7 @@ func main() {
|
|||||||
if m.Source == "" {
|
if m.Source == "" {
|
||||||
m.Source = r.Header.Get("X-Tether-Source")
|
m.Source = r.Header.Get("X-Tether-Source")
|
||||||
if m.Source == "" {
|
if m.Source == "" {
|
||||||
m.Source = "phone"
|
m.Source = "web"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.TS = time.Now().UnixMilli()
|
m.TS = time.Now().UnixMilli()
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
const r = await fetch("/api/send", {
|
const r = await fetch("/api/send", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ type: "clipboard", text, source: "phone" }),
|
body: JSON.stringify({ type: "clipboard", text, source: "web" }),
|
||||||
});
|
});
|
||||||
status(r.ok ? "delivered ✓" : "server returned " + r.status, r.ok ? "ok" : "err");
|
status(r.ok ? "delivered ✓" : "server returned " + r.status, r.ok ? "ok" : "err");
|
||||||
} catch (e) { status("network error", "err"); }
|
} catch (e) { status("network error", "err"); }
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
type: "signal",
|
type: "signal",
|
||||||
from: peerID,
|
from: peerID,
|
||||||
source: "phone",
|
source: "web",
|
||||||
signal: JSON.stringify(payload),
|
signal: JSON.stringify(payload),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
es.addEventListener("clipboard", (ev) => {
|
es.addEventListener("clipboard", (ev) => {
|
||||||
try {
|
try {
|
||||||
const m = JSON.parse(ev.data);
|
const m = JSON.parse(ev.data);
|
||||||
if (m.source !== "phone") {
|
if (m.source !== "web") {
|
||||||
addIncoming(m.text, m.source, m.ts, false);
|
addIncoming(m.text, m.source, m.ts, false);
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user