mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
6140ed1718
- Added update service to fetch the latest server release from GitHub. - Implemented server upgrade scheduling and execution logic. - Created platform-specific restart mechanisms for Unix and Windows. - Introduced API endpoints for fetching the latest release and triggering upgrades. - Developed UI components for version upgrade modal, including loading and error states. - Updated documentation to reflect new upgrade features and instructions. - Refactored settings types to streamline interface definitions.
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { apiRequest } from '@/lib/api/client';
|
|
|
|
import type {
|
|
OptionItem,
|
|
SettingsProfile,
|
|
UpdateSelfPayload,
|
|
} from '@/features/settings/types';
|
|
|
|
export function getOptions() {
|
|
return apiRequest<OptionItem[]>('/option/');
|
|
}
|
|
|
|
export function updateOption(key: string, value: string) {
|
|
return apiRequest<void>('/option/', {
|
|
method: 'PUT',
|
|
body: JSON.stringify({ key, value }),
|
|
});
|
|
}
|
|
|
|
export function getSettingsProfile() {
|
|
return apiRequest<SettingsProfile>('/user/self');
|
|
}
|
|
|
|
export function updateSelf(payload: UpdateSelfPayload) {
|
|
return apiRequest<void>('/user/self', {
|
|
method: 'PUT',
|
|
body: JSON.stringify(payload),
|
|
});
|
|
}
|
|
|
|
export function generateAccessToken() {
|
|
return apiRequest<string>('/user/token');
|
|
}
|
|
|
|
export function bindWeChat(code: string) {
|
|
return apiRequest<void>(
|
|
`/oauth/wechat/bind?code=${encodeURIComponent(code)}`,
|
|
);
|
|
}
|
|
|
|
export function bindEmail(email: string, code: string) {
|
|
const searchParams = new URLSearchParams({ email, code });
|
|
return apiRequest<void>(`/oauth/email/bind?${searchParams.toString()}`);
|
|
}
|
|
|
|
export function getAboutContent() {
|
|
return apiRequest<string>('/about');
|
|
}
|