mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 02:53:05 +00:00
#184 Linux done
This commit is contained in:
parent
f3e727574a
commit
b68655b9b8
6 changed files with 35 additions and 29 deletions
|
@ -1,11 +1,13 @@
|
|||
{
|
||||
"name": "webtools-ng",
|
||||
"productName": "WebTools-NG",
|
||||
"version": "0.1.8",
|
||||
"description": "WebTools Next Generation 4 Plex",
|
||||
"author": "dane22 & CPSO",
|
||||
"license": "MPL-2.0",
|
||||
"homepage": "https://github.com/WebTools-NG/WebTools-NG",
|
||||
"private": true,
|
||||
|
||||
"scripts": {
|
||||
"serve": "run-script-os",
|
||||
"serve:darwin:linux": "chmod +x script/getGitVer.sh && . script/getGitVer.sh && vue-cli-service electron:serve && unset AppRev",
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
'use strict'
|
||||
import { app, protocol, BrowserWindow, Menu} from 'electron'
|
||||
import { app, protocol, BrowserWindow, Menu} from 'electron';
|
||||
import { wtutils } from '../src/components/modules/General/wtutils';
|
||||
|
||||
const log = require('electron-log');
|
||||
console.log = log.log;
|
||||
|
||||
//var appName = app.getName();
|
||||
var appName = app.name;
|
||||
|
||||
// Sadly needs below, since part of main process, so not inherited
|
||||
log.transports.file.fileName = appName;
|
||||
|
||||
log.transports.file.fileName = wtutils.AppName;
|
||||
|
||||
import {
|
||||
createProtocol,
|
||||
|
@ -48,9 +46,8 @@ function createWindow () {
|
|||
})
|
||||
|
||||
// Set proper title for main window
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
let rev = require('../public/version.json').rev;
|
||||
let windowtitle = appName + " v" + process.env.VUE_APP_VERSION + "." + rev;
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
let windowtitle = wtutils.AppName + " v" + wtutils.AppVersion;
|
||||
win.setTitle(windowtitle);
|
||||
})
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ console.log = log.log;
|
|||
const electron = require('electron');
|
||||
// User Config
|
||||
const Store = require('electron-store');
|
||||
const wtconfig = new Store({name: require('electron').remote.app.getName()});
|
||||
const wtconfig = new Store({ name: (electron.app || electron.remote.app).getName() });
|
||||
|
||||
const wtutils = new class WTUtils {
|
||||
|
||||
|
@ -94,12 +94,19 @@ const wtutils = new class WTUtils {
|
|||
return (electron.app || electron.remote.app).getPath('documents');
|
||||
}
|
||||
|
||||
get AppName() {
|
||||
return (electron.app || electron.remote.app).getName();
|
||||
get AppName() {
|
||||
return (electron.app || electron.remote.app).name;
|
||||
}
|
||||
|
||||
get AppVersion() {
|
||||
return (electron.app || electron.remote.app).getVersion();
|
||||
/*
|
||||
This function will return the revision number of the app,
|
||||
based on the current GitHub Branch commit hash */
|
||||
get Rev() {
|
||||
return require('../../../../public/version.json').rev;
|
||||
}
|
||||
|
||||
get AppVersion() {
|
||||
return (electron.app || electron.remote.app).getVersion() + '.' + this.Rev;
|
||||
}
|
||||
|
||||
get LangFiles() {
|
||||
|
@ -129,7 +136,7 @@ const wtutils = new class WTUtils {
|
|||
const logDir = wtutils.Home.replace('Application Support', 'Logs');
|
||||
log.info(`Log directory on Mac is detected as: ${logDir}`)
|
||||
return logDir;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This will move translation files in the app to userdata
|
||||
|
@ -157,7 +164,7 @@ const wtutils = new class WTUtils {
|
|||
}
|
||||
else
|
||||
{
|
||||
localHome = __dirname.replace('app.asar', 'locales');
|
||||
localHome = __dirname.replace('app.asar', 'locales');
|
||||
}
|
||||
var last = wtconfig.get('General.transfilescopied', "0")
|
||||
if (!(last == wtutils.AppVersion))
|
||||
|
@ -324,7 +331,8 @@ const dialog = new class Dialog {
|
|||
OpenDirectory(Title, OKLabel)
|
||||
{
|
||||
log.debug('Start OpenDirectory Dialog')
|
||||
const {remote} = require('electron'),
|
||||
// const {remote, app} = require('electron'),
|
||||
const {remote} = require('electron'),
|
||||
dialog = remote.dialog,
|
||||
WIN = remote.getCurrentWindow();
|
||||
let options = {
|
||||
|
@ -374,7 +382,7 @@ const github = new class GitHub {
|
|||
const response = await fetch(this.releaseUrl);
|
||||
const releases = await response.json();
|
||||
return releases;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,11 +51,11 @@
|
|||
|
||||
|
||||
<script>
|
||||
import store from '../../../store'
|
||||
import store from '../../../store';
|
||||
import { wtutils, wtconfig } from '../General/wtutils';
|
||||
const log = require('electron-log');
|
||||
console.log = log.log;
|
||||
// User Config
|
||||
import {wtconfig} from '../General/wtutils';
|
||||
log.transports.file.fileName = wtutils.AppName;
|
||||
|
||||
var userName = "";
|
||||
|
||||
|
@ -90,7 +90,7 @@ export default {
|
|||
log.verbose(`Save username is: ${this.checkbox}`)
|
||||
wtconfig.set('General.rememberlastusername', true )
|
||||
wtconfig.set('General.username', this.input.username)
|
||||
} else {
|
||||
} else {
|
||||
log.verbose(`Save username is: ${this.checkbox}`)
|
||||
wtconfig.set('General.rememberlastusername', false )
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import {wtutils, wtconfig} from './components/modules/General/wtutils'
|
|||
|
||||
const log = require('electron-log');
|
||||
console.log = log.log;
|
||||
log.transports.file.fileName = wtutils.AppName;
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
|
|
12
src/main.js
12
src/main.js
|
@ -13,24 +13,22 @@ import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue'
|
|||
import 'bootstrap/dist/css/bootstrap.css'
|
||||
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||
|
||||
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(Vuex);
|
||||
Vue.use(VueSidebarMenu)
|
||||
Vue.use(VueSidebarMenu);
|
||||
Vue.use(BootstrapVue);
|
||||
Vue.use(BootstrapVueIcons)
|
||||
|
||||
|
||||
Vue.use(BootstrapVueIcons);
|
||||
|
||||
// Logging start
|
||||
// Remember to define log in all components where its used, as in below
|
||||
const log = require('electron-log');
|
||||
log.transports.file.fileName = wtutils.AppName;
|
||||
console.log = log.log;
|
||||
// Default file log level is info
|
||||
log.transports.file.level = wtconfig.get('Log.fileLevel', 'info');
|
||||
// Default console level is Silly, since used by us
|
||||
log.transports.console.level = wtconfig.get('Log.consoleLevel', 'silly');
|
||||
log.transports.file.fileName = wtutils.AppName;
|
||||
|
||||
// Set logfile to 10Mb
|
||||
log.transports.file.maxSize = wtconfig.get('Log.maxSize', 1048576);
|
||||
log.info('*********************************')
|
||||
|
@ -70,5 +68,5 @@ new Vue({
|
|||
render: h => h(App),
|
||||
router: router,
|
||||
store: store,
|
||||
i18n
|
||||
i18n
|
||||
}).$mount('#app')
|
||||
|
|
Loading…
Reference in a new issue