fix: git private clone with custom proxy (#1010)
Browse files* cookie fix
* fix: git private clone with custom proxy
* list -fix
- app/lib/hooks/useGit.ts +14 -0
app/lib/hooks/useGit.ts
CHANGED
@@ -50,6 +50,18 @@ export function useGit() {
|
|
50 |
|
51 |
fileData.current = {};
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
try {
|
54 |
await git.clone({
|
55 |
fs,
|
@@ -59,6 +71,8 @@ export function useGit() {
|
|
59 |
depth: 1,
|
60 |
singleBranch: true,
|
61 |
corsProxy: '/api/git-proxy',
|
|
|
|
|
62 |
onAuth: (url) => {
|
63 |
let auth = lookupSavedPassword(url);
|
64 |
|
|
|
50 |
|
51 |
fileData.current = {};
|
52 |
|
53 |
+
const headers: {
|
54 |
+
[x: string]: string;
|
55 |
+
} = {
|
56 |
+
'User-Agent': 'bolt.diy',
|
57 |
+
};
|
58 |
+
|
59 |
+
const auth = lookupSavedPassword(url);
|
60 |
+
|
61 |
+
if (auth) {
|
62 |
+
headers.Authorization = `Basic ${Buffer.from(`${auth.username}:${auth.password}`).toString('base64')}`;
|
63 |
+
}
|
64 |
+
|
65 |
try {
|
66 |
await git.clone({
|
67 |
fs,
|
|
|
71 |
depth: 1,
|
72 |
singleBranch: true,
|
73 |
corsProxy: '/api/git-proxy',
|
74 |
+
headers,
|
75 |
+
|
76 |
onAuth: (url) => {
|
77 |
let auth = lookupSavedPassword(url);
|
78 |
|