init studio admin frontend

This commit is contained in:
2026-07-01 17:34:15 +09:00
commit c50bd2b941
64 changed files with 22452 additions and 0 deletions
+252
View File
@@ -0,0 +1,252 @@
import { apiRequest } from '../../lib/api';
import type { AppRelease, AppWithComponents } from '../../types/application';
import type { GiteaRepo } from '../../types/application';
export type LauncherVersion = {
id: string;
version: string;
minimumVersion?: string | null;
artifact: string;
downloadUrl: string;
releaseNotes?: string | null;
repository?: string | null;
branch?: string | null;
commitSha?: string | null;
isActive: boolean;
createdAt?: string;
updatedAt?: string;
};
export type LauncherBuildJob = {
id: string;
target: string;
repository?: string | null;
branch: string;
commitSha?: string | null;
version: string;
uploadPath: string;
downloadUrl: string;
artifact: string;
status: 'PENDING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELED';
logs?: string | null;
startedAt?: string | null;
finishedAt?: string | null;
createdAt: string;
updatedAt?: string;
};
export type LauncherSource = {
repository?: string | null;
branch?: string | null;
commitSha?: string | null;
};
export type LauncherAppLink = {
id: string;
appId: string;
releaseId?: string | null;
displayOrder: number;
isEnabled: boolean;
displayName?: string | null;
description?: string | null;
subtitle?: string | null;
detailUrl?: string | null;
videoPath?: string | null;
iconKey?: string | null;
launchUrl?: string | null;
devAppPath?: string | null;
execPath?: string | null;
artifact?: string | null;
createdAt: string;
updatedAt?: string;
app: AppWithComponents;
release?: AppRelease | null;
};
export type LauncherCommonSetting = {
id: string;
key: string;
name: string;
type: string;
value: string;
description?: string | null;
isActive: boolean;
isSecret: boolean;
createdAt: string;
updatedAt?: string;
};
export type LauncherUnlinkedApp = AppWithComponents & {
releases?: AppRelease[];
};
export function listLauncherVersions() {
return apiRequest<LauncherVersion[]>('/launcher/versions');
}
export function createLauncherVersion(input: {
version: string;
minimumVersion?: string;
artifact: string;
downloadUrl: string;
releaseNotes?: string;
repository?: string;
branch?: string;
commitSha?: string;
}) {
return apiRequest<{ version: LauncherVersion }>('/launcher/versions', {
method: 'POST',
body: JSON.stringify(input)
});
}
export function linkLauncherVersionSource(
versionId: string,
input: { repository: string; branch?: string; commitSha?: string }
) {
return apiRequest<{ version: LauncherVersion }>(`/launcher/versions/${versionId}/source`, {
method: 'PATCH',
body: JSON.stringify(input)
});
}
export function getLauncherSource() {
return apiRequest<{ source: LauncherSource }>('/launcher/source');
}
export function updateLauncherSource(input: { repository: string; branch?: string; commitSha?: string }) {
return apiRequest<{ source: LauncherSource }>('/launcher/source', {
method: 'PATCH',
body: JSON.stringify(input)
});
}
export function listPlatformRepos(limit = 50) {
return apiRequest<{ owner: string | null; repos: GiteaRepo[] }>(`/gitea/repos?owner=platform&limit=${limit}`)
.then((result) => result.repos);
}
export function listLauncherBuildJobs() {
return apiRequest<LauncherBuildJob[]>('/launcher/builds');
}
export function createLauncherBuildJob(input: {
target?: string;
repository?: string;
branch?: string;
commitSha?: string;
version: string;
artifact: string;
uploadPath?: string;
downloadUrl?: string;
}) {
return apiRequest<{ job: LauncherBuildJob }>('/launcher/builds', {
method: 'POST',
body: JSON.stringify(input)
});
}
export function listLauncherAppLinks() {
return apiRequest<{ linked: LauncherAppLink[]; unlinked: LauncherUnlinkedApp[] }>('/launcher/app-links');
}
export function syncLauncherAppsToAdminApps() {
return apiRequest<{ syncedApps: number; syncedReleases: number }>('/launcher/app-links/sync-admin-apps', {
method: 'POST'
});
}
export function createLauncherAppLink(input: {
appId: string;
releaseId?: string;
displayOrder?: number;
displayName?: string;
description?: string;
subtitle?: string;
detailUrl?: string;
videoPath?: string;
iconKey?: string;
launchUrl?: string;
devAppPath?: string;
execPath?: string;
artifact?: string;
}) {
return apiRequest<{ link: LauncherAppLink }>('/launcher/app-links', {
method: 'POST',
body: JSON.stringify(input)
});
}
export function updateLauncherAppLink(
id: string,
input: Partial<{
displayOrder: number;
isEnabled: boolean;
displayName: string;
description: string;
subtitle: string;
detailUrl: string;
videoPath: string;
iconKey: string;
launchUrl: string;
devAppPath: string;
execPath: string;
}>
) {
return apiRequest<{ link: LauncherAppLink }>(`/launcher/app-links/${id}`, {
method: 'PATCH',
body: JSON.stringify(input)
});
}
export function moveLauncherAppLink(id: string, direction: 'up' | 'down') {
return apiRequest<{ linked: LauncherAppLink[]; unlinked: LauncherUnlinkedApp[] }>(`/launcher/app-links/${id}/move`, {
method: 'PATCH',
body: JSON.stringify({ direction })
});
}
export function deleteLauncherAppLink(id: string) {
return apiRequest<{ deleted: boolean }>(`/launcher/app-links/${id}`, { method: 'DELETE' });
}
export function listLauncherCommonSettings() {
return apiRequest<LauncherCommonSetting[]>('/launcher/common-settings');
}
export function createLauncherCommonSetting(input: {
key: string;
name: string;
type: string;
value: string;
description?: string;
isActive?: boolean;
isSecret?: boolean;
}) {
return apiRequest<{ setting: LauncherCommonSetting }>('/launcher/common-settings', {
method: 'POST',
body: JSON.stringify(input)
});
}
export function updateLauncherCommonSetting(
id: string,
input: Partial<{
key: string;
name: string;
type: string;
value: string;
description: string;
isActive: boolean;
isSecret: boolean;
}>
) {
return apiRequest<{ setting: LauncherCommonSetting }>(`/launcher/common-settings/${id}`, {
method: 'PATCH',
body: JSON.stringify(input)
});
}
export function deleteLauncherCommonSetting(id: string) {
return apiRequest<{ deleted: boolean }>(`/launcher/common-settings/${id}`, { method: 'DELETE' });
}