javascript-solid-server 0.0.44 → 0.0.46

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.
@@ -138,7 +138,8 @@
138
138
  "Bash(gh gist edit:*)",
139
139
  "Bash(gh gist view:*)",
140
140
  "Bash(./bin/git-credential-nostr acl:*)",
141
- "Bash(DATA_ROOT=/tmp/jss-git-test/data node:*)"
141
+ "Bash(DATA_ROOT=/tmp/jss-git-test/data node:*)",
142
+ "Bash(git remote set-url:*)"
142
143
  ]
143
144
  }
144
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
- import { spawn } from 'child_process';
2
- import { existsSync, statSync } from 'fs';
3
- import { join, resolve } from 'path';
1
+ import { spawn, execSync } from 'child_process';
2
+ import { existsSync, statSync, mkdirSync, writeFileSync } from 'fs';
3
+ import { join, resolve, dirname } from 'path';
4
4
 
5
5
  /**
6
6
  * Check if a URL path is a Git protocol request
@@ -93,6 +93,26 @@ export async function handleGit(request, reply) {
93
93
  return reply.code(404).send({ error: 'Not a git repository' });
94
94
  }
95
95
 
96
+ // Auto-configure repos to accept pushes (check full URL for query string)
97
+ if (isGitWriteOperation(request.url)) {
98
+ try {
99
+ // Enable receive-pack for HTTP push
100
+ execSync('git config http.receivepack true', {
101
+ cwd: repoAbs,
102
+ env: { ...process.env, GIT_DIR: gitInfo.gitDir }
103
+ });
104
+ // For non-bare repos, auto-update working directory after push
105
+ if (gitInfo.isRegular) {
106
+ execSync('git config receive.denyCurrentBranch updateInstead', {
107
+ cwd: repoAbs,
108
+ env: { ...process.env, GIT_DIR: gitInfo.gitDir }
109
+ });
110
+ }
111
+ } catch (e) {
112
+ // Ignore config errors - repo may still work
113
+ }
114
+ }
115
+
96
116
  // Build CGI environment
97
117
  const env = {
98
118
  ...process.env,
@@ -202,21 +222,6 @@ export async function handleGit(request, reply) {
202
222
  reply.code(500).send({ error: 'Git operation failed' });
203
223
  }
204
224
 
205
- // Auto-checkout working directory after successful push to non-bare repo
206
- if (code === 0 && isGitWriteOperation(urlPath) && gitInfo.isRegular) {
207
- const checkout = spawn('git', ['checkout', '-f'], {
208
- cwd: repoAbs,
209
- env: {
210
- ...process.env,
211
- GIT_DIR: gitInfo.gitDir,
212
- GIT_WORK_TREE: repoAbs
213
- }
214
- });
215
- checkout.on('error', (err) => {
216
- console.error('Auto-checkout failed:', err.message);
217
- });
218
- }
219
-
220
225
  resolve();
221
226
  });
222
227
  });