Skip to content

Commit 2a0a524

Browse files
author
djinni-hppro
committed
fix: remove git.plugins usage to resolve TypeError
1 parent 1a312a0 commit 2a0a524

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/git.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55
const fs = new LightningFS('feathernote-fs');
66
const pfs = fs.promises;
77

8-
// Setup Git plugin
9-
// We rely on window.git and window.GitHttp being available from loaded libs
10-
if (window.git && window.GitHttp) {
11-
git.plugins.set('fs', fs);
12-
git.plugins.set('http', window.GitHttp);
13-
}
8+
// Note: isomorphic-git v1.x does not use git.plugins.set('fs', ...) or 'http'.
9+
// Instead, we pass 'fs' and 'http' in the options object for each command.
1410

1511
const GIT_DIR = '/repo';
1612

1713
// Helper to get git config object
1814
const getGitConfig = (creds) => {
19-
return {
15+
const config = {
2016
fs,
2117
dir: GIT_DIR,
2218
corsProxy: creds.corsProxy || 'https://cors.isomorphic-git.org',
@@ -27,6 +23,11 @@ const getGitConfig = (creds) => {
2723
email: creds.email || 'user@feathernote.app',
2824
},
2925
};
26+
27+
if (window.GitHttp) {
28+
config.http = window.GitHttp;
29+
}
30+
return config;
3031
};
3132

3233
// Helper to parse Frontmatter
@@ -228,4 +229,4 @@ window.finishGitSync = async (creds) => {
228229
console.error('Git Commit/Push Error:', e);
229230
}
230231
}
231-
};
232+
};

src/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,10 @@ <h4 class="font-semibold text-sm" x-text="toast.title"></h4>
517517

518518
<link rel="stylesheet" href="/index.css?v=___VERSION___"/>
519519

520-
<script defer src="/libs/isomorphic-git.min.js"></script>
521-
<script defer src="/libs/lightning-fs.min.js"></script>
522-
<script defer src="/libs/http.min.js"></script>
523-
<!-- <script src="/src/git.js?v=___VERSION___"></script> -->
520+
<script src="/libs/isomorphic-git.min.js"></script>
521+
<script src="/libs/lightning-fs.min.js"></script>
522+
<script src="/libs/http.min.js"></script>
523+
<script src="/git.js?v=___VERSION___"></script>
524524

525525
<script src="/s3.js?v=___VERSION___"></script>
526526
<script src="/nostr.js?v=___VERSION___"></script>

0 commit comments

Comments
 (0)