Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with crashing in desktop mode #91

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,62 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install Dependencies
run: npm install
- name: build
run: npm run build
- name: copy files into build
run: pnpm install

- name: Build frontend
run: pnpm run build

- name: Download Decky Plugin CLI
run: |
cp plugin.json ./dist/
mkdir ./dist/dist
mv ./dist/index.js ./dist/dist/
mkdir $(pwd)/cli
curl -L -o $(pwd)/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-x86_64"
chmod +x $(pwd)/cli/decky

- name: Build plugin
run: |
$(pwd)/cli/decky plugin build $(pwd)
unzip "out/Game Theme Music.zip" -d "out/Game Theme Music"

- name: Upload package
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SDH-GameThemeMusic
path: |
./dist/*
./out/Game Theme Music/*

release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: SDH-GameThemeMusic
path: SDH-GameThemeMusic

- name: zip/tar release
run: |
zip -r SDH-GameThemeMusic.zip SDH-GameThemeMusic/*
tar -czvf SDH-GameThemeMusic.tar.gz SDH-GameThemeMusic

- name: Create a release
uses: ncipollo/release-action@v1
with:
artifacts: 'SDH-GameThemeMusic.zip,SDH-GameThemeMusic.tar.gz'
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Game Theme Music",
"author": "OMGDuke",
"flags": [],
"api_version": 2,
"api_version": 1,
"publish": {
"tags": ["audio"],
"description": "Play theme songs on your game pages",
Expand Down
13 changes: 9 additions & 4 deletions src/lib/patchContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ const contextMenuPatch = (LibraryContextMenu: any) => {
component.type.prototype,
'shouldComponentUpdate',
([nextProps]: any, shouldUpdate: any) => {
const gtmIdx = nextProps.children.findIndex(
(x: any) => x?.key === 'game-theme-music-change-music'
)
if (gtmIdx != -1) nextProps.children.splice(gtmIdx, 1)
try {
const gtmIdx = nextProps.children.findIndex(
(x: any) => x?.key === 'game-theme-music-change-music'
)
if (gtmIdx != -1) nextProps.children.splice(gtmIdx, 1)
}
catch (e) {
return component;
}

if (shouldUpdate === true) {
let updatedAppid: number = appid
Expand Down