├── .babelrc ├── .electron-vue ├── build.js ├── dev-client.js ├── dev-runner.js ├── webpack.main.config.js ├── webpack.renderer.config.js └── webpack.web.config.js ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── appveyor.yml ├── build └── icons │ ├── 256x256.png │ ├── icon.icns │ └── icon.ico ├── dist ├── electron │ └── .gitkeep └── web │ └── .gitkeep ├── package-lock.json ├── package.json ├── src ├── index.ejs ├── logic │ └── database │ │ ├── dao.js │ │ ├── database.js │ │ └── models │ │ └── core.model.js ├── main │ ├── index.dev.js │ └── index.js └── renderer │ ├── App.vue │ ├── assets │ ├── .gitkeep │ ├── CacheMonkey.png │ ├── logo.png │ ├── monkey.svg │ ├── monkey_cover_ears.svg │ ├── monkey_cover_eyes.svg │ ├── monkey_cover_mouth.svg │ └── osx_zoom.svg │ ├── components │ ├── Alerts.vue │ ├── ConfirmModal.vue │ ├── FileView.vue │ ├── Info.vue │ ├── Input.vue │ ├── LandingPage.vue │ ├── Modal.vue │ ├── Settings.vue │ ├── Sidebar │ │ └── Sidebar.vue │ ├── SlidePanel.vue │ ├── TrafficLights.vue │ └── WindowsButtons.vue │ ├── main.js │ ├── monkey.js │ ├── router │ └── index.js │ └── store │ ├── index.js │ ├── modules │ ├── Counter.js │ ├── Themes.js │ └── index.js │ ├── request.js │ ├── routes.js │ └── socket.js ├── static └── .gitkeep ├── test ├── .eslintrc └── unit │ ├── index.js │ ├── karma.conf.js │ └── specs │ └── LandingPage.spec.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "comments": false, 3 | "env": { 4 | "test": { 5 | "presets": [ 6 | ["env", { 7 | "targets": { "node": 7 } 8 | }], 9 | "stage-0" 10 | ], 11 | "plugins": ["istanbul"] 12 | }, 13 | "main": { 14 | "presets": [ 15 | ["env", { 16 | "targets": { "node": 7 } 17 | }], 18 | "stage-0" 19 | ] 20 | }, 21 | "renderer": { 22 | "presets": [ 23 | ["env", { 24 | "modules": false 25 | }], 26 | "stage-0" 27 | ] 28 | }, 29 | "web": { 30 | "presets": [ 31 | ["env", { 32 | "modules": false 33 | }], 34 | "stage-0" 35 | ] 36 | } 37 | }, 38 | "plugins": ["transform-runtime"] 39 | } 40 | -------------------------------------------------------------------------------- /.electron-vue/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | const { say } = require('cfonts') 6 | const chalk = require('chalk') 7 | const del = require('del') 8 | const { spawn } = require('child_process') 9 | const webpack = require('webpack') 10 | const Multispinner = require('multispinner') 11 | 12 | 13 | const mainConfig = require('./webpack.main.config') 14 | const rendererConfig = require('./webpack.renderer.config') 15 | const webConfig = require('./webpack.web.config') 16 | 17 | const doneLog = chalk.bgGreen.white(' DONE ') + ' ' 18 | const errorLog = chalk.bgRed.white(' ERROR ') + ' ' 19 | const okayLog = chalk.bgBlue.white(' OKAY ') + ' ' 20 | const isCI = process.env.CI || false 21 | 22 | if (process.env.BUILD_TARGET === 'clean') clean() 23 | else if (process.env.BUILD_TARGET === 'web') web() 24 | else build() 25 | 26 | function clean () { 27 | del.sync(['build/*', '!build/icons', '!build/icons/icon.*']) 28 | console.log(`\n${doneLog}\n`) 29 | process.exit() 30 | } 31 | 32 | function build () { 33 | greeting() 34 | 35 | del.sync(['dist/electron/*', '!.gitkeep']) 36 | 37 | const tasks = ['main', 'renderer'] 38 | const m = new Multispinner(tasks, { 39 | preText: 'building', 40 | postText: 'process' 41 | }) 42 | 43 | let results = '' 44 | 45 | m.on('success', () => { 46 | process.stdout.write('\x1B[2J\x1B[0f') 47 | console.log(`\n\n${results}`) 48 | console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`) 49 | process.exit() 50 | }) 51 | 52 | pack(mainConfig).then(result => { 53 | results += result + '\n\n' 54 | m.success('main') 55 | }).catch(err => { 56 | m.error('main') 57 | console.log(`\n ${errorLog}failed to build main process`) 58 | console.error(`\n${err}\n`) 59 | process.exit(1) 60 | }) 61 | 62 | pack(rendererConfig).then(result => { 63 | results += result + '\n\n' 64 | m.success('renderer') 65 | }).catch(err => { 66 | m.error('renderer') 67 | console.log(`\n ${errorLog}failed to build renderer process`) 68 | console.error(`\n${err}\n`) 69 | process.exit(1) 70 | }) 71 | } 72 | 73 | function pack (config) { 74 | return new Promise((resolve, reject) => { 75 | config.mode = 'production' 76 | webpack(config, (err, stats) => { 77 | if (err) reject(err.stack || err) 78 | else if (stats.hasErrors()) { 79 | let err = '' 80 | 81 | stats.toString({ 82 | chunks: false, 83 | colors: true 84 | }) 85 | .split(/\r?\n/) 86 | .forEach(line => { 87 | err += ` ${line}\n` 88 | }) 89 | 90 | reject(err) 91 | } else { 92 | resolve(stats.toString({ 93 | chunks: false, 94 | colors: true 95 | })) 96 | } 97 | }) 98 | }) 99 | } 100 | 101 | function web () { 102 | del.sync(['dist/web/*', '!.gitkeep']) 103 | webConfig.mode = 'production' 104 | webpack(webConfig, (err, stats) => { 105 | if (err || stats.hasErrors()) console.log(err) 106 | 107 | console.log(stats.toString({ 108 | chunks: false, 109 | colors: true 110 | })) 111 | 112 | process.exit() 113 | }) 114 | } 115 | 116 | function greeting () { 117 | const cols = process.stdout.columns 118 | let text = '' 119 | 120 | if (cols > 85) text = 'lets-build' 121 | else if (cols > 60) text = 'lets-|build' 122 | else text = false 123 | 124 | if (text && !isCI) { 125 | say(text, { 126 | colors: ['yellow'], 127 | font: 'simple3d', 128 | space: false 129 | }) 130 | } else console.log(chalk.yellow.bold('\n lets-build')) 131 | console.log() 132 | } -------------------------------------------------------------------------------- /.electron-vue/dev-client.js: -------------------------------------------------------------------------------- 1 | const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 2 | 3 | hotClient.subscribe(event => { 4 | /** 5 | * Reload browser when HTMLWebpackPlugin emits a new index.html 6 | * 7 | * Currently disabled until jantimon/html-webpack-plugin#680 is resolved. 8 | * https://github.com/SimulatedGREG/electron-vue/issues/437 9 | * https://github.com/jantimon/html-webpack-plugin/issues/680 10 | */ 11 | // if (event.action === 'reload') { 12 | // window.location.reload() 13 | // } 14 | 15 | /** 16 | * Notify `mainWindow` when `main` process is compiling, 17 | * giving notice for an expected reload of the `electron` process 18 | */ 19 | if (event.action === 'compiling') { 20 | document.body.innerHTML += ` 21 | 34 | 35 |
36 | Compiling Main Process... 37 |
38 | ` 39 | } 40 | }) 41 | -------------------------------------------------------------------------------- /.electron-vue/dev-runner.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const chalk = require('chalk') 4 | const electron = require('electron') 5 | const path = require('path') 6 | const { say } = require('cfonts') 7 | const { spawn } = require('child_process') 8 | const webpack = require('webpack') 9 | const WebpackDevServer = require('webpack-dev-server') 10 | const webpackHotMiddleware = require('webpack-hot-middleware') 11 | 12 | const mainConfig = require('./webpack.main.config') 13 | const rendererConfig = require('./webpack.renderer.config') 14 | 15 | let electronProcess = null 16 | let manualRestart = false 17 | let hotMiddleware 18 | 19 | function logStats (proc, data) { 20 | let log = '' 21 | 22 | log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`) 23 | log += '\n\n' 24 | 25 | if (typeof data === 'object') { 26 | data.toString({ 27 | colors: true, 28 | chunks: false 29 | }).split(/\r?\n/).forEach(line => { 30 | log += ' ' + line + '\n' 31 | }) 32 | } else { 33 | log += ` ${data}\n` 34 | } 35 | 36 | log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n' 37 | 38 | console.log(log) 39 | } 40 | 41 | function startRenderer () { 42 | return new Promise((resolve, reject) => { 43 | rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer) 44 | rendererConfig.mode = 'development' 45 | const compiler = webpack(rendererConfig) 46 | hotMiddleware = webpackHotMiddleware(compiler, { 47 | log: false, 48 | heartbeat: 2500 49 | }) 50 | 51 | compiler.hooks.compilation.tap('compilation', compilation => { 52 | compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => { 53 | hotMiddleware.publish({ action: 'reload' }) 54 | cb() 55 | }) 56 | }) 57 | 58 | compiler.hooks.done.tap('done', stats => { 59 | logStats('Renderer', stats) 60 | }) 61 | 62 | const server = new WebpackDevServer( 63 | compiler, 64 | { 65 | contentBase: path.join(__dirname, '../'), 66 | quiet: true, 67 | before (app, ctx) { 68 | app.use(hotMiddleware) 69 | ctx.middleware.waitUntilValid(() => { 70 | resolve() 71 | }) 72 | } 73 | } 74 | ) 75 | 76 | server.listen(9080) 77 | }) 78 | } 79 | 80 | function startMain () { 81 | return new Promise((resolve, reject) => { 82 | mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main) 83 | mainConfig.mode = 'development' 84 | const compiler = webpack(mainConfig) 85 | 86 | compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { 87 | logStats('Main', chalk.white.bold('compiling...')) 88 | hotMiddleware.publish({ action: 'compiling' }) 89 | done() 90 | }) 91 | 92 | compiler.watch({}, (err, stats) => { 93 | if (err) { 94 | console.log(err) 95 | return 96 | } 97 | 98 | logStats('Main', stats) 99 | 100 | if (electronProcess && electronProcess.kill) { 101 | manualRestart = true 102 | process.kill(electronProcess.pid) 103 | electronProcess = null 104 | startElectron() 105 | 106 | setTimeout(() => { 107 | manualRestart = false 108 | }, 5000) 109 | } 110 | 111 | resolve() 112 | }) 113 | }) 114 | } 115 | 116 | function startElectron () { 117 | var args = [ 118 | '--inspect=5858', 119 | path.join(__dirname, '../dist/electron/main.js') 120 | ] 121 | 122 | // detect yarn or npm and process commandline args accordingly 123 | if (process.env.npm_execpath.endsWith('yarn.js')) { 124 | args = args.concat(process.argv.slice(3)) 125 | } else if (process.env.npm_execpath.endsWith('npm-cli.js')) { 126 | args = args.concat(process.argv.slice(2)) 127 | } 128 | 129 | electronProcess = spawn(electron, args) 130 | 131 | electronProcess.stdout.on('data', data => { 132 | electronLog(data, 'blue') 133 | }) 134 | electronProcess.stderr.on('data', data => { 135 | electronLog(data, 'red') 136 | }) 137 | 138 | electronProcess.on('close', () => { 139 | if (!manualRestart) process.exit() 140 | }) 141 | } 142 | 143 | function electronLog (data, color) { 144 | let log = '' 145 | data = data.toString().split(/\r?\n/) 146 | data.forEach(line => { 147 | log += ` ${line}\n` 148 | }) 149 | if (/[0-9A-z]+/.test(log)) { 150 | console.log( 151 | chalk[color].bold('┏ Electron -------------------') + 152 | '\n\n' + 153 | log + 154 | chalk[color].bold('┗ ----------------------------') + 155 | '\n' 156 | ) 157 | } 158 | } 159 | 160 | function greeting () { 161 | const cols = process.stdout.columns 162 | let text = '' 163 | 164 | if (cols > 104) text = 'electron-vue' 165 | else if (cols > 76) text = 'electron-|vue' 166 | else text = false 167 | 168 | if (text) { 169 | say(text, { 170 | colors: ['yellow'], 171 | font: 'simple3d', 172 | space: false 173 | }) 174 | } else console.log(chalk.yellow.bold('\n electron-vue')) 175 | console.log(chalk.blue(' getting ready...') + '\n') 176 | } 177 | 178 | function init () { 179 | greeting() 180 | 181 | Promise.all([startRenderer(), startMain()]) 182 | .then(() => { 183 | startElectron() 184 | }) 185 | .catch(err => { 186 | console.error(err) 187 | }) 188 | } 189 | 190 | init() 191 | -------------------------------------------------------------------------------- /.electron-vue/webpack.main.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | process.env.BABEL_ENV = 'main' 4 | 5 | const path = require('path') 6 | const { dependencies } = require('../package.json') 7 | const webpack = require('webpack') 8 | 9 | const BabiliWebpackPlugin = require('babili-webpack-plugin') 10 | 11 | let mainConfig = { 12 | entry: { 13 | main: path.join(__dirname, '../src/main/index.js') 14 | }, 15 | externals: [ 16 | ...Object.keys(dependencies || {}) 17 | ], 18 | module: { 19 | rules: [ 20 | { 21 | test: /\.(js)$/, 22 | enforce: 'pre', 23 | exclude: /node_modules/, 24 | use: { 25 | loader: 'eslint-loader', 26 | options: { 27 | formatter: require('eslint-friendly-formatter') 28 | } 29 | } 30 | }, 31 | { 32 | test: /\.js$/, 33 | use: 'babel-loader', 34 | exclude: /node_modules/ 35 | }, 36 | { 37 | test: /\.node$/, 38 | use: 'node-loader' 39 | } 40 | ] 41 | }, 42 | node: { 43 | __dirname: process.env.NODE_ENV !== 'production', 44 | __filename: process.env.NODE_ENV !== 'production' 45 | }, 46 | output: { 47 | filename: '[name].js', 48 | libraryTarget: 'commonjs2', 49 | path: path.join(__dirname, '../dist/electron') 50 | }, 51 | plugins: [ 52 | new webpack.NoEmitOnErrorsPlugin() 53 | ], 54 | resolve: { 55 | extensions: ['.js', '.json', '.node'] 56 | }, 57 | target: 'electron-main' 58 | } 59 | 60 | /** 61 | * Adjust mainConfig for development settings 62 | */ 63 | if (process.env.NODE_ENV !== 'production') { 64 | mainConfig.plugins.push( 65 | new webpack.DefinePlugin({ 66 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"` 67 | }) 68 | ) 69 | } 70 | 71 | /** 72 | * Adjust mainConfig for production settings 73 | */ 74 | if (process.env.NODE_ENV === 'production') { 75 | mainConfig.plugins.push( 76 | new BabiliWebpackPlugin(), 77 | new webpack.DefinePlugin({ 78 | 'process.env.NODE_ENV': '"production"' 79 | }) 80 | ) 81 | } 82 | 83 | module.exports = mainConfig 84 | -------------------------------------------------------------------------------- /.electron-vue/webpack.renderer.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | process.env.BABEL_ENV = 'renderer' 4 | 5 | const path = require('path') 6 | const { dependencies } = require('../package.json') 7 | const webpack = require('webpack') 8 | 9 | const BabiliWebpackPlugin = require('babili-webpack-plugin') 10 | const CopyWebpackPlugin = require('copy-webpack-plugin') 11 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 12 | const HtmlWebpackPlugin = require('html-webpack-plugin') 13 | const { VueLoaderPlugin } = require('vue-loader') 14 | 15 | /** 16 | * List of node_modules to include in webpack bundle 17 | * 18 | * Required for specific packages like Vue UI libraries 19 | * that provide pure *.vue files that need compiling 20 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals 21 | */ 22 | let whiteListedModules = ['vue'] 23 | 24 | let rendererConfig = { 25 | devtool: '#cheap-module-eval-source-map', 26 | entry: { 27 | renderer: path.join(__dirname, '../src/renderer/main.js') 28 | }, 29 | externals: [ 30 | ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)) 31 | ], 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.(js|vue)$/, 36 | enforce: 'pre', 37 | exclude: /node_modules/, 38 | use: { 39 | loader: 'eslint-loader', 40 | options: { 41 | formatter: require('eslint-friendly-formatter') 42 | } 43 | } 44 | }, 45 | { 46 | test: /\.scss$/, 47 | use: ['vue-style-loader', 'css-loader', 'sass-loader'] 48 | }, 49 | { 50 | test: /\.sass$/, 51 | use: ['vue-style-loader', 'css-loader', 'sass-loader?indentedSyntax'] 52 | }, 53 | { 54 | test: /\.less$/, 55 | use: ['vue-style-loader', 'css-loader', 'less-loader'] 56 | }, 57 | { 58 | test: /\.css$/, 59 | use: ['vue-style-loader', 'css-loader'] 60 | }, 61 | { 62 | test: /\.html$/, 63 | use: 'vue-html-loader' 64 | }, 65 | { 66 | test: /\.js$/, 67 | use: 'babel-loader', 68 | exclude: /node_modules/ 69 | }, 70 | { 71 | test: /\.node$/, 72 | use: 'node-loader' 73 | }, 74 | { 75 | test: /\.vue$/, 76 | use: { 77 | loader: 'vue-loader', 78 | options: { 79 | extractCSS: process.env.NODE_ENV === 'production', 80 | loaders: { 81 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1', 82 | scss: 'vue-style-loader!css-loader!sass-loader', 83 | less: 'vue-style-loader!css-loader!less-loader' 84 | } 85 | } 86 | } 87 | }, 88 | { 89 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 90 | use: { 91 | loader: 'url-loader', 92 | query: { 93 | limit: 10000, 94 | name: 'imgs/[name]--[folder].[ext]' 95 | } 96 | } 97 | }, 98 | { 99 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 100 | loader: 'url-loader', 101 | options: { 102 | limit: 10000, 103 | name: 'media/[name]--[folder].[ext]' 104 | } 105 | }, 106 | { 107 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 108 | use: { 109 | loader: 'url-loader', 110 | query: { 111 | limit: 10000, 112 | name: 'fonts/[name]--[folder].[ext]' 113 | } 114 | } 115 | } 116 | ] 117 | }, 118 | node: { 119 | __dirname: process.env.NODE_ENV !== 'production', 120 | __filename: process.env.NODE_ENV !== 'production' 121 | }, 122 | plugins: [ 123 | new VueLoaderPlugin(), 124 | new MiniCssExtractPlugin({filename: 'styles.css'}), 125 | new HtmlWebpackPlugin({ 126 | filename: 'index.html', 127 | template: path.resolve(__dirname, '../src/index.ejs'), 128 | minify: { 129 | collapseWhitespace: true, 130 | removeAttributeQuotes: true, 131 | removeComments: true 132 | }, 133 | nodeModules: process.env.NODE_ENV !== 'production' 134 | ? path.resolve(__dirname, '../node_modules') 135 | : false 136 | }), 137 | new webpack.HotModuleReplacementPlugin(), 138 | new webpack.NoEmitOnErrorsPlugin() 139 | ], 140 | output: { 141 | filename: '[name].js', 142 | libraryTarget: 'commonjs2', 143 | path: path.join(__dirname, '../dist/electron') 144 | }, 145 | resolve: { 146 | alias: { 147 | '@': path.join(__dirname, '../src/renderer'), 148 | 'vue$': 'vue/dist/vue.esm.js' 149 | }, 150 | extensions: ['.js', '.vue', '.json', '.css', '.node'] 151 | }, 152 | target: 'electron-renderer' 153 | } 154 | 155 | /** 156 | * Adjust rendererConfig for development settings 157 | */ 158 | if (process.env.NODE_ENV !== 'production') { 159 | rendererConfig.plugins.push( 160 | new webpack.DefinePlugin({ 161 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"` 162 | }) 163 | ) 164 | } 165 | 166 | /** 167 | * Adjust rendererConfig for production settings 168 | */ 169 | if (process.env.NODE_ENV === 'production') { 170 | rendererConfig.devtool = '' 171 | 172 | rendererConfig.plugins.push( 173 | new BabiliWebpackPlugin(), 174 | new CopyWebpackPlugin([ 175 | { 176 | from: path.join(__dirname, '../static'), 177 | to: path.join(__dirname, '../dist/electron/static'), 178 | ignore: ['.*'] 179 | } 180 | ]), 181 | new webpack.DefinePlugin({ 182 | 'process.env.NODE_ENV': '"production"' 183 | }), 184 | new webpack.LoaderOptionsPlugin({ 185 | minimize: true 186 | }) 187 | ) 188 | } 189 | 190 | module.exports = rendererConfig 191 | -------------------------------------------------------------------------------- /.electron-vue/webpack.web.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | process.env.BABEL_ENV = 'web' 4 | 5 | const path = require('path') 6 | const webpack = require('webpack') 7 | 8 | const BabiliWebpackPlugin = require('babili-webpack-plugin') 9 | const CopyWebpackPlugin = require('copy-webpack-plugin') 10 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 11 | const HtmlWebpackPlugin = require('html-webpack-plugin') 12 | const { VueLoaderPlugin } = require('vue-loader') 13 | 14 | let webConfig = { 15 | devtool: '#cheap-module-eval-source-map', 16 | entry: { 17 | web: path.join(__dirname, '../src/renderer/main.js') 18 | }, 19 | module: { 20 | rules: [ 21 | { 22 | test: /\.(js|vue)$/, 23 | enforce: 'pre', 24 | exclude: /node_modules/, 25 | use: { 26 | loader: 'eslint-loader', 27 | options: { 28 | formatter: require('eslint-friendly-formatter') 29 | } 30 | } 31 | }, 32 | { 33 | test: /\.scss$/, 34 | use: ['vue-style-loader', 'css-loader', 'sass-loader'] 35 | }, 36 | { 37 | test: /\.sass$/, 38 | use: ['vue-style-loader', 'css-loader', 'sass-loader?indentedSyntax'] 39 | }, 40 | { 41 | test: /\.less$/, 42 | use: ['vue-style-loader', 'css-loader', 'less-loader'] 43 | }, 44 | { 45 | test: /\.css$/, 46 | use: ['vue-style-loader', 'css-loader'] 47 | }, 48 | { 49 | test: /\.html$/, 50 | use: 'vue-html-loader' 51 | }, 52 | { 53 | test: /\.js$/, 54 | use: 'babel-loader', 55 | include: [ path.resolve(__dirname, '../src/renderer') ], 56 | exclude: /node_modules/ 57 | }, 58 | { 59 | test: /\.vue$/, 60 | use: { 61 | loader: 'vue-loader', 62 | options: { 63 | extractCSS: true, 64 | loaders: { 65 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1', 66 | scss: 'vue-style-loader!css-loader!sass-loader', 67 | less: 'vue-style-loader!css-loader!less-loader' 68 | } 69 | } 70 | } 71 | }, 72 | { 73 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 74 | use: { 75 | loader: 'url-loader', 76 | query: { 77 | limit: 10000, 78 | name: 'imgs/[name].[ext]' 79 | } 80 | } 81 | }, 82 | { 83 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 84 | use: { 85 | loader: 'url-loader', 86 | query: { 87 | limit: 10000, 88 | name: 'fonts/[name].[ext]' 89 | } 90 | } 91 | } 92 | ] 93 | }, 94 | plugins: [ 95 | new VueLoaderPlugin(), 96 | new MiniCssExtractPlugin({filename: 'styles.css'}), 97 | new HtmlWebpackPlugin({ 98 | filename: 'index.html', 99 | template: path.resolve(__dirname, '../src/index.ejs'), 100 | minify: { 101 | collapseWhitespace: true, 102 | removeAttributeQuotes: true, 103 | removeComments: true 104 | }, 105 | nodeModules: false 106 | }), 107 | new webpack.DefinePlugin({ 108 | 'process.env.IS_WEB': 'true' 109 | }), 110 | new webpack.HotModuleReplacementPlugin(), 111 | new webpack.NoEmitOnErrorsPlugin() 112 | ], 113 | output: { 114 | filename: '[name].js', 115 | path: path.join(__dirname, '../dist/web') 116 | }, 117 | resolve: { 118 | alias: { 119 | '@': path.join(__dirname, '../src/renderer'), 120 | 'vue$': 'vue/dist/vue.esm.js' 121 | }, 122 | extensions: ['.js', '.vue', '.json', '.css'] 123 | }, 124 | target: 'web' 125 | } 126 | 127 | /** 128 | * Adjust webConfig for production settings 129 | */ 130 | if (process.env.NODE_ENV === 'production') { 131 | webConfig.devtool = '' 132 | 133 | webConfig.plugins.push( 134 | new BabiliWebpackPlugin(), 135 | new CopyWebpackPlugin([ 136 | { 137 | from: path.join(__dirname, '../static'), 138 | to: path.join(__dirname, '../dist/web/static'), 139 | ignore: ['.*'] 140 | } 141 | ]), 142 | new webpack.DefinePlugin({ 143 | 'process.env.NODE_ENV': '"production"' 144 | }), 145 | new webpack.LoaderOptionsPlugin({ 146 | minimize: true 147 | }) 148 | ) 149 | } 150 | 151 | module.exports = webConfig 152 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | test/unit/coverage/** 2 | test/unit/*.js 3 | test/e2e/*.js 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | parserOptions: { 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | node: true 10 | }, 11 | globals: { 12 | __static: true 13 | }, 14 | plugins: [ 15 | 'html' 16 | ], 17 | 'rules': { 18 | 'global-require': 0, 19 | 'import/no-unresolved': 0, 20 | 'no-param-reassign': 0, 21 | 'no-shadow': 0, 22 | 'no-console': 0, 23 | 'comma-dangle': 0, 24 | 'quotes': 0, 25 | 'prefer-const': 0, 26 | 'no-restricted-properties': 0, 27 | 'prefer-template': 0, 28 | 'radix': 0, 29 | 'eqeqeq': 0, 30 | 'no-plusplus': 0, 31 | 'import/extensions': 0, 32 | 'import/newline-after-import': 0, 33 | 'no-multi-assign': 0, 34 | // allow debugger during development 35 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 36 | } 37 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | dist/electron/* 3 | dist/web/* 4 | build/* 5 | !build/icons 6 | coverage 7 | node_modules/ 8 | npm-debug.log 9 | npm-debug.log.* 10 | thumbs.db 11 | !.gitkeep 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Commented sections below can be used to run tests on the CI server 2 | # https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing 3 | osx_image: xcode8.3 4 | sudo: required 5 | dist: trusty 6 | language: c 7 | matrix: 8 | include: 9 | - os: osx 10 | - os: linux 11 | env: CC=clang CXX=clang++ npm_config_clang=1 12 | compiler: clang 13 | cache: 14 | directories: 15 | - node_modules 16 | - "$HOME/.electron" 17 | - "$HOME/.cache" 18 | addons: 19 | apt: 20 | packages: 21 | - libgnome-keyring-dev 22 | - icnsutils 23 | #- xvfb 24 | before_install: 25 | - mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([ 26 | "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz 27 | | tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull 28 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils; fi 29 | install: 30 | #- export DISPLAY=':99.0' 31 | #- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & 32 | - nvm install 7 33 | - curl -o- -L https://yarnpkg.com/install.sh | bash 34 | - source ~/.bashrc 35 | - npm install -g xvfb-maybe 36 | - yarn 37 | script: 38 | #- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js 39 | - yarn run build 40 | branches: 41 | only: 42 | - master 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cache Monkey 2 | 3 | > Thats hot. 4 | 5 | #### Build Setup 6 | 7 | ```bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:9080 12 | npm run dev 13 | 14 | # build electron application for production 15 | npm run build 16 | 17 | # run unit tests 18 | npm test 19 | 20 | 21 | # lint all JS/Vue component files in `src/` 22 | npm run lint 23 | 24 | ``` 25 | 26 | --- 27 | 28 | This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html). 29 | 30 | NOTES: 31 | Building for OSX might error with .icns that aren't "clean". This command fixes it. 32 | https://winsmarts.com/ios-macos-code-signing-error-resource-fork-finder-information-or-similar-detritus-not-allowed-b7333a7596b5 33 | 34 | ``` 35 | // find offending files (run in project directory) 36 | xattr -lr ./ 37 | // fix them 38 | find . -type f -name '*.icns' -exec xattr -c {} \; 39 | ``` 40 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # Commented sections below can be used to run tests on the CI server 2 | # https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing 3 | version: 0.1.{build} 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | image: Visual Studio 2017 10 | platform: 11 | - x64 12 | 13 | cache: 14 | - node_modules 15 | - '%APPDATA%\npm-cache' 16 | - '%USERPROFILE%\.electron' 17 | - '%USERPROFILE%\AppData\Local\Yarn\cache' 18 | 19 | init: 20 | - git config --global core.autocrlf input 21 | 22 | install: 23 | - ps: Install-Product node 8 x64 24 | - git reset --hard HEAD 25 | - yarn 26 | - node --version 27 | 28 | build_script: 29 | #- yarn test 30 | - yarn build 31 | 32 | test: off 33 | -------------------------------------------------------------------------------- /build/icons/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/build/icons/256x256.png -------------------------------------------------------------------------------- /build/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/build/icons/icon.icns -------------------------------------------------------------------------------- /build/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/build/icons/icon.ico -------------------------------------------------------------------------------- /dist/electron/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/dist/electron/.gitkeep -------------------------------------------------------------------------------- /dist/web/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/dist/web/.gitkeep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cache-monkey", 3 | "version": "1.0.8", 4 | "description": "Ah thats hot.", 5 | "author": "Jamie Pine", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/jamiepine/cache-monkey" 9 | }, 10 | "license": "MIT", 11 | "main": "./dist/electron/main.js", 12 | "scripts": { 13 | "build:osx": "node .electron-vue/build.js && electron-builder build -m -p never", 14 | "build:win": "node .electron-vue/build.js && electron-builder build -w --x64 --ia32 -p never", 15 | "build:lin": "node .electron-vue/build.js && electron-builder build -l --x64 -p never", 16 | "build:dir": "node .electron-vue/build.js && electron-builder --dir", 17 | "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", 18 | "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js", 19 | "dev": "node .electron-vue/dev-runner.js", 20 | "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test", 21 | "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test", 22 | "pack": "npm run pack:main && npm run pack:renderer", 23 | "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js", 24 | "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js", 25 | "test": "npm run unit", 26 | "unit": "karma start test/unit/karma.conf.js", 27 | "postinstall": "electron-builder install-app-deps && npm run lint:fix" 28 | }, 29 | "build": { 30 | "productName": "CacheMonkey", 31 | "appId": "com.jamiepine.cachemonkey", 32 | "directories": { 33 | "output": "build" 34 | }, 35 | "files": [ 36 | "dist/electron/**/*" 37 | ], 38 | "publish": [ 39 | { 40 | "provider": "github", 41 | "owner": "jamiepine", 42 | "repo": "cache-monkey" 43 | } 44 | ], 45 | "dmg": { 46 | "contents": [ 47 | { 48 | "x": 410, 49 | "y": 150, 50 | "type": "link", 51 | "path": "/Applications" 52 | }, 53 | { 54 | "x": 130, 55 | "y": 150, 56 | "type": "file" 57 | } 58 | ] 59 | }, 60 | "mac": { 61 | "icon": "build/icons/icon.icns" 62 | }, 63 | "win": { 64 | "icon": "build/icons/icon.ico" 65 | }, 66 | "linux": { 67 | "target": [ 68 | "AppImage", 69 | "deb", 70 | "snap" 71 | ], 72 | "maintainer": "AlekEagle", 73 | "category": "Utility", 74 | "icon": "build/icons" 75 | } 76 | }, 77 | "dependencies": { 78 | "@fortawesome/fontawesome-free": "^5.7.2", 79 | "@fortawesome/fontawesome-svg-core": "^1.2.15", 80 | "@fortawesome/free-brands-svg-icons": "^5.7.2", 81 | "@fortawesome/free-solid-svg-icons": "^5.7.2", 82 | "@fortawesome/vue-fontawesome": "^0.1.5", 83 | "axios": "^0.18.0", 84 | "bluebird": "^3.5.3", 85 | "chokidar": "^2.1.2", 86 | "drivelist": "^6.4.6", 87 | "electron-log": "^3.0.1", 88 | "electron-updater": "^4.0.6", 89 | "file-type": "^10.8.0", 90 | "font-awesome": "^4.7.0", 91 | "moment": "^2.24.0", 92 | "nanoid": "^2.0.1", 93 | "read-chunk": "^3.0.0", 94 | "remote": "^0.2.6", 95 | "sqlite3": "^4.0.6", 96 | "update-electron-app": "^1.3.0", 97 | "util": "^0.11.1", 98 | "uuid": "^3.3.2", 99 | "vue": "^2.5.16", 100 | "vue-electron": "^1.0.6", 101 | "vue-fontawesome": "0.0.2", 102 | "vue-router": "^3.0.1", 103 | "vue-shortkey": "^3.1.6", 104 | "vue-tippy": "^2.1.0", 105 | "vuex": "^3.0.1", 106 | "vuex-electron": "^1.0.0" 107 | }, 108 | "devDependencies": { 109 | "ajv": "^6.5.0", 110 | "babel-core": "^6.26.3", 111 | "babel-eslint": "^8.2.3", 112 | "babel-loader": "^7.1.4", 113 | "babel-plugin-istanbul": "^4.1.6", 114 | "babel-plugin-transform-runtime": "^6.23.0", 115 | "babel-preset-env": "^1.7.0", 116 | "babel-preset-stage-0": "^6.24.1", 117 | "babel-register": "^6.26.0", 118 | "babili-webpack-plugin": "^0.1.2", 119 | "cfonts": "^2.1.2", 120 | "chai": "^4.1.2", 121 | "chalk": "^2.4.1", 122 | "copy-webpack-plugin": "^4.5.1", 123 | "cross-env": "^5.1.6", 124 | "css-loader": "^0.28.11", 125 | "del": "^3.0.0", 126 | "devtron": "^1.4.0", 127 | "electron": "^4.0.6", 128 | "electron-builder": "^20.40.2", 129 | "electron-debug": "^1.5.0", 130 | "electron-devtools-installer": "^2.2.4", 131 | "eslint": "^4.19.1", 132 | "eslint-config-airbnb-base": "^12.1.0", 133 | "eslint-friendly-formatter": "^4.0.1", 134 | "eslint-import-resolver-webpack": "^0.10.0", 135 | "eslint-loader": "^2.0.0", 136 | "eslint-plugin-html": "^4.0.3", 137 | "eslint-plugin-import": "^2.12.0", 138 | "file-loader": "^1.1.11", 139 | "html-webpack-plugin": "^3.2.0", 140 | "inject-loader": "^4.0.1", 141 | "karma": "^2.0.2", 142 | "karma-chai": "^0.1.0", 143 | "karma-coverage": "^1.1.2", 144 | "karma-electron": "^6.0.0", 145 | "karma-mocha": "^1.3.0", 146 | "karma-sourcemap-loader": "^0.3.7", 147 | "karma-spec-reporter": "^0.0.32", 148 | "karma-webpack": "^3.0.0", 149 | "mini-css-extract-plugin": "0.4.0", 150 | "mocha": "^5.2.0", 151 | "multispinner": "^0.2.1", 152 | "node-loader": "^0.6.0", 153 | "node-sass": "^4.12.0", 154 | "sass-loader": "^7.0.3", 155 | "style-loader": "^0.21.0", 156 | "url-loader": "^1.0.1", 157 | "vue-html-loader": "^1.2.4", 158 | "vue-loader": "^15.2.4", 159 | "vue-style-loader": "^4.1.0", 160 | "vue-template-compiler": "^2.5.16", 161 | "webpack": "^4.15.1", 162 | "webpack-cli": "^3.0.8", 163 | "webpack-dev-server": "^3.1.4", 164 | "webpack-hot-middleware": "^2.22.2", 165 | "webpack-merge": "^4.1.3" 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /src/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cache Monkey 6 | <% if (htmlWebpackPlugin.options.nodeModules) { %> 7 | 8 | 11 | <% } %> 12 | 13 | 14 |
15 | 16 | <% if (!process.browser) { %> 17 | 20 | <% } %> 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/logic/database/dao.js: -------------------------------------------------------------------------------- 1 | const sqlite3 = require('sqlite3') 2 | const Promise = require('bluebird') 3 | const nanoid = require('nanoid') 4 | 5 | // import models 6 | const Core = require('./models/core.model').default 7 | 8 | class database { 9 | 10 | constructor(dbName, memory = false) { 11 | 12 | // definitions 13 | this.memory = memory 14 | this.dbName = dbName 15 | this.dbFolderPath = '' 16 | this.models = { 17 | Core, 18 | } 19 | // if the folder path does not contain a trailing slash, add it. 20 | if (this.dbFolderPath.slice(this.dbFolderPath.length - 1, this.dbFolderPath.length) !== '/') { 21 | this.dbFolderPath = this.dbFolderPath + '/' 22 | } 23 | // combine the name with the path and call the connect method 24 | this.dbPath = this.dbFolderPath + this.dbName 25 | } 26 | 27 | connect() { 28 | return new Promise((resolve, reject) => { 29 | this.db = new sqlite3.Database(this.memory ? ':memory:' : this.dbPath, (err) => { 30 | if (err) { 31 | console.log('Could not connect to database', err) 32 | // if no database found, create using model 33 | this.createDB().then(resolve).catch(err => reject(err)) 34 | } else { 35 | console.log(`Connected to database: ${this.dbName} via ${this.memory ? 'memory' : 'disk'}.`) 36 | if (this.memory) this.createDB() 37 | resolve() 38 | } 39 | 40 | }) 41 | }) 42 | } 43 | 44 | createDB() { 45 | return new Promise((resolve, reject) => { 46 | // create the database using model 47 | let model = this.models[this.dbName] 48 | 49 | if (!model) return reject('model_not_found'); 50 | if (!model.tables) return reject('tables_not_found'); 51 | 52 | for (let table of model.tables) { 53 | 54 | let parameters = [] 55 | 56 | // begin the query string 57 | let query = `CREATE TABLE IF NOT EXISTS ${table.name} (` 58 | for (let column of table.columns) { 59 | 60 | // define the name & type 61 | let param = `${column.name} ${column.type}` 62 | 63 | // append any additional options 64 | if (column.primaryKey) param = param + ` PRIMARY KEY` 65 | if (column.autoIncrement) param = param + ` AUTOINCREMENT` 66 | // push the string to an array 67 | parameters.push(param) 68 | } 69 | // convert the array into a string 70 | query = query + parameters.join(', ') + `)`; 71 | 72 | console.log(query); 73 | 74 | // run the query 75 | this.db.serialize(() => this.db.run(query)) 76 | } 77 | // this.db.close() 78 | resolve() 79 | }) 80 | } 81 | 82 | newRow(table, template) { 83 | return new Promise((resolve, reject) => { 84 | const id = nanoid() 85 | const model = this.models[this.dbName].tables.find(model => model.name === table) 86 | 87 | // Non negotiable 88 | template.id = id 89 | template.dateCreated = new Date() 90 | 91 | // VALIDATION: iterate over the columns in the model 92 | for (let column of model.columns) { 93 | // apply defaults 94 | if (column.hasOwnProperty('default') && !template.hasOwnProperty(column.name)) template[column.name] = column.default 95 | } 96 | 97 | // VALIDATION: iterate over the properties in the template 98 | const keys = Object.keys(template) 99 | for (let key of keys) { 100 | // verify the key exists in the model 101 | let column = model.columns.find(column => column.name === key) 102 | if (!column) return reject(`${key} was not found on model ${model.name}`) 103 | // fail if trying to assign primary key 104 | // if (column.primaryKey) return reject(`Can not assign primary key on model ${model.name}`) 105 | } 106 | 107 | // parse the template 108 | const parsedTemplate = keys.join(', '); 109 | // add a question mark for the values in the query 110 | const values = Array.from('?'.repeat(keys.length)).join(','); 111 | 112 | this.db.serialize(async () => { 113 | const query = this.db.prepare(`INSERT INTO ${table} (${parsedTemplate}) VALUES (${values})`); 114 | console.log(...Object.values(template)) 115 | query.run(...Object.values(template)); 116 | 117 | query.finalize(res => { 118 | console.log(this.lastID) 119 | }); 120 | }); 121 | 122 | resolve(template) 123 | }) 124 | } 125 | } 126 | 127 | export default database -------------------------------------------------------------------------------- /src/logic/database/database.js: -------------------------------------------------------------------------------- 1 | let Promise = require('bluebird') 2 | let sqlite3 = require('sqlite3').verbose(); 3 | let db = new sqlite3.Database(':memory:'); 4 | 5 | // db.serialize(() => { 6 | // db.run("CREATE TABLE lorem (info TEXT)"); 7 | 8 | // let stmt = db.prepare("INSERT INTO lorem VALUES (?)"); 9 | // for (let i = 0; i < 10; i++) { 10 | // stmt.run("Ipsum " + i); 11 | // } 12 | // stmt.finalize(); 13 | 14 | // db.each("SELECT rowid AS id, info FROM lorem", (err, row) => { 15 | // console.log(row.id + ": " + row.info); 16 | // }); 17 | // }); 18 | 19 | db.serialize(() => { 20 | db.run(`CREATE TABLE IF NOT EXISTS drives ( 21 | id INTEGER PRIMARY KEY AUTOINCREMENT, 22 | name TEXT, 23 | size TEXT 24 | )`); 25 | 26 | let stmt = db.prepare("INSERT INTO drives (name, size) VALUES (?, ?)"); 27 | for (let i = 0; i < 10; i++) { 28 | stmt.run("NAME: " + i, "SIZE: " + i); 29 | } 30 | stmt.finalize(); 31 | 32 | db.each("SELECT id, name, size FROM drives", (err, row) => { 33 | console.log([row.id, row.name, row.size]); 34 | }); 35 | }); 36 | db.close() 37 | 38 | export default { 39 | saveDrives: async drives => { 40 | db.serialize(() => { 41 | 42 | let stmt = db.prepare("INSERT INTO lorem VALUES (?)"); 43 | for (let i = 0; i < 10; i++) { 44 | stmt.run("Ipsum " + i); 45 | } 46 | stmt.finalize(); 47 | }); 48 | db.close(); 49 | } 50 | } -------------------------------------------------------------------------------- /src/logic/database/models/core.model.js: -------------------------------------------------------------------------------- 1 | export default { 2 | tables: [{ 3 | name: 'user', 4 | columns: [{ 5 | name: 'id', 6 | type: 'TEXT', 7 | primaryKey: true, 8 | }, 9 | { 10 | name: 'name', 11 | type: 'TEXT' 12 | }, 13 | { 14 | name: 'email', 15 | type: 'TEXT' 16 | }, 17 | { 18 | name: 'dateCreated', 19 | type: 'DATE', 20 | } 21 | ] 22 | }, 23 | { 24 | name: 'logs', 25 | columns: [{ 26 | name: 'id', 27 | type: 'TEXT', 28 | primaryKey: true, 29 | }, 30 | { 31 | name: 'name', 32 | type: 'TEXT' 33 | }, 34 | { 35 | name: 'email', 36 | type: 'TEXT' 37 | }, 38 | { 39 | name: 'dateCreated', 40 | type: 'DATE', 41 | } 42 | ] 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /src/main/index.dev.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is used specifically and only for development. It installs 3 | * `electron-debug` & `vue-devtools`. There shouldn't be any need to 4 | * modify this file, but it can be used to extend your development 5 | * environment. 6 | */ 7 | 8 | /* eslint-disable */ 9 | 10 | // Install `electron-debug` with `devtron` 11 | require('electron-debug')({ showDevTools: true }) 12 | 13 | // Install `vue-devtools` 14 | require('electron').app.on('ready', () => { 15 | let installExtension = require('electron-devtools-installer') 16 | installExtension.default(installExtension.VUEJS_DEVTOOLS) 17 | .then(() => {}) 18 | .catch(err => { 19 | console.log('Unable to install `vue-devtools`: \n', err) 20 | }) 21 | }) 22 | 23 | // Require `main` process to boot app 24 | require('./index') -------------------------------------------------------------------------------- /src/main/index.js: -------------------------------------------------------------------------------- 1 | import { app, BrowserWindow, dialog } from "electron"; // eslint-disable-line 2 | import { autoUpdater } from "electron-updater"; 3 | import Vue from "vue"; 4 | /** 5 | * Set `__static` path to static files in production 6 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html 7 | */ 8 | if (process.env.NODE_ENV !== "development") { 9 | global.__static = require("path") 10 | .join(__dirname, "/static") 11 | .replace(/\\/g, "\\\\"); // eslint-disable-line 12 | } 13 | 14 | let mainWindow; 15 | const winURL = 16 | process.env.NODE_ENV === "development" 17 | ? "http://localhost:9080" 18 | : `file://${__dirname}/index.html`; 19 | 20 | function createWindow() { 21 | /** 22 | * Initial window options 23 | */ 24 | mainWindow = new BrowserWindow({ 25 | height: 619, 26 | useContentSize: true, 27 | width: 1093, 28 | frame: false, 29 | title: "CacheMonkey", 30 | webPreferences: { 31 | devTools: true, 32 | webSecurity: false 33 | } 34 | }); 35 | 36 | mainWindow.loadURL(winURL); 37 | 38 | mainWindow.on("closed", () => { 39 | mainWindow = null; 40 | }); 41 | } 42 | 43 | app.on("ready", () => { 44 | createWindow(); 45 | autoUpdater.checkForUpdates(); 46 | }); 47 | 48 | app.on("window-all-closed", () => { 49 | if (process.platform !== "darwin") { 50 | app.quit(); 51 | } 52 | }); 53 | 54 | app.on("activate", () => { 55 | if (mainWindow === null) { 56 | createWindow(); 57 | } 58 | }); 59 | 60 | app.updateDownloaded = false; 61 | app.updateFailed = false; 62 | 63 | autoUpdater.on("update-available", info => { 64 | app.updateDownloading = true; 65 | autoUpdater.downloadUpdate(); 66 | }); 67 | 68 | autoUpdater.on("update-downloaded", info => { 69 | app.updateDownloaded = true; 70 | 71 | try { 72 | autoUpdater.quitAndInstall(); 73 | } catch (error) { 74 | console.error('Updated failed', error); 75 | app.updateFailed = true; 76 | } 77 | }); 78 | 79 | app.reloadApp = () => { 80 | autoUpdater.quitAndInstall(); 81 | }; 82 | 83 | // app.getPath('temp') 84 | 85 | /** 86 | * Auto Updater 87 | * 88 | * Uncomment the following code below and install `electron-updater` to 89 | * support auto updating. Code Signing with a valid certificate is required. 90 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating 91 | import { autoUpdater } from 'electron-updater' 92 | */ 93 | 94 | // autoUpdater.checkForUpdatesAndNotify(); 95 | 96 | // app.on("ready", () => { 97 | 98 | // autoUpdater.checkForUpdates(); 99 | // }); 100 | 101 | // autoUpdater.on("update-available", info => {}); 102 | 103 | // autoUpdater.on("update-downloaded", info => {}); 104 | 105 | // autoUpdater.on("checking-for-update", () => { 106 | // dialog.showMessageBox({ 107 | // type: "info", 108 | // title: "Checking for updates", 109 | // message: `Checking for updates...\nFeed URL: ${autoUpdater.getFeedURL()}\nCurrent: ${ 110 | // autoUpdater.currentVersion 111 | // }` 112 | // }); 113 | // }); 114 | // autoUpdater.on("update-available", info => { 115 | // dialog.showMessageBox( 116 | // { 117 | // type: "info", 118 | // title: "Update Available", 119 | // message: `New update available, would you like to update now?\n\nVersion: ${ 120 | // info.version 121 | // }`, 122 | // buttons: ["Yes", "No"] 123 | // }, 124 | // buttonIndex => { 125 | // if (buttonIndex == 0) { 126 | // autoUpdater.downloadUpdate(); 127 | // } 128 | // } 129 | // ); 130 | // }); 131 | // autoUpdater.on("error", error => { 132 | // dialog.showErrorBox( 133 | // "Error: ", 134 | // error == null ? "unknown" : (error.stack || error).toString() 135 | // ); 136 | // }); 137 | 138 | // autoUpdater.on("update-not-available", info => { 139 | // dialog.showMessageBox({ 140 | // title: "No Updates", 141 | // message: `Current version is already up-to-date\n\nVersion: ${info.version}` 142 | // }); 143 | // }); 144 | 145 | // autoUpdater.on("update-downloaded", info => { 146 | // dialog.showMessageBox( 147 | // { 148 | // title: "Updates Downloaded", 149 | // message: `Updates successfully downloaded, application will now quit...\n\nVersion: ${ 150 | // info.version 151 | // }` 152 | // }, 153 | // () => { 154 | // setImmediate(() => autoUpdate.quitAndInstall()); 155 | // } 156 | // ); 157 | // }); 158 | 159 | setInterval(() => { 160 | // Check for updates every 30 minutes 161 | // Do more with this in the events above this should only call the check for updates function. 162 | 163 | // USE THIS FOR THE DOWNLOAD PROGRESS FOR A PROGRESS BAR (ECT) 164 | // https://www.electron.build/auto-update#event-download-progress 165 | autoUpdater.checkForUpdates(); 166 | }, 1800000); 167 | -------------------------------------------------------------------------------- /src/renderer/App.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 647 | 1006 | -------------------------------------------------------------------------------- /src/renderer/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/assets/.gitkeep -------------------------------------------------------------------------------- /src/renderer/assets/CacheMonkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/assets/CacheMonkey.png -------------------------------------------------------------------------------- /src/renderer/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/assets/logo.png -------------------------------------------------------------------------------- /src/renderer/assets/monkey.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/renderer/assets/monkey_cover_ears.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/renderer/assets/monkey_cover_eyes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/renderer/assets/monkey_cover_mouth.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/renderer/assets/osx_zoom.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/renderer/components/Alerts.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 58 | 59 | 136 | -------------------------------------------------------------------------------- /src/renderer/components/ConfirmModal.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 76 | 77 | 219 | -------------------------------------------------------------------------------- /src/renderer/components/FileView.vue: -------------------------------------------------------------------------------- 1 | 91 | 92 | 220 | 221 | 249 | -------------------------------------------------------------------------------- /src/renderer/components/Info.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 65 | 66 | 77 | -------------------------------------------------------------------------------- /src/renderer/components/Input.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 47 | 48 | 124 | 125 | -------------------------------------------------------------------------------- /src/renderer/components/LandingPage.vue: -------------------------------------------------------------------------------- 1 | 133 | 134 | 383 | 384 | 539 | -------------------------------------------------------------------------------- /src/renderer/components/Modal.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 69 | 70 | 204 | -------------------------------------------------------------------------------- /src/renderer/components/Settings.vue: -------------------------------------------------------------------------------- 1 | 90 | 91 | 431 | 432 | 434 | -------------------------------------------------------------------------------- /src/renderer/components/Sidebar/Sidebar.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 54 | 55 | 100 | -------------------------------------------------------------------------------- /src/renderer/components/SlidePanel.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | 24 | 39 | -------------------------------------------------------------------------------- /src/renderer/components/TrafficLights.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 67 | 68 | 181 | -------------------------------------------------------------------------------- /src/renderer/components/WindowsButtons.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 29 | 30 | 52 | 53 | 90 | -------------------------------------------------------------------------------- /src/renderer/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import axios from "axios"; 3 | 4 | import App from "./App"; 5 | import router from "./router"; 6 | import store from "./store"; 7 | 8 | // import '../logic/database/database'; 9 | // Font Awesome Libraries 10 | import { library } from "@fortawesome/fontawesome-svg-core"; 11 | import { 12 | faEnvelope, 13 | faMagic, 14 | faHeart, 15 | faCog, 16 | faTrash, 17 | faFolderOpen 18 | } from "@fortawesome/free-solid-svg-icons"; 19 | import { 20 | faTwitter, 21 | faLinkedinIn, 22 | faTwitch 23 | } from "@fortawesome/free-brands-svg-icons"; 24 | import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; 25 | 26 | library.add({ 27 | faTwitter, 28 | faLinkedinIn, 29 | faTwitch, 30 | faEnvelope, 31 | faMagic, 32 | faHeart, 33 | faCog, 34 | faFolderOpen, 35 | faTrash 36 | }); 37 | 38 | Vue.component("icon", FontAwesomeIcon); 39 | 40 | import vshortkey from "vue-shortkey"; 41 | Vue.use(vshortkey); 42 | 43 | // Vue Tippy 44 | import VueTippy from "vue-tippy"; 45 | Vue.use(VueTippy); 46 | 47 | // import dao from '../logic/database/dao' 48 | 49 | // const CoreDB = new dao('Core', true); 50 | // CoreDB.connect().then(() => { 51 | // CoreDB.newRow('user', { 52 | // name: 'Jamie', 53 | // email: 'jamie@notify.me' 54 | // }).then() 55 | // }) 56 | 57 | if (!process.env.IS_WEB) Vue.use(require("vue-electron")); 58 | Vue.http = Vue.prototype.$http = axios; 59 | Vue.config.productionTip = false; 60 | 61 | /* eslint-disable no-new */ 62 | new Vue({ 63 | components: { 64 | App 65 | }, 66 | router, 67 | store, 68 | template: "" 69 | }).$mount("#app"); 70 | -------------------------------------------------------------------------------- /src/renderer/monkey.js: -------------------------------------------------------------------------------- 1 | import store from "./store"; 2 | -------------------------------------------------------------------------------- /src/renderer/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | 4 | Vue.use(Router); 5 | 6 | export default new Router({ 7 | routes: [ 8 | { 9 | path: '/home', 10 | name: 'home', 11 | component: require('@/components/LandingPage').default, 12 | }, 13 | { 14 | path: '/settings', 15 | name: 'settings', 16 | component: require('@/components/Settings').default, 17 | }, 18 | { 19 | path: '/info', 20 | name: 'info', 21 | component: require('@/components/Info').default, 22 | }, 23 | { 24 | path: '*', 25 | redirect: '/home', 26 | }, 27 | ], 28 | }); 29 | -------------------------------------------------------------------------------- /src/renderer/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Vuex from "vuex"; 3 | 4 | import { createPersistedState, createSharedMutations } from "vuex-electron"; 5 | 6 | import modules from "./modules"; 7 | 8 | Vue.use(Vuex); 9 | 10 | export default new Vuex.Store({ 11 | strict: false, 12 | modules, 13 | state: { 14 | updateReady: false, 15 | processing: false, 16 | fileIndex: {}, 17 | scan: [], 18 | drives: [], 19 | dumpDirectory: "", 20 | watchDirectories: [], 21 | foundFiletypes: [], 22 | showPanel: true, 23 | viewingItem: false, 24 | picsDir: "", 25 | showModel: false, 26 | showConfirmModel: false, 27 | // task tracking 28 | currentTask: "Ready.", 29 | totalAnalysing: 0, 30 | totalAnalysed: 0, 31 | dumpScanComplete: false, 32 | dirScanComplete: false, 33 | watchBlocker: true, 34 | autoStart: false, 35 | // tooltips 36 | tooltipDefault: { 37 | placement: "top", 38 | arrow: true, 39 | animation: "fade", 40 | delay: [0, 0], 41 | duration: 0 42 | }, 43 | tooltipBottom: { 44 | placement: "bottom", 45 | arrow: true, 46 | animation: "fade", 47 | delay: [0, 0], 48 | duration: 0 49 | }, 50 | tooltipSidebar: { 51 | placement: "right", 52 | arrow: true, 53 | animation: "fade", 54 | delay: [0, 0], 55 | duration: 0 56 | }, 57 | tooltipLeft: { 58 | placement: "left", 59 | arrow: true, 60 | animation: "fade", 61 | delay: [0, 0], 62 | duration: 0 63 | } 64 | }, 65 | plugins: [ 66 | createPersistedState() 67 | // createSharedMutations(), 68 | ] 69 | }); 70 | -------------------------------------------------------------------------------- /src/renderer/store/modules/Counter.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | main: 0, 3 | }; 4 | 5 | const mutations = { 6 | DECREMENT_MAIN_COUNTER(state) { 7 | state.main -= 1; 8 | }, 9 | INCREMENT_MAIN_COUNTER(state) { 10 | state.main += 1; 11 | }, 12 | }; 13 | 14 | const actions = { 15 | someAsyncTask({ commit }) { 16 | // do something async 17 | commit('INCREMENT_MAIN_COUNTER'); 18 | }, 19 | }; 20 | 21 | export default { 22 | state, 23 | mutations, 24 | actions, 25 | }; 26 | -------------------------------------------------------------------------------- /src/renderer/store/modules/Themes.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | theme: "dark", 3 | // define styles here 4 | themes: { 5 | light: { 6 | sidebar: "#efefef", 7 | background: "#f1f1f1", 8 | main: "#f1f1f1", 9 | box: "#e6e6e6", 10 | boxLight: "#e6e6e6", 11 | boxHover: "#ececec", 12 | text: "#181818", 13 | avatar: "#f3f3f3", 14 | avatarActive: "#f5f5f5", 15 | shadow: "rgba(19, 19, 19, 0.09)", 16 | searchBackground: "#dadada", 17 | searchBorder: "rgba(216, 216, 216, 0)", 18 | headings: "#181818", 19 | faintText: "#535353", 20 | windowsBar: "#c6c6c6" 21 | }, 22 | dark: { 23 | sidebar: "#202020", 24 | background: "#181818", 25 | main: "#1a1a1a", 26 | box: "#202020", 27 | boxLight: "#292929", 28 | boxHover: "#242424", 29 | avatar: "#313131", 30 | avatarActive: "#484848", 31 | text: "#fff", 32 | shadow: "rgba(0, 0, 0, 0.38)", 33 | searchBackground: "#1d1d1d", 34 | searchBorder: "#171717", 35 | faintText: "#535353", 36 | headings: "#a5a5a5", 37 | filterBar: "#1b1b1b", 38 | windowsBar: "#181818" 39 | } 40 | } 41 | }; 42 | const mutations = { 43 | CHANGE_THEME(state, theme) { 44 | state.theme = theme; 45 | } 46 | }; 47 | 48 | const actions = { 49 | toggleDark({ commit, state }) { 50 | let theme; 51 | if (state.theme === "light") theme = "dark"; 52 | else theme = "light"; 53 | commit("CHANGE_THEME", theme); 54 | } 55 | }; 56 | 57 | const getters = { 58 | getThemeName: state => state.theme, 59 | getTheme: state => state.themes[state.theme] 60 | }; 61 | 62 | export default { 63 | state, 64 | mutations, 65 | getters, 66 | actions 67 | }; 68 | -------------------------------------------------------------------------------- /src/renderer/store/modules/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The file enables `@/store/index.js` to import all vuex modules 3 | * in a one-shot manner. There should not be any reason to edit this file. 4 | */ 5 | 6 | const files = require.context('.', false, /\.js$/); 7 | const modules = {}; 8 | 9 | files.keys().forEach((key) => { 10 | if (key === './index.js') return; 11 | modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default; 12 | }); 13 | 14 | export default modules; 15 | -------------------------------------------------------------------------------- /src/renderer/store/request.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/store/request.js -------------------------------------------------------------------------------- /src/renderer/store/routes.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/store/routes.js -------------------------------------------------------------------------------- /src/renderer/store/socket.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/src/renderer/store/socket.js -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamiepine/cache-monkey/e6d842cadf0eb80efcd37672a2ee6e6cda7ac1a2/static/.gitkeep -------------------------------------------------------------------------------- /test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "assert": true, 7 | "expect": true, 8 | "should": true, 9 | "__static": true 10 | }, 11 | "rules": { 12 | "func-names": 0, 13 | "prefer-arrow-callback": 0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | Vue.config.devtools = false 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src/renderer', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | const merge = require('webpack-merge') 5 | const webpack = require('webpack') 6 | 7 | const baseConfig = require('../../.electron-vue/webpack.renderer.config') 8 | const projectRoot = path.resolve(__dirname, '../../src/renderer') 9 | 10 | // Set BABEL_ENV to use proper preset config 11 | process.env.BABEL_ENV = 'test' 12 | 13 | let webpackConfig = merge(baseConfig, { 14 | devtool: '#inline-source-map', 15 | plugins: [ 16 | new webpack.DefinePlugin({ 17 | 'process.env.NODE_ENV': '"testing"' 18 | }) 19 | ] 20 | }) 21 | 22 | // don't treat dependencies as externals 23 | delete webpackConfig.entry 24 | delete webpackConfig.externals 25 | delete webpackConfig.output.libraryTarget 26 | 27 | // apply vue option to apply isparta-loader on js 28 | webpackConfig.module.rules 29 | .find(rule => rule.use.loader === 'vue-loader').use.options.loaders.js = 'babel-loader' 30 | 31 | module.exports = config => { 32 | config.set({ 33 | browsers: ['visibleElectron'], 34 | client: { 35 | useIframe: false 36 | }, 37 | coverageReporter: { 38 | dir: './coverage', 39 | reporters: [ 40 | { type: 'lcov', subdir: '.' }, 41 | { type: 'text-summary' } 42 | ] 43 | }, 44 | customLaunchers: { 45 | 'visibleElectron': { 46 | base: 'Electron', 47 | flags: ['--show'] 48 | } 49 | }, 50 | frameworks: ['mocha', 'chai'], 51 | files: ['./index.js'], 52 | preprocessors: { 53 | './index.js': ['webpack', 'sourcemap'] 54 | }, 55 | reporters: ['spec', 'coverage'], 56 | singleRun: true, 57 | webpack: webpackConfig, 58 | webpackMiddleware: { 59 | noInfo: true 60 | } 61 | }) 62 | } 63 | -------------------------------------------------------------------------------- /test/unit/specs/LandingPage.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import LandingPage from '@/components/LandingPage'; 3 | 4 | describe('LandingPage.vue', () => { 5 | it('should render correct contents', () => { 6 | const vm = new Vue({ 7 | el: document.createElement('div'), 8 | render: h => h(LandingPage), 9 | }).$mount(); 10 | 11 | expect(vm.$el.querySelector('.title').textContent).to.contain('Welcome to your new project!'); 12 | }); 13 | }); 14 | --------------------------------------------------------------------------------