javascript-solid-server 0.0.45 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.45",
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,12 +93,24 @@ 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 non-bare repos to accept pushes and update working directory
97
- if (gitInfo.isRegular && isGitWriteOperation(urlPath)) {
98
- spawn('git', ['config', 'receive.denyCurrentBranch', 'updateInstead'], {
99
- cwd: repoAbs,
100
- env: { ...process.env, GIT_DIR: gitInfo.gitDir }
101
- });
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
+ }
102
114
  }
103
115
 
104
116
  // Build CGI environment