Skip to content

Commit

Permalink
Add version number in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
RuurdBijlsma committed Nov 12, 2023
1 parent c129a32 commit d6c4008
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ruurd-music",
"version": "6.5.0",
"version": "6.5.1",
"description": "A streaming music player",
"main": "./out/main/index.js",
"keywords": [
Expand Down
4 changes: 4 additions & 0 deletions src/main/NodeFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,8 @@ export default class NodeFunctions {
return false;
}
}

getAppVersion(){
return app.getVersion();
}
}
1 change: 1 addition & 0 deletions src/main/ipcFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function handleIpc(ipcMain: Electron.IpcMain, win: BrowserWindow) {
ipcMain.handle("getFileContents", (_, file: string) =>
nf.getFileContents(file),
);
ipcMain.handle("getAppVersion", (_) => nf.getAppVersion());

ipcMain.handle(
"firstLogin",
Expand Down
3 changes: 2 additions & 1 deletion src/preload/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ declare global {
updateYtdlp: () => Promise<string>,
checkTracksDownloaded: (filenames: string[]) => Promise<boolean>,
saveStringToFile: (file: string, contents: string) => Promise<boolean>,
getFileContents: (file: string) => Promise<string|null>,
getFileContents: (file: string) => Promise<string | null>,
getAppVersion: () => Promise<string>,

fileSize: (file: string) => Promise<number>,
checkFileExists: (filename: string) => Promise<any>,
Expand Down
3 changes: 1 addition & 2 deletions src/preload/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { contextBridge, ipcRenderer } from "electron";
import { electronAPI } from "@electron-toolkit/preload";

// Custom APIs for renderer
const api = {
Expand Down Expand Up @@ -58,6 +57,7 @@ const api = {
secret: string;
}) => ipcRenderer.invoke("firstLogin", spotifyAuth),
resetSpotifyLogin: () => ipcRenderer.invoke("resetSpotifyLogin"),
getAppVersion: () => ipcRenderer.invoke("getAppVersion"),

minimizeWindow: () => ipcRenderer.send("win:invoke", "min"),
toggleMaximize: () => ipcRenderer.send("win:invoke", "max"),
Expand Down Expand Up @@ -100,7 +100,6 @@ ipcRenderer.on(

if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld("electron", electronAPI);
contextBridge.exposeInMainWorld("api", api);
contextBridge.exposeInMainWorld("events", events);
} catch (error) {
Expand Down
17 changes: 17 additions & 0 deletions src/renderer/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@
>
{{ updateResult }}
</v-sheet>

<div class="version-string mt-10">
<span class="mr-2">Ruurd Music</span><span class="bold-version">v{{ appVersion }}</span>
</div>
</div>
</template>

Expand All @@ -187,6 +191,8 @@ const platform = usePlatformStore();
const base = useBaseStore();
const ruurdAuth = useRuurdAuthStore();
const ui = useUIStore();
const appVersion = ref("");
window.api.getAppVersion().then((r) => (appVersion.value = r));
const updateLoading = ref(false);
const updateResult = ref("");
Expand Down Expand Up @@ -292,4 +298,15 @@ h5 {
.file-buttons > * {
flex-grow: 1;
}
.version-string {
display: flex;
justify-content: center;
align-items: center;
opacity: 0.6;
font-weight: 300;
}
.bold-version{
font-weight: 500;
}
</style>

0 comments on commit d6c4008

Please sign in to comment.