mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Git proxy origins are configured separately from git credentials
This commit is contained in:
15 files changed
+35
-47
No files matched your search
@@ -63,6 +63,7 @@ describe('useGenerateProjectInfo', () => {
|
||||
templates: defaultTemplates,
|
||||
esmUrl: 'https://esm.sh',
|
||||
corsProxy: 'https://proxy.example.com/{href}',
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'local-shakespeare.dev',
|
||||
@@ -224,6 +225,7 @@ describe('useGenerateProjectInfo', () => {
|
||||
templates: [],
|
||||
esmUrl: 'https://esm.sh',
|
||||
corsProxy: 'https://proxy.example.com/{href}',
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'local-shakespeare.dev',
|
||||
|
||||
@@ -40,6 +40,7 @@ function createWrapper(corsProxy: string) {
|
||||
templates: [{ name: 'MKStack', description: 'Build Nostr clients with React.', url: 'https://gitlab.com/soapbox-pub/mkstack.git' }],
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy,
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'local-test.dev',
|
||||
@@ -93,6 +94,7 @@ describe('useGit', () => {
|
||||
fs: mockFS,
|
||||
nostr: mockNostr,
|
||||
corsProxy: 'https://cors.isomorphic-git.org',
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
relayList: [{ url: new URL('wss://relay.test/'), read: true, write: true }],
|
||||
graspList: [{ url: new URL('wss://git.shakespeare.diy/') }, { url: new URL('wss://relay.ngit.dev/') }],
|
||||
credentials: [],
|
||||
@@ -110,6 +112,7 @@ describe('useGit', () => {
|
||||
fs: mockFS,
|
||||
nostr: mockNostr,
|
||||
corsProxy: 'https://custom-cors.example.com',
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
relayList: [{ url: new URL('wss://relay.test/'), read: true, write: true }],
|
||||
graspList: [{ url: new URL('wss://git.shakespeare.diy/') }, { url: new URL('wss://relay.ngit.dev/') }],
|
||||
credentials: [],
|
||||
@@ -127,6 +130,7 @@ describe('useGit', () => {
|
||||
fs: mockFS,
|
||||
nostr: mockNostr,
|
||||
corsProxy: 'https://cors.isomorphic-git.org',
|
||||
gitProxyOrigins: ['https://github.com', 'https://gitlab.com'],
|
||||
relayList: [{ url: new URL('wss://relay.test/'), read: true, write: true }],
|
||||
graspList: [{ url: new URL('wss://git.shakespeare.diy/') }, { url: new URL('wss://relay.ngit.dev/') }],
|
||||
credentials: [],
|
||||
|
||||
+3
-2
@@ -16,7 +16,7 @@ export function useGit(): { git: Git } {
|
||||
const { nostr } = useNostr();
|
||||
const { config } = useAppContext();
|
||||
const { settings } = useGitSettings();
|
||||
const { corsProxy, relayMetadata, graspMetadata } = config;
|
||||
const { corsProxy, gitProxyOrigins, relayMetadata, graspMetadata } = config;
|
||||
|
||||
const relayList = useMemo(() => {
|
||||
// Extract hostnames from grasp relay URLs for backwards compatibility with Git class
|
||||
@@ -45,12 +45,13 @@ export function useGit(): { git: Git } {
|
||||
fs,
|
||||
nostr,
|
||||
corsProxy,
|
||||
gitProxyOrigins,
|
||||
relayList,
|
||||
graspList,
|
||||
credentials: settings.credentials,
|
||||
signer: user?.signer,
|
||||
});
|
||||
}, [fs, nostr, corsProxy, relayList, graspList, settings.credentials, user?.signer]);
|
||||
}, [fs, nostr, corsProxy, gitProxyOrigins, relayList, graspList, settings.credentials, user?.signer]);
|
||||
|
||||
return { git };
|
||||
}
|
||||
Reference in new issue
Block a user