mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
add buttons in electron to show rns config and meshchat database files in containing folder
This commit is contained in:
parent
5c4d342d78
commit
b7f4123946
3 changed files with 43 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
const { app, BrowserWindow, dialog, ipcMain, systemPreferences } = require('electron');
|
||||
const { app, BrowserWindow, dialog, ipcMain, shell, systemPreferences } = require('electron');
|
||||
const electronPrompt = require('electron-prompt');
|
||||
const { spawn } = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
|
@ -11,7 +11,7 @@ var mainWindow = null;
|
|||
var exeChildProcess = null;
|
||||
|
||||
// allow fetching app version via ipc
|
||||
ipcMain.handle('app-version', async() => {
|
||||
ipcMain.handle('app-version', () => {
|
||||
return app.getVersion();
|
||||
});
|
||||
|
||||
|
|
@ -36,11 +36,16 @@ ipcMain.handle('prompt', async(event, message) => {
|
|||
});
|
||||
|
||||
// allow relaunching app via ipc
|
||||
ipcMain.handle('relaunch', async() => {
|
||||
ipcMain.handle('relaunch', () => {
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
|
||||
// allow showing a file path in os file manager
|
||||
ipcMain.handle('showPathInFolder', (event, path) => {
|
||||
shell.showItemInFolder(path);
|
||||
});
|
||||
|
||||
function log(message) {
|
||||
|
||||
// make sure main window exists
|
||||
|
|
|
|||
|
|
@ -25,4 +25,9 @@ contextBridge.exposeInMainWorld('electron', {
|
|||
return await ipcRenderer.invoke('relaunch');
|
||||
},
|
||||
|
||||
// allow showing a file path in os file manager
|
||||
showPathInFolder: async function(path) {
|
||||
return await ipcRenderer.invoke('showPathInFolder', path);
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1298,13 +1298,27 @@
|
|||
<div>Version</div>
|
||||
<div class="text-sm text-gray-700">v{{ appInfo.version }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Reticulum Config Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.reticulum_config_path }}</div>
|
||||
<div class="flex p-1">
|
||||
<div class="mr-auto">
|
||||
<div>Reticulum Config Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.reticulum_config_path }}</div>
|
||||
</div>
|
||||
<div v-if="isElectron" class="mx-2 my-auto">
|
||||
<button @click="showReticulumConfigFile" type="button" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500">
|
||||
Show in Folder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Database Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.database_path }}</div>
|
||||
<div class="flex p-1">
|
||||
<div class="mr-auto">
|
||||
<div>Database Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.database_path }}</div>
|
||||
</div>
|
||||
<div v-if="isElectron" class="mx-2 my-auto">
|
||||
<button @click="showDatabaseFile" type="button" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500">
|
||||
Show in Folder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Database File Size</div>
|
||||
|
|
@ -3136,6 +3150,16 @@
|
|||
window.electron.relaunch();
|
||||
}
|
||||
},
|
||||
showReticulumConfigFile() {
|
||||
if(window.electron && this.appInfo.reticulum_config_path){
|
||||
window.electron.showPathInFolder(this.appInfo.reticulum_config_path);
|
||||
}
|
||||
},
|
||||
showDatabaseFile() {
|
||||
if(window.electron && this.appInfo.database_path){
|
||||
window.electron.showPathInFolder(this.appInfo.database_path);
|
||||
}
|
||||
},
|
||||
isInterfaceEnabled: function(iface) {
|
||||
const rawValue = iface.enabled ?? iface.interface_enabled;
|
||||
const value = rawValue?.toLowerCase();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue