2
0
Fork 0
mirror of https://github.com/WebTools-NG/WebTools-NG synced 2025-02-03 05:33:23 +00:00
This commit is contained in:
Tommy Mikkelsen 2022-04-11 14:29:54 +02:00
parent 89d21a6bc5
commit 6927c90893
10 changed files with 138 additions and 15 deletions
CHANGELOG.md
public/locales
src
background.js
components
layout
modules
ExportTools/scripts
General
PMS/DVR
preload.js
vue.config.js

View file

@ -12,6 +12,7 @@
**Changes**:
* [#453 Kickstart Butler Scheduled tasks](https://github.com/WebTools-NG/WebTools-NG/issues/453)
* [#456 ET Custom levels doesn't use include params](https://github.com/WebTools-NG/WebTools-NG/issues/456)
## V0.3.14 (20220323)

View file

@ -396,6 +396,7 @@
"selDVR": "Select DVR to backup",
"ttselDVR": "Here you select the DVR you want to make a backup of",
"lblBtnBackup": "Backup",
"lblBtnRestore": "Restore",
"BackupDone": "DVR has been saved"
}
},

View file

@ -4,6 +4,7 @@ import { wtutils } from '../src/components/modules/General/wtutils';
const log = require('electron-log');
console.log = log.log;
const { ipcMain, dialog } = require('electron');
// Sadly needs below, since part of main process, so not inherited
log.transports.file.fileName = wtutils.logFileName;
@ -28,11 +29,13 @@ protocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true
function createWindow () {
// Create the browser window.
console.log('Ged 33: ' + __dirname)
console.log('Ged 34: ' + __static)
win = new BrowserWindow({ width: 1024, height: 768, icon: __dirname + "/../src/assets/WebTools-512.png", webPreferences: {
nodeIntegration: true,
contextIsolation: false,
webSecurity: false,
enableRemoteModule: true
enableRemoteModule: true
} })
if (process.env.WEBPACK_DEV_SERVER_URL) {
@ -87,6 +90,11 @@ app.on('ready', async () => {
}
}
// Open system Dialog
ipcMain.handle('dialog', (event, method, params) => {
dialog[method](params);
});
Menu.setApplicationMenu(null)
createWindow()
})
@ -106,7 +114,7 @@ if (isDevelopment) {
}
}
const ipcMain = require('electron').ipcMain;
//const ipcMain = require('electron').ipcMain;
const axios = require('axios')
const fs = require('fs')

View file

@ -13,8 +13,11 @@
import etIcon from '@/assets/ET-256.png';
import pmsIcon from '@/assets/plex-pms-icon.png';
import plextvIcon from '@/assets/plex-app-icon.png';
import {wtconfig, wtutils} from '../../components/modules/General/wtutils';
wtconfig, wtutils
export default {
data() {
return {
@ -37,6 +40,7 @@
{
href: { path: '/plextv' },
title: this.$t("Modules.PlexTV.Name"),
hidden: wtutils.hideMenu('plextv'),
// icon: 'fas fa-file-export',
icon: {
//adjust element
@ -47,6 +51,7 @@
{
href: { path: '/pms' },
title: this.$t("Modules.PMS.Name"),
hidden: wtutils.hideMenu('pms'),
// icon: 'fas fa-file-export',
icon: {
//adjust element
@ -56,17 +61,20 @@
child: [
{
href: '/pms/settings',
hidden: wtutils.hideMenu('pmsSettings'),
title: this.$t("Common.Menu.Sidebar.PMS.Settings"),
icon: 'fa fa-cog'
},
{
href: '/pms/butler',
title: this.$t("Common.Menu.Sidebar.PMS.Butler"),
hidden: wtutils.hideMenu('pmsButler'),
icon: 'fa fa-tasks'
},
{
href: { path: '/pms/dvr' },
title: this.$t("Modules.PMS.DVR.Name"),
hidden: wtutils.hideMenu('pmsDVR'),
icon: 'fas fa-tv',
}
]
@ -74,6 +82,7 @@
{
href: { path: '/export' },
title: this.$t("Modules.ET.Name"),
hidden: wtutils.hideMenu('et'),
// icon: 'fas fa-file-export',
icon: {
//adjust element
@ -83,12 +92,14 @@
child: [
{
href: '/export/settings',
title: this.$t("Common.Menu.Sidebar.ET.Settings"),
title: this.$t("Common.Menu.Sidebar.ET.Settings"),
hidden: wtutils.hideMenu('etSettings'),
icon: 'fa fa-cog'
},
{
href: '/export/custom',
title: this.$t("Common.Menu.Sidebar.ET.Custom"),
title: this.$t("Common.Menu.Sidebar.ET.Custom"),
hidden: wtutils.hideMenu('etCustom'),
icon: 'fa fa-cog'
}
]
@ -102,30 +113,27 @@
{
href: { path: '/language' },
title: this.$t("Common.Menu.Sidebar.Language.NavTitle"),
hidden: wtutils.hideMenu('Language'),
//icon: 'fas fa-language'
icon: 'fa fa-globe'
},
{
href: '/settings',
title: this.$t("Common.Menu.Sidebar.Settings.NavTitle"),
title: this.$t("Common.Menu.Sidebar.Settings.NavTitle"),
hidden: wtutils.hideMenu('Settings'),
icon: 'fa fa-cog'
},
{
href: { path: '/about' },
title: this.$t("Common.Menu.Sidebar.About.NavTitle"),
hidden: wtutils.hideMenu('About'),
icon: 'fas fa-question-circle'
},
{
href: { path: '/' },
title: this.$t("Common.Menu.Sidebar.Theme.NavTitle"),
icon: 'fas fa-palette',
hidden: true
},
{
href: { path: '/' },
title: this.$t("Common.Menu.Sidebar.Reset.NavTitle"),
icon: 'fas fa-power-off',
hidden: true
hidden: wtutils.hideMenu('Theme'),
icon: 'fas fa-palette'
}
]
}

View file

@ -602,7 +602,13 @@ const etHelper = new class ETHELPER {
retVal = await this.getSuggestedFolderName( {data: data} );
break;
case "Part File":
console.log('Ged 76-0 Part File in: ' + valArray)
console.log('Ged 76-1 Part File in: ' + JSON.stringify(valArray))
console.log('Ged 76-2 Part File Basename: ' + path.basename(valArray[0]))
for (x=0; x<valArray.length; x++) {
console.log('Ged 77-1 Part File in: ' + valArray[x])
console.log('Ged 77-2 Part File basename : ' + path.basename(valArray[x]))
retArray.push(path.basename(valArray[x]).slice(0, -1));
}
retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * '))

View file

@ -232,9 +232,59 @@ const wtutils = new class WTUtils {
}
}
hideMenu(menu)
{
let retVal = false;
log.debug(`Start menu check for ${menu}`);
// If indeveloper mode, always return false
if (this.isDev){
log.debug('We are running in dev mode, so turn on all menues');
retVal = false;
}
else
{
retVal = wtconfig.get('Menu.' + menu, true);
}
log.debug(`Menu returning ${retVal}`);
return retVal
}
UpdateConfigFile() {
// Update config file with defaults if missing
log.verbose('Updating config file');
// Hide/Show Menu
if ( wtconfig.get('Menu.plextv', 'N/A') == 'N/A' ){
wtconfig.set('Menu.plextv', false)
}
if ( wtconfig.get('Menu.pms', 'N/A') == 'N/A' ){
wtconfig.set('Menu.pms', false)
}
if ( wtconfig.get('Menu.pmsSettings', 'N/A') == 'N/A' ){
wtconfig.set('Menu.pmsSettings', false)
}
if ( wtconfig.get('Menu.et', 'N/A') == 'N/A' ){
wtconfig.set('Menu.et', false)
}
if ( wtconfig.get('Menu.etSettings', 'N/A') == 'N/A' ){
wtconfig.set('Menu.etSettings', false)
}
if ( wtconfig.get('Menu.etCustom', 'N/A') == 'N/A' ){
wtconfig.set('Menu.etCustom', false)
}
if ( wtconfig.get('Menu.Language', 'N/A') == 'N/A' ){
wtconfig.set('Menu.Language', false)
}
if ( wtconfig.get('Menu.Settings', 'N/A') == 'N/A' ){
wtconfig.set('Menu.Settings', false)
}
if ( wtconfig.get('Menu.About', 'N/A') == 'N/A' ){
wtconfig.set('Menu.About', false)
}
// General section
if ( wtconfig.get('General.username', 'N/A') == 'N/A' ){
wtconfig.set('General.username', '')

View file

@ -25,6 +25,7 @@
<div id="buttons" class="text-center">
<b-button-group >
<b-button
class="mr-2"
type="is-primary"
@click="dvrBackup"
icon-left="fas fa-file-download"
@ -33,10 +34,20 @@
variant="success"
>
{{ $t("Modules.PMS.DVR.lblBtnBackup") }}
</b-button>
</b-button>
<b-button
class="mr-2"
type="is-primary"
@click="dvrRestore"
icon-left="fas fa-file-download"
icon-pack="fas"
variant="success"
>
{{ $t("Modules.PMS.DVR.lblBtnRestore") }}
</b-button>
</b-button-group>
</div>
</div>
</div>
</b-container>
@ -93,6 +104,11 @@
},
methods: {
async dvrRestore() {
log.info("DVR Restore started");
//dvr.backupDVR( {'dvrName': this.selDVR} );
dvr.restoreDVR();
},
async dvrBackup() {
log.info("DVR Backup started");
dvr.backupDVR( {'dvrName': this.selDVR} );

View file

@ -8,6 +8,7 @@ import {wtconfig, wtutils} from '../../../General/wtutils';
import i18n from '../../../../../i18n';
import store from '../../../../../store';
import axios from 'axios';
import { electron } from 'process';
i18n, wtconfig
@ -52,6 +53,20 @@ const dvr = new class DVR {
return arrDVR;
}
async restoreDVR (){
console.log('Ged 70 restore start')
const dialogConfig = {
title: 'Select a file',
buttonLabel: 'This one will do',
properties: ['openFile']
};
//const electron = require('electron');
electron.openDialog('showOpenDialog', dialogConfig)
.then(result => console.log(result));
}
async backupDVR( { dvrName } ){
let fileName = await this.getFileName( {'dvrName': dvrName} );
const fs = require('fs');

6
src/preload.js Normal file
View file

@ -0,0 +1,6 @@
// Expose select dvr backup dialog
contextBridge.exposeInMainWorld('electron', {
openDialog: (method, config) => ipcRenderer.invoke('dialog', method, config)
});
console.log('Ged 14 Preload')

View file

@ -10,6 +10,7 @@ module.exports = {
},
electronBuilder: {
builderOptions: {
appId: "com.webtools.webtools-ng",
artifactName: "${productName}-${version}.${env.AppRev}.${ext}",
directories: {
@ -47,3 +48,14 @@ module.exports = {
}
}
}
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
}