@feynmanzhang/open-party 0.1.1 → 0.1.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,7 +152,7 @@ function joinTailnet(authKey, timeout = 3e4) {
152
152
  const binary = getTailscaleBinary();
153
153
  try {
154
154
  const output = execWithSudoFallback(
155
- [binary, "up", "--authkey", authKey, "--accept-routes"],
155
+ [binary, "up", "--authkey", authKey],
156
156
  timeout
157
157
  );
158
158
  return { success: true, output: output.trim() };
@@ -3502,6 +3502,9 @@ var serve = (options, listeningListener) => {
3502
3502
  // src/server/index.ts
3503
3503
  init_config();
3504
3504
  init_state();
3505
+ import { mkdirSync, writeFileSync, unlinkSync } from "fs";
3506
+ import { join as join2, dirname } from "path";
3507
+ import { homedir } from "os";
3505
3508
 
3506
3509
  // src/server/models.ts
3507
3510
  function sanitizeAgentInfo(info) {
@@ -4327,6 +4330,19 @@ body::after{
4327
4330
  fastTimer = setInterval(fastRefresh, 3000);
4328
4331
  fullTimer = setInterval(fullRefresh, 5000);
4329
4332
 
4333
+ // Clipboard click delegation for .cmd elements
4334
+ document.addEventListener('click', function(e) {
4335
+ var cmd = e.target.closest('.cmd');
4336
+ if (!cmd) return;
4337
+ var text = cmd.getAttribute('data-clipboard');
4338
+ if (text) {
4339
+ navigator.clipboard.writeText(text).then(function() {
4340
+ var hint = cmd.querySelector('.copy-hint');
4341
+ if (hint) hint.textContent = 'Copied!';
4342
+ });
4343
+ }
4344
+ });
4345
+
4330
4346
  // Update uptime display every second
4331
4347
  setInterval(function() {
4332
4348
  if (overview && overview.server) {
@@ -4454,7 +4470,7 @@ body::after{
4454
4470
  html += '<div style="color:var(--muted);margin-bottom:6px">Install for ' + info.os + ':</div>';
4455
4471
  info.commands.forEach(function(cmd) {
4456
4472
  const display = info.needs_sudo ? 'sudo ' + cmd : cmd;
4457
- html += '<div class="cmd" onclick="navigator.clipboard.writeText('' + display.replace(/'/g, "\\'") + '').then(function(){this.querySelector('.copy-hint').textContent='Copied!'}.bind(this))">';
4473
+ html += '<div class="cmd" data-clipboard="' + display.replace(/"/g, '&quot;') + '">';
4458
4474
  html += '<code>' + display + '</code><span class="copy-hint">Click to copy</span></div>';
4459
4475
  });
4460
4476
  if (info.download_url) {
@@ -4610,7 +4626,15 @@ app.use("*", cors());
4610
4626
  app.route("/agent", agentRoutes);
4611
4627
  app.route("/proxy", proxyRoutes);
4612
4628
  app.route("/dashboard", dashboardRoutes);
4629
+ function pidFilePath() {
4630
+ const pluginData = process.env.CLAUDE_PLUGIN_DATA || "";
4631
+ if (pluginData) return join2(pluginData, "server.pid");
4632
+ return join2(homedir(), ".open-party", "server.pid");
4633
+ }
4613
4634
  async function main() {
4635
+ const pidPath = pidFilePath();
4636
+ mkdirSync(dirname(pidPath), { recursive: true });
4637
+ writeFileSync(pidPath, String(process.pid));
4614
4638
  console.log(`Starting Party Server on port ${PARTY_PORT} (Tailscale IP: ${getSelfIp()})`);
4615
4639
  process.on("SIGHUP", () => {
4616
4640
  });
@@ -4619,6 +4643,10 @@ async function main() {
4619
4643
  const cleanupPromise = periodicCleanup();
4620
4644
  const shutdown = () => {
4621
4645
  console.log("\nShutting down Party Server...");
4646
+ try {
4647
+ unlinkSync(pidPath);
4648
+ } catch {
4649
+ }
4622
4650
  server.close();
4623
4651
  process.exit(0);
4624
4652
  };