Generate Valve GSI config templates
This commit is contained in:
1 parent
3e6a5695ee
commit
14bb5009c6
4 files changed
+157
No files matched your search
@@ -66,6 +66,11 @@ type ClipDto = {
|
||||
color_class: string;
|
||||
};
|
||||
|
||||
type GsiConfigDto = {
|
||||
game_id: string;
|
||||
path: string;
|
||||
};
|
||||
|
||||
type AppState = {
|
||||
activeView: "Library" | "Recording" | "Auto Clip" | "Uploads" | "Settings";
|
||||
recordingState: RecordingState;
|
||||
@@ -82,6 +87,7 @@ type AppState = {
|
||||
uploadProvider: "catbox" | "litterbox" | "custom_http" | "lustful";
|
||||
customUploadEndpoint: string;
|
||||
customUploadResponsePath: string;
|
||||
gsiConfigStatus: string;
|
||||
selectedClipId: string;
|
||||
clips: Clip[];
|
||||
autoEvents: AutoEvent[];
|
||||
@@ -118,6 +124,7 @@ const state: AppState = {
|
||||
uploadProvider: "catbox",
|
||||
customUploadEndpoint: "",
|
||||
customUploadResponsePath: "url",
|
||||
gsiConfigStatus: "",
|
||||
selectedClipId: "clip-1",
|
||||
clips: [
|
||||
{
|
||||
@@ -403,6 +410,10 @@ function renderAutoClipView() {
|
||||
)
|
||||
.join("")}
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button data-action="write-gsi-configs">Write GSI Configs</button>
|
||||
</div>
|
||||
${state.gsiConfigStatus ? `<p class="muted file-path">${state.gsiConfigStatus}</p>` : ""}
|
||||
</section>
|
||||
`;
|
||||
}
|
||||
@@ -493,6 +504,10 @@ function bindEvents() {
|
||||
void uploadSelectedClip();
|
||||
});
|
||||
|
||||
appRoot.querySelector<HTMLButtonElement>("[data-action='write-gsi-configs']")?.addEventListener("click", () => {
|
||||
void writeGsiConfigs();
|
||||
});
|
||||
|
||||
appRoot.querySelector<HTMLButtonElement>("[data-action='delete']")?.addEventListener("click", () => {
|
||||
void deleteSelectedClip();
|
||||
});
|
||||
@@ -677,6 +692,21 @@ async function uploadSelectedClip() {
|
||||
}
|
||||
}
|
||||
|
||||
async function writeGsiConfigs() {
|
||||
if (!tauriInvoke) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const configs = await tauriInvoke<GsiConfigDto[]>("write_gsi_configs");
|
||||
state.gsiConfigStatus = configs.map((config) => `${config.game_id}: ${config.path}`).join(" · ");
|
||||
render();
|
||||
} catch (error) {
|
||||
state.gsiConfigStatus = `Could not write GSI configs: ${String(error)}`;
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteSelectedClip() {
|
||||
if (!tauriInvoke || !state.selectedClipId) {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user