mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-05 15:33:59 +00:00
67ddcd8c68
* feat/table add react-table * feat/table add protected table route * feat/table upgrade dependencies * feat/table support parsing of new properties Co-authored-by: DeepSource Bot <bot@deepsource.io>
31 lines
669 B
JavaScript
31 lines
669 B
JavaScript
/**
|
|
* Returns hostname
|
|
* @type {string}
|
|
*/
|
|
export const host = window?.location?.host;
|
|
|
|
/**
|
|
* Open an external URLs: specifically for a electron / browser case
|
|
* If electron: ask main process to call a new browser window
|
|
* If browser: open in new tab
|
|
* @param url
|
|
*/
|
|
export function openLink(url) {
|
|
if (window.process?.type === 'renderer') {
|
|
window.ipcRenderer.send('send-to-link', url);
|
|
} else {
|
|
window.open(url);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handles opening external links
|
|
* @param event
|
|
* @param location
|
|
*/
|
|
export function handleLinks(event, location) {
|
|
// we handle the link manually
|
|
event.preventDefault();
|
|
openLink(`http://${host}/${location}`);
|
|
}
|