ci: add desktop files

This commit is contained in:
2024-10-22 03:22:52 +03:00
parent f3126c6d5e
commit 76b6fb3da6
7 changed files with 82 additions and 12 deletions

View File

@@ -23,7 +23,7 @@ jobs:
submodules: 'recursive'
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
manifest-path: dev.casraf.StimVisor.yml
manifest-path: flatpak/dev.casraf.StimVisor.yml
cache-key: flatpak-builder-${{ github.sha }}
bundle: StimVisor.flatpak
# - name: "Add to release"

33
build/appicon.svg Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 2048 2048" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<rect id="appicon" x="0" y="0" width="2048" height="2048" style="fill:none;"/>
<g id="appicon1" serif:id="appicon">
<g transform="matrix(1,0,0,1,24,21.1781)">
<path d="M1860,572.822L1860,1432.82C1860,1670.14 1667.32,1862.82 1430,1862.82L570,1862.82C332.677,1862.82 140,1670.14 140,1432.82L140,572.822C140,335.498 332.677,142.822 570,142.822L1430,142.822C1667.32,142.822 1860,335.498 1860,572.822Z" style="fill:url(#_Linear1);"/>
</g>
<g transform="matrix(1.35152,0,0,1.35152,-327.524,-148.677)">
<path d="M1048.31,860.864C1090.51,842.262 1120,800.048 1120,751C1120,704.11 1093.05,663.466 1053.8,643.727C1061.66,639.576 1071.4,637.955 1080,636.567C1128.52,628.74 1300,660.899 1300,660.899C1037.21,767.469 1140.85,948.948 1120,940C1099.15,931.052 1060,880 1060,880C1055.73,873.503 1051.84,867.124 1048.31,860.864Z" style="fill:white;"/>
<g transform="matrix(-1,0,0,1,1998.31,0)">
<path d="M1048.31,860.864C1090.51,842.262 1120,800.048 1120,751C1120,704.11 1093.05,663.466 1053.8,643.727C1061.66,639.576 1071.4,637.955 1080,636.567C1128.52,628.74 1300,660.899 1300,660.899C1037.21,767.469 1140.85,948.948 1120,940C1099.15,931.052 1060,880 1060,880C1055.73,873.503 1051.84,867.124 1048.31,860.864Z" style="fill:white;"/>
</g>
<g transform="matrix(1,0,0,1,20,0)">
<path d="M660,660C781.421,660 880,758.579 880,880C880,1001.42 781.421,1100 660,1100C538.579,1100 440,1001.42 440,880C440,758.579 538.579,660 660,660ZM660,730C577.213,730 510,797.213 510,880C510,962.787 577.213,1030 660,1030C742.787,1030 810,962.787 810,880C810,797.213 742.787,730 660,730ZM660,767C722.366,767 773,817.634 773,880C773,942.366 722.366,993 660,993C597.634,993 547,942.366 547,880C547,817.634 597.634,767 660,767Z" style="fill:white;"/>
</g>
<g transform="matrix(1,0,0,1,660,0)">
<path d="M660,660C781.421,660 880,758.579 880,880C880,1001.42 781.421,1100 660,1100C538.579,1100 440,1001.42 440,880C440,758.579 538.579,660 660,660ZM660,730C577.213,730 510,797.213 510,880C510,962.787 577.213,1030 660,1030C742.787,1030 810,962.787 810,880C810,797.213 742.787,730 660,730ZM660,767C722.366,767 773,817.634 773,880C773,942.366 722.366,993 660,993C597.634,993 547,942.366 547,880C547,817.634 597.634,767 660,767Z" style="fill:white;"/>
</g>
<g>
<g transform="matrix(1.03093,0,0,1.04124,-30.9278,-26.8041)">
<path d="M1000,650C1053.54,650 1097,693.464 1097,747C1097,800.536 1053.54,844 1000,844C946.464,844 903,800.536 903,747C903,693.464 946.464,650 1000,650ZM1000,694.178C970.555,694.178 946.65,717.847 946.65,747C946.65,776.153 970.555,799.822 1000,799.822C1029.44,799.822 1053.35,776.153 1053.35,747C1053.35,717.847 1029.44,694.178 1000,694.178Z" style="fill:white;"/>
</g>
<g transform="matrix(0.316423,0,0,0.319588,683.577,512.268)">
<circle cx="1000" cy="747" r="97" style="fill:white;"/>
</g>
</g>
</g>
</g>
<defs>
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1720,0,0,1720,140,1002.82)"><stop offset="0" style="stop-color:rgb(12,23,64);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(20,32,74);stop-opacity:1"/></linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -15,9 +15,11 @@ const (
LINUX_STEAM_DIR = "%s/.steam/steam"
)
const (
SYNC_APP_ID = 760
)
var STEAM_INTERNAL_IDS = []string{
"7", // Steam Config
"760", // Steam Cloud - Screenshots
"241100", // Steam Controller Config
}
// GetSteamDirectory returns the Steam directory path based on the operating system.
func GetSteamDirectory() (string, error) {
@@ -74,8 +76,6 @@ func GetSyncDirectory() (string, error) {
return fmt.Sprintf("%s/760", userDir), nil
}
var STEAM_INTERNAL_IDS = []string{"7", "760"}
// GetUsersDirectories returns a list of directories for all Steam users.
func GetUsersDirectories() ([]string, error) {
steamDir, err := GetSteamDirectory()

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2024 Chen Asraf <contact@casraf.dev> -->
<component type="desktop">
<id>dev.casraf.StimVisor</id>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<name>StimVisor</name>
<summary>A Steam library manager for screenshots, screen captures, save data and more.</summary>
<description>
<ul>
<li>Manage, export and share screenshots or screen captures.</li>
<li>View game information and manage your installation.</li>
<li>Manage your game save data.</li>
</ul>
</description>
<categories>
<category>Utility</category>
</categories>
<url type="homepage">https://github.com/chenasraf/stimvisor</url>
<update_contact>contact_at_casraf_dot_dev</update_contact>
</component>

View File

@@ -0,0 +1,4 @@
[Desktop Entry]
Name=StimVisor
Type=Application
Exec=/app/bin/stimvisor

View File

@@ -53,7 +53,17 @@ modules:
buildsystem: simple
sources:
- type: dir
path: .
path: ../
build-commands:
- PATH=$PATH:$GOROOT/bin:$NODEROOT/bin:$GOBIN wails build -ldflags="-X main.Version=0.0.1 -X main.Build=$(date +%FT%T%z)"
- install -Dm755 build/bin/stimvisor $FLATPAK_DEST/bin/stimvisor
- desktop-file-edit --set-icon=$FLATPAK_ID flatpak/$FLATPAK_ID.desktop
- install -Dm644 build/appicon.svg /app/share/icons/hicolor/scalable/apps/$FLATPAK_ID.svg
- >
for size in {32,64,128,256}; do
rsvg-convert build/appicon.svg -w "$size" -h "$size" -a -f png -o "$size.png";
install -Dm644 "$size.png" "/app/share/icons/hicolor/${size}x${size}/apps/$FLATPAK_ID.png";
done
- install -Dm00644 flatpak/$FLATPAK_ID.desktop $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
- install -Dm00644 flatpak/$FLATPAK_ID.appdata.xml $FLATPAK_DEST/share/appdata/$FLATPAK_ID.appdata.xml

View File

@@ -68,16 +68,12 @@ const STEAM_API_URL = "https://store.steampowered.com/api/appdetails?appids=%s"
func FetchGameInfo(gameId string) (map[string]interface{}, error) {
cachePath := filepath.Join(GetGameInfoCacheDir(), gameId+".json")
url := fmt.Sprintf(STEAM_API_URL, gameId)
fmt.Printf("Fetching game info for %s from %s", gameId, url)
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
cacheFile, err := os.Create(cachePath)
if err != nil {
panic(err)
}
defer cacheFile.Close()
respBytes, err := io.ReadAll(resp.Body)
respJson := make(map[string]interface{})
@@ -92,6 +88,12 @@ func FetchGameInfo(gameId string) (map[string]interface{}, error) {
respGameData := respGame["data"].(map[string]interface{})
partBytes, _ := json.Marshal(respGameData)
cacheFile, err := os.Create(cachePath)
if err != nil {
panic(err)
}
defer cacheFile.Close()
cacheFile.WriteString(string(partBytes))
return respGameData, nil