feat(account): add client account api foundation

This commit is contained in:
2026-05-18 22:02:39 +08:00
parent 960bababc5
commit 881aceb78c
6 changed files with 562 additions and 1 deletions
+8
View File
@@ -7,6 +7,14 @@ export const APM_STORE_BASE_URL: string =
export const APM_STORE_STATS_BASE_URL: string =
import.meta.env.VITE_APM_STORE_STATS_BASE_URL || "";
export const SPARK_BACKEND_BASE_URL: string =
import.meta.env.VITE_SPARK_BACKEND_BASE_URL || "";
export const FLARUM_BASE_URL = "https://bbs.spark-app.store";
export const FLARUM_REGISTER_URL = `${FLARUM_BASE_URL}/register`;
export const FLARUM_PROFILE_URL = `${FLARUM_BASE_URL}/u`;
export const FLARUM_SETTINGS_URL = `${FLARUM_BASE_URL}/settings`;
// 下面的变量用于存储当前应用的信息,其实用在多个组件中
export const currentApp = ref<App | null>(null);
export const currentAppSparkInstalled = ref(false);
+127
View File
@@ -249,3 +249,130 @@ export interface SidebarEntry {
type?: "category" | "search" | "link";
value?: string;
}
export interface SparkUser {
id: number;
flarumUserId: string;
username: string;
displayName: string;
avatarUrl: string;
forumLevel: string;
forumGroups: string[];
}
export interface AuthSession {
accessToken: string;
tokenType: "bearer";
user: SparkUser;
}
export interface FlarumLoginPayload {
identification: string;
password: string;
}
export interface ReviewTags {
origin: "spark" | "apm";
category: string;
pkgname: string;
version: string;
packageArch: string;
clientArch: string;
distro: string;
}
export interface RatingSummary {
averageRating: number;
reviewCount: number;
starCounts: Record<number, number>;
}
export interface AppReview {
id: number;
rating: number;
content: string;
version: string;
packageArch: string;
clientArch: string;
distro: string;
origin: "spark" | "apm";
category: string;
createdAt: string;
updatedAt: string;
userDisplayName: string;
userAvatarUrl: string;
}
export interface FavoriteFolder {
id: number;
name: string;
itemCount: number;
createdAt: string;
updatedAt: string;
}
export interface FavoriteItem {
id: number;
appKey: string;
pkgname: string;
name: string;
category: string;
iconUrl: string;
createdAt: string;
}
export type FavoriteAvailabilityStatus =
| "installable"
| "installed"
| "platform-unavailable"
| "arch-unavailable"
| "downlisted";
export interface ResolvedFavoriteItem {
item: FavoriteItem;
status: FavoriteAvailabilityStatus;
reason: string;
selectedApp: App | null;
}
export interface DownloadedAppRecord {
id: number;
appKey: string;
pkgname: string;
name: string;
category: string;
selectedOrigin: "spark" | "apm";
version: string;
packageArch: string;
downloadedAt: string;
}
export interface DownloadedAppList {
items: DownloadedAppRecord[];
total: number;
page: number;
pageSize: number;
}
export interface SyncedAppListItem {
id?: number;
pkgname: string;
origin: "spark" | "apm";
category: string;
version: string;
packageArch: string;
appName: string;
iconUrl: string;
}
export interface SyncedAppList {
snapshotName: string;
clientArch: string;
distro: string;
updatedAt: string;
items: SyncedAppListItem[];
}
export interface SystemInfo {
distro: string;
}