diff --git a/README.md b/README.md index 6aa984a6..9f680389 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Shakespeare is available on the following URLs: - [shakespeare.diy](https://shakespeare.diy) - [shakespeare.soapbox.dev](https://shakespeare.soapbox.dev) +- [shakespeare-diy.github.io](https://shakespeare-diy.github.io) - [shakespeare-b0b9c8.gitlab.io](https://shakespeare-b0b9c8.gitlab.io) ## Alternatives diff --git a/electron/electron.d.ts b/electron/electron.d.ts index ef41da91..dbfa44c7 100644 --- a/electron/electron.d.ts +++ b/electron/electron.d.ts @@ -60,6 +60,11 @@ interface ElectronShellAPI { } interface ElectronAPI { + /** + * Get the user's home directory path. + */ + homedir: string; + /** * Get the current platform. * @returns 'darwin' | 'win32' | 'linux' diff --git a/electron/preload.js b/electron/preload.js index dd554c3c..7c32b7fa 100644 --- a/electron/preload.js +++ b/electron/preload.js @@ -1,8 +1,12 @@ import { contextBridge, ipcRenderer } from 'electron'; +import os from 'node:os'; // Expose protected methods that allow the renderer process to use // ipcRenderer without exposing the entire object contextBridge.exposeInMainWorld('electron', { + // Get the home directory + homedir: os.homedir(), + // Platform information platform: () => ipcRenderer.invoke('get-platform'), diff --git a/src/components/AppProvider.tsx b/src/components/AppProvider.tsx index 0e4b3126..275bdb8e 100644 --- a/src/components/AppProvider.tsx +++ b/src/components/AppProvider.tsx @@ -58,8 +58,14 @@ export function AppProvider(props: AppProviderProps) { setConfig(updater); }; + // Merge default config with stored config const config = { ...defaultConfig, ...rawConfig }; + // Expand filesystem paths + config.fsPathConfig = expandPath(config.fsPathConfig); + config.fsPathProjects = expandPath(config.fsPathProjects); + config.fsPathTmp = expandPath(config.fsPathTmp); + const appContextValue: AppContextType = { config, updateConfig, @@ -127,4 +133,18 @@ function useApplyLanguage(language?: string): void { useEffect(() => { i18n.changeLanguage(language ?? navigator.language); }, [language]); +} + +/** Expand FS paths with the user's home directory, if available. */ +function expandPath(path: string): string { + const homedir = window.electron?.homedir; + if (!homedir) { + return path; + } else if (path.startsWith('~/')) { + return homedir + path.slice(1); + } else if (path === '~') { + return homedir; + } else { + return path; + } } \ No newline at end of file diff --git a/src/components/CreditsDialog.tsx b/src/components/CreditsDialog.tsx index b8cb506b..76f3dd29 100644 --- a/src/components/CreditsDialog.tsx +++ b/src/components/CreditsDialog.tsx @@ -554,7 +554,14 @@ export function CreditsDialog({ open, onOpenChange, provider }: CreditsDialogPro }; const handleCopyCode = (code: string) => { - navigator.clipboard.writeText(code); + // Create the full shareable URL for the gift card + const url = new URL('/giftcard', window.location.origin); + url.hash = new URLSearchParams({ + baseURL: provider.baseURL, + code: code, + }).toString(); + + navigator.clipboard.writeText(url.toString()); setCopiedCode(code); setTimeout(() => setCopiedCode(null), 2000); }; diff --git a/src/components/PWAUpdatePrompt.tsx b/src/components/PWAUpdatePrompt.tsx index 0943e0a6..970e08ff 100644 --- a/src/components/PWAUpdatePrompt.tsx +++ b/src/components/PWAUpdatePrompt.tsx @@ -51,7 +51,7 @@ export function PWAUpdatePrompt() { } return ( -
+
+