-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4877 from ethereum/gitui
GIT UI ( squashed )
- Loading branch information
Showing
119 changed files
with
10,154 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"scripts": { | ||
"start:server": "npx ts-node server.ts" | ||
}, | ||
"dependencies": { | ||
"body-parser": "^1.20.2", | ||
"child_process": "^1.0.2", | ||
"express": "^4.19.2", | ||
"git-http-backend": "^1.1.2", | ||
"path": "^0.12.7", | ||
"zlib": "^1.0.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as http from 'http'; | ||
import { spawn } from 'child_process'; | ||
import * as path from 'path'; | ||
let backend = require('git-http-backend'); | ||
import * as zlib from 'zlib'; | ||
|
||
const directory = process.argv[2]; | ||
|
||
if (!directory) { | ||
console.error('Please provide a directory as a command line argument.'); | ||
process.exit(1); | ||
} | ||
|
||
const server = http.createServer((req, res) => { | ||
|
||
// Set CORS headers | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); | ||
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); | ||
res.setHeader('Access-Control-Allow-Credentials', 'true'); | ||
|
||
if (req.method === 'OPTIONS') { | ||
// Handle preflight request | ||
res.writeHead(204); | ||
res.end(); | ||
return; | ||
} | ||
|
||
const repo = req.url?.split('/')[1]; | ||
const dir = path.join(directory, 'git', repo || ''); | ||
console.log(dir); | ||
const reqStream = req.headers['content-encoding'] === 'gzip' ? req.pipe(zlib.createGunzip()) : req; | ||
|
||
reqStream.pipe(backend(req.url || '', (err, service) => { | ||
if (err) return res.end(err + '\n'); | ||
|
||
res.setHeader('content-type', service.type); | ||
console.log(service.action, repo, service.fields); | ||
|
||
const ps = spawn(service.cmd, [...service.args, dir]); | ||
ps.stdout.pipe(service.createStream()).pipe(ps.stdin); | ||
|
||
})).pipe(res); | ||
}); | ||
|
||
server.listen(6868, () => { | ||
console.log('Server is listening on port 6868'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
cd /tmp/ | ||
rm -rf git/bare.git | ||
rm -rf git | ||
mkdir -p git | ||
cd git | ||
git clone --bare https://github.com/ethereum/awesome-remix bare.git |
Oops, something went wrong.