drop/desktop/main/types.ts
wdunn001 8a18e657f0 desktop: fix community telemetry to match the corrected architecture, fix a release-blocking borrow-checker error
Community was never a separate community.quasarke.net host -- it lives
inside the Drop server itself at {server}/community, same as the server-side
fold-in two commits up. The desktop client's own community.rs, models.rs,
and the two community.vue pages still assumed the old sidecar design
(Settings.communityUrl/communityEndpoint defaulting to
https://community.quasarke.net), so this corrects them to match:

- community.rs now posts to {server}/api/v1/ingest/{session-start,
  session-stop,achievements} (the fixed contract, matching the wrapper) via
  the same generate_url()/make_authenticated_post_json() helpers
  cloud_saves_commands.rs already uses, instead of an unauthenticated
  bespoke HTTP client pointed at a hardcoded second host. {server} is
  DB.base_url -- whatever Drop server the user actually signed into.
- database/src/models.rs: dropped the now-meaningless community_endpoint/
  community_url Settings fields; kept enable_community_telemetry as the
  only toggle.
- community.vue (the tab) and settings/community.vue: resolve the page URL
  via the existing gen_drop_url Tauri command (same one the admin-panel
  link already uses) instead of a stored/hardcoded URL.
- error.vue: the generic pre-auth error page can render before any server
  is configured, so it can't resolve a per-server community link the way
  community.vue does -- pointed its "Support" link at our docs instead of
  the retired community.quasarke.net.

Also fixes a real release-blocking bug in process_manager.rs found while
verifying this compiles: the drop://game-launch telemetry emit held
install_dir (a reference borrowed out of db_lock via game_status) live past
the db_lock.applications.transient_statuses.insert() mutable borrow a few
lines above it -- an E0502 that fails every build, release or debug.
Fixed by cloning install_dir to an owned String before that mutable borrow
point and using the clone in the emit instead.

Verified: cargo check -p drop-app passes; full `cargo tauri build` release
build succeeds and produces a working NSIS installer (7z archive-test:
"Everything is Ok").
2026-08-02 00:45:05 -04:00

126 lines
2.6 KiB
TypeScript

import type { Component } from "vue";
export type NavigationItem = {
prefix: string;
route: string;
label: string;
};
export type QuickActionNav = {
icon: Component;
notifications?: number;
action: () => Promise<void>;
};
export type User = {
id: string;
username: string;
admin: boolean;
displayName: string;
profilePictureObjectId: string;
};
type UmuState = "Installed" | "NotInstalled" | "NotNeeded";
export type AppState = {
status: AppStatus;
umuState: UmuState;
user?: User;
};
export type Game = {
id: string;
type: "Game" | "Executor" | "Redist";
mName: string;
mShortDescription: string;
mDescription: string;
mIconObjectId: string;
mBannerObjectId: string;
mCoverObjectId: string;
mImageLibraryObjectIds: string[];
mImageCarouselObjectIds: string[];
};
export type Collection = {
id: string;
name: string;
isDefault: boolean;
isTools?: boolean;
entries: Array<{ gameId: string; game: Game }>;
};
export type GameVersion = {
userConfiguration: {
launchTemplate: string;
overrideProtonPath: string;
overrideHandler: string | undefined;
enableUpdates: boolean
};
setups: Array<{ platform: string }>;
launches: Array<{ platform: string }>;
};
export enum AppStatus {
NotConfigured = "NotConfigured",
Offline = "Offline",
SignedOut = "SignedOut",
SignedIn = "SignedIn",
SignedInNeedsReauth = "SignedInNeedsReauth",
ServerUnavailable = "ServerUnavailable",
}
export type EmptyGameStatusEnum =
| "Remote"
| "Queued"
| "Downloading"
| "Validating"
| "Updating"
| "Uninstalling"
| "Running";
export enum InstalledType {
PartiallyInstalled = "PartiallyInstalled",
SetupRequired = "SetupRequired",
Installed = "Installed",
}
export interface InstalledGameStatusData {
install_type: { type: InstalledType };
version_id: string;
install_dir: string;
update_available: boolean;
}
export type GameStatus =
| {
type: EmptyGameStatusEnum;
}
| ({
type: "Installed";
} & InstalledGameStatusData);
export type GameStatusEnum = GameStatus["type"];
export type RawGameStatus = [GameStatus | null, GameStatus | null];
export enum DownloadableType {
Game = "Game",
Tool = "Tool",
DLC = "DLC",
Mod = "Mod",
}
export type DownloadableMetadata = {
id: string;
version: string;
downloadType: DownloadableType;
};
export type Settings = {
autostart: boolean;
maxDownloadThreads: number;
forceOffline: boolean;
// Community (session/achievement telemetry + the /community tab) lives on
// this client's own configured Drop server -- no separate URL to store.
enableCommunityTelemetry: boolean;
};