Compare commits

..

No commits in common. "dev-1.0.0" and "master" have entirely different histories.

15 changed files with 308 additions and 888 deletions

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>InternalDropLauncher</string>
<key>CFBundleIdentifier</key>
<string>local.privatedrop.launcher</string>
<key>CFBundleName</key>
<string>Internal Drop Launcher</string>
<key>CFBundleDisplayName</key>
<string>Internal Drop</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
</dict>
</plist>

View File

@ -1,4 +0,0 @@
#!/bin/zsh
open -a Terminal "/Users/sin/Work/private/privatedrop/launch-internal-drop.command"
sleep 1
open "http://localhost:10051"

View File

@ -1 +0,0 @@
APPL????

View File

@ -23,7 +23,6 @@ Internal Drop is a small LAN text and file transfer app for 2 to 3 internal user
| `INTERNAL_DROP_MAX_FILE_SIZE` | `1073741824` | Max single upload bytes | | `INTERNAL_DROP_MAX_FILE_SIZE` | `1073741824` | Max single upload bytes |
| `INTERNAL_DROP_FILE_TTL` | `2h` | Transfer expiry duration | | `INTERNAL_DROP_FILE_TTL` | `2h` | Transfer expiry duration |
| `INTERNAL_DROP_ALLOWED_CIDRS` | empty | Optional comma-separated client CIDR allowlist, for example `192.168.1.0/24,10.0.0.0/8` | | `INTERNAL_DROP_ALLOWED_CIDRS` | empty | Optional comma-separated client CIDR allowlist, for example `192.168.1.0/24,10.0.0.0/8` |
| `INTERNAL_DROP_PUBLIC_URLS` | empty | Optional comma-separated URLs to show first in the UI, for example `http://10.20.8.138:10051,https://drop.company.lan` |
## Local Build ## Local Build

View File

@ -13,7 +13,6 @@ type Config struct {
MaxFileSize int64 MaxFileSize int64
FileTTL time.Duration FileTTL time.Duration
AllowedCIDRs []string AllowedCIDRs []string
PublicURLs []string
} }
func DefaultConfig() Config { func DefaultConfig() Config {
@ -23,7 +22,6 @@ func DefaultConfig() Config {
MaxFileSize: envInt64("INTERNAL_DROP_MAX_FILE_SIZE", 1<<30), MaxFileSize: envInt64("INTERNAL_DROP_MAX_FILE_SIZE", 1<<30),
FileTTL: envDuration("INTERNAL_DROP_FILE_TTL", 2*time.Hour), FileTTL: envDuration("INTERNAL_DROP_FILE_TTL", 2*time.Hour),
AllowedCIDRs: envList("INTERNAL_DROP_ALLOWED_CIDRS"), AllowedCIDRs: envList("INTERNAL_DROP_ALLOWED_CIDRS"),
PublicURLs: envList("INTERNAL_DROP_PUBLIC_URLS"),
} }
} }

View File

@ -8,19 +8,3 @@ func TestDefaultConfigUsesPort10051(t *testing.T) {
t.Fatalf("default addr = %q, want :10051", cfg.Addr) t.Fatalf("default addr = %q, want :10051", cfg.Addr)
} }
} }
func TestDefaultConfigReadsPublicURLs(t *testing.T) {
t.Setenv("INTERNAL_DROP_PUBLIC_URLS", "http://10.20.8.138:10051, https://drop.company.lan ")
cfg := DefaultConfig()
want := []string{"http://10.20.8.138:10051", "https://drop.company.lan"}
if len(cfg.PublicURLs) != len(want) {
t.Fatalf("public urls = %#v, want %#v", cfg.PublicURLs, want)
}
for i := range want {
if cfg.PublicURLs[i] != want[i] {
t.Fatalf("public urls = %#v, want %#v", cfg.PublicURLs, want)
}
}
}

View File

@ -105,20 +105,10 @@ func (a *App) Routes() http.Handler {
mux.HandleFunc("/api/health", a.handleHealth) mux.HandleFunc("/api/health", a.handleHealth)
mux.HandleFunc("/api/server-info", a.handleServerInfo) mux.HandleFunc("/api/server-info", a.handleServerInfo)
mux.HandleFunc("/ws", a.handleWebSocket) mux.HandleFunc("/ws", a.handleWebSocket)
mux.Handle("/", a.staticHandler()) mux.Handle("/", http.FileServer(a.static))
return a.withNetworkPolicy(mux) return a.withNetworkPolicy(mux)
} }
func (a *App) staticHandler() http.Handler {
fileServer := http.FileServer(a.static)
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-store, max-age=0")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
fileServer.ServeHTTP(w, r)
})
}
func (a *App) StartCleaner(stop <-chan struct{}) { func (a *App) StartCleaner(stop <-chan struct{}) {
ticker := time.NewTicker(time.Minute) ticker := time.NewTicker(time.Minute)
defer ticker.Stop() defer ticker.Stop()
@ -283,7 +273,7 @@ func (a *App) handleServerInfo(w http.ResponseWriter, r *http.Request) {
ListenAddr: a.cfg.Addr, ListenAddr: a.cfg.Addr,
Port: port, Port: port,
CurrentURL: current, CurrentURL: current,
URLs: uniqueStrings(append(publicServerURLs(a.cfg.PublicURLs, port), localServerURLs(port)...)), URLs: uniqueStrings(localServerURLs(port)),
}) })
} }
@ -510,25 +500,6 @@ func localServerURLs(port string) []string {
return urls return urls
} }
func publicServerURLs(values []string, port string) []string {
urls := make([]string, 0, len(values))
for _, value := range values {
value = strings.TrimSpace(value)
if value == "" {
continue
}
if strings.HasPrefix(value, "http://") || strings.HasPrefix(value, "https://") {
urls = append(urls, value)
continue
}
if !strings.Contains(value, ":") && port != "" {
value = net.JoinHostPort(value, port)
}
urls = append(urls, "http://"+value)
}
return urls
}
func isPrivateLANIPv4(ip net.IP) bool { func isPrivateLANIPv4(ip net.IP) bool {
ip = ip.To4() ip = ip.To4()
if ip == nil { if ip == nil {

View File

@ -9,7 +9,6 @@ import (
"os" "os"
"strings" "strings"
"testing" "testing"
"testing/fstest"
"time" "time"
) )
@ -86,64 +85,6 @@ func TestServerInfoAPIShowsCurrentURLAndPort(t *testing.T) {
} }
} }
func TestServerInfoAPIPrioritizesConfiguredPublicURLs(t *testing.T) {
app := NewApp(
Config{
Addr: ":10051",
TempDir: t.TempDir(),
MaxFileSize: 1024,
FileTTL: time.Hour,
PublicURLs: []string{"http://10.20.8.138:10051", "https://drop.company.lan"},
},
nil,
)
req := httptest.NewRequest(http.MethodGet, "/api/server-info", nil)
rec := httptest.NewRecorder()
app.Routes().ServeHTTP(rec, req)
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rec.Code, http.StatusOK)
}
var info serverInfoResponse
if err := json.NewDecoder(rec.Body).Decode(&info); err != nil {
t.Fatalf("decode server info: %v", err)
}
if len(info.URLs) < 2 {
t.Fatalf("urls = %#v, want configured public urls", info.URLs)
}
want := []string{"http://10.20.8.138:10051", "https://drop.company.lan"}
for i := range want {
if info.URLs[i] != want[i] {
t.Fatalf("urls = %#v, want configured public urls first %#v", info.URLs, want)
}
}
}
func TestStaticAssetsAreServedWithoutBrowserCaching(t *testing.T) {
app := NewApp(
Config{Addr: ":10051", TempDir: t.TempDir(), MaxFileSize: 1024, FileTTL: time.Hour},
http.FS(fstest.MapFS{"app.js": {Data: []byte("console.log('ok')")}}),
)
req := httptest.NewRequest(http.MethodGet, "/app.js", nil)
rec := httptest.NewRecorder()
app.Routes().ServeHTTP(rec, req)
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rec.Code, http.StatusOK)
}
if got := rec.Header().Get("Cache-Control"); got != "no-store, max-age=0" {
t.Fatalf("Cache-Control = %q, want no-store, max-age=0", got)
}
if got := rec.Header().Get("Pragma"); got != "no-cache" {
t.Fatalf("Pragma = %q, want no-cache", got)
}
if got := rec.Header().Get("Expires"); got != "0" {
t.Fatalf("Expires = %q, want 0", got)
}
}
func TestPrivateLANIPv4Filter(t *testing.T) { func TestPrivateLANIPv4Filter(t *testing.T) {
cases := map[string]bool{ cases := map[string]bool{
"10.0.1.5": true, "10.0.1.5": true,

View File

@ -1,8 +0,0 @@
tell application "Terminal"
activate
do script "cd /Users/sin/Work/private/privatedrop && ./internal-drop"
end tell
delay 1
do shell script "open http://localhost:10051"

View File

@ -1,3 +0,0 @@
#!/bin/zsh
cd "/Users/sin/Work/private/privatedrop" || exit 1
./internal-drop

View File

@ -6,7 +6,6 @@ const state = {
users: [], users: [],
serverInfo: null, serverInfo: null,
activities: new Map(), activities: new Map(),
selectedPeerId: "",
ws: null, ws: null,
reconnectTimer: null reconnectTimer: null
}; };
@ -17,16 +16,14 @@ const els = {
saveName: document.querySelector("#saveName"), saveName: document.querySelector("#saveName"),
regenCode: document.querySelector("#regenCode"), regenCode: document.querySelector("#regenCode"),
serverAddress: document.querySelector("#serverAddress"), serverAddress: document.querySelector("#serverAddress"),
copyServerAddress: document.querySelector("#copyServerAddress"),
connectionState: document.querySelector("#connectionState"), connectionState: document.querySelector("#connectionState"),
selectedPeer: document.querySelector("#selectedPeer"),
dropZone: document.querySelector("#dropZone"),
peerCount: document.querySelector("#peerCount"), peerCount: document.querySelector("#peerCount"),
peerList: document.querySelector("#peerList"), peerList: document.querySelector("#peerList"),
targetSelect: document.querySelector("#targetSelect"), targetSelect: document.querySelector("#targetSelect"),
textInput: document.querySelector("#textInput"), textInput: document.querySelector("#textInput"),
sendText: document.querySelector("#sendText"), sendText: document.querySelector("#sendText"),
fileInput: document.querySelector("#fileInput"), fileInput: document.querySelector("#fileInput"),
sendFile: document.querySelector("#sendFile"),
uploadProgress: document.querySelector("#uploadProgress"), uploadProgress: document.querySelector("#uploadProgress"),
activityList: document.querySelector("#activityList"), activityList: document.querySelector("#activityList"),
clearLog: document.querySelector("#clearLog") clearLog: document.querySelector("#clearLog")
@ -88,58 +85,16 @@ function connectWebSocket() {
} }
function bindEvents() { function bindEvents() {
document.querySelectorAll(".panel-toggle").forEach((button) => {
button.addEventListener("click", (event) => {
event.stopPropagation();
togglePanel(button.dataset.panel, button);
});
});
document.querySelectorAll(".dock-panel").forEach((panel) => {
panel.addEventListener("click", (event) => event.stopPropagation());
});
document.addEventListener("click", closePanels);
document.addEventListener("keydown", (event) => {
if (event.key === "Escape") closePanels();
});
els.saveName.addEventListener("click", saveName); els.saveName.addEventListener("click", saveName);
els.regenCode.addEventListener("click", regenerateCode); els.regenCode.addEventListener("click", regenerateCode);
els.copyServerAddress.addEventListener("click", copyServerAddress);
els.sendText.addEventListener("click", sendText); els.sendText.addEventListener("click", sendText);
els.fileInput.addEventListener("change", () => { els.sendFile.addEventListener("click", sendFile);
const file = els.fileInput.files[0];
if (file) uploadFile(file);
});
els.dropZone.addEventListener("click", () => els.fileInput.click());
els.dropZone.addEventListener("dragenter", handleDragEnter);
els.dropZone.addEventListener("dragover", handleDragOver);
els.dropZone.addEventListener("dragleave", handleDragLeave);
els.dropZone.addEventListener("drop", handleDrop);
els.targetSelect.addEventListener("change", () => selectPeer(els.targetSelect.value));
els.clearLog.addEventListener("click", () => { els.clearLog.addEventListener("click", () => {
els.activityList.innerHTML = ""; els.activityList.innerHTML = "";
state.activities.clear(); state.activities.clear();
}); });
} }
function togglePanel(panelId, button) {
const shouldOpen = document.querySelector(`#${panelId}`)?.hidden;
setPanel(panelId, shouldOpen, button);
}
function setPanel(panelId, open, button = null) {
const panel = document.querySelector(`#${panelId}`);
if (!panel) return;
closePanels();
panel.hidden = !open;
const toggle = button || document.querySelector(`.panel-toggle[data-panel="${panelId}"]`);
if (toggle) toggle.setAttribute("aria-expanded", String(open));
}
function closePanels() {
document.querySelectorAll(".dock-panel").forEach((item) => { item.hidden = true; });
document.querySelectorAll(".panel-toggle").forEach((item) => item.setAttribute("aria-expanded", "false"));
}
async function saveName() { async function saveName() {
const name = els.nickname.value.trim(); const name = els.nickname.value.trim();
if (!name) return; if (!name) return;
@ -178,8 +133,9 @@ function sendText() {
els.textInput.value = ""; els.textInput.value = "";
} }
function uploadFile(file) { function sendFile() {
const receiverId = state.selectedPeerId || els.targetSelect.value; const file = els.fileInput.files[0];
const receiverId = els.targetSelect.value;
if (!file || !receiverId || !state.user) return; if (!file || !receiverId || !state.user) return;
const url = `/api/uploads?sender_id=${encodeURIComponent(state.user.id)}&receiver_id=${encodeURIComponent(receiverId)}&filename=${encodeURIComponent(file.name)}`; const url = `/api/uploads?sender_id=${encodeURIComponent(state.user.id)}&receiver_id=${encodeURIComponent(receiverId)}&filename=${encodeURIComponent(file.name)}`;
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
@ -208,30 +164,6 @@ function uploadFile(file) {
xhr.send(file); xhr.send(file);
} }
function handleDragEnter(event) {
event.preventDefault();
els.dropZone.classList.add("drag-over");
}
function handleDragOver(event) {
event.preventDefault();
event.dataTransfer.dropEffect = state.selectedPeerId ? "copy" : "none";
}
function handleDragLeave(event) {
if (!els.dropZone.contains(event.relatedTarget)) {
els.dropZone.classList.remove("drag-over");
}
}
function handleDrop(event) {
event.preventDefault();
els.dropZone.classList.remove("drag-over");
const file = event.dataTransfer.files[0];
if (!file) return;
uploadFile(file);
}
function handleEvent(event) { function handleEvent(event) {
switch (event.type) { switch (event.type) {
case "user.list": case "user.list":
@ -280,7 +212,6 @@ function handleEvent(event) {
} }
function addIncomingText(event) { function addIncomingText(event) {
setPanel("activityPanel", true);
const text = event.text || event.transfer?.text || ""; const text = event.text || event.transfer?.text || "";
const item = upsertActivity({ const item = upsertActivity({
key: transferKey(event.transfer), key: transferKey(event.transfer),
@ -293,18 +224,14 @@ function addIncomingText(event) {
copy.type = "button"; copy.type = "button";
copy.textContent = "复制"; copy.textContent = "复制";
copy.className = "secondary"; copy.className = "secondary";
copy.addEventListener("click", async () => { copy.addEventListener("click", () => {
if (await copyTextToClipboard(text)) { navigator.clipboard.writeText(text);
updateTransferActivity(event.transfer, "已复制", "ok"); updateTransferActivity(event.transfer, "已复制", "ok");
} else {
updateTransferActivity(event.transfer, "复制失败", "bad");
}
}); });
setActivityActions(item, [copy]); setActivityActions(item, [copy]);
} }
function addIncomingFile(event) { function addIncomingFile(event) {
setPanel("activityPanel", true);
const transfer = event.transfer; const transfer = event.transfer;
if (!transfer) return; if (!transfer) return;
const item = upsertActivity({ const item = upsertActivity({
@ -383,22 +310,14 @@ function renderIdentity() {
function renderServerInfo() { function renderServerInfo() {
const info = state.serverInfo; const info = state.serverInfo;
if (!info) return; if (!info) return;
const urls = (info.urls || []).filter(Boolean); const urls = (info.urls || []).filter((url) => /^http:\/\/(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(url));
if (urls.length === 0) { if (urls.length === 0) {
els.serverAddress.textContent = "未检测到可用地址"; els.serverAddress.textContent = "未检测到内网 IP";
els.serverAddress.title = ""; els.serverAddress.title = "";
els.copyServerAddress.disabled = true;
return; return;
} }
els.serverAddress.textContent = urls[0]; els.serverAddress.textContent = urls[0];
els.serverAddress.title = urls.join("\n"); els.serverAddress.title = urls.join("\n");
els.copyServerAddress.disabled = false;
}
async function copyServerAddress() {
const text = els.serverAddress.textContent.trim();
if (!text || text === "检测中" || text.startsWith("未检测到")) return false;
return copyTextToClipboard(text);
} }
function renderUsers() { function renderUsers() {
@ -406,12 +325,6 @@ function renderUsers() {
els.peerCount.textContent = peers.length; els.peerCount.textContent = peers.length;
els.peerList.innerHTML = ""; els.peerList.innerHTML = "";
els.targetSelect.innerHTML = ""; els.targetSelect.innerHTML = "";
if (state.selectedPeerId && !peers.some((user) => user.id === state.selectedPeerId)) {
state.selectedPeerId = "";
}
if (!state.selectedPeerId && peers.length > 0) {
state.selectedPeerId = peers[0].id;
}
if (peers.length === 0) { if (peers.length === 0) {
const empty = document.createElement("div"); const empty = document.createElement("div");
empty.className = "peer"; empty.className = "peer";
@ -422,41 +335,23 @@ function renderUsers() {
const option = document.createElement("option"); const option = document.createElement("option");
option.value = user.id; option.value = user.id;
option.textContent = `${user.name} (${user.code})`; option.textContent = `${user.name} (${user.code})`;
option.selected = user.id === state.selectedPeerId;
els.targetSelect.append(option); els.targetSelect.append(option);
const card = document.createElement("button"); const card = document.createElement("div");
card.type = "button";
card.className = "peer"; card.className = "peer";
card.innerHTML = `<strong></strong><code></code>`; card.innerHTML = `<strong></strong><code></code>`;
card.querySelector("strong").textContent = user.name; card.querySelector("strong").textContent = user.name;
card.querySelector("code").textContent = user.code; card.querySelector("code").textContent = user.code;
if (user.id === state.selectedPeerId) card.classList.add("selected"); card.addEventListener("click", () => {
card.addEventListener("click", () => selectPeer(user.id)); els.targetSelect.value = user.id;
document.querySelectorAll(".peer.selected").forEach((node) => node.classList.remove("selected"));
card.classList.add("selected");
});
els.peerList.append(card); els.peerList.append(card);
} }
if (state.selectedPeerId) els.targetSelect.value = state.selectedPeerId;
const hasTarget = peers.length > 0; const hasTarget = peers.length > 0;
els.sendText.disabled = !hasTarget; els.sendText.disabled = !hasTarget;
els.dropZone.disabled = !hasTarget; els.sendFile.disabled = !hasTarget;
renderSelectedPeer();
}
function selectPeer(userId) {
state.selectedPeerId = userId;
els.targetSelect.value = userId;
renderUsers();
}
function renderSelectedPeer() {
const peer = state.users.find((user) => user.id === state.selectedPeerId);
if (!peer) {
els.selectedPeer.textContent = "打开“成员”选择接收方";
els.dropZone.querySelector("#dropHint").textContent = "选择在线成员后,把文件拖到这里,或点击选择文件";
return;
}
els.selectedPeer.textContent = `发送给 ${peer.name} · ${peer.code}`;
els.dropZone.querySelector("#dropHint").textContent = "把文件拖到这里,或点击选择文件";
} }
function addActivity(title, body, tone = "") { function addActivity(title, body, tone = "") {
@ -502,42 +397,6 @@ function setActivityActions(item, buttons) {
for (const button of buttons) actions.append(button); for (const button of buttons) actions.append(button);
} }
async function copyTextToClipboard(text) {
if (globalThis.isSecureContext === false) {
return copyTextWithSelection(text);
}
const clipboard = navigator.clipboard;
if (clipboard?.writeText) {
try {
await clipboard.writeText(text);
return true;
} catch {}
}
return copyTextWithSelection(text);
}
function copyTextWithSelection(text) {
const textArea = document.createElement("textarea");
textArea.value = text;
textArea.setAttribute("readonly", "");
textArea.style.position = "fixed";
textArea.style.top = "-9999px";
textArea.style.left = "-9999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
textArea.setSelectionRange(0, text.length);
try {
return document.execCommand("copy");
} catch {
return false;
} finally {
document.body.removeChild(textArea);
}
}
function updateTransferActivity(transfer, status, tone) { function updateTransferActivity(transfer, status, tone) {
if (!transfer) return; if (!transfer) return;
const item = upsertActivity({ const item = upsertActivity({

View File

@ -1,159 +0,0 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import vm from "node:vm";
function loadAppContext(overrides = {}) {
const selectors = new Map();
const body = {
children: [],
appendChild(node) {
node.parentElement = this;
this.children.push(node);
return node;
},
removeChild(node) {
this.children = this.children.filter((child) => child !== node);
node.parentElement = null;
return node;
}
};
const document = {
body,
userActivation: true,
execCommand(command) {
if (command !== "copy") return false;
if (!this.userActivation) return false;
this.copiedText = this.activeElement?.value || "";
return true;
},
querySelector(selector) {
if (!selectors.has(selector)) {
selectors.set(selector, makeElement());
}
return selectors.get(selector);
},
querySelectorAll() {
return [];
},
createElement(tagName) {
const element = makeElement(tagName);
element.ownerDocument = document;
return element;
}
};
const context = {
document,
localStorage: {
getItem() {
return "";
},
setItem() {}
},
navigator: {},
isSecureContext: false,
location: { protocol: "http:", host: "192.168.1.10:10051" },
setTimeout() {},
clearTimeout() {},
WebSocket: { OPEN: 1 }
};
Object.assign(context, overrides);
const source = readFileSync(new URL("./app.js", import.meta.url), "utf8")
.replace("const state = {", "globalThis.state = {")
.replace(/boot\(\)\.catch\([\s\S]*?\n\}\);?\s*$/, "");
vm.runInNewContext(source, context);
return context;
}
function makeElement(tagName = "div") {
return {
tagName,
children: [],
className: "",
style: {},
value: "",
parentElement: null,
append(...nodes) {
for (const node of nodes) {
node.parentElement = this;
this.children.push(node);
}
},
focus() {
if (this.ownerDocument) this.ownerDocument.activeElement = this;
},
select() {
this.selected = true;
},
setSelectionRange(start, end) {
this.selectionStart = start;
this.selectionEnd = end;
},
setAttribute() {},
addEventListener() {},
querySelector() {
return makeElement();
}
};
}
test("copyTextToClipboard falls back when navigator.clipboard is unavailable", async () => {
const context = loadAppContext();
const text = '{\n "copy": "json text"\n}';
const copied = await context.copyTextToClipboard(text);
assert.equal(copied, true);
assert.equal(context.document.copiedText, text);
});
test("copyTextToClipboard uses the synchronous fallback first on insecure remote pages", async () => {
const context = loadAppContext();
context.navigator.clipboard = {
async writeText() {
context.document.userActivation = false;
throw new Error("Clipboard API blocked on insecure context");
}
};
const text = `[
{
"id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImFlNjc5NWRjLTRiYWUtNDE4YS04NjVkLTA4YTY0MzllZWRhNiIsInR5cCI6IkpXVCJ9..UVl-YCSs3lfN6QLMGH03qfE3pBH7YYuEV2be8hV6VQDFRX0-bMMlWvB9sE0DCnfnDSRCOw4_fh7V72fg",
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImFlNjc5NWRjLTRiYWUtNDE4YS04NjVkLTA4YTY0MzllZWRhNiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiaHR0cHM6LykJzi2DPDA1mEUCMRCyg_3tGuskm0bQlbo0_ttDv53sF-fO-7nEPHqBDO7KpKPQPvG9w3HdTXtxPktHNkcmO5453BHc61ONukP2QJUp-OBv6T2mvC4ZKq6TlgOaXxrH32sMV4VtixWDbmmlrZ0zbXD72_WMS9mWR7wQLDN21-fCyaLma0cbLuWyxSqyWvkMIeuBEnFcTZVAcrgwd1lTw0e-pdsfVGyDiqDg2ZNs_Bk7vdk8c3VVcpZA5o7SEZUEaJRN-9ncI11INQpf5BubH8zCMnFa5u2fLfvtThZ_JON75mGKPBdwJYpY5FMjscBipu95RXf4ch0PQieCSoROx21YI6z7gSvvMHL-rCc",
"refresh_token": "rt.1.AACMpNpZuZ1c2Q0I9Bdcv7uo-5HKMEM3oz3XDEe_94-NGxq9TPQODzZ6SzYo66U6Ef4Efyub2ocxy4NrJRqtzz-ZthgvY6SG4PvQJYdUH9MZEwFCRsq22FTb__oE_t_QGVqGSbNIhZ2XhT8Lzvb7gI9utaKG9uH3P1zofogkRXlC3Xb8zd8okhjRl8QDFz8",
"account_id": "c1f",
"last_refresh": "",
"email": "l,
"type": "",
"expired": "2Z"
}
]`;
const copied = await context.copyTextToClipboard(text);
assert.equal(copied, true);
assert.equal(context.document.copiedText, text);
});
test("renderServerInfo displays configured public URLs without private LAN filtering", () => {
const context = loadAppContext();
const serverAddress = context.document.querySelector("#serverAddress");
context.state.serverInfo = {
urls: ["https://drop.company.lan", "http://10.20.8.138:10051"]
};
context.renderServerInfo();
assert.equal(serverAddress.textContent, "https://drop.company.lan");
assert.equal(serverAddress.title, "https://drop.company.lan\nhttp://10.20.8.138:10051");
});
test("copyServerAddress copies the visible server URL", async () => {
const context = loadAppContext();
const serverAddress = context.document.querySelector("#serverAddress");
serverAddress.textContent = "http://10.20.8.138:10051";
const copied = await context.copyServerAddress();
assert.equal(copied, true);
assert.equal(context.document.copiedText, "http://10.20.8.138:10051");
});

View File

@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" role="img" aria-labelledby="title desc">
<title id="title">Internal Drop icon</title>
<desc id="desc">A simple blue local transfer mark with a white drop arrow and receiving line.</desc>
<rect width="256" height="256" rx="58" fill="#1e88e5"/>
<circle cx="128" cy="128" r="74" fill="none" stroke="#ffffff" stroke-width="14" opacity="0.24"/>
<path d="M128 66v96" fill="none" stroke="#ffffff" stroke-width="18" stroke-linecap="round"/>
<path d="M92 105 128 69l36 36" fill="none" stroke="#ffffff" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M82 178h92" fill="none" stroke="#ffffff" stroke-width="18" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 736 B

View File

@ -4,101 +4,76 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Internal Drop</title> <title>Internal Drop</title>
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="stylesheet" href="/styles.css"> <link rel="stylesheet" href="/styles.css">
</head> </head>
<body> <body>
<main class="app-shell"> <main class="app-shell">
<header class="topbar"> <section class="topbar">
<div class="brand-block"> <div class="brand-block">
<img class="brand-mark" src="/icon.svg" alt="" aria-hidden="true"> <span class="product-kicker">LAN transfer desk</span>
<div class="brand-copy"> <h1>Internal Drop</h1>
<span class="product-kicker">LAN transfer</span> </div>
<h1>Internal Drop</h1> <div class="top-meta">
</div> <div class="server-line">
<span>服务器</span>
<code id="serverAddress">检测中</code>
</div>
<div id="connectionState" class="state">连接中</div>
</div> </div>
<nav class="utility-nav" aria-label="工具面板">
<button class="panel-toggle" type="button" data-panel="peersPanel" aria-expanded="false">成员 <span id="peerCount">0</span></button>
<button class="panel-toggle" type="button" data-panel="textPanel" aria-expanded="false">文字</button>
<button class="panel-toggle" type="button" data-panel="activityPanel" aria-expanded="false">状态</button>
<button class="panel-toggle" type="button" data-panel="identityPanel" aria-expanded="false">我的 ID</button>
<button class="panel-toggle" type="button" data-panel="serverPanel" aria-expanded="false">服务器</button>
</nav>
<div id="connectionState" class="state">连接中</div>
</header>
<section class="drop-stage" aria-label="文件投放区">
<div class="selected-peer" id="selectedPeer">未选择接收方</div>
<button id="dropZone" class="drop-zone" type="button" aria-label="选择或拖入文件发送" aria-describedby="dropHint">
<span class="drop-ring" aria-hidden="true"></span>
<span class="drop-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 15V4m0 0 4.5 4.5M12 4 7.5 8.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5 14.5v2.8A2.7 2.7 0 0 0 7.7 20h8.6a2.7 2.7 0 0 0 2.7-2.7v-2.8" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
</svg>
</span>
<span id="dropHint">选择在线成员后,把文件拖到这里,或点击选择文件</span>
</button>
<input id="fileInput" type="file" aria-label="选择文件">
<progress id="uploadProgress" max="100" value="0"></progress>
</section> </section>
<section class="panel-dock" aria-label="可折叠信息面板"> <section class="identity-bar">
<aside id="peersPanel" class="dock-panel" hidden> <div class="identity-code">
<span>用户码</span>
<strong id="userCode">------</strong>
</div>
<label class="nickname-field">
<span>昵称</span>
<input id="nickname" type="text" maxlength="32" autocomplete="off" aria-label="昵称">
</label>
<div class="identity-actions">
<button id="saveName" type="button">保存</button>
<button id="regenCode" type="button" class="secondary">换码</button>
</div>
</section>
<section class="workspace">
<aside class="peer-panel">
<header> <header>
<h2>在线成员</h2> <h2>在线成员</h2>
<span class="panel-note">选择一个接收方</span> <span id="peerCount">0</span>
</header> </header>
<select id="targetSelect" aria-label="发送给"></select>
<div id="peerList" class="peer-list"></div> <div id="peerList" class="peer-list"></div>
</aside> </aside>
<aside id="textPanel" class="dock-panel text-panel" hidden> <section class="send-panel">
<header> <div class="target-row">
<h2>发送文字</h2> <label for="targetSelect">发送给</label>
<span class="panel-note">发送给当前选中成员</span> <select id="targetSelect"></select>
</header> </div>
<textarea id="textInput" rows="3" placeholder="输入要发送的文字"></textarea>
<button id="sendText" type="button">发送文字</button>
</aside>
<aside id="activityPanel" class="dock-panel activity-panel" hidden> <div class="composer">
<label for="textInput">文字</label>
<textarea id="textInput" rows="3" placeholder="输入要发送的文字"></textarea>
<button id="sendText" type="button">发送文字</button>
</div>
<div class="file-box">
<input id="fileInput" type="file">
<button id="sendFile" type="button">发送文件</button>
<progress id="uploadProgress" max="100" value="0"></progress>
</div>
</section>
<section class="activity-panel">
<header> <header>
<h2>接收与状态</h2> <h2>接收与状态</h2>
<button id="clearLog" class="secondary small-button" type="button">清空</button> <button id="clearLog" type="button">清空</button>
</header> </header>
<div id="activityList" class="activity-list"></div> <div id="activityList" class="activity-list"></div>
</aside> </section>
<aside id="identityPanel" class="dock-panel" hidden>
<header>
<h2>我的 ID</h2>
<span class="panel-note">用于识别当前设备</span>
</header>
<div class="identity-card">
<span>用户码</span>
<strong id="userCode">------</strong>
</div>
<label class="nickname-field">
<span>昵称</span>
<input id="nickname" type="text" maxlength="32" autocomplete="off" aria-label="昵称">
</label>
<div class="identity-actions">
<button id="saveName" type="button">保存</button>
<button id="regenCode" type="button" class="secondary">换码</button>
</div>
</aside>
<aside id="serverPanel" class="dock-panel" hidden>
<header>
<h2>服务器 IP</h2>
<span class="panel-note">可分享访问地址</span>
</header>
<code id="serverAddress" class="server-address">检测中</code>
<button id="copyServerAddress" type="button" class="secondary">复制地址</button>
</aside>
</section> </section>
</main> </main>
<script src="/app.js?v=20260622-public-urls-v1"></script> <script src="/app.js"></script>
</body> </body>
</html> </html>

View File

@ -1,26 +1,24 @@
:root { :root {
color-scheme: light; color-scheme: light;
--bg: #f5f7fb; --bg: #eef2f5;
--bg-2: #e9f0f7;
--surface: #ffffff; --surface: #ffffff;
--surface-soft: #f8fafc; --surface-subtle: #f7f9fb;
--ink: #111827; --ink: #111827;
--muted: #667085; --muted: #64748b;
--line: #d9e2ec; --line: #d8e0e8;
--line-strong: #c8d3df; --line-strong: #c6d1dc;
--primary: #176b87; --primary: #0f766e;
--primary-strong: #0f5369; --primary-strong: #115e59;
--primary-soft: #e7f4f7; --primary-soft: #e3f5f2;
--blue: #2f6fed; --blue: #2563eb;
--blue-soft: #eaf1ff; --blue-soft: #eaf1ff;
--ok: #166534; --ok: #166534;
--ok-soft: #eaf7ee; --ok-soft: #eaf7ee;
--warn: #995f00; --warn: #9a5b00;
--warn-soft: #fff5df; --warn-soft: #fff4dc;
--bad: #a33838; --bad: #a33838;
--bad-soft: #fff0f0; --bad-soft: #fff0f0;
--shadow-sm: 0 8px 24px rgba(31, 45, 61, 0.08); --shadow: 0 16px 40px rgba(28, 45, 64, 0.08);
--shadow-lg: 0 24px 80px rgba(31, 45, 61, 0.16);
} }
* { * {
@ -30,11 +28,9 @@
body { body {
margin: 0; margin: 0;
min-height: 100vh; min-height: 100vh;
overflow-x: hidden;
background: background:
radial-gradient(circle at top left, rgba(47, 111, 237, 0.12), transparent 34vw), linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 220px),
radial-gradient(circle at bottom right, rgba(23, 107, 135, 0.12), transparent 30vw), var(--bg);
linear-gradient(180deg, var(--bg), var(--bg-2));
color: var(--ink); color: var(--ink);
font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
} }
@ -48,27 +44,39 @@ textarea {
button { button {
min-height: 44px; min-height: 44px;
border: 1px solid var(--line-strong); border: 1px solid var(--primary);
border-radius: 8px; border-radius: 8px;
background: var(--surface); background: var(--primary);
color: var(--ink); color: #fff;
cursor: pointer; cursor: pointer;
padding: 0 14px; padding: 0 16px;
font-weight: 700; font-weight: 700;
transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease; transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
} }
button:hover { button:hover {
background: var(--primary-strong);
border-color: var(--primary-strong);
}
button.secondary,
.activity button.secondary {
background: #fff;
color: var(--primary-strong);
border-color: var(--line-strong);
}
button.secondary:hover,
.activity button.secondary:hover {
border-color: var(--primary); border-color: var(--primary);
background: var(--primary-soft); background: var(--primary-soft);
color: var(--primary-strong);
} }
button:focus-visible, button:focus-visible,
input:focus-visible, input:focus-visible,
select:focus-visible, select:focus-visible,
textarea:focus-visible { textarea:focus-visible {
outline: 3px solid rgba(47, 111, 237, 0.22); outline: 3px solid rgba(37, 99, 235, 0.22);
outline-offset: 2px; outline-offset: 2px;
} }
@ -78,37 +86,34 @@ button:disabled {
} }
.app-shell { .app-shell {
position: relative; width: min(1240px, calc(100% - 36px));
min-height: 100dvh;
width: min(1200px, calc(100% - 32px));
margin: 0 auto; margin: 0 auto;
padding: 22px 0 34px; padding: 24px 0 36px;
}
.topbar,
.identity-bar,
.peer-panel,
.send-panel,
.activity-panel {
background: rgba(255, 255, 255, 0.92);
border: 1px solid rgba(216, 224, 232, 0.92);
border-radius: 8px;
box-shadow: var(--shadow);
} }
.topbar { .topbar {
display: grid; display: flex;
grid-template-columns: minmax(180px, 1fr) auto auto;
align-items: center; align-items: center;
gap: 16px; justify-content: space-between;
min-height: 64px; gap: 20px;
margin-bottom: 12px;
padding: 18px 20px;
} }
.brand-block { .brand-block {
display: flex;
align-items: center;
gap: 12px;
}
.brand-mark {
width: 48px;
height: 48px;
border-radius: 15px;
box-shadow: 0 10px 28px rgba(23, 107, 135, 0.24);
}
.brand-copy {
display: grid; display: grid;
gap: 2px; gap: 4px;
} }
.product-kicker { .product-kicker {
@ -122,209 +127,94 @@ button:disabled {
h1, h1,
h2 { h2 {
margin: 0; margin: 0;
line-height: 1.2;
letter-spacing: 0; letter-spacing: 0;
line-height: 1.2;
} }
h1 { h1 {
font-size: clamp(24px, 4vw, 34px); font-size: 28px;
} }
h2 { h2 {
font-size: 15px; font-size: 15px;
} }
.utility-nav { .top-meta {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px;
}
.panel-toggle {
min-height: 40px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.82);
backdrop-filter: blur(12px);
padding: 0 13px;
font-size: 13px;
box-shadow: 0 6px 20px rgba(31, 45, 61, 0.06);
}
.panel-toggle[aria-expanded="true"] {
border-color: var(--primary);
background: var(--primary);
color: #fff;
}
#peerCount {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 22px;
margin-left: 4px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.65);
padding: 1px 6px;
font-size: 12px;
}
.state {
justify-self: end;
border: 1px solid var(--line-strong);
border-radius: 999px;
background: rgba(255, 255, 255, 0.82);
color: var(--muted);
padding: 8px 12px;
white-space: nowrap;
font-size: 13px;
font-weight: 800;
}
.state.online {
border-color: #b8dfc8;
background: var(--ok-soft);
color: var(--ok);
}
.state.offline {
border-color: #efc4c4;
background: var(--bad-soft);
color: var(--bad);
}
.drop-stage {
display: grid;
place-items: center;
min-height: calc(100dvh - 132px);
padding: 28px 0;
}
.selected-peer {
align-self: end;
margin-bottom: 16px;
border: 1px solid rgba(200, 211, 223, 0.9);
border-radius: 999px;
background: rgba(255, 255, 255, 0.74);
color: #334155;
padding: 8px 14px;
font-size: 13px;
font-weight: 800;
box-shadow: var(--shadow-sm);
}
.drop-zone {
position: relative;
display: grid;
place-items: center;
gap: 10px; gap: 10px;
width: min(520px, 78vw); min-width: 0;
aspect-ratio: 1;
border: 1px solid rgba(200, 211, 223, 0.95);
border-radius: 50%;
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.88)),
var(--surface);
color: var(--ink);
box-shadow: var(--shadow-lg);
text-align: center;
padding: 52px;
} }
.drop-zone:hover, .server-line {
.drop-zone.drag-over {
border-color: var(--primary);
background: linear-gradient(180deg, #ffffff, var(--primary-soft));
}
.drop-zone:disabled {
opacity: 0.82;
}
.drop-ring {
position: absolute;
inset: 10%;
border: 1px dashed rgba(23, 107, 135, 0.28);
border-radius: 50%;
pointer-events: none;
}
.drop-icon {
display: grid;
place-items: center;
width: 78px;
height: 78px;
border-radius: 50%;
background: var(--blue-soft);
color: var(--blue);
}
.drop-icon svg {
width: 38px;
height: 38px;
}
.drop-zone #dropHint {
max-width: 290px;
color: var(--muted);
font-size: clamp(16px, 2.2vw, 20px);
font-weight: 800;
}
#fileInput {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
white-space: nowrap;
}
#uploadProgress {
width: min(360px, 70vw);
height: 9px;
margin-top: 18px;
accent-color: var(--primary);
}
.panel-dock {
position: fixed;
z-index: 20;
top: 92px;
right: max(18px, calc((100vw - 1200px) / 2));
display: grid;
gap: 10px;
width: min(420px, calc(100vw - 28px));
pointer-events: none;
}
.dock-panel {
pointer-events: auto;
border: 1px solid rgba(217, 226, 236, 0.95);
border-radius: 8px;
background: rgba(255, 255, 255, 0.96);
box-shadow: var(--shadow-lg);
padding: 16px;
backdrop-filter: blur(16px);
}
.dock-panel[hidden] {
display: none;
}
.dock-panel header {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; gap: 8px;
gap: 10px; min-width: 0;
margin-bottom: 12px; color: var(--muted);
} }
.panel-note { .server-line span {
font-size: 12px;
font-weight: 700;
}
.server-line code {
display: inline-block;
max-width: min(460px, 52vw);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--surface-subtle);
color: #334155;
padding: 5px 10px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
}
.identity-bar {
display: grid;
grid-template-columns: auto minmax(220px, 320px) auto;
align-items: end;
gap: 12px;
margin-bottom: 16px;
padding: 14px 16px;
}
.identity-code,
.nickname-field {
display: grid;
gap: 5px;
}
.identity-code span,
.nickname-field span,
.target-row label,
.composer label {
color: var(--muted); color: var(--muted);
font-size: 12px; font-size: 12px;
font-weight: 700;
}
.identity-code strong {
display: inline-flex;
align-items: center;
min-height: 44px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--primary-soft);
padding: 0 14px;
color: var(--primary-strong);
font: 800 20px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.identity-actions {
display: flex;
gap: 8px;
} }
input, input,
@ -340,33 +230,95 @@ textarea {
} }
textarea { textarea {
min-height: 96px; min-height: 92px;
max-height: 180px; max-height: 170px;
resize: vertical; resize: vertical;
} }
.state {
border: 1px solid var(--line);
border-radius: 999px;
background: var(--surface-subtle);
color: var(--muted);
padding: 6px 12px;
white-space: nowrap;
font-size: 13px;
font-weight: 700;
}
.state.online {
border-color: #b8dfc8;
background: var(--ok-soft);
color: var(--ok);
}
.state.offline {
border-color: #efc4c4;
background: var(--bad-soft);
color: var(--bad);
}
.workspace {
display: grid;
grid-template-columns: minmax(220px, 270px) minmax(360px, 1fr) minmax(420px, 520px);
gap: 16px;
align-items: start;
}
.peer-panel,
.send-panel,
.activity-panel {
min-height: 420px;
padding: 16px;
}
.peer-panel header,
.activity-panel header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 14px;
}
#peerCount {
border-radius: 999px;
background: var(--blue-soft);
color: var(--blue);
min-width: 30px;
padding: 3px 9px;
text-align: center;
font-size: 12px;
font-weight: 800;
}
.peer-list, .peer-list,
.activity-list { .activity-list {
display: grid; display: grid;
gap: 8px; gap: 8px;
} }
.peer-list {
margin-top: 10px;
}
.peer { .peer {
display: grid;
width: 100%;
min-height: 58px;
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 8px; border-radius: 8px;
padding: 11px 12px;
cursor: pointer;
background: #fff; background: #fff;
padding: 10px 12px; transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
text-align: left; }
.peer:hover {
border-color: var(--primary);
box-shadow: 0 8px 24px rgba(15, 118, 110, 0.08);
}
.peer.selected {
border-color: var(--primary);
background: var(--primary-soft);
} }
.peer strong { .peer strong {
display: block;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
@ -376,73 +328,23 @@ textarea {
font-size: 12px; font-size: 12px;
} }
.peer.selected { .target-row,
border-color: var(--primary); .composer,
background: var(--primary-soft); .file-box {
}
.text-panel {
display: grid; display: grid;
gap: 10px; gap: 9px;
margin-bottom: 16px;
} }
.text-panel header { .file-box {
margin-bottom: 2px; border-top: 1px solid var(--line);
padding-top: 16px;
} }
.identity-card, progress {
.nickname-field { width: 100%;
display: grid; height: 10px;
gap: 6px; accent-color: var(--primary);
margin-bottom: 12px;
}
.identity-card span,
.nickname-field span {
color: var(--muted);
font-size: 12px;
font-weight: 800;
}
.identity-card strong {
display: inline-flex;
align-items: center;
min-height: 48px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--primary-soft);
padding: 0 14px;
color: var(--primary-strong);
font: 900 22px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.identity-actions {
display: flex;
gap: 8px;
}
.server-address {
display: block;
overflow-wrap: anywhere;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface-soft);
padding: 12px;
color: #334155;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.small-button,
.activity button {
min-height: 34px;
padding: 0 10px;
font-size: 12px;
}
.secondary,
.activity button.secondary {
background: #fff;
color: var(--primary-strong);
} }
.activity { .activity {
@ -486,7 +388,7 @@ textarea {
.activity-status { .activity-status {
border-radius: 999px; border-radius: 999px;
background: var(--surface-soft); background: var(--surface-subtle);
color: var(--muted); color: var(--muted);
padding: 4px 8px; padding: 4px 8px;
font-size: 12px; font-size: 12px;
@ -505,6 +407,13 @@ textarea {
gap: 6px; gap: 6px;
} }
.activity button {
min-height: 32px;
border-radius: 7px;
padding: 0 10px;
font-size: 12px;
}
.activity-progress { .activity-progress {
grid-column: 1 / -1; grid-column: 1 / -1;
height: 5px; height: 5px;
@ -549,45 +458,47 @@ textarea {
} }
} }
@media (max-width: 820px) { @media (max-width: 1080px) {
.app-shell { .workspace {
width: min(100% - 20px, 1200px); grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
padding-top: 12px;
} }
.topbar { .activity-panel {
grid-column: 1 / -1;
}
}
@media (max-width: 760px) {
.app-shell {
width: min(100% - 20px, 1240px);
padding-top: 10px;
}
.topbar,
.identity-bar {
align-items: flex-start;
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
.utility-nav, .topbar,
.state { .top-meta,
justify-self: stretch; .identity-actions {
flex-direction: column;
align-items: stretch;
} }
.utility-nav { .workspace {
display: grid; grid-template-columns: 1fr;
grid-template-columns: repeat(3, minmax(0, 1fr));
} }
.panel-toggle { .peer-panel,
width: 100%; .send-panel,
padding: 0 10px; .activity-panel {
}
.drop-stage {
min-height: auto; min-height: auto;
padding: 36px 0 20px;
} }
.drop-zone { .server-line code {
width: min(440px, 86vw); max-width: 100%;
padding: 34px;
}
.panel-dock {
position: static;
width: 100%;
margin-top: 12px;
} }
.activity { .activity {
@ -602,14 +513,3 @@ textarea {
grid-column: 1 / -1; grid-column: 1 / -1;
} }
} }
@media (max-width: 520px) {
.utility-nav {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.drop-icon {
width: 64px;
height: 64px;
}
}