clay-server 2.26.0-beta.5 → 2.26.0-beta.7

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.
package/lib/server.js CHANGED
@@ -38,6 +38,24 @@ function httpGet(url) {
38
38
  });
39
39
  }
40
40
 
41
+ function httpGetBinary(url) {
42
+ return new Promise(function (resolve, reject) {
43
+ var mod = url.startsWith("https") ? https : http;
44
+ mod.get(url, { headers: { "User-Agent": "Clay/1.0" } }, function (resp) {
45
+ if (resp.statusCode >= 300 && resp.statusCode < 400 && resp.headers.location) {
46
+ return httpGetBinary(resp.headers.location).then(resolve, reject);
47
+ }
48
+ if (resp.statusCode !== 200) {
49
+ return reject(new Error("HTTP " + resp.statusCode));
50
+ }
51
+ var chunks = [];
52
+ resp.on("data", function (c) { chunks.push(c); });
53
+ resp.on("end", function () { resolve(Buffer.concat(chunks)); });
54
+ resp.on("error", reject);
55
+ }).on("error", reject);
56
+ });
57
+ }
58
+
41
59
  function fetchSkillsPage(url) {
42
60
  return httpGet(url).then(function (html) {
43
61
  // Data is inside self.__next_f.push() with escaped quotes: \"initialSkills\":[{\"source\":...}]
@@ -1018,6 +1036,28 @@ function createServer(opts) {
1018
1036
  return;
1019
1037
  }
1020
1038
 
1039
+ // Chrome extension download (proxy from GitHub)
1040
+ if (fullUrl === "/api/extension/download" && req.method === "GET") {
1041
+ if (!isRequestAuthed(req)) {
1042
+ res.writeHead(401, { "Content-Type": "application/json" });
1043
+ res.end(JSON.stringify({ error: "Unauthorized" }));
1044
+ return;
1045
+ }
1046
+ var archiveUrl = "https://github.com/chadbyte/clay-chrome/archive/refs/heads/main.zip";
1047
+ httpGetBinary(archiveUrl).then(function (buf) {
1048
+ res.writeHead(200, {
1049
+ "Content-Type": "application/zip",
1050
+ "Content-Disposition": 'attachment; filename="clay-chrome-extension.zip"',
1051
+ "Content-Length": buf.length,
1052
+ });
1053
+ res.end(buf);
1054
+ }).catch(function (err) {
1055
+ res.writeHead(502, { "Content-Type": "application/json" });
1056
+ res.end(JSON.stringify({ error: "Failed to download extension: " + (err.message || "unknown error") }));
1057
+ });
1058
+ return;
1059
+ }
1060
+
1021
1061
  // CORS preflight for cross-origin requests (HTTP onboarding → HTTPS)
1022
1062
  if (req.method === "OPTIONS") {
1023
1063
  res.writeHead(204, {
@@ -2889,6 +2929,8 @@ function createServer(opts) {
2889
2929
  osUsers: osUsers,
2890
2930
  currentVersion: currentVersion,
2891
2931
  lanHost: lanHost,
2932
+ port: portNum,
2933
+ tls: !!tlsOptions,
2892
2934
  getProjectCount: function () { return projects.size; },
2893
2935
  getProjectList: function (userId) {
2894
2936
  var list = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.26.0-beta.5",
3
+ "version": "2.26.0-beta.7",
4
4
  "description": "Self-hosted Claude Code in your browser. Multi-session, multi-user, push notifications.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",