small fixes + improvements

- open link in external browser
- stop app from running after install
- fix lowercase path
- fix bug on file upload
This commit is contained in:
cv
2021-06-14 13:19:45 +02:00
parent 8260a50ed2
commit 9b2bd8ee3c
6 changed files with 22 additions and 9 deletions
+10 -3
View File
@@ -15,6 +15,12 @@ export default function InfoNif() {
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const baseURL = `http://__IP__:${isDev ? 3000 : 4001}`; const baseURL = `http://__IP__:${isDev ? 3000 : 4001}`;
const handleLink = (url) => {
if (window.process.type === 'renderer') {
window.ipcRenderer.send('send-to-link', url);
}
};
return ( return (
<div className={style.container}> <div className={style.container}>
<div className={style.header}> <div className={style.header}>
@@ -33,9 +39,10 @@ export default function InfoNif() {
{data?.networkInterfaces.map((e) => { {data?.networkInterfaces.map((e) => {
return ( return (
<a <a
href={baseURL.replace('__IP__', e.address)} href='/'
target='_blank' onClick={() =>
rel='noreferrer' handleLink(baseURL.replace('__IP__', e.address))
}
className={style.if} className={style.if}
>{`${e.name} - ${e.address}`}</a> >{`${e.name} - ${e.address}`}</a>
); );
-3
View File
@@ -12,9 +12,6 @@ import HelpIconBtn from './buttons/HelpIconBtn';
import UploadIconBtn from './buttons/UploadIconBtn'; import UploadIconBtn from './buttons/UploadIconBtn';
import { useRef } from 'react'; import { useRef } from 'react';
// const { ipcRenderer } = window.require('electron');
// import { ipcRenderer, remote }from 'electron';
export default function MenuBar(props) { export default function MenuBar(props) {
const { onOpen } = props; const { onOpen } = props;
const hiddenFileInput = useRef(null); const hiddenFileInput = useRef(null);
+2
View File
@@ -256,5 +256,7 @@ ipcMain.on('send-to-link', (event, arg) => {
// send to help URL // send to help URL
if (arg === 'help') { if (arg === 'help') {
shell.openExternal('https://cpvalente.gitbook.io/ontime/'); shell.openExternal('https://cpvalente.gitbook.io/ontime/');
} else {
shell.openExternal(arg);
} }
}); });
+1
View File
@@ -55,6 +55,7 @@
"createDesktopShortcut": true, "createDesktopShortcut": true,
"createStartMenuShortcut": true, "createStartMenuShortcut": true,
"deleteAppDataOnUninstall": true, "deleteAppDataOnUninstall": true,
"runAfterFinish": false,
"installerIcon": "icon.ico" "installerIcon": "icon.ico"
}, },
"files": [ "files": [
+1 -1
View File
@@ -29,7 +29,7 @@ export const initiateOSC = (config) => {
if (address !== 'ontime') return; if (address !== 'ontime') return;
// get second part (command) // get second part (command)
switch (path.toLocaleLowerCase()) { switch (path.toLowerCase()) {
case 'start': case 'start':
case 'play': case 'play':
console.log('calling play'); console.log('calling play');
+8 -2
View File
@@ -120,8 +120,14 @@ const upload = async (file, req, res) => {
deleteFile(file); deleteFile(file);
// check version // check version
if (uploadedJson.settings.version === 1) parsev1(uploadedJson); if (uploadedJson.settings.version === 1) {
else { try {
parsev1(uploadedJson);
global.timer.setupWithEventList(db.data.events);
} catch (error) {
res.status(400).send({ message: `Error parsing file: ${error}` });
}
} else {
res.status(400).send({ message: 'Error parsing file, version unknown' }); res.status(400).send({ message: 'Error parsing file, version unknown' });
return; return;
} }