mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
Add GitHub token environment variable support and improve git operations
This commit is contained in:
1 parent
025b2990ed
commit
af0dcac7c8
11 files changed
+125
-21
No files matched your search
@@ -6,9 +6,10 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { TTSSettings } from './TTSSettings'
|
||||
import { showToast } from '@/lib/toast'
|
||||
|
||||
export function GeneralSettings() {
|
||||
const { preferences, isLoading, updateSettings, isUpdating } = useSettings()
|
||||
const { preferences, isLoading, updateSettings, updateSettingsAsync, isUpdating } = useSettings()
|
||||
|
||||
const [gitToken, setGitToken] = useState('')
|
||||
|
||||
@@ -120,7 +121,17 @@ export function GeneralSettings() {
|
||||
placeholder="ghp_..."
|
||||
value={gitToken}
|
||||
onChange={(e) => setGitToken(e.target.value)}
|
||||
onBlur={() => updateSettings({ gitToken })}
|
||||
onBlur={async () => {
|
||||
if (gitToken !== preferences?.gitToken) {
|
||||
showToast.loading('Restarting OpenCode server...', { id: 'restart-server' })
|
||||
try {
|
||||
await updateSettingsAsync({ gitToken })
|
||||
showToast.success('GitHub token updated', { id: 'restart-server' })
|
||||
} catch {
|
||||
showToast.error('Failed to update GitHub token', { id: 'restart-server' })
|
||||
}
|
||||
}
|
||||
}}
|
||||
className="bg-background border-border text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
|
||||
Reference in new issue
Block a user