Skip to content

Commit f36f946

Browse files
authored
Merge pull request #638 from 4gray/ci-add-github-actions-ui-fixes
ci-add-github-actions-ui-fixes
2 parents 68ab822 + 4c6ee1b commit f36f946

29 files changed

+23051
-889
lines changed

.coderabbit.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Minimal configuration for getting started
2-
language: "en-US"
2+
language: 'en-US'
33

44
reviews:
5-
profile: "chill"
6-
high_level_summary: true
5+
profile: 'chill'
6+
high_level_summary: true
77
auto_review:
8-
enabled: true
9-
drafts: false
8+
enabled: true
9+
drafts: false
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Build and Make Electron App
2+
3+
on:
4+
push:
5+
branches:
6+
- nx
7+
# - master # Uncomment this when ready to run on master branch
8+
tags:
9+
- 'v*.*.*'
10+
pull_request:
11+
branches:
12+
- nx
13+
# - master # Uncomment this when ready to run on master branch
14+
workflow_dispatch:
15+
16+
jobs:
17+
build:
18+
name: Build on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
20+
timeout-minutes: 60
21+
strategy:
22+
matrix:
23+
os: [macos-latest, ubuntu-latest, windows-latest]
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v4
31+
with:
32+
version: 10
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '22'
38+
cache: 'pnpm'
39+
40+
- name: Install dependencies
41+
run: pnpm install --no-frozen-lockfile
42+
43+
- name: Build frontend
44+
run: npm run build:frontend
45+
46+
- name: Build backend
47+
run: npm run build:backend
48+
49+
- name: Make Electron app
50+
run: npm run make:app
51+
52+
- name: Upload artifacts (macOS)
53+
if: matrix.os == 'macos-latest'
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: macos-artifacts
57+
path: |
58+
dist/executables/**/*.dmg
59+
dist/executables/**/*.zip
60+
retention-days: 7
61+
62+
- name: Upload artifacts (Linux)
63+
if: matrix.os == 'ubuntu-latest'
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: linux-artifacts
67+
path: |
68+
dist/executables/**/*.deb
69+
dist/executables/**/*.rpm
70+
dist/executables/**/*.snap
71+
dist/executables/**/*.AppImage
72+
dist/executables/**/*.tar.gz
73+
retention-days: 7
74+
75+
- name: Upload artifacts (Windows)
76+
if: matrix.os == 'windows-latest'
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: windows-artifacts
80+
path: |
81+
dist/executables/**/*.exe
82+
dist/executables/**/*.msi
83+
dist/executables/**/*.zip
84+
retention-days: 7
85+
86+
create-release:
87+
name: Create Draft Release
88+
needs: build
89+
runs-on: ubuntu-latest
90+
permissions:
91+
contents: write
92+
93+
steps:
94+
- name: Checkout code
95+
uses: actions/checkout@v4
96+
97+
- name: Download all artifacts
98+
uses: actions/download-artifact@v4
99+
with:
100+
path: artifacts
101+
102+
- name: Display structure of downloaded files
103+
run: ls -R artifacts
104+
105+
- name: Get version from package.json
106+
id: package-version
107+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
108+
109+
- name: Create Draft Release
110+
uses: softprops/action-gh-release@v2
111+
with:
112+
draft: true
113+
prerelease: false
114+
name: Release v${{ steps.package-version.outputs.version }}
115+
tag_name: ${{ github.ref_name }}
116+
generate_release_notes: true
117+
files: |
118+
artifacts/**/*
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

apps/electron-backend/src/app/api/main.preload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ contextBridge.exposeInMainWorld('electron', {
88
updatePlaylistFromFilePath: (filePath: string, title: string) =>
99
ipcRenderer.invoke('update-playlist-from-file-path', filePath, title),
1010
openPlaylistFromFile: () => ipcRenderer.invoke('open-playlist-from-file'),
11+
saveFileDialog: (defaultPath: string, filters?: { name: string; extensions: string[] }[]) =>
12+
ipcRenderer.invoke('save-file-dialog', defaultPath, filters),
13+
writeFile: (filePath: string, content: string) =>
14+
ipcRenderer.invoke('write-file', filePath, content),
1115
setUserAgent: (userAgent: string, referer?: string) =>
1216
ipcRenderer.invoke('set-user-agent', userAgent, referer),
1317
openInMpv: (

apps/electron-backend/src/app/events/playlist.events.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import axios from 'axios';
77
import { dialog, ipcMain } from 'electron';
88
import { parse } from 'iptv-playlist-parser';
99
import { createPlaylistObject, getFilenameFromUrl } from 'm3u-utils';
10-
import { readFile } from 'node:fs/promises';
10+
import { readFile, writeFile } from 'node:fs/promises';
1111
import { AUTO_UPDATE_PLAYLISTS } from 'shared-interfaces';
1212

1313
export default class PlaylistEvents {
@@ -102,3 +102,33 @@ ipcMain.handle(AUTO_UPDATE_PLAYLISTS, async (event, playlistUrls) => {
102102
console.log(`Auto-updating playlist from ${url}`);
103103
}
104104
});
105+
106+
ipcMain.handle('save-file-dialog', async (event, defaultPath, filters) => {
107+
try {
108+
const { canceled, filePath } = await dialog.showSaveDialog({
109+
defaultPath,
110+
filters: filters || [
111+
{ name: 'All Files', extensions: ['*'] },
112+
],
113+
});
114+
115+
if (canceled || !filePath) {
116+
return null;
117+
}
118+
119+
return filePath;
120+
} catch (error) {
121+
console.error('Error showing save dialog:', error);
122+
throw error;
123+
}
124+
});
125+
126+
ipcMain.handle('write-file', async (event, filePath, content) => {
127+
try {
128+
await writeFile(filePath, content, 'utf-8');
129+
return { success: true };
130+
} catch (error) {
131+
console.error('Error writing file:', error);
132+
throw error;
133+
}
134+
});

apps/electron-backend/src/app/events/setttings.events.ts renamed to apps/electron-backend/src/app/events/settings.events.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { ipcMain } from 'electron';
22
import {
3-
MPV_PLAYER_PATH,
43
MPV_REUSE_INSTANCE,
54
store,
65
} from '../services/store.service';
@@ -13,5 +12,9 @@ export default class SettingsEvents {
1312

1413
ipcMain.handle('SETTINGS_UPDATE', (_event, arg) => {
1514
console.log('Received SETTINGS_UPDATE with data:', arg);
16-
store.set(MPV_REUSE_INSTANCE, arg.mpvReuseInstance);
15+
16+
// Only set values that are defined
17+
if (arg.mpvReuseInstance !== undefined) {
18+
store.set(MPV_REUSE_INSTANCE, arg.mpvReuseInstance);
19+
}
1720
});

apps/electron-backend/src/app/services/store.service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Store from 'electron-store';
1+
import { Conf } from 'electron-conf/main';
22

33
export const WINDOW_BOUNDS = 'WINDOW_BOUNDS';
44
export const MPV_PLAYER_PATH = 'MPV_PLAYER_PATH';
@@ -12,8 +12,5 @@ export type StoreType = {
1212
[MPV_REUSE_INSTANCE]: boolean;
1313
};
1414

15-
// Initialize renderer support
16-
Store.initRenderer();
17-
1815
// Export singleton store instance
19-
export const store = new Store<StoreType>();
16+
export const store = new Conf<StoreType>();

apps/electron-backend/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ElectronEvents from './app/events/electron.events';
77
import EpgEvents from './app/events/epg.events';
88
import PlayerEvents from './app/events/player.events';
99
import PlaylistEvents from './app/events/playlist.events';
10-
import SettingsEvents from './app/events/setttings.events';
10+
import SettingsEvents from './app/events/settings.events';
1111
import SharedEvents from './app/events/shared.events';
1212
import SquirrelEvents from './app/events/squirrel.events';
1313
import StalkerEvents from './app/events/stalker.events';

apps/web/src/app/app.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Language,
1414
OPEN_FILE,
1515
Settings,
16-
SETTINGS_UPDATE,
1716
STORE_KEY,
1817
Theme,
1918
VIEW_ADD_PLAYLIST,
@@ -120,13 +119,12 @@ export class AppComponent implements OnInit, OnDestroy {
120119
.getValueFromLocalStorage(STORE_KEY.Settings)
121120
.subscribe((settings: Settings) => {
122121
if (settings && Object.keys(settings).length > 0) {
123-
// Send settings to Electron main process
124-
if (window.electron) {
125-
window.electron.updateSettings(settings);
126-
}
127-
122+
// No need to send settings to Electron on init
123+
// Settings are stored in IndexedDB and loaded by the settings store
124+
// Only specific Electron settings (MPV/VLC paths) are sent when changed in settings component
125+
128126
this.translate.use(settings.language ?? this.DEFAULT_LANG);
129-
127+
130128
// Fetch EPG if URLs are configured
131129
if (
132130
window.electron &&

apps/web/src/app/settings/settings.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,20 @@ export class SettingsComponent implements OnInit {
252252
onSubmit(): void {
253253
this.settingsStore.updateSettings(this.settingsForm.value).then(() => {
254254
this.applyChangedSettings();
255-
255+
256256
if (window.electron) {
257257
window.electron.updateSettings(this.settingsForm.value);
258-
258+
259259
// Set player paths if using external players
260260
if (this.settingsForm.value.mpvPlayerPath) {
261-
window.electron.setMpvPlayerPath(this.settingsForm.value.mpvPlayerPath);
261+
window.electron.setMpvPlayerPath(
262+
this.settingsForm.value.mpvPlayerPath
263+
);
262264
}
263265
if (this.settingsForm.value.vlcPlayerPath) {
264-
window.electron.setVlcPlayerPath(this.settingsForm.value.vlcPlayerPath);
266+
window.electron.setVlcPlayerPath(
267+
this.settingsForm.value.vlcPlayerPath
268+
);
265269
}
266270
}
267271
});

apps/web/src/app/shared/components/mpv-player-bar/mpv-player-bar.component.html

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@if ((activeProcesses$ | async)?.length) {
1+
<!-- @if ((activeProcesses$ | async)?.length) {
22
<div class="mpv-player-bar">
33
@for (process of activeProcesses$ | async; track process.id) {
44
<div class="player-item">
@@ -24,20 +24,6 @@
2424
</div>
2525
</div>
2626
<div class="player-controls">
27-
<!-- <button
28-
mat-icon-button
29-
(click)="pauseStream(process.id)"
30-
title="Pause"
31-
>
32-
<mat-icon>pause</mat-icon>
33-
</button>
34-
<button
35-
mat-icon-button
36-
(click)="playStream(process.id)"
37-
title="Play"
38-
>
39-
<mat-icon>play_arrow</mat-icon>
40-
</button> -->
4127
<button
4228
mat-icon-button
4329
(click)="closeStream(process.id)"
@@ -50,3 +36,4 @@
5036
}
5137
</div>
5238
}
39+
-->

0 commit comments

Comments
 (0)