mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Let ngitWebUrl be configurable
This commit is contained in:
22 files changed
+194
-12
No files matched your search
@@ -46,6 +46,7 @@ const AppConfigSchema = z.object({
|
||||
esmUrl: z.string().url(),
|
||||
corsProxy: z.string().url(),
|
||||
faviconUrl: z.string().url(),
|
||||
ngitWebUrl: z.string().url(),
|
||||
previewDomain: z.string().min(1),
|
||||
language: z.string(),
|
||||
showcaseEnabled: z.boolean(),
|
||||
|
||||
@@ -35,6 +35,7 @@ describe('SentryProvider', () => {
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy: 'https://proxy.test/{href}',
|
||||
faviconUrl: 'https://favicon.test/{href}',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'test.dev',
|
||||
showcaseEnabled: false,
|
||||
showcaseModerator: '',
|
||||
@@ -75,6 +76,7 @@ describe('SentryProvider', () => {
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy: 'https://proxy.test/{href}',
|
||||
faviconUrl: 'https://favicon.test/{href}',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'test.dev',
|
||||
showcaseEnabled: false,
|
||||
showcaseModerator: '',
|
||||
@@ -116,6 +118,7 @@ describe('SentryProvider', () => {
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy: 'https://proxy.test/{href}',
|
||||
faviconUrl: 'https://favicon.test/{href}',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'test.dev',
|
||||
showcaseEnabled: false,
|
||||
showcaseModerator: '',
|
||||
@@ -160,6 +163,7 @@ describe('SentryProvider', () => {
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy: 'https://proxy.test/{href}',
|
||||
faviconUrl: 'https://favicon.test/{href}',
|
||||
ngitWebUrl: 'https://nostrhub.io/{naddr}',
|
||||
previewDomain: 'test.dev',
|
||||
showcaseEnabled: false,
|
||||
showcaseModerator: '',
|
||||
|
||||
@@ -15,9 +15,11 @@ import { useGitStatus } from '@/hooks/useGitStatus';
|
||||
import { useGitSettings } from '@/hooks/useGitSettings';
|
||||
import { useGit } from '@/hooks/useGit';
|
||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||
import { useAppContext } from '@/hooks/useAppContext';
|
||||
import type { StepProps } from '../types';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
import { ngitWebUrl } from '@/lib/ngitWebUrl';
|
||||
|
||||
export function SyncStep({ projectId }: StepProps) {
|
||||
const [isSyncing, setIsSyncing] = useState(false);
|
||||
@@ -29,6 +31,7 @@ export function SyncStep({ projectId }: StepProps) {
|
||||
const { settings } = useGitSettings();
|
||||
const { git } = useGit();
|
||||
const { projectsPath } = useFSPaths();
|
||||
const { config } = useAppContext();
|
||||
|
||||
const originRemote = gitStatus?.remotes.find(r => r.name === 'origin');
|
||||
|
||||
@@ -109,10 +112,9 @@ export function SyncStep({ projectId }: StepProps) {
|
||||
// For HTTPS URLs, open directly
|
||||
externalUrl = originRemote.url;
|
||||
} else if (originRemote.url.startsWith('nostr://')) {
|
||||
// For Nostr URLs, parse and convert to naddr, then link to nostrhub.io
|
||||
// For Nostr URLs, parse and generate URL using the configured template
|
||||
const nostrUri = await NostrURI.parse(originRemote.url);
|
||||
const naddr = nostrUri.toNaddr();
|
||||
externalUrl = `https://nostrhub.io/${naddr}`;
|
||||
externalUrl = ngitWebUrl(config.ngitWebUrl, nostrUri);
|
||||
} else {
|
||||
// Unsupported URL type
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user