Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.showNotification = function(push) {
// If snooze is active, global.snoozeUntil is === 0
let isSnoozed = Boolean(remote.getGlobal('snoozeUntil'));
// DEBUG
logger.devtools('snoozed', isSnoozed);
if (Date.now() < remote.getGlobal('snoozeUntil')) {
return;
}
if ((push.active && push.active === true) || (push.type && push.type === 'mirror')) {
return new Notification(null, push);
}
};
/* global $ */
const MAX_PER_PAGE = 10
const MAX_RETRIES = 3
const { electron, BrowserWindow, remote, ipcRenderer, shell, dialog, clipboard } = require('electron')
const fs = require('fs')
const path = require('path')
const appSettings = remote.require('electron-settings')
const isDev = remote.getGlobal('isDev')
const LiveMe = remote.getGlobal('LiveMe')
const DataManager = remote.getGlobal('DataManager')
const formatDuration = require('format-duration')
const prettydate = require('pretty-date')
const request = require('request')
let currentUser = {}
let currentPage = 1
let currentIndex = 0
let tempvar = null
let hasMore = false
let currentSearch = ''
let scrollBusy = false
let currentView = 'home'
$(function () {
document.title = 'LiveMe Pro Tools v' + remote.app.getVersion() // Set Title of Window
window.addEventListener('contextmenu', (e) => {
e.preventDefault();
ipcRenderer.send('contextmenu-click');
}, false);
// Instantiating our Server Configs collection now since the page nav
// utilizes it. We'll fetch it later on.
app.serverConfigs = new ServerConfigs();
app.pageNav = new PageNav({
serverConfigs: app.serverConfigs,
});
$('#pageNavContainer').append(app.pageNav.render().el);
let externalRoute = remote.getGlobal('externalRoute');
app.router = new ObRouter();
// Clear the external route flag as soon as it's used so it's not re-used
// on app refreshes.
app.router.on('route', () => (externalRoute = null));
// create our status bar view
app.statusBar = new StatusBar();
$('#statusBar').html(app.statusBar.render().el);
const startupConnectMessaging = new StartupConnectMessaging();
// Create loading modal, which is a shared instance used throughout the app
app.loadingModal = new LoadingModal({
dismissOnOverlayClick: false,
uninstall(pluginPath) {
if (this.plugins[pluginPath]) {
try {
this.plugins[pluginPath].uninstall();
} catch (err) {
remote.getGlobal('Logger').error('Error while uninstalling plugin', this.plugins[pluginPath].constructor.PLUGIN_NAME, { message: err.message, stack: err.stack });
}
this.plugins[pluginPath].__BINDINGS__.forEach((binding) => {
Emitter.off(binding[0], binding[1]);
});
purgeCache(pluginPath);
}
}
}
fs.writeFile(imageDir, validImage, 'base64', (err) => {
if (err) reject();
remote.getGlobal('sharedObj').lastScreenshotPath = imageDir;
remote.getGlobal('sharedObj').screenshotTime = screenshotTime;
remote.getGlobal('sharedObj').timestamp = now;
remote.getGlobal('sharedObj').screenshotPreviewTime = screenshotPreviewTime;
remote.getGlobal('sharedObj').nativeNotifications = nativeNotifications;
if (showPreview) {
ipcRenderer.send('show-screenshot-popup');
} else {
ipcRenderer.send('screenshot-accept');
}
resolve();
});
},
acum[ seed.get('url') ] = state.get('crawls').get(`${latest}`)
return acum
}
acum[ seed.get('url') ] = state.get('crawls').get(`${seed.get('jobIds').get(0)}`)
return acum
}, {}))
} else {
return Immutable.Map()
}
}
const stateToProps = (state, ownProps) => ({
collection: state.get('collections').get(ownProps.params.col),
viewingCol: ownProps.params.col,
})
const wbUrl = remote.getGlobal('settings').get('pywb.url')
const openInWb = (seed, forCol) => shell.openExternal(`${wbUrl}${forCol}/*/${seed}`)
@connect(stateToProps)
export default class CollectionView extends Component {
static contextTypes = {
muiTheme: PropTypes.object.isRequired
}
static propTypes = {
collection: PropTypes.instanceOf(Immutable.Map).isRequired,
viewingCol: PropTypes.string.isRequired
}
constructor (...args) {
super(...args)
this.state = {
searchText: '',
import { connect } from 'dva';
import { remote } from 'electron';
import React, { PureComponent } from 'react';
import { Icon, Menu, Button } from 'antd';
import styles from './index.less';
const { window } = remote.getGlobal('services');
const MenuItem = Menu.Item;
export const statusList = [
{
key: 'active',
countProps: 'numActive',
text: '进行中',
icon: 'caret-right'
},
{
key: 'waiting',
countProps: 'numWaiting',
text: '已暂停',
icon: 'pause',
},
{
isDarwin() {
return remote.getGlobal('isDarwin')
},
isLinux() {
public static get() {
const electronContext = ElectronContextTypes.create();
if (electronContext === ElectronContextType.RENDERER) {
return remote.getGlobal("appPath");
} else {
return global.appPath;
}
}