not always decompress

This commit is contained in:
Trit0 2025-07-12 21:01:15 -04:00
parent 3161bbbba1
commit c704b72a03
6 changed files with 42 additions and 67 deletions

View File

@ -67,8 +67,8 @@ onMounted(async () => {
// Create the gradient background style
const backgroundStyle = computed(() => {
const primary = selectedGame?.value?.color_scheme?.primary ?? "#4d97f8";
const secondary = selectedGame?.value?.color_scheme?.secondary ?? "#100a7d";
const primary = selectedGame?.value?.colorScheme?.primary ?? "#4d97f8";
const secondary = selectedGame?.value?.colorScheme?.secondary ?? "#100a7d";
const backgroundImage = `linear-gradient(135deg, ${primary}, ${secondary})`;
// const backgroundImage = !!bgImage ? `url(${bgImage})` : `linear-gradient(135deg, ${primary}, ${secondary})`;

View File

@ -7,7 +7,7 @@
]"
>
<LocalImage
:src="game.thumbnail_path"
:src="game.thumbnailPath"
class="h-32 w-48 object-cover"
:alt="game.title"
:gameId="game.id"

View File

@ -1,7 +1,7 @@
<template>
<div class="p-6 h-full w-full overflow-auto flex flex-col items-center">
<div v-if="game" class="space-y-4 flex flex-col items-center w-full max-w-400">
<img v-if="game.logo_path" :src="game.logo_path" :alt="game.title" class="h-72"/>
<img v-if="game.logoPath" :src="game.logoPath" :alt="game.title" class="h-72"/>
<h1 v-else class="text-4xl font-bold">{{ game.title }}</h1>
<!-- Actual carousel pls -->
@ -18,7 +18,7 @@
<div class="flex justify-between w-full space-y-1">
<ImageCarousel :gameId="game.id"
:links="game.media_paths"
:links="game.mediaPaths"
class="basis-1/4"
/>
<!-- <LocalImage-->
@ -56,8 +56,8 @@
<div
v-for="(link, name) in {
Repo: game?.public_repository_link ?? undefined,
Itch: game.itch_link
Repo: game?.publicRepositoryLink,
Itch: game?.itchLink
}">
<button
v-if="link"
@ -93,7 +93,6 @@
<script setup lang="ts">
import { models } from "../../wailsjs/go/models";
import Game = models.Game;
import LocalImage from "./LocalImage.vue";
import { computed } from "vue";
import DevCard from "./DevCard.vue";
import { useAppStore } from "../stores/app-store";
@ -106,8 +105,8 @@ const props = defineProps<{
}>();
const buttonStyle = computed(() => {
const ternary = props.game?.color_scheme?.ternary ?? "#ffffff";
const secondary = props.game?.color_scheme?.primary ?? "#100a99";
const ternary = props.game?.colorScheme?.ternary ?? "#ffffff";
const secondary = props.game?.colorScheme?.primary ?? "#100a99";
return {
backgroundColor: secondary,

View File

@ -44,18 +44,18 @@ export namespace models {
players: string;
release: string;
modification: string;
public_repository_link: string;
itch_link: string;
publicRepositoryLink: string;
itchLink: string;
genres: string;
collections: string;
executable: string;
thumbnail_path: string;
logo_path: string;
thumbnailPath: string;
logoPath: string;
backgroundImagePath: string;
media_paths: string[];
audio_path: string;
mediaPaths: string[];
audioPath: string;
developers: Developer[];
color_scheme: ColorScheme;
colorScheme: ColorScheme;
static createFrom(source: any = {}) {
return new Game(source);
@ -70,18 +70,18 @@ export namespace models {
this.players = source["players"];
this.release = source["release"];
this.modification = source["modification"];
this.public_repository_link = source["public_repository_link"];
this.itch_link = source["itch_link"];
this.publicRepositoryLink = source["publicRepositoryLink"];
this.itchLink = source["itchLink"];
this.genres = source["genres"];
this.collections = source["collections"];
this.executable = source["executable"];
this.thumbnail_path = source["thumbnail_path"];
this.logo_path = source["logo_path"];
this.thumbnailPath = source["thumbnailPath"];
this.logoPath = source["logoPath"];
this.backgroundImagePath = source["backgroundImagePath"];
this.media_paths = source["media_paths"];
this.audio_path = source["audio_path"];
this.mediaPaths = source["mediaPaths"];
this.audioPath = source["audioPath"];
this.developers = this.convertValues(source["developers"], Developer);
this.color_scheme = this.convertValues(source["color_scheme"], ColorScheme);
this.colorScheme = this.convertValues(source["colorScheme"], ColorScheme);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {

View File

@ -26,18 +26,18 @@ type Game struct {
Players string `json:"players"`
Release string `json:"release"`
Modification string `json:"modification"`
PublicRepositoryLink string `json:"public_repository_link"`
ItchLink string `json:"itch_link"`
PublicRepositoryLink string `json:"publicRepositoryLink"`
ItchLink string `json:"itchLink"`
Genres string `json:"genres"`
Collections string `json:"collections"`
Executable string `json:"executable"`
ThumbnailPath string `json:"thumbnail_path"`
LogoPath string `json:"logo_path"`
BackgroundImagePath string `json:"backgroundImagePath"`
MediaPaths []string `json:"media_paths"`
AudioPath string `json:"audio_path"`
ThumbnailPath string `json:"thumbnailPath"`
LogoPath string `json:"logoPath"`
BackgroundImagePath string `json:"backgroundImagePath"`
MediaPaths []string `json:"mediaPaths"`
AudioPath string `json:"audioPath"`
Developers []Developer `json:"developers"`
ColorScheme ColorScheme `json:"color_scheme"`
ColorScheme ColorScheme `json:"colorScheme"`
}
type Developer struct {

View File

@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/fs"
"log"
"net/http"
"net/url"
@ -181,7 +180,6 @@ func ExtractGame(game models.Metadata) string {
}
func GetConjureGameInfo() []models.Metadata {
gamePath := config.GetDefaultConjureGamesDirectory()
entries, err := os.ReadDir(gamePath)
@ -196,11 +194,18 @@ func GetConjureGameInfo() []models.Metadata {
continue
} else if filepath.Ext(e.Name()) == ".conj" {
conjPath := filepath.Join(gamePath, e.Name())
err = extractZipToSiblingFolder(conjPath)
check(err)
conjBase := strings.TrimSuffix(conjPath, ".conj")
// Check if the destination folder already exists
if _, err := os.Stat(conjBase); os.IsNotExist(err) {
err = extractZipToSiblingFolder(conjPath)
check(err)
}
// Now read metadata from the extracted directory
entries, err := os.ReadDir(conjBase)
check(err)
fmt.Println("Contents of", conjPath)
for _, f := range entries {
if f.Name() == "metadata.txt" {
@ -210,18 +215,17 @@ func GetConjureGameInfo() []models.Metadata {
fmt.Println("Contents of metadata.txt:")
metadata, err := io.ReadAll(rc)
check(err)
game := parseGameInfo([]byte(escapeBackslashes(string(metadata))))
fmt.Println(game.ThumbnailPath)
games = append(games, game)
check(err)
}
}
}
}
if len(games) > 0 {
fmt.Println("Found Conjure Games: " + string(rune(len(games))))
fmt.Println("Found Conjure Games:", len(games))
} else {
fmt.Println("No Conjure games Found")
}
@ -246,34 +250,6 @@ func printIndentedPath(path string) {
}
}
func readFolder(entry fs.DirEntry, path string) []models.Metadata {
newPath := path + "/" + entry.Name()
entries, err := os.ReadDir(newPath)
check(err)
var games []models.Metadata
for _, e := range entries {
if e.IsDir() {
games = append(games, readFolder(e, newPath)...)
} else {
filenamesplit := strings.Split(e.Name(), ".")
if filenamesplit[1] == "conf" && filenamesplit[2] == "yml" {
game := parseGameInfoFromFile(newPath + "/" + e.Name())
games = append(games, game)
}
}
}
return games
}
func parseGameInfoFromFile(path string) models.Metadata {
data, err := os.ReadFile(path)
check(err)
return parseGameInfo(data)
}
func parseGameInfo(data []byte) models.Metadata {
game := models.Metadata{}
err := yaml.Unmarshal(data, &game)