Full Code of LanceGin/QBox for AI

master e318f8a14186 cached
49 files
122.3 KB
32.5k tokens
39 symbols
1 requests
Download .txt
Repository: LanceGin/QBox
Branch: master
Commit: e318f8a14186
Files: 49
Total size: 122.3 KB

Directory structure:
gitextract_2rr1couu/

├── .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
├── README_zh.md
├── appveyor.yml
├── build/
│   └── icons/
│       └── icon.icns
├── package.json
├── src/
│   ├── index.ejs
│   ├── main/
│   │   ├── index.dev.js
│   │   └── index.js
│   └── renderer/
│       ├── App.vue
│       ├── assets/
│       │   └── .gitkeep
│       ├── components/
│       │   ├── About.vue
│       │   ├── BucketHeader.vue
│       │   ├── BucketList.vue
│       │   ├── FileList.vue
│       │   ├── LandingPage/
│       │   │   └── SystemInformation.vue
│       │   ├── LandingPage.vue
│       │   ├── ManageTool.vue
│       │   └── NoBucket.vue
│       ├── main.js
│       ├── pages/
│       │   ├── Bucket.vue
│       │   ├── Login.vue
│       │   ├── Manage.vue
│       │   └── Upload.vue
│       ├── router/
│       │   └── index.js
│       ├── store/
│       │   ├── index.js
│       │   └── modules/
│       │       ├── Counter.js
│       │       └── index.js
│       └── utils/
│           ├── bus.js
│           ├── put_policy.js
│           ├── qiniu.js
│           └── util.js
├── static/
│   ├── .gitkeep
│   └── style/
│       └── iconfont.css
└── test/
    ├── .eslintrc
    └── unit/
        ├── index.js
        ├── karma.conf.js
        └── specs/
            └── LandingPage.spec.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .babelrc
================================================
{
  "comments": false,
  "env": {
    "test": {
      "presets": [
        ["env", {
          "targets": { "node": 7 }
        }],
        "stage-0"
      ],
      "plugins": ["istanbul"]
    },
    "main": {
      "presets": [
        ["env", {
          "targets": { "node": 7 }
        }],
        "stage-0"
      ]
    },
    "renderer": {
      "presets": [
        ["env", {
          "modules": false
        }],
        "stage-0"
      ]
    },
    "web": {
      "presets": [
        ["env", {
          "modules": false
        }],
        "stage-0"
      ]
    }
  },
  "plugins": ["transform-runtime"]
}


================================================
FILE: .electron-vue/build.js
================================================
'use strict'

process.env.NODE_ENV = 'production'

const { say } = require('cfonts')
const chalk = require('chalk')
const del = require('del')
const { spawn } = require('child_process')
const webpack = require('webpack')
const Multispinner = require('multispinner')


const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')
const webConfig = require('./webpack.web.config')

const doneLog = chalk.bgGreen.white(' DONE ') + ' '
const errorLog = chalk.bgRed.white(' ERROR ') + ' '
const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
const isCI = process.env.CI || false

if (process.env.BUILD_TARGET === 'clean') clean()
else if (process.env.BUILD_TARGET === 'web') web()
else build()

function clean () {
  del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
  console.log(`\n${doneLog}\n`)
  process.exit()
}

function build () {
  greeting()

  del.sync(['dist/electron/*', '!.gitkeep'])

  const tasks = ['main', 'renderer']
  const m = new Multispinner(tasks, {
    preText: 'building',
    postText: 'process'
  })

  let results = ''

  m.on('success', () => {
    process.stdout.write('\x1B[2J\x1B[0f')
    console.log(`\n\n${results}`)
    console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
    process.exit()
  })

  pack(mainConfig).then(result => {
    results += result + '\n\n'
    m.success('main')
  }).catch(err => {
    m.error('main')
    console.log(`\n  ${errorLog}failed to build main process`)
    console.error(`\n${err}\n`)
    process.exit(1)
  })

  pack(rendererConfig).then(result => {
    results += result + '\n\n'
    m.success('renderer')
  }).catch(err => {
    m.error('renderer')
    console.log(`\n  ${errorLog}failed to build renderer process`)
    console.error(`\n${err}\n`)
    process.exit(1)
  })
}

function pack (config) {
  return new Promise((resolve, reject) => {
    webpack(config, (err, stats) => {
      if (err) reject(err.stack || err)
      else if (stats.hasErrors()) {
        let err = ''

        stats.toString({
          chunks: false,
          colors: true
        })
        .split(/\r?\n/)
        .forEach(line => {
          err += `    ${line}\n`
        })

        reject(err)
      } else {
        resolve(stats.toString({
          chunks: false,
          colors: true
        }))
      }
    })
  })
}

function web () {
  del.sync(['dist/web/*', '!.gitkeep'])
  webpack(webConfig, (err, stats) => {
    if (err || stats.hasErrors()) console.log(err)

    console.log(stats.toString({
      chunks: false,
      colors: true
    }))

    process.exit()
  })
}

function greeting () {
  const cols = process.stdout.columns
  let text = ''

  if (cols > 85) text = 'lets-build'
  else if (cols > 60) text = 'lets-|build'
  else text = false

  if (text && !isCI) {
    say(text, {
      colors: ['yellow'],
      font: 'simple3d',
      space: false
    })
  } else console.log(chalk.yellow.bold('\n  lets-build'))
  console.log()
}


================================================
FILE: .electron-vue/dev-client.js
================================================
const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')

hotClient.subscribe(event => {
  /**
   * Reload browser when HTMLWebpackPlugin emits a new index.html
   */
  if (event.action === 'reload') {
    window.location.reload()
  }

  /**
   * Notify `mainWindow` when `main` process is compiling,
   * giving notice for an expected reload of the `electron` process
   */
  if (event.action === 'compiling') {
    document.body.innerHTML += `
      <style>
        #dev-client {
          background: #4fc08d;
          border-radius: 4px;
          bottom: 20px;
          box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
          color: #fff;
          font-family: 'Source Sans Pro', sans-serif;
          left: 20px;
          padding: 8px 12px;
          position: absolute;
        }
      </style>

      <div id="dev-client">
        Compiling Main Process...
      </div>
    `
  }
})


================================================
FILE: .electron-vue/dev-runner.js
================================================
'use strict'

const chalk = require('chalk')
const electron = require('electron')
const path = require('path')
const { say } = require('cfonts')
const { spawn } = require('child_process')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const webpackHotMiddleware = require('webpack-hot-middleware')

const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')

let electronProcess = null
let manualRestart = false
let hotMiddleware

function logStats (proc, data) {
  let log = ''

  log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`)
  log += '\n\n'

  if (typeof data === 'object') {
    data.toString({
      colors: true,
      chunks: false
    }).split(/\r?\n/).forEach(line => {
      log += '  ' + line + '\n'
    })
  } else {
    log += `  ${data}\n`
  }

  log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'

  console.log(log)
}

function startRenderer () {
  return new Promise((resolve, reject) => {
    rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)

    const compiler = webpack(rendererConfig)
    hotMiddleware = webpackHotMiddleware(compiler, { 
      log: false, 
      heartbeat: 2500 
    })

    compiler.plugin('compilation', compilation => {
      compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => {
        hotMiddleware.publish({ action: 'reload' })
        cb()
      })
    })

    compiler.plugin('done', stats => {
      logStats('Renderer', stats)
    })

    const server = new WebpackDevServer(
      compiler,
      {
        contentBase: path.join(__dirname, '../'),
        quiet: true,
        setup (app, ctx) {
          app.use(hotMiddleware)
          ctx.middleware.waitUntilValid(() => {
            resolve()
          })
        }
      }
    )

    server.listen(9080)
  })
}

function startMain () {
  return new Promise((resolve, reject) => {
    mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)

    const compiler = webpack(mainConfig)

    compiler.plugin('watch-run', (compilation, done) => {
      logStats('Main', chalk.white.bold('compiling...'))
      hotMiddleware.publish({ action: 'compiling' })
      done()
    })

    compiler.watch({}, (err, stats) => {
      if (err) {
        console.log(err)
        return
      }

      logStats('Main', stats)

      if (electronProcess && electronProcess.kill) {
        manualRestart = true
        process.kill(electronProcess.pid)
        electronProcess = null
        startElectron()

        setTimeout(() => {
          manualRestart = false
        }, 5000)
      }

      resolve()
    })
  })
}

function startElectron () {
  electronProcess = spawn(electron, ['--inspect=5858', path.join(__dirname, '../dist/electron/main.js')])

  electronProcess.stdout.on('data', data => {
    electronLog(data, 'blue')
  })
  electronProcess.stderr.on('data', data => {
    electronLog(data, 'red')
  })

  electronProcess.on('close', () => {
    if (!manualRestart) process.exit()
  })
}

function electronLog (data, color) {
  let log = ''
  data = data.toString().split(/\r?\n/)
  data.forEach(line => {
    log += `  ${line}\n`
  })
  if (/[0-9A-z]+/.test(log)) {
    console.log(
      chalk[color].bold('┏ Electron -------------------') +
      '\n\n' +
      log +
      chalk[color].bold('┗ ----------------------------') +
      '\n'
    )
  }
}

function greeting () {
  const cols = process.stdout.columns
  let text = ''

  if (cols > 104) text = 'electron-vue'
  else if (cols > 76) text = 'electron-|vue'
  else text = false

  if (text) {
    say(text, {
      colors: ['yellow'],
      font: 'simple3d',
      space: false
    })
  } else console.log(chalk.yellow.bold('\n  electron-vue'))
  console.log(chalk.blue('  getting ready...') + '\n')
}

function init () {
  greeting()

  Promise.all([startRenderer(), startMain()])
    .then(() => {
      startElectron()
    })
    .catch(err => {
      console.error(err)
    })
}

init()


================================================
FILE: .electron-vue/webpack.main.config.js
================================================
'use strict'

process.env.BABEL_ENV = 'main'

const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')

let mainConfig = {
  entry: {
    main: path.join(__dirname, '../src/main/index.js')
  },
  externals: [
    ...Object.keys(dependencies || {})
  ],
  module: {
    rules: [
      {
        test: /\.(js)$/,
        enforce: 'pre',
        exclude: /node_modules/,
        use: {
          loader: 'eslint-loader',
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        }
      },
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.node$/,
        use: 'node-loader'
      }
    ]
  },
  node: {
    __dirname: process.env.NODE_ENV !== 'production',
    __filename: process.env.NODE_ENV !== 'production'
  },
  output: {
    filename: '[name].js',
    libraryTarget: 'commonjs2',
    path: path.join(__dirname, '../dist/electron')
  },
  plugins: [
    new webpack.NoEmitOnErrorsPlugin()
  ],
  resolve: {
    extensions: ['.js', '.json', '.node']
  },
  target: 'electron-main'
}

/**
 * Adjust mainConfig for development settings
 */
if (process.env.NODE_ENV !== 'production') {
  mainConfig.plugins.push(
    new webpack.DefinePlugin({
      '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
    })
  )
}

/**
 * Adjust mainConfig for production settings
 */
if (process.env.NODE_ENV === 'production') {
  mainConfig.plugins.push(
    new BabiliWebpackPlugin({
      removeConsole: true,
      removeDebugger: true
    }),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    })
  )
}

module.exports = mainConfig


================================================
FILE: .electron-vue/webpack.renderer.config.js
================================================
'use strict'

process.env.BABEL_ENV = 'renderer'

const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

/**
 * List of node_modules to include in webpack bundle
 *
 * Required for specific packages like Vue UI libraries
 * that provide pure *.vue files that need compiling
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
 */
let whiteListedModules = ['vue']

let rendererConfig = {
  devtool: '#cheap-module-eval-source-map',
  entry: {
    renderer: path.join(__dirname, '../src/renderer/main.js')
  },
  externals: [
    ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
  ],
  module: {
    rules: [
      {
        test: /\.(js|vue)$/,
        enforce: 'pre',
        exclude: /node_modules/,
        use: {
          loader: 'eslint-loader',
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        }
      },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: 'css-loader'
        })
      },
      {
        test: /\.html$/,
        use: 'vue-html-loader'
      },
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.node$/,
        use: 'node-loader'
      },
      {
        test: /\.vue$/,
        use: {
          loader: 'vue-loader',
          options: {
            extractCSS: process.env.NODE_ENV === 'production',
            loaders: {
              sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
              scss: 'vue-style-loader!css-loader!sass-loader'
            }
          }
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          query: {
            limit: 10000,
            name: 'imgs/[name].[ext]'
          }
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          query: {
            limit: 10000,
            name: 'fonts/[name].[ext]'
          }
        }
      }
    ]
  },
  node: {
    __dirname: process.env.NODE_ENV !== 'production',
    __filename: process.env.NODE_ENV !== 'production'
  },
  plugins: [
    new ExtractTextPlugin('styles.css'),
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: path.resolve(__dirname, '../src/index.ejs'),
      minify: {
        collapseWhitespace: true,
        removeAttributeQuotes: true,
        removeComments: true
      },
      nodeModules: process.env.NODE_ENV !== 'production'
        ? path.resolve(__dirname, '../node_modules')
        : false
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin()
  ],
  output: {
    filename: '[name].js',
    libraryTarget: 'commonjs2',
    path: path.join(__dirname, '../dist/electron')
  },
  resolve: {
    alias: {
      '@': path.join(__dirname, '../src/renderer'),
      'vue$': 'vue/dist/vue.esm.js'
    },
    extensions: ['.js', '.vue', '.json', '.css', '.node']
  },
  target: 'electron-renderer'
}

/**
 * Adjust rendererConfig for development settings
 */
if (process.env.NODE_ENV !== 'production') {
  rendererConfig.plugins.push(
    new webpack.DefinePlugin({
      '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
    })
  )
}

/**
 * Adjust rendererConfig for production settings
 */
if (process.env.NODE_ENV === 'production') {
  rendererConfig.devtool = ''

  rendererConfig.plugins.push(
    new BabiliWebpackPlugin({
      removeConsole: true,
      removeDebugger: true
    }),
    new CopyWebpackPlugin([
      {
        from: path.join(__dirname, '../static'),
        to: path.join(__dirname, '../dist/electron/static'),
        ignore: ['.*']
      }
    ]),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  )
}

module.exports = rendererConfig


================================================
FILE: .electron-vue/webpack.web.config.js
================================================
'use strict'

process.env.BABEL_ENV = 'web'

const path = require('path')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

let webConfig = {
  devtool: '#cheap-module-eval-source-map',
  entry: {
    web: path.join(__dirname, '../src/renderer/main.js')
  },
  module: {
    rules: [
      {
        test: /\.(js|vue)$/,
        enforce: 'pre',
        exclude: /node_modules/,
        use: {
          loader: 'eslint-loader',
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        }
      },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: 'css-loader'
        })
      },
      {
        test: /\.html$/,
        use: 'vue-html-loader'
      },
      {
        test: /\.js$/,
        use: 'babel-loader',
        include: [ path.resolve(__dirname, '../src/renderer') ],
        exclude: /node_modules/
      },
      {
        test: /\.vue$/,
        use: {
          loader: 'vue-loader',
          options: {
            extractCSS: true,
            loaders: {
              sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
              scss: 'vue-style-loader!css-loader!sass-loader'
            }
          }
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          query: {
            limit: 10000,
            name: 'imgs/[name].[ext]'
          }
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          query: {
            limit: 10000,
            name: 'fonts/[name].[ext]'
          }
        }
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('styles.css'),
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: path.resolve(__dirname, '../src/index.ejs'),
      minify: {
        collapseWhitespace: true,
        removeAttributeQuotes: true,
        removeComments: true
      },
      nodeModules: false
    }),
    new webpack.DefinePlugin({
      'process.env.IS_WEB': 'true'
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin()
  ],
  output: {
    filename: '[name].js',
    path: path.join(__dirname, '../dist/web')
  },
  resolve: {
    alias: {
      '@': path.join(__dirname, '../src/renderer'),
      'vue$': 'vue/dist/vue.esm.js'
    },
    extensions: ['.js', '.vue', '.json', '.css']
  },
  target: 'web'
}

/**
 * Adjust webConfig for production settings
 */
if (process.env.NODE_ENV === 'production') {
  webConfig.devtool = ''

  webConfig.plugins.push(
    new BabiliWebpackPlugin({
      removeConsole: true,
      removeDebugger: true
    }),
    new CopyWebpackPlugin([
      {
        from: path.join(__dirname, '../static'),
        to: path.join(__dirname, '../dist/web/static'),
        ignore: ['.*']
      }
    ]),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  )
}

module.exports = webConfig


================================================
FILE: .eslintignore
================================================
test/unit/coverage/**
test/unit/*.js
test/e2e/*.js


================================================
FILE: .eslintrc.js
================================================
module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true,
    node: true
  },
  extends: 'airbnb-base',
  globals: {
    __static: true
  },
  plugins: [
    'html'
  ],
  'rules': {
    'global-require': 0,
    'import/no-unresolved': 0,
    'no-param-reassign': 0,
    'no-shadow': 0,
    'import/extensions': 0,
    'import/newline-after-import': 0,
    'no-multi-assign': 0,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'import/no-extraneous-dependencies': ["error", { devDependencies: true, }]
  }
}


================================================
FILE: .gitignore
================================================
.DS_Store
dist/electron/
dist/web/
build/
!build/icons
coverage
node_modules/
npm-debug.log
npm-debug.log.*
thumbs.db
!.gitkeep
package-lock.json
*.plist
*.sh


================================================
FILE: .travis.yml
================================================
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
osx_image: xcode8.3
sudo: required
dist: trusty
language: c
matrix:
  include:
  - os: osx
  - os: linux
    env: CC=clang CXX=clang++ npm_config_clang=1
    compiler: clang
cache:
  directories:
  - node_modules
  - "$HOME/.electron"
  - "$HOME/.cache"
addons:
  apt:
    packages:
    - libgnome-keyring-dev
    - icnsutils
    #- xvfb
before_install:
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
  "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
  | tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils; fi
install:
#- export DISPLAY=':99.0'
#- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- nvm install 7
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g xvfb-maybe
- yarn
script:
#- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js
- yarn run build
branches:
  only:
  - master


================================================
FILE: LICENSE
================================================
                    GNU AFFERO GENERAL PUBLIC LICENSE
                       Version 3, 19 November 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.

  A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate.  Many developers of free software are heartened and
encouraged by the resulting cooperation.  However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.

  The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community.  It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server.  Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.

  An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals.  This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU Affero General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Remote Network Interaction; Use with the GNU General Public License.

  Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software.  This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time.  Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source.  For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code.  There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.


================================================
FILE: README.md
================================================

# ![Qbox logo](http://orhcxc3kd.bkt.clouddn.com/logo-blue.png)

[![Build status](https://ci.appveyor.com/api/projects/status/soh7mapv45levrxy?svg=true)](https://ci.appveyor.com/project/LanceGin/qbox) [![Github All Releases](https://img.shields.io/github/downloads/lancegin/qbox/total.svg)]() [![Itunes App Store](https://img.shields.io/itunes/v/1267204866.svg)]() 


> QBox is a convenient manage tool for your [Qiniu](https://www.qiniu.com/) buckets. It is an open-source software and can be used on `OS X`, `Linux` and `Windows`, and it was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)

## Screenshots

#### Bucket Panel

![bucket panel](http://otwcctfiu.bkt.clouddn.com/bucket-panel.png)

#### Manage Panel

![bucket panel](http://otwcctfiu.bkt.clouddn.com/manage-panel.png)

#### Upload Panel

![bucket panel](http://otwcctfiu.bkt.clouddn.com/upload-panel.png)

## Feature

#### Bucket Panel

- [x] Login by setting `accessKey` and `secretKey`.
- [x] Logout by clearing localStorage (include `accessKey` and `secretKey`).
- [x] List all buckets (include private).
- [x] Manage files in a bucket, that will open a new `Manage Panel`.

#### Manage Panel

- [x] List all files in a specified bucket.
- [x] List all files with pagination.
- [x] Sort by `file name`, `file type`, `file size` or `modified time`.
- [x] Preview `image` and `media` file.
- [x] Delete a existing file.
- [x] Delete a batch of files were checked.
- [x] Copy the outer link of a file.
- [x] Refresh the files in the bucket.
- [x] Download a existing file.(this feature will be put in `preview` modal)
- [x] Upload a single file. 
- [x] Search filter.

## TODO

#### MenuBar

- [x] Set default bucket.
- [x] Drag to MenuBar icon to upload.

#### Bucket Panel

- [x] Delete a existing bucket.
- [x] Create a new bucket.

#### Manage Panel

- [x] Add enter event to search box.
- [ ] Upload mutiple files.
- [x] Download a batch of files were checked.
- [x] Rename resouces.

## License

[![license](https://img.shields.io/github/license/lancegin/qbox.svg)]()

## Contribute

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:9080
npm run dev

# build electron application for production
npm run build

# run unit tests (no tests now)
npm test

# lint all JS/Vue component files in `src/`
npm run lint
```

## [中文文档](https://github.com/LanceGin/QBox/blob/master/README_zh.md)


================================================
FILE: README_zh.md
================================================

# ![Qbox logo](http://orhcxc3kd.bkt.clouddn.com/logo-blue.png)

[![Build status](https://ci.appveyor.com/api/projects/status/soh7mapv45levrxy?svg=true)](https://ci.appveyor.com/project/LanceGin/qbox) [![Github All Releases](https://img.shields.io/github/downloads/lancegin/qbox/total.svg)]() [![Itunes App Store](https://img.shields.io/itunes/v/1267204866.svg)]()


> QBox是一款方便的[七牛](https://www.qiniu.com/)仓库以及文件管理工具,是一款可以跨平台运行在`OS X`,`Linux` 以及 `Windows` 系统的开源软件。QBox基于 [electron-vue](https://github.com/SimulatedGREG/electron-vue) 开发。

## 软件截图

#### 仓库面板

![bucket panel](http://otwcctfiu.bkt.clouddn.com/bucket-panel.png)

#### 文件管理面板

![bucket panel](http://otwcctfiu.bkt.clouddn.com/manage-panel.png)

#### 上传文件面板

![bucket panel](http://otwcctfiu.bkt.clouddn.com/upload-panel.png)

## 功能

#### 仓库面板

- [x] 通过本地设置 `accessKey` 和 `secretKey`获取管理权限。
- [x] 可清除本地token(包括 `accessKey` 和 `secretKey`)从而退出。
- [x] 获取所有的仓库(包含私有仓库)。
- [x] 新建一个专门的 `管理面板` 进行文件管理。

#### 管理面板

- [x] 列出仓库中的所有文件。
- [x] 分页显示仓库中的文件,每次加载100条。
- [x] 可通过 `文件名`,`文件类型`,`文件大小` 或者 `修改时间` 进行排序。
- [x] `图片` 以及 `多媒体文件` 预览功能。
- [x] 删除单个文件。
- [x] 批量删除文件。
- [x] 复制文件外链。
- [x] 刷新文件列表。
- [x] 下载单个文件。
- [x] 上传文件(支持拖拽)。
- [x] 文件名前缀搜索。

## 计划

#### 导航栏

- [x] 设置默认仓库。
- [x] 拖动至导航栏图标进行上传。

#### 仓库面板

- [x] 删除仓库。
- [x] 创建仓库。

#### 管理面板

- [x] 搜索框提供回车响应。
- [ ] 批量上传文件。
- [x] 批量下载文件。
- [x] 重命名文件。

## 协议

[![license](https://img.shields.io/github/license/lancegin/qbox.svg)]()

## 代码贡献

``` bash
# 安装依赖
npm install

# 本地开放版本测试
npm run dev

# 编译线上版本
npm run build

# 单元测试(目前暂无)
npm test

# 检查代码规范
npm run lint
```

## [Document](https://github.com/LanceGin/QBox/blob/master/README.md)


================================================
FILE: appveyor.yml
================================================
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
version: 0.1.{build}

branches:
  only:
    - master

image: Visual Studio 2017
platform:
  - x64

cache:
  - node_modules
  - '%APPDATA%\npm-cache'
  - '%USERPROFILE%\.electron'
  - '%USERPROFILE%\AppData\Local\Yarn\cache'

init:
  - git config --global core.autocrlf input

install:
  - ps: Install-Product node 8 x64
  - choco install yarn --ignore-dependencies
  - git reset --hard HEAD
  - yarn
  - node --version

build_script:
  #- yarn test
  - yarn build

test: off


================================================
FILE: package.json
================================================
{
  "name": "qbox",
  "version": "1.6.0",
  "author": "lancegin",
  "description": "assistant",
  "license": "AGPL",
  "main": "./dist/electron/main.js",
  "scripts": {
    "build": "node .electron-vue/build.js && electron-builder",
    "build:dir": "node .electron-vue/build.js && electron-builder --dir",
    "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
    "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
    "dev": "node .electron-vue/dev-runner.js",
    "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
    "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
    "pack": "npm run pack:main && npm run pack:renderer",
    "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
    "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
    "test": "npm run unit",
    "unit": "karma start test/unit/karma.conf.js",
    "postinstall": "npm run lint:fix"
  },
  "build": {
    "productName": "QBox",
    "appId": "com.artisanland.qbox",
    "directories": {
      "output": "build"
    },
    "files": [
      "dist/electron",
      "node_modules/",
      "package.json"
    ],
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "mac": {
      "icon": "build/icons/icon.icns",
      "target": [
        "mas",
        "dmg",
        "pkg"
      ],
      "bundleVersion": "1.6.0"
    },
    "win": {
      "icon": "build/icons/icon.ico"
    },
    "linux": {
      "icon": "build/icons"
    }
  },
  "dependencies": {
    "axios": "^0.16.1",
    "element-ui": "^1.4.0",
    "jszip": "^3.1.5",
    "moment": "^2.18.1",
    "request": "^2.81.0",
    "request-promise": "^4.2.1",
    "vue": "^2.3.3",
    "vue-electron": "^1.0.6",
    "vue-router": "^2.5.3",
    "vuex": "^2.3.1"
  },
  "devDependencies": {
    "babel-core": "^6.22.1",
    "babel-loader": "^7.0.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.3.3",
    "babel-preset-stage-0": "^6.5.0",
    "babel-register": "^6.2.0",
    "babili-webpack-plugin": "^0.1.1",
    "cfonts": "^1.1.3",
    "chalk": "^1.1.3",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.0.0",
    "css-loader": "^0.28.4",
    "del": "^2.2.1",
    "devtron": "^1.1.0",
    "electron": "^1.7.2",
    "electron-debug": "^1.1.0",
    "electron-devtools-installer": "^2.0.1",
    "electron-builder": "^19.10.0",
    "babel-eslint": "^7.0.0",
    "eslint": "^3.13.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.3.0",
    "eslint-plugin-html": "^2.0.0",
    "eslint-config-airbnb-base": "^11.2.0",
    "eslint-import-resolver-webpack": "^0.8.1",
    "eslint-plugin-import": "^2.2.0",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.11.1",
    "html-webpack-plugin": "^2.16.1",
    "json-loader": "^0.5.4",
    "inject-loader": "^3.0.0",
    "karma": "^1.3.0",
    "karma-chai": "^0.1.0",
    "karma-coverage": "^1.1.1",
    "karma-electron": "^5.1.1",
    "karma-mocha": "^1.2.0",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "^0.0.31",
    "karma-webpack": "^2.0.1",
    "webpack-merge": "^4.1.0",
    "babel-plugin-istanbul": "^4.1.1",
    "chai": "^4.0.0",
    "mocha": "^3.0.2",
    "multispinner": "^0.2.1",
    "style-loader": "^0.18.1",
    "url-loader": "^0.5.7",
    "vue-html-loader": "^1.2.2",
    "vue-loader": "^12.2.1",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.3.3",
    "webpack": "^2.2.1",
    "webpack-dev-server": "^2.3.0",
    "webpack-hot-middleware": "^2.18.0"
  }
}


================================================
FILE: src/index.ejs
================================================
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>QBox</title>
    <% if (htmlWebpackPlugin.options.nodeModules) { %>
      <!-- Add `node_modules/` to global paths so `require` works properly in development -->
      <script>
        require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
      </script>
    <% } %>
    
  </head>
  <body>
    <div id="app"></div>
    <!-- Set `__static` path to static files in production -->
    <script>
      if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
    </script>

    <!-- webpack builds are automatically injected -->
  </body>
</html>


================================================
FILE: src/main/index.dev.js
================================================
/**
 * This file is used specifically and only for development. It installs
 * `electron-debug` & `vue-devtools`. There shouldn't be any need to
 *  modify this file, but it can be used to extend your development
 *  environment.
 */

/* eslint-disable */

// Set environment for development
process.env.NODE_ENV = 'development'

// Install `electron-debug` with `devtron`
require('electron-debug')({ showDevTools: false })

// Install `vue-devtools`
require('electron').app.on('ready', () => {
  let installExtension = require('electron-devtools-installer')
  installExtension.default(installExtension.VUEJS_DEVTOOLS)
    .then(() => {})
    .catch(err => {
      console.log('Unable to install `vue-devtools`: \n', err)
    })
})

// Require `main` process to boot app
require('./index')


================================================
FILE: src/main/index.js
================================================
import { app, BrowserWindow, Menu, Tray, ipcMain } from 'electron' // eslint-disable-line
import Qiniu from '../renderer/utils/qiniu';

/**
 * Set `__static` path to static files in production
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
 */
if (process.env.NODE_ENV !== 'development') {
  global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') // eslint-disable-line
}

let mainWindow;
let mainMenu;
let appIcon = null;

const winURL = process.env.NODE_ENV === 'development'
  ? 'http://localhost:9080'
  : `file://${__dirname}/index.html`;

function createWindow() {
  /**
   * Initial menu options
   */
  const template = [
    {
      role: 'editMenu',
    },
    {
      label: 'Window',
      submenu: [
        {
          role: 'minimize',
        },
        {
          role: 'close',
        },
        {
          type: 'separator',
        },
        {
          label: 'QBox',
          accelerator: 'CmdOrCtrl+O',
          click: () => {
            app.emit('activate');
          },
        },
      ],
    },
    {
      role: 'help',
      submenu: [
        {
          label: 'Document',
          click() { require('electron').shell.openExternal('https://github.com/LanceGin/QBox/blob/master/README.md'); },
        },
        {
          label: '中文文档',
          click() { require('electron').shell.openExternal('https://github.com/LanceGin/QBox/blob/master/README_zh.md'); },
        },
        {
          type: 'separator',
        },
        {
          label: 'Open Source',
          click() { require('electron').shell.openExternal('https://github.com/LanceGin/QBox'); },
        },
        {
          label: 'License',
          click() { require('electron').shell.openExternal('https://github.com/LanceGin/QBox/blob/master/LICENSE'); },
        },
        {
          type: 'separator',
        },
        {
          label: 'About Author(LanceGin)',
          click() { require('electron').shell.openExternal('http://www.lancegin.cc'); },
        },
      ],
    },
  ];

  if (process.platform === 'darwin') {
    template.unshift({
      label: app.getName(),
      submenu: [
        { role: 'about' },
        { type: 'separator' },
        { role: 'services', submenu: [] },
        { type: 'separator' },
        { role: 'hide' },
        { role: 'hideothers' },
        { role: 'unhide' },
        { type: 'separator' },
        { role: 'quit' },
      ],
    });
  }

  mainMenu = Menu.buildFromTemplate(template);
  Menu.setApplicationMenu(mainMenu);

  /**
   * Initial window options
   */
  mainWindow = new BrowserWindow({
    height: 640,
    useContentSize: true,
    width: 400,
    titleBarStyle: 'hidden-inset',
    resizable: false,
    show: false,
  });

  mainWindow.loadURL(winURL);

  // disable white loading page by 'ready-to-show' event
  mainWindow.once('ready-to-show', () => {
    mainWindow.show();
  });

  mainWindow.on('closed', () => {
    mainWindow = null;
  });

  // disable open a outer resource from a dragover event
  mainWindow.webContents.on('will-navigate', (e) => {
    e.preventDefault();
  });

  // icon in menu bar
  let accessKey = '';
  let secretKey = '';
  let defaultBucket = '';
  if (appIcon === null) {
    appIcon = new Tray(`${__static}/img/qboxTemplate.png`);
    // appIcon.setToolTip('Drag file here and upload to the default bucket.');

    // get qiniu bucket list
    ipcMain.on('setKey', (event, key) => {
      accessKey = key.ak;
      secretKey = key.sk;
      defaultBucket = key.db;
      appIcon.setToolTip('set default bucket and drag a file here to upload');

      // appIcon.setToolTip(accessKey);
      Qiniu.buckets(accessKey, secretKey)
        .then((data) => {
          const submenuTmp = [];
          data.map((bucketTmp) => {
            // set the default bucket
            let objTmp;
            if (key.db !== undefined && bucketTmp === key.db) {
              objTmp = {
                label: bucketTmp,
                type: 'radio',
                checked: true,
                click() {
                  event.sender.send('setDefaultBucket', bucketTmp);
                  defaultBucket = bucketTmp;
                },
              };
            } else {
              objTmp = {
                label: bucketTmp,
                type: 'radio',
                click() {
                  event.sender.send('setDefaultBucket', bucketTmp);
                  defaultBucket = bucketTmp;
                },
              };
            }

            return submenuTmp.push(objTmp);
          });
          const contextMenu = Menu.buildFromTemplate([
            {
              label: 'Default Bucket',
              submenu: submenuTmp,
            },
          ]);
          appIcon.setContextMenu(contextMenu);
          // this.bucketList = data;
        });
    });

    // app tray click event
    appIcon.on('click', () => {
      if (mainWindow === null) {
        createWindow();
      }
    });

    // app tray drag-enter event
    appIcon.on('drag-enter', () => {
      // window.open(this.$router);
      const uploadWin = new BrowserWindow({
        height: 640,
        useContentSize: true,
        width: 1000,
        titleBarStyle: 'hidden-inset',
        resizable: false,
      });
      const winURL = process.env.NODE_ENV === 'development'
        ? 'http://localhost:9080'
        : `file://${__dirname}/index.html`;
      uploadWin.loadURL(`${winURL}#/upload?bucket=${defaultBucket}`);
    });
  }
}

app.on('ready', createWindow);

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () => {
  if (mainWindow === null) {
    createWindow();
  }
});

/**
 * Auto Updater
 *
 * Uncomment the following code below and install `electron-updater` to
 * support auto updating. Code Signing with a valid certificate is required.
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
 */

/*
import { autoUpdater } from 'electron-updater'

autoUpdater.on('update-downloaded', () => {
  autoUpdater.quitAndInstall()
})

app.on('ready', () => {
  if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
})
 */


================================================
FILE: src/renderer/App.vue
================================================
<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
  export default {
    name: 'qbox',
  };
</script>

<style>
  /* CSS */
</style>


================================================
FILE: src/renderer/assets/.gitkeep
================================================


================================================
FILE: src/renderer/components/About.vue
================================================
<template>
  <div id="about-page">
    <p>this is the about page.</p>
    <i class="iconfont icon-flip"></i>
  </div>
</template>

<script>
  export default {
    name: 'about',
  };
</script>

<style scope>
  body {
    background: #eee;
  }
</style>


================================================
FILE: src/renderer/components/BucketHeader.vue
================================================
<template>
  <header style="-webkit-app-region: drag">
  </header>
</template>

<script>
  export default {
    name: 'bucket-header',
  };
</script>

<style scope>
  header {
    position: fixed;
    width: 100vw;
    height: 50px;
    -webkit-app-region: drag;
    background: url('../../../static/img/logo.png') no-repeat #2e84c7;
    background-size: 80.6px 30px;
    background-position: center;
  }
</style>


================================================
FILE: src/renderer/components/BucketList.vue
================================================
<template>
  <div id="bucket-list-page">
    <div class="logout">
      <el-button type="text" class="logout-btn" icon="upload2" @click="logout()" v-loading.fullscreen.lock="fullscreenLoading"></el-button>
    </div>
    <div v-for="bucket in bucketList" :key="bucket" class="bucket-item">
      <div class="item-icon"></div>
      <div class="item-name">
        <p>{{ bucket }}</p>
      </div>
      <div class="item-handler">
        <i class="el-icon-edit" @click="manage(bucket)"></i>
        <i class="el-icon-delete" @click="drop(bucket)"></i>
      </div>
    </div>
    <div class="mkbucket">
      <el-button class="mkbucket-btn" @click="dialogFormVisible = true">创建新仓库</el-button>
      <el-dialog
        title="创建新仓库"
        size="large"
        top="25%"
        :visible.sync="dialogFormVisible">
        <el-form :model="newBucket">
          <el-form-item label="Name" :label-width="formLabelWidth">
            <el-input v-model="newBucket.name" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="Region" :label-width="formLabelWidth">
            <el-select v-model="newBucket.region" placeholder="请选择">
              <el-option
                v-for="item in regions"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button @click="mkbucket()" v-loading.fullscreen.lock="fullscreenLoading">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  // import Qiniu class
  import Qiniu from '../utils/qiniu';

  const BrowserWindow = require('electron').remote.BrowserWindow;
  const { ipcRenderer } = require('electron');

  // transfer data to main process
  const key = {
    ak: localStorage.accessKey,
    sk: localStorage.secretKey,
    db: localStorage.db,
  };

  // register an event to set default bucket
  ipcRenderer.on('setDefaultBucket', (event, arg) => {
    // console.log(`${arg} args from main process`);
    localStorage.db = arg;
  });

  let buckets;
  export default {
    name: 'bucket-list',
    data() {
      return {
        fullscreenLoading: false,
        bucketList: buckets,
        dialogFormVisible: false,
        formLabelWidth: '80px',
        regions: [
          {
            value: 'z0',
            label: '华东',
          },
          {
            value: 'z1',
            label: '华北',
          },
          {
            value: 'z2',
            label: '华南',
          },
          {
            value: 'na0',
            label: '北美',
          },
        ],
        newBucket: {
          name: '',
          region: '',
        },
      };
    },
    mounted() {
      const accessKey = localStorage.accessKey;
      const secretKey = localStorage.secretKey;

      Qiniu.buckets(accessKey, secretKey)
        .then((data) => {
          this.bucketList = data;
        })
        .catch((err) => {
          // 当token无效时触发
          this.$message(`${err.error.error}...💔`);
          localStorage.clear();
          this.$router.push({ path: '/login' });
        });

      // send signal and transfer localstorage to the main process
      ipcRenderer.send('setKey', key);
      // console.log(localStorage.db);
    },
    methods: {
      // create new bucket
      mkbucket() {
        this.fullscreenLoading = true;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;

        Qiniu.mkbucket(accessKey, secretKey, this.newBucket.name, this.newBucket.region)
          .then(() => {
            Qiniu.buckets(accessKey, secretKey)
              .then((data) => {
                this.dialogFormVisible = false;
                this.fullscreenLoading = false;
                this.bucketList = data;
                this.$message(`仓库 ${this.newBucket.name} 创建成功..💗`);
              });
          })
          .catch((err) => {
            this.fullscreenLoading = false;
            this.$message(`${err.error.error}...💔`);
          });
      },
      // drop an exist bucket
      drop(bucket) {
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        this.$confirm(`确定删除 ${bucket} ?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          customClass: 'confirm-box',
        }).then(() => {
          this.fullscreenLoading = true;
          Qiniu.drop(accessKey, secretKey, bucket)
            .then(() => {
              Qiniu.buckets(accessKey, secretKey)
                .then((data) => {
                  this.bucketList = data;
                  this.fullscreenLoading = false;
                  this.$message(`成功删除 ${bucket}...💗`);
                });
            })
            .catch((err) => {
              this.$message(`${err.error.error}...💔`);
            });
        }).catch(() => {
          this.$message('差点手误...💔');
        });
      },
      // logout function.
      // keys will be clear.
      logout() {
        const router = this.$router;
        this.$confirm('确认退出并清空公私钥?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          customClass: 'confirm-box',
        }).then(() => {
          localStorage.clear();
          this.fullscreenLoading = true;
          setTimeout(() => {
            router.push({ path: '/login' });
            this.fullscreenLoading = false;
          }, 1000);
        }).catch(() => {
        });
      },

      // manage function.
      // open a new window to manage files.
      manage(bucket) {
        // window.open(this.$router);
        const win = new BrowserWindow({
          height: 640,
          useContentSize: true,
          width: 1000,
          titleBarStyle: 'hidden-inset',
          resizable: false,
        });
        const winURL = process.env.NODE_ENV === 'development'
          ? 'http://localhost:9080'
          : `file://${__dirname}/index.html`;
        win.loadURL(`${winURL}#/manage?bucket=${bucket}`);
      },
    },
  };
</script>

<style scope>
  .logout-btn {
    position: fixed;
    right: 30px;
    top: 6px;
    color: #fff;
  }
  .logout-btn:hover {
    color: #fff;
  }
  .el-icon-upload2 {
    cursor: pointer;
  }
  .confirm-box {
    width: 80vw;
  }
  .bucket-item {
    height: 60px;
    border-bottom: 1px #eee solid;
    padding: 0 20px;
  }
  .bucket-item:hover {
    background: #eee;
  }
  .item-icon {
    float: left;
    margin-top: 5px;
    height: 48px;
    width: 48px;
    background: url("../../../static/img/bucket.png") no-repeat;
    background-size: contain;
    background-position: 0 2px;
  }
  .item-name {
    float: left;
    margin-top: 20px;
    margin-left: 10px;
    color: #888;
  }
  .item-name p {
    -webkit-margin-before: 0;
  }
  .item-handler {
    float: right;
    margin-top: 20px;
  }
  .item-handler i {
    border: 0;
    margin-right: 10px;
    background: transparent;
    color: #888;
    cursor: pointer;
  }
  .item-handler i:hover {
    color: #2e84c7;
  }
  .mkbucket {
    text-align: center;
    margin-top: 20px;
  }
  .mkbucket-btn {
    background: #2e84c7;
    border: 0;
    color: #fff;
    font-size: 12px;
  }
  .mkbucket-btn:hover,
  .mkbucket-btn:focus {
    color: #fff;
  }
  .el-input__icon+.el-input__inner {
    width: 240px;
  }
</style>


================================================
FILE: src/renderer/components/FileList.vue
================================================
<template>
  <div id="file-list-page">

    <!-- rename resource -->
    <el-dialog
      title="重命名资源"
      :visible.sync="renameDialogVisible"
      width="30%">
      <el-input v-model="currentName" :placeholder="currentName"></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="renameCancel">取 消</el-button>
        <el-button type="primary" @click="renameConfirm">确 定</el-button>
      </span>
    </el-dialog>
  
    <!-- preview -->
    <el-dialog
      :title="preview_name"
      :visible.sync="dialogVisible"
      size="large">
      <div class="preview">
        <img :src="preview_url" class="preview-img">
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="previewCopy()">复 制</el-button>
        <el-button type="primary" @click="download()">下 载</el-button>
      </span>
    </el-dialog>

    <!-- file list table -->
    <el-table
      ref="multipleTable"
      :data="fileList"
      tooltip-effect="dark"
      style="width: 100%"
      stripe
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="35">
      </el-table-column>
      <el-table-column
        prop="key"
        label="文件名"
        sortable
        width="320">
      </el-table-column>
      <el-table-column
        prop="mimeType"
        label="文件类型"
        sortable
        width="140">
      </el-table-column>
      <el-table-column
        prop="fsize"
        label="文件大小"
        sortable
        width="120"
        :formatter="fsizeFormat">
      </el-table-column>
      <el-table-column
        prop="putTime"
        label="修改时间"
        sortable
        width="200"
        :formatter="dateFormat">
      </el-table-column>
      <el-table-column
        label="操作"
        width="185">
        <template scope="scope">
          <el-button type="text" size="small" icon="view" @click="preview(scope.row)"></el-button>
          <el-button type="text" size="small" @click="removeFile(scope.row)">删除</el-button>
          <el-button type="text" size="small" @click="copyLink(scope.row)">复制</el-button>
          <el-button type="text" size="small" @click="rename(scope.row)">重命名</el-button>
        </template>
      </el-table-column>
      <template slot="append">
        <div class="loadmore">
          <el-button
            align="center"
            type="text"
            v-if="marker != ''"
            size="small"
            @click="loadMore()">加载更多</el-button>
        </div>
      </template>
    </el-table>
  </div>
</template>

<script>
  // import Qiniu class
  import Qiniu from '../utils/qiniu';
  import Util from '../utils/util';
  import Bus from '../utils/bus';
  const moment = require('moment');
  const clipboard = require('electron').clipboard;
  const webContents = require('electron').remote.getCurrentWebContents();

  export default {
    name: 'file-list',
    data() {
      return {
        renameDialogVisible: false,
        dialogVisible: false,
        fileList: [],
        multipleSelection: [],
        preview_url: '',
        preview_name: '',
        marker: '',
        filter: '',
        oldName: '',
        currentName: '',
      };
    },
    created() {
      // refresh files
      Bus.$on('refresh', () => {
        this.fileList = [];
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.list(accessKey, secretKey, bucket)
          .then((data) => {
            this.marker = data.marker == null ? '' : data.marker;
            this.fileList = data.items;
          })
          .catch();
      });

      // batch delete
      Bus.$on('batchDelete', () => {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        // confirm to delete
        this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          Qiniu.batchDelete(accessKey, secretKey, bucket, this.multipleSelection)
            .then(() => {
              this.$message('文件删除成功..💗');
              Qiniu.list(accessKey, secretKey, bucket)
                .then((data) => {
                  this.marker = data.marker == null ? '' : data.marker;
                  this.fileList = data.items;
                })
                .catch();
            })
            .catch();
        }).catch(() => {
          this.$message('取消删除');
        });
      });

      // batch download
      Bus.$on('batchDownload', () => {
        // import jszip and fileSaver
        const JSZip = require('jszip');
        const saveAs = require('jszip/vendor/FileSaver');

        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        const zip = new JSZip();
        const items = this.multipleSelection;

        Qiniu.domain(accessKey, secretKey, bucket)
          .then((data) => {
            const domain = data[data.length - 1];

            items.forEach((item) => {
              const link = `http://${domain}/${item.key}`;

              // add file to the zip file through promise
              const promise = Util.urlToBlob(link).then(res => res.blob());
              zip.file(item.key, promise);
            });

            // compress and download
            zip.generateAsync({
              type: 'blob',
              mimeType: 'application/zip',
            })
              .then((content) => {
                saveAs(content, 'qbox-batchDownload.zip.zip');
              });
          })
          .catch();
      });

      // search filter
      Bus.$on('search', (filter) => {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.list(accessKey, secretKey, bucket, '', filter)
          .then((data) => {
            // console.log(data);
            this.filter = filter;
            this.marker = data.marker == null ? '' : data.marker;
            this.fileList = data.items;
          })
          .catch();
      });
    },
    destroyed() {
      Bus.$off('refresh');
      Bus.$off('batchDelete');
      Bus.$off('batchDownload');
    },
    mounted() {
      const bucket = this.$route.query.bucket;
      const accessKey = localStorage.accessKey;
      const secretKey = localStorage.secretKey;
      Qiniu.list(accessKey, secretKey, bucket)
        .then((data) => {
          // console.log(data);
          this.marker = data.marker == null ? '' : data.marker;
          this.fileList = data.items;
        })
        .catch();
    },
    methods: {
      handleSelectionChange(val) {
        this.multipleSelection = val;
        Bus.$emit('batchShowStatus', this.multipleSelection);
      },
      // format the time stamp
      dateFormat(row) {
        let date = row.putTime;
        if (date === undefined) {
          return '';
        }
        date = date.toString();
        date = date.substring(0, date.length - 7);
        return moment.unix(date).format('YYYY-MM-DD HH:mm:ss');
      },
      // format file size
      fsizeFormat(row) {
        return Util.fsizeFormat(row.fsize);
      },
      // copy the link
      copyLink(row) {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.domain(accessKey, secretKey, bucket)
          .then((data) => {
            // get the latest domain
            const domain = data[data.length - 1];
            const link = `http://${domain}/${row.key}`;
            clipboard.writeText(link);
            this.$message('链接复制成功..💗');
          })
          .catch();
      },
      // remove a file
      removeFile(row) {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        // confirm to delete
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          Qiniu.delete(accessKey, secretKey, bucket, row.key)
            .then(() => {
              this.$message('文件删除成功..💗');
              // TODO
              // just remove items from local datas, do not
              // need to refresh.
              Qiniu.list(accessKey, secretKey, bucket)
                .then((data) => {
                  this.marker = data.marker == null ? '' : data.marker;
                  this.fileList = data.items;
                })
                .catch();
            })
            .catch();
        }).catch(() => {
          this.$message('取消删除');
        });
      },
      // rename file
      rename(row) {
        this.oldName = row.key;
        this.currentName = row.key;
        this.renameDialogVisible = true;
      },
      renameCancel() {
        this.renameDialogVisible = false;
      },
      renameConfirm() {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        // console.log(bucket, this.oldName, this.currentName);
        Qiniu.rename(accessKey, secretKey, bucket, this.oldName, this.currentName)
          .then(() => {
            this.renameDialogVisible = false;
            this.$message('重命名成功..💗');
            Qiniu.list(accessKey, secretKey, bucket)
              .then((data) => {
                this.marker = data.marker == null ? '' : data.marker;
                this.fileList = data.items;
              })
              .catch();
          })
          .catch();
      },
      // preview file
      preview(row) {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.domain(accessKey, secretKey, bucket)
          .then((data) => {
            // get the latest domain
            const domain = data[data.length - 1];
            const link = `http://${domain}/${row.key}`;
            this.preview_name = row.key;
            this.dialogVisible = true;
            if (row.mimeType.indexOf('image') >= 0) {
              this.preview_url = link;
            } else {
              this.preview_url = 'https://qiniu.staticfile.org/static/images/no-prev.6ae40070.png';
            }
          })
          .catch();
      },
      // copy link in the preview modal
      previewCopy() {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.domain(accessKey, secretKey, bucket)
          .then((data) => {
            // get the latest domain
            const domain = data[data.length - 1];
            const link = `http://${domain}/${this.preview_name}`;
            clipboard.writeText(link);
            this.$message('链接复制成功..💗');
          })
          .catch();
      },
      // download file
      download() {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.domain(accessKey, secretKey, bucket)
          .then((data) => {
            // get the latest domain
            const domain = data[data.length - 1];
            const link = `http://${domain}/${this.preview_name}?attname=${this.preview_name}.${this.preview_name.split('.')[1]}`;
            webContents.loadURL(link);
          })
          .catch();
      },
      // loadMore feature
      loadMore() {
        // console.log(this.filter);
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.list(accessKey, secretKey, bucket, this.marker, this.filter)
          .then((data) => {
            this.marker = data.marker == null ? '' : data.marker;
            this.fileList.push(...data.items);
          })
          .catch();
      },
    },
  };
</script>

<style scope>
  /* set table style */
  .el-table {
    color: #888;
    max-height: 540px;
  }
  .el-table__header-wrapper thead div {
    background: #fff;
    color: #888;
    font-size: 14px;
    font-weight: lighter;
  }
  .el-table__header-wrapper th {
    height: 30px;
  }
  .el-checkbox__inner {
    width: 14px;
    height: 14px;
  }
  .el-checkbox__inner::after {
    width: 2px;
    height: 6px;
  }
  .el-table th {
    background: #fff;
  }
  .el-table .el-button--text {
    color: #2e84c7;
  }
  .el-table .el-button--text:hover {
    color: #2e84c7;
  }
  .el-table::after,
  .el-table::before {
    background: transparent;
    z-index: 1;
  }
  .el-table__body-wrapper {
    max-height: 520px !important;
  }
  .loadmore {
    width: 100vw;
    text-align: center;
    margin-top: 5px;
  }
  .preview {
    text-align: center;
    max-height: 300px;
  }
  .preview-img {
    max-height: 300px;
    max-width: 100%;
  }
</style>


================================================
FILE: src/renderer/components/LandingPage/SystemInformation.vue
================================================
<template>
  <div>
    <div class="title">Information</div>
    <div class="items">
      <div class="item">
        <div class="name">Path:</div>
        <div class="value">{{ path }}</div>
      </div>
      <div class="item">
        <div class="name">Route Name:</div>
        <div class="value">{{ name }}</div>
      </div>
      <div class="item">
        <div class="name">Vue.js:</div>
        <div class="value">{{ vue }}</div>
      </div>
      <div class="item">
        <div class="name">Electron:</div>
        <div class="value">{{ electron }}</div>
      </div>
      <div class="item">
        <div class="name">Node:</div>
        <div class="value">{{ node }}</div>
      </div>
      <div class="item">
        <div class="name">Platform:</div>
        <div class="value">{{ platform }}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        electron: process.versions['atom-shell'],
        name: 'landing-page',
        node: process.versions.node,
        path: '/',
        platform: require('os').platform(),
        vue: require('vue/package.json').version,
      };
    },
  };
</script>

<style scoped>
  .title {
    color: #888;
    font-size: 18px;
    font-weight: initial;
    letter-spacing: .25px;
    margin-top: 10px;
  }

  .items { margin-top: 8px; }

  .item {
    display: flex;
    margin-bottom: 6px;
  }

  .item .name {
    color: #6a6a6a;
    margin-right: 6px;
  }

  .item .value {
    color: #35495e;
    font-weight: bold;
  }
</style>


================================================
FILE: src/renderer/components/LandingPage.vue
================================================
<template>
  <div id="wrapper">
    <img id="logo" src="~@/assets/logo.png" alt="electron-vue">
    <main>
      <div class="left-side">
        <span class="title">
          Welcome to your new project!
        </span>
        <system-information></system-information>
        <about></about>
      </div>

      <div class="right-side">
        <div class="doc">
          <div class="title">Getting Started</div>
          <p>
            electron-vue comes packed with detailed documentation that covers everything from
            internal configurations, using the project structure, building your application,
            and so much more.
          </p>
          <button @click="open('https://simulatedgreg.gitbooks.io/electron-vue/content/')">Read the Docs</button><br><br>
        </div>
        <div class="doc">
          <div class="title alt">Other Documentation</div>
          <button class="alt" @click="open('https://electron.atom.io/docs/')">Electron</button>
          <button class="alt" @click="open('https://vuejs.org/v2/guide/')">Vue.js</button>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
  import SystemInformation from './LandingPage/SystemInformation';
  import About from './About';

  export default {
    name: 'landing-page',
    components: { SystemInformation, About },
    methods: {
      open(link) {
        this.$electron.shell.openExternal(link);
      },
    },
  };
</script>

<style>
  @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro');

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body { font-family: 'Source Sans Pro', sans-serif; }

  #wrapper {
    background:
      radial-gradient(
        ellipse at top left,
        rgba(255, 255, 255, 1) 40%,
        rgba(229, 229, 229, .9) 100%
      );
    height: 100vh;
    padding: 60px 80px;
    width: 100vw;
  }

  #logo {
    height: auto;
    margin-bottom: 20px;
    width: 420px;
  }

  main {
    display: flex;
    justify-content: space-between;
  }

  main > div { flex-basis: 50%; }

  .left-side {
    display: flex;
    flex-direction: column;
  }

  .welcome {
    color: #555;
    font-size: 23px;
    margin-bottom: 10px;
  }

  .title {
    color: #2c3e50;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 6px;
  }

  .title.alt {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .doc p {
    color: black;
    margin-bottom: 10px;
  }

  .doc button {
    font-size: .8em;
    cursor: pointer;
    outline: none;
    padding: 0.75em 2em;
    border-radius: 2em;
    display: inline-block;
    color: #fff;
    background-color: #4fc08d;
    transition: all 0.15s ease;
    box-sizing: border-box;
    border: 1px solid #4fc08d;
  }

  .doc button.alt {
    color: #42b983;
    background-color: transparent;
  }
</style>


================================================
FILE: src/renderer/components/ManageTool.vue
================================================
<template>
  <div class="manage-tool">
    <div class="bucket-info">
      <el-tag class="bucket-name">{{ bucket }}</el-tag>
    </div>
    <div class="manage-btn">
      <el-button class="w-btn" type="text" icon="upload" @click="upload()"> 上传</el-button>
      <el-button class="w-btn" type="text" icon="time" @click="refresh()"> 刷新</el-button>
      <el-button class="w-btn" type="text" icon="delete" :disabled="batchShow" @click="batchDelete()">删除</el-button>
      <el-button class="w-btn" type="text" :disabled="batchShow" icon="document" @click="batchDownload()"> 下载</el-button>
    </div>
    <div class="search-input">
      <el-input
        placeholder="搜索"
        icon="search"
        v-model="filter"
        :on-icon-click="search"
        @keyup.enter.native="search">
      </el-input>
    </div>
  </div>
</template>

<script>
  import Bus from '../utils/bus';

  export default {
    name: 'manage-tool',
    data() {
      return {
        bucket: this.$route.query.bucket,
        filter: '',
        batchShow: true,
      };
    },
    created() {
      Bus.$on('batchShowStatus', (multipleSelection) => {
        if (multipleSelection.length > 0) {
          this.batchShow = false;
        } else {
          this.batchShow = true;
        }
      });
    },
    destroyed() {
      Bus.$off('batchShowStatus');
    },
    methods: {
      search() {
        // file list filter
        Bus.$emit('search', this.filter);
      },
      refresh() {
        Bus.$emit('refresh');
      },
      upload() {
        this.$router.push({ path: `/upload?bucket=${this.bucket}` });
      },
      batchDelete() {
        Bus.$emit('batchDelete');
      },
      batchDownload() {
        Bus.$emit('batchDownload');
      },
    },
  };
</script>

<style scope>
  .manage-tool {
    position: fixed;
    margin-top: 50px;
    width: 100vw;
    height: 50px;
    -webkit-app-region: drag;
    background: #2e84c7;
  }
  .manage-btn {
    float: left;
    margin-left: 4vw;
  }
  .bucket-info {
    float: left;
    margin-left: 10vw;
    padding-top: 4px;
  }
  .bucket-name {
    background: #fff;
    color: #2e84c7;
  }
  .w-btn,
  .w-btn:hover,
  .w-btn:focus {
    color: #fff;
  }
  .search-input {
    float: right;
    margin-right: 10vw;
  }
</style>


================================================
FILE: src/renderer/components/NoBucket.vue
================================================
<template>
  <div id="no-bucket-page">
    <div class="nothing-img"></div>
    <el-button class="show-modal-btn" @click="dialogFormVisible = true">设置Key</el-button>

    <el-dialog
      title="设置公/私钥"
      size="large"
      top="25%"
      :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="AccessKey" :label-width="formLabelWidth">
          <el-input v-model="form.ak" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="SecretKey" :label-width="formLabelWidth">
          <el-input type="password" v-model="form.sk" auto-complete="off"></el-input>
        </el-form-item>
      </el-form>
      <div class="notice">
        <p>不知道key? <el-button type="text" @click="openPortal()">去七牛查看</el-button></p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button @click="setKey()" v-loading.fullscreen.lock="fullscreenLoading">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: 'no-bucket',
    data() {
      return {
        fullscreenLoading: false,
        dialogVisible: false,
        dialogFormVisible: false,
        formLabelWidth: '80px',
        form: {
          ak: '',
          sk: '',
        },
      };
    },
    methods: {
      setKey() {
        const router = this.$router;
        localStorage.accessKey = this.form.ak;
        localStorage.secretKey = this.form.sk;
        this.dialogFormVisible = false;
        this.fullscreenLoading = true;
        setTimeout(() => {
          router.push({ path: 'bucket' });
          this.fullscreenLoading = false;
        }, 3000);
      },
      // go to qiniu portal to find key
      openPortal() {
        require('electron').shell.openExternal('https://portal.qiniu.com/user/key');
      },
    },
  };
</script>

<style scope>
  body {
    background: #fff;
  }
  .nothing-img {
    text-align: center;
    height: 260px;
    background: url(../../../static/img/nothing.png) no-repeat;
    background-size: 320px 198.35px;
    background-position: 40px 80px;
    margin-bottom: 80px;
  }
  .nothing-img img {
    width: 80vw;
  }
  .show-modal-btn {
    background: #2e84c7;
    color: #ffffff;
    border: 0;
    width: 40vw;
    margin-left: 30vw;
    margin-top: 20px;
    height: 50px;
  }
  .show-modal-btn:hover {
    color: #ffffff;
  }
  .el-dialog__body {
    padding-bottom: 0;
  }
  .notice {
    margin-left: 170px;
    color: #888;
    font-size: 14px;
    margin-top: -20px;
  }
  .dialog-footer {
    margin-top: -10px;
  }
</style>


================================================
FILE: src/renderer/main.js
================================================
import Vue from 'vue';
import axios from 'axios';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-default/index.css';

import App from './App';
import router from './router';
import store from './store';

if (!process.env.IS_WEB) Vue.use(require('vue-electron'));
Vue.http = Vue.prototype.$http = axios;
Vue.config.productionTip = false;
Vue.use(ElementUI);

/* eslint-disable no-new */
new Vue({
  components: { App },
  router,
  store,
  template: '<App/>',
  created() {
    this.checkLogin();
  },
  methods: {
    checkLogin() {
      const accessKey = localStorage.getItem('accessKey');
      const secretKey = localStorage.getItem('secretKey');

      // check the exist of AK and SK
      let hasKey = true;
      if (accessKey == null || secretKey == null) {
        hasKey = false;
      }

      if (hasKey === false) {
        this.$router.push('/login');
      }
    },
  },
}).$mount('#app');


================================================
FILE: src/renderer/pages/Bucket.vue
================================================
<template>
  <div class="bucket-page">
    <bucket-header></bucket-header>
    <div class="bucket-list">
      <bucket-list></bucket-list>
    </div>
  </div>
</template>

<script>
  import BucketHeader from '../components/BucketHeader';
  import BucketList from '../components/BucketList';

  export default {
    name: 'bucket',
    components: { BucketHeader, BucketList },
  };
</script>

<style>
  webkit,
  ::-webkit-scrollbar {
    width: 0;
  }
  body {
    margin: 0;
    font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  }
  .bucket-list {
    padding-top: 50px;
  }
</style>


================================================
FILE: src/renderer/pages/Login.vue
================================================
<template>
  <div class="login-page">
    <bucket-header></bucket-header>
    <no-bucket></no-bucket>
  </div>
</template>

<script>
  import BucketHeader from '../components/BucketHeader';
  import NoBucket from '../components/NoBucket';

  export default {
    name: 'login',
    components: { BucketHeader, NoBucket },
  };
</script>

<style>
  webkit,
  ::-webkit-scrollbar {
    width: 0;
  }
  body {
    margin: 0;
    font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  }
</style>


================================================
FILE: src/renderer/pages/Manage.vue
================================================
<template>
  <div class="manage-page">
    <bucket-header></bucket-header>
    <manage-tool></manage-tool>
    <div class="file-list">
      <file-list></file-list>
    </div>
  </div>
</template>

<script>
  import BucketHeader from '../components/BucketHeader';
  import ManageTool from '../components/ManageTool';
  import FileList from '../components/FileList';

  export default {
    name: 'manage',
    components: { BucketHeader, ManageTool, FileList },
  };
</script>

<style>
  webkit,
  ::-webkit-scrollbar {
    width: 0;
  }
  body {
    margin: 0;
    font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  }
  .file-list {
    padding-top: 100px;
  }
</style>


================================================
FILE: src/renderer/pages/Upload.vue
================================================
<template>
  <div class="upload-page">
    <bucket-header></bucket-header>
    <!-- manage tool -->
    <div class="manage-tool">
      <div class="bucket-info">
        <el-tag class="bucket-name">{{ bucket }}</el-tag>
      </div>
      <div class="manage-btn">
        <el-button class="w-btn" type="text" icon="arrow-left" @click="goback()">返回</el-button>
      </div>
    </div>

    <div class="upload-panel">
      <el-upload
        class="upload-demo"
        :action="uploadUrl"
        drag
        :on-remove="handleRemove"
        :before-upload="beforeUpload"
        :on-success="handleSuccess"
        :on-error="handleError"
        :on-progress="handleProgress"
        :data="form">
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
      </el-upload>
    </div>
  </div>
</template>

<script>
  import BucketHeader from '../components/BucketHeader';
  import PutPolicy from '../utils/put_policy';
  import Qiniu from '../utils/qiniu';

  export default {
    name: 'upload',
    components: { BucketHeader },
    data() {
      return {
        uploadUrl: '',
        bucket: this.$route.query.bucket,
        form: {},
        headers: {},
      };
    },
    created() {
      Qiniu.autoZone(localStorage.accessKey, this.bucket)
        .then((zone) => {
          this.uploadUrl = `http://${zone.up.src.main[0]}`;
        })
        .catch();
    },
    methods: {
      goback() {
        this.$router.push({ path: `/manage?bucket=${this.bucket}` });
      },
      handleSuccess() {
      },
      handleError() {
      },
      handleProgress() {
      },
      handleRemove(item) {
        const bucket = this.$route.query.bucket;
        const accessKey = localStorage.accessKey;
        const secretKey = localStorage.secretKey;
        Qiniu.delete(accessKey, secretKey, bucket, item.response.key)
          .then(() => {
            this.$message('删除成功...💗');
          })
          .catch();
      },
      async beforeUpload(file) {
        // generate uploadToken
        const options = {
          scope: `${this.bucket}:${file.name}`,
        };
        const mac = {
          accessKey: localStorage.accessKey,
          secretKey: localStorage.secretKey,
        };
        const putPolicy = new PutPolicy(options);
        const uploadToken = putPolicy.uploadToken(mac);
        // form data
        this.form = {
          key: file.name,
          token: uploadToken,
        };
      },
    },
  };
</script>

<style>
  webkit,
  ::-webkit-scrollbar {
    width: 0;
  }
  body {
    margin: 0;
    font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
  }
  .upload-panel {
    padding-top: 100px;
  }
  .manage-tool {
    position: fixed;
    margin-top: 50px;
    width: 100vw;
    height: 50px;
    -webkit-app-region: drag;
    background: #2e84c7;
  }
  .bucket-info {
    float: left;
    margin-left: 10vw;
    padding-top: 4px;
  }
  .bucket-name {
    background: #fff;
    color: #2e84c7;
  }
  .manage-btn {
    float: left;
    margin-left: 4vw;
  }
  .w-btn,
  .w-btn:hover,
  .w-btn:focus {
    color: #fff;
  }
  /* dtrag upload style */
  .el-upload {
    float: right;
  }
  .el-upload-dragger {
    width: 61vw;
    height: 536px;
    border: 0;
    border-left: 1px solid #eee;
    border-radius: 0;
    background: transparent;
  }
  .el-upload-dragger:hover {
    border: 1px dashed #2e84c7;
  }
  .el-upload-dragger .el-icon-upload {
    margin-top: 30vh;
  }
  .el-upload-list {
    position: absolute;
    width: 35vw;
    top: 100px;
    left: 2vw;
    height: 540px;
    overflow: scroll;
  }
</style>


================================================
FILE: src/renderer/router/index.js
================================================
import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/landing',
      name: 'landing-page',
      component: require('@/components/LandingPage'),
    },
    {
      path: '/',
      name: 'bucket',
      component: require('@/pages/bucket'),
    },
    {
      path: '/login',
      name: 'login',
      component: require('@/pages/login'),
    },
    {
      path: '/manage',
      name: 'manage',
      component: require('@/pages/manage'),
    },
    {
      path: '/upload',
      name: 'upload',
      component: require('@/pages/upload'),
    },
    {
      path: '*',
      redirect: '/',
    },
  ],
});


================================================
FILE: src/renderer/store/index.js
================================================
import Vue from 'vue';
import Vuex from 'vuex';

import modules from './modules';

Vue.use(Vuex);

export default new Vuex.Store({
  modules,
  strict: process.env.NODE_ENV !== 'production',
});


================================================
FILE: src/renderer/store/modules/Counter.js
================================================
const state = {
  main: 0,
};

const mutations = {
  DECREMENT_MAIN_COUNTER(state) {
    state.main -= 1;
  },
  INCREMENT_MAIN_COUNTER(state) {
    state.main += 1;
  },
};

const actions = {
  someAsyncTask({ commit }) {
    // do something async
    commit('INCREMENT_MAIN_COUNTER');
  },
};

export default {
  state,
  mutations,
  actions,
};


================================================
FILE: src/renderer/store/modules/index.js
================================================
/**
 * The file enables `@/store/index.js` to import all vuex modules
 * in a one-shot manner. There should not be any reason to edit this file.
 */

const files = require.context('.', false, /\.js$/);
const modules = {};

files.keys().forEach((key) => {
  if (key === './index.js') return;
  modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default;
});

export default modules;


================================================
FILE: src/renderer/utils/bus.js
================================================
// bus component
import Vue from 'vue';

export default new Vue();


================================================
FILE: src/renderer/utils/put_policy.js
================================================
/**
 *  @module   : Module to generate put policy and upload token
 *  @author   : Gin (gin.lance.inside@hotmail.com)
 */
import Util from './util';

export default class PutPolicy {
  /**
   * Generate put policy class.
   *
   * @param scope       must have this attr.
   *                    the other option could find in
   *                    https://developer.qiniu.com/kodo/manual/1206/put-policy
   *
   * @return PutPolicy
   */
  constructor(options) {
    if (typeof options !== 'object') {
      throw new Error('invalid putpolicy options');
    }

    this.scope = options.scope || null;
    this.isPrefixalScope = options.isPrefixalScope || null;
    this.expires = options.expires || 3600;
    this.insertOnly = options.insertOnly || null;

    this.saveKey = options.saveKey || null;
    this.endUser = options.endUser || null;

    this.returnUrl = options.returnUrl || null;
    this.returnBody = options.returnBody || null;

    this.callbackUrl = options.callbackUrl || null;
    this.callbackHost = options.callbackHost || null;
    this.callbackBody = options.callbackBody || null;
    this.callbackBodyType = options.callbackBodyType || null;
    this.callbackFetchKey = options.callbackFetchKey || null;

    this.persistentOps = options.persistentOps || null;
    this.persistentNotifyUrl = options.persistentNotifyUrl || null;
    this.persistentPipeline = options.persistentPipeline || null;

    this.fsizeLimit = options.fsizeLimit || null;
    this.fsizeMin = options.fsizeMin || null;
    this.mimeLimit = options.mimeLimit || null;

    this.detectMime = options.detectMime || null;
    this.deleteAfterDays = options.deleteAfterDays || null;
    this.fileType = options.fileType || null;
  }

  /**
   * make the PutPolicy to json string
   *
   * @return string
   */
  getFlags() {
    const flags = {};
    const attrs = ['scope', 'isPrefixalScope', 'insertOnly', 'saveKey', 'endUser',
      'returnUrl', 'returnBody', 'callbackUrl', 'callbackHost',
      'callbackBody', 'callbackBodyType', 'callbackFetchKey', 'persistentOps',
      'persistentNotifyUrl', 'persistentPipeline', 'fsizeLimit', 'fsizeMin',
      'detectMime', 'mimeLimit', 'deleteAfterDays', 'fileType',
    ];

    for (let i = attrs.length - 1; i >= 0; i -= 1) {
      if (this[attrs[i]] !== null) {
        flags[attrs[i]] = this[attrs[i]];
      }
    }

    flags.deadline = this.expires + Math.floor(Date.now() / 1000);

    return flags;
  }

  /**
   * generate upload token
   *
   * @param mac      an object contain sk and ak
   *
   * @return string
   */
  uploadToken(mac) {
    const flags = this.getFlags();
    const encodedFlags = Util.urlsafeBase64Encode(JSON.stringify(flags));
    const encoded = Util.hmacSha1(encodedFlags, mac.secretKey);
    const encodedSign = Util.base64ToUrlSafe(encoded);
    const uploadToken = `${mac.accessKey}:${encodedSign}:${encodedFlags}`;
    return uploadToken;
  }
}


================================================
FILE: src/renderer/utils/qiniu.js
================================================
// load Util class
import Util from './util';

// commonJs load modules
const rp = require('request-promise');

/**
 * Qiniu module to implement all apis.
 */
export default class Qiniu {
  /**
   * auto get the bucket zone
   * @param ak       accessKey
   * @param bucket   bucket name
   */
  static async autoZone(ak, bucket) {
    const requestURI = `https://uc.qbox.me/v2/query?ak=${ak}&bucket=${bucket}`;
    const options = {
      uri: requestURI,
      json: true,
    };

    return rp(options);
  }

  /**
   * list all buckets
   * @param ak   accessKey
   * @param sk   secretKey
   */
  static async buckets(ak, sk) {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = 'http://rs.qbox.me/buckets';
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * drop an exist bucket
   * @param ak      accessKey
   * @param sk      secretKey
   * @param name    bucket name
   */
  static async drop(ak, sk, name) {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = `http://rs.qiniu.com/drop/${name}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * create new bucket
   * @param ak      accessKey
   * @param sk      secretKey
   * @param name    bucket name
   * @param region  bucket region
   */
  static async mkbucket(ak, sk, name, region) {
    const encodedBucketName = Util.urlsafeBase64Encode(name);
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = `http://rs.qiniu.com/mkbucketv2/${encodedBucketName}/region/${region}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * list all files in a bucket
   * @param ak     accessKey
   * @param sk     secretKey
   * @param bucket bucket name
   */
  static async list(ak, sk, bucket, marker = '', prefix = '') {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = `http://rsf.qbox.me/list?bucket=${bucket}&limit=100&marker=${marker}&prefix=${prefix}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * list the domain of a bucket
   * @param ak     accessKey
   * @param sk     secretKey
   * @param bucket bucket name
   */
  static async domain(ak, sk, bucket) {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = `http://api.qiniu.com/v6/domain/list?tbl=${bucket}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * delete a file from a bucket
   * @param ak     accessKey
   * @param sk     secretKey
   * @param bucket bucket name
   * @patam key    item key
   */
  static async delete(ak, sk, bucket, key) {
    const entry = `${bucket}:${key}`;
    const encodedEntryURI = Util.urlsafeBase64Encode(entry);
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    const requestURI = `http://rs.qiniu.com/delete/${encodedEntryURI}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   *  batch management, delete, download etc.
   *
   */
  static async batchDelete(ak, sk, bucket, items) {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };

    let query = '';
    items.forEach((item) => {
      const entry = `${bucket}:${item.key}`;
      const encodedEntryURI = Util.urlsafeBase64Encode(entry);
      query += `op=/delete/${encodedEntryURI}&`;
    });
    query = query.substring(0, query.length - 1);

    const requestURI = `http://rs.qiniu.com/batch?${query}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }

  /**
   * rename the resource
   * @param ak      accessKey
   * @param sk      secretKey
   * @param bucket  bucket name
   * @param oldName the old name of the resource
   * @param newName the new name of the resource
   */
  static async rename(ak, sk, bucket, oldName, newName) {
    const mac = {
      accessKey: ak,
      secretKey: sk,
    };
    // generate encodedEntryURISrc
    const entrySrc = `${bucket}:${oldName}`;
    const encodedEntryURISrc = Util.urlsafeBase64Encode(entrySrc);

    // generate encodedEntryURIDest
    const entryDest = `${bucket}:${newName}`;
    const encodedEntryURIDest = Util.urlsafeBase64Encode(entryDest);

    const requestURI = `http://rs.qiniu.com/move/${encodedEntryURISrc}/${encodedEntryURIDest}`;
    const reqBody = '';
    const accessToken = Util.generateAccessToken(mac, requestURI, reqBody);

    const options = {
      uri: requestURI,
      headers: {
        Authorization: accessToken,
      },
      json: true,
    };

    return rp(options);
  }
}


================================================
FILE: src/renderer/utils/util.js
================================================
const url = require('url');
const crypto = require('crypto');

/**
 * Util module to implement the safe strategy.
 */
export default class Util {
  /**
   * Hmac-sha1 Crypt and return value already encoded with base64.
   * @param encodedFlags    flag used to encode the key.
   * @param secretKey       Qiniu secret key, you can get it in
   *                        "https://portal.qiniu.com/user/key"
   */
  static hmacSha1(encodedFlags, secretKey) {
    const hmac = crypto.createHmac('sha1', secretKey);
    hmac.update(encodedFlags);
    return hmac.digest('base64');
  }

  /**
   * base64 to url safe with Qiniu standard.
   * @param v    base64 string
   */
  static base64ToUrlSafe(v) {
    return v.replace(/\//g, '_').replace(/\+/g, '-');
  }

  /**
   * format the file size
   * @param fsize  file size
   */
  static fsizeFormat(fsize, prec = 2) {
    let rank = 0;
    let unit = 'B';

    while (fsize > 1024) {
      fsize /= 1024;
      rank += 1;
    }

    fsize = fsize.toFixed(prec);
    switch (rank) {
      case 1:
        unit = 'KB';
        break;
      case 2:
        unit = 'MB';
        break;
      case 3:
        unit = 'GB';
        break;
      case 4:
        unit = 'TB';
        break;
      default:
        break;
    }
    return `${fsize} ${unit}`;
  }


  /**
   * UrlSafe Base64 Decode.
   * @param jsonFlag
   */
  static urlsafeBase64Encode(jsonFlags) {
    const encoded = new Buffer(jsonFlags).toString('base64');
    return this.base64ToUrlSafe(encoded);
  }

  /**
   * generate AccessToken to manage the QBox.
   * @param mac         AK&SK object
   * @param requestURI  callback requestURI
   * @param reqBody     requst body, needed while ContentType be
   *                    application/x-www-form-urlencoded
   */
  static generateAccessToken(mac, requestURI, reqBody) {
    const u = url.parse(requestURI);
    const path = u.path;
    let access = `${path}\n`;

    if (reqBody) {
      access += reqBody;
    }

    const digest = this.hmacSha1(access, mac.secretKey);
    const safeDigest = this.base64ToUrlSafe(digest);
    return `QBox ${mac.accessKey}:${safeDigest}`;
  }

  /**
   * transfer url string to Blob object
   * @param url    url string
   */
  static urlToBlob(url) {
    return fetch(url);
  }
}


================================================
FILE: static/.gitkeep
================================================


================================================
FILE: static/style/iconfont.css
================================================

@font-face {font-family: "iconfont";
  src: url('iconfont.eot?t=1501386021427'); /* IE9*/
  src: url('iconfont.eot?t=1501386021427#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('iconfont.woff?t=1501386021427') format('woff'), /* chrome, firefox */
  url('iconfont.ttf?t=1501386021427') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
  url('iconfont.svg?t=1501386021427#iconfont') format('svg'); /* iOS 4.1- */
}

.iconfont {
  font-family:"iconfont" !important;
  font-size:16px;
  font-style:normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-download:before { content: "\e6e9"; }

.icon-202023:before { content: "\e65b"; }

.icon-upload:before { content: "\e60a"; }

.icon-previewline:before { content: "\e755"; }

.icon-logout:before { content: "\e62f"; }

.icon-manage:before { content: "\e502"; }



================================================
FILE: test/.eslintrc
================================================
{
  "env": {
    "mocha": true
  },
  "globals": {
    "assert": true,
    "expect": true,
    "should": true,
    "__static": true
  },
  "rules": {
    "func-names": 0,
    "prefer-arrow-callback": 0
  }
}


================================================
FILE: test/unit/index.js
================================================
import Vue from 'vue'
Vue.config.devtools = false
Vue.config.productionTip = false

// require all test files (files that ends with .spec.js)
const testsContext = require.context('./specs', true, /\.spec$/)
testsContext.keys().forEach(testsContext)

// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want coverage for.
const srcContext = require.context('../../src/renderer', true, /^\.\/(?!main(\.js)?$)/)
srcContext.keys().forEach(srcContext)


================================================
FILE: test/unit/karma.conf.js
================================================
'use strict'

const path = require('path')
const merge = require('webpack-merge')
const webpack = require('webpack')

const baseConfig = require('../../.electron-vue/webpack.renderer.config')
const projectRoot = path.resolve(__dirname, '../../src/renderer')

// Set BABEL_ENV to use proper preset config
process.env.BABEL_ENV = 'test'

let webpackConfig = merge(baseConfig, {
  devtool: '#inline-source-map',
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"testing"'
    })
  ]
})

// don't treat dependencies as externals
delete webpackConfig.entry
delete webpackConfig.externals
delete webpackConfig.output.libraryTarget

// apply vue option to apply isparta-loader on js
webpackConfig.module.rules
  .find(rule => rule.use.loader === 'vue-loader').use.options.loaders.js = 'babel-loader'

module.exports = config => {
  config.set({
    browsers: ['visibleElectron'],
    client: {
      useIframe: false
    },
    coverageReporter: {
      dir: './coverage',
      reporters: [
        { type: 'lcov', subdir: '.' },
        { type: 'text-summary' }
      ]
    },
    customLaunchers: {
      'visibleElectron': {
        base: 'Electron',
        flags: ['--show']
      }
    },
    frameworks: ['mocha', 'chai'],
    files: ['./index.js'],
    preprocessors: {
      './index.js': ['webpack', 'sourcemap']
    },
    reporters: ['spec', 'coverage'],
    singleRun: true,
    webpack: webpackConfig,
    webpackMiddleware: {
      noInfo: true
    }
  })
}


================================================
FILE: test/unit/specs/LandingPage.spec.js
================================================
import Vue from 'vue';
import LandingPage from '@/components/LandingPage';

describe('LandingPage.vue', () => {
  it('should render correct contents', () => {
    const vm = new Vue({
      el: document.createElement('div'),
      render: h => h(LandingPage),
    }).$mount();

    expect(vm.$el.querySelector('.title').textContent).to.contain('Welcome to your new project!');
  });
});
Download .txt
gitextract_2rr1couu/

├── .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
├── README_zh.md
├── appveyor.yml
├── build/
│   └── icons/
│       └── icon.icns
├── package.json
├── src/
│   ├── index.ejs
│   ├── main/
│   │   ├── index.dev.js
│   │   └── index.js
│   └── renderer/
│       ├── App.vue
│       ├── assets/
│       │   └── .gitkeep
│       ├── components/
│       │   ├── About.vue
│       │   ├── BucketHeader.vue
│       │   ├── BucketList.vue
│       │   ├── FileList.vue
│       │   ├── LandingPage/
│       │   │   └── SystemInformation.vue
│       │   ├── LandingPage.vue
│       │   ├── ManageTool.vue
│       │   └── NoBucket.vue
│       ├── main.js
│       ├── pages/
│       │   ├── Bucket.vue
│       │   ├── Login.vue
│       │   ├── Manage.vue
│       │   └── Upload.vue
│       ├── router/
│       │   └── index.js
│       ├── store/
│       │   ├── index.js
│       │   └── modules/
│       │       ├── Counter.js
│       │       └── index.js
│       └── utils/
│           ├── bus.js
│           ├── put_policy.js
│           ├── qiniu.js
│           └── util.js
├── static/
│   ├── .gitkeep
│   └── style/
│       └── iconfont.css
└── test/
    ├── .eslintrc
    └── unit/
        ├── index.js
        ├── karma.conf.js
        └── specs/
            └── LandingPage.spec.js
Download .txt
SYMBOL INDEX (39 symbols across 8 files)

FILE: .electron-vue/build.js
  function clean (line 26) | function clean () {
  function build (line 32) | function build () {
  function pack (line 73) | function pack (config) {
  function web (line 100) | function web () {
  function greeting (line 114) | function greeting () {

FILE: .electron-vue/dev-runner.js
  function logStats (line 19) | function logStats (proc, data) {
  function startRenderer (line 41) | function startRenderer () {
  function startMain (line 80) | function startMain () {
  function startElectron (line 116) | function startElectron () {
  function electronLog (line 131) | function electronLog (data, color) {
  function greeting (line 148) | function greeting () {
  function init (line 166) | function init () {

FILE: src/main/index.js
  function createWindow (line 20) | function createWindow() {

FILE: src/renderer/main.js
  method created (line 21) | created() {
  method checkLogin (line 25) | checkLogin() {

FILE: src/renderer/store/modules/Counter.js
  method DECREMENT_MAIN_COUNTER (line 6) | DECREMENT_MAIN_COUNTER(state) {
  method INCREMENT_MAIN_COUNTER (line 9) | INCREMENT_MAIN_COUNTER(state) {
  method someAsyncTask (line 15) | someAsyncTask({ commit }) {

FILE: src/renderer/utils/put_policy.js
  class PutPolicy (line 7) | class PutPolicy {
    method constructor (line 17) | constructor(options) {
    method getFlags (line 57) | getFlags() {
    method uploadToken (line 84) | uploadToken(mac) {

FILE: src/renderer/utils/qiniu.js
  class Qiniu (line 10) | class Qiniu {
    method autoZone (line 16) | static async autoZone(ak, bucket) {
    method buckets (line 31) | static async buckets(ak, sk) {
    method drop (line 57) | static async drop(ak, sk, name) {
    method mkbucket (line 84) | static async mkbucket(ak, sk, name, region) {
    method list (line 111) | static async list(ak, sk, bucket, marker = '', prefix = '') {
    method domain (line 137) | static async domain(ak, sk, bucket) {
    method delete (line 164) | static async delete(ak, sk, bucket, key) {
    method batchDelete (line 190) | static async batchDelete(ak, sk, bucket, items) {
    method rename (line 227) | static async rename(ak, sk, bucket, oldName, newName) {

FILE: src/renderer/utils/util.js
  class Util (line 7) | class Util {
    method hmacSha1 (line 14) | static hmacSha1(encodedFlags, secretKey) {
    method base64ToUrlSafe (line 24) | static base64ToUrlSafe(v) {
    method fsizeFormat (line 32) | static fsizeFormat(fsize, prec = 2) {
    method urlsafeBase64Encode (line 66) | static urlsafeBase64Encode(jsonFlags) {
    method generateAccessToken (line 78) | static generateAccessToken(mac, requestURI, reqBody) {
    method urlToBlob (line 96) | static urlToBlob(url) {
Condensed preview — 49 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (135K chars).
[
  {
    "path": ".babelrc",
    "chars": 617,
    "preview": "{\n  \"comments\": false,\n  \"env\": {\n    \"test\": {\n      \"presets\": [\n        [\"env\", {\n          \"targets\": { \"node\": 7 }\n"
  },
  {
    "path": ".electron-vue/build.js",
    "chars": 2996,
    "preview": "'use strict'\n\nprocess.env.NODE_ENV = 'production'\n\nconst { say } = require('cfonts')\nconst chalk = require('chalk')\ncons"
  },
  {
    "path": ".electron-vue/dev-client.js",
    "chars": 989,
    "preview": "const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')\n\nhotClient.subscribe(event => {\n  /**"
  },
  {
    "path": ".electron-vue/dev-runner.js",
    "chars": 4148,
    "preview": "'use strict'\n\nconst chalk = require('chalk')\nconst electron = require('electron')\nconst path = require('path')\nconst { s"
  },
  {
    "path": ".electron-vue/webpack.main.config.js",
    "chars": 1815,
    "preview": "'use strict'\n\nprocess.env.BABEL_ENV = 'main'\n\nconst path = require('path')\nconst { dependencies } = require('../package."
  },
  {
    "path": ".electron-vue/webpack.renderer.config.js",
    "chars": 4355,
    "preview": "'use strict'\n\nprocess.env.BABEL_ENV = 'renderer'\n\nconst path = require('path')\nconst { dependencies } = require('../pack"
  },
  {
    "path": ".electron-vue/webpack.web.config.js",
    "chars": 3331,
    "preview": "'use strict'\n\nprocess.env.BABEL_ENV = 'web'\n\nconst path = require('path')\nconst webpack = require('webpack')\n\nconst Babi"
  },
  {
    "path": ".eslintignore",
    "chars": 51,
    "preview": "test/unit/coverage/**\ntest/unit/*.js\ntest/e2e/*.js\n"
  },
  {
    "path": ".eslintrc.js",
    "chars": 649,
    "preview": "module.exports = {\n  root: true,\n  parser: 'babel-eslint',\n  parserOptions: {\n    sourceType: 'module'\n  },\n  env: {\n   "
  },
  {
    "path": ".gitignore",
    "chars": 159,
    "preview": ".DS_Store\ndist/electron/\ndist/web/\nbuild/\n!build/icons\ncoverage\nnode_modules/\nnpm-debug.log\nnpm-debug.log.*\nthumbs.db\n!."
  },
  {
    "path": ".travis.yml",
    "chars": 1259,
    "preview": "# Commented sections below can be used to run tests on the CI server\n# https://simulatedgreg.gitbooks.io/electron-vue/co"
  },
  {
    "path": "LICENSE",
    "chars": 34520,
    "preview": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C)"
  },
  {
    "path": "README.md",
    "chars": 2415,
    "preview": "\n# ![Qbox logo](http://orhcxc3kd.bkt.clouddn.com/logo-blue.png)\n\n[![Build status](https://ci.appveyor.com/api/projects/s"
  },
  {
    "path": "README_zh.md",
    "chars": 1636,
    "preview": "\n# ![Qbox logo](http://orhcxc3kd.bkt.clouddn.com/logo-blue.png)\n\n[![Build status](https://ci.appveyor.com/api/projects/s"
  },
  {
    "path": "appveyor.yml",
    "chars": 646,
    "preview": "# Commented sections below can be used to run tests on the CI server\n# https://simulatedgreg.gitbooks.io/electron-vue/co"
  },
  {
    "path": "package.json",
    "chars": 3935,
    "preview": "{\n  \"name\": \"qbox\",\n  \"version\": \"1.6.0\",\n  \"author\": \"lancegin\",\n  \"description\": \"assistant\",\n  \"license\": \"AGPL\",\n  \""
  },
  {
    "path": "src/index.ejs",
    "chars": 736,
    "preview": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>QBox</title>\n    <% if (htmlWebpackPlugin.options."
  },
  {
    "path": "src/main/index.dev.js",
    "chars": 790,
    "preview": "/**\n * This file is used specifically and only for development. It installs\n * `electron-debug` & `vue-devtools`. There "
  },
  {
    "path": "src/main/index.js",
    "chars": 6262,
    "preview": "import { app, BrowserWindow, Menu, Tray, ipcMain } from 'electron' // eslint-disable-line\nimport Qiniu from '../renderer"
  },
  {
    "path": "src/renderer/App.vue",
    "chars": 173,
    "preview": "<template>\n  <div id=\"app\">\n    <router-view></router-view>\n  </div>\n</template>\n\n<script>\n  export default {\n    name: "
  },
  {
    "path": "src/renderer/assets/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/renderer/components/About.vue",
    "chars": 252,
    "preview": "<template>\n  <div id=\"about-page\">\n    <p>this is the about page.</p>\n    <i class=\"iconfont icon-flip\"></i>\n  </div>\n</"
  },
  {
    "path": "src/renderer/components/BucketHeader.vue",
    "chars": 414,
    "preview": "<template>\n  <header style=\"-webkit-app-region: drag\">\n  </header>\n</template>\n\n<script>\n  export default {\n    name: 'b"
  },
  {
    "path": "src/renderer/components/BucketList.vue",
    "chars": 7577,
    "preview": "<template>\n  <div id=\"bucket-list-page\">\n    <div class=\"logout\">\n      <el-button type=\"text\" class=\"logout-btn\" icon=\""
  },
  {
    "path": "src/renderer/components/FileList.vue",
    "chars": 13254,
    "preview": "<template>\n  <div id=\"file-list-page\">\n\n    <!-- rename resource -->\n    <el-dialog\n      title=\"重命名资源\"\n      :visible.s"
  },
  {
    "path": "src/renderer/components/LandingPage/SystemInformation.vue",
    "chars": 1548,
    "preview": "<template>\n  <div>\n    <div class=\"title\">Information</div>\n    <div class=\"items\">\n      <div class=\"item\">\n        <di"
  },
  {
    "path": "src/renderer/components/LandingPage.vue",
    "chars": 2828,
    "preview": "<template>\n  <div id=\"wrapper\">\n    <img id=\"logo\" src=\"~@/assets/logo.png\" alt=\"electron-vue\">\n    <main>\n      <div cl"
  },
  {
    "path": "src/renderer/components/ManageTool.vue",
    "chars": 2276,
    "preview": "<template>\n  <div class=\"manage-tool\">\n    <div class=\"bucket-info\">\n      <el-tag class=\"bucket-name\">{{ bucket }}</el-"
  },
  {
    "path": "src/renderer/components/NoBucket.vue",
    "chars": 2648,
    "preview": "<template>\n  <div id=\"no-bucket-page\">\n    <div class=\"nothing-img\"></div>\n    <el-button class=\"show-modal-btn\" @click="
  },
  {
    "path": "src/renderer/main.js",
    "chars": 925,
    "preview": "import Vue from 'vue';\nimport axios from 'axios';\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-defau"
  },
  {
    "path": "src/renderer/pages/Bucket.vue",
    "chars": 654,
    "preview": "<template>\n  <div class=\"bucket-page\">\n    <bucket-header></bucket-header>\n    <div class=\"bucket-list\">\n      <bucket-l"
  },
  {
    "path": "src/renderer/pages/Login.vue",
    "chars": 555,
    "preview": "<template>\n  <div class=\"login-page\">\n    <bucket-header></bucket-header>\n    <no-bucket></no-bucket>\n  </div>\n</templat"
  },
  {
    "path": "src/renderer/pages/Manage.vue",
    "chars": 738,
    "preview": "<template>\n  <div class=\"manage-page\">\n    <bucket-header></bucket-header>\n    <manage-tool></manage-tool>\n    <div clas"
  },
  {
    "path": "src/renderer/pages/Upload.vue",
    "chars": 3689,
    "preview": "<template>\n  <div class=\"upload-page\">\n    <bucket-header></bucket-header>\n    <!-- manage tool -->\n    <div class=\"mana"
  },
  {
    "path": "src/renderer/router/index.js",
    "chars": 693,
    "preview": "import Vue from 'vue';\nimport Router from 'vue-router';\n\nVue.use(Router);\n\nexport default new Router({\n  routes: [\n    {"
  },
  {
    "path": "src/renderer/store/index.js",
    "chars": 195,
    "preview": "import Vue from 'vue';\nimport Vuex from 'vuex';\n\nimport modules from './modules';\n\nVue.use(Vuex);\n\nexport default new Vu"
  },
  {
    "path": "src/renderer/store/modules/Counter.js",
    "chars": 349,
    "preview": "const state = {\n  main: 0,\n};\n\nconst mutations = {\n  DECREMENT_MAIN_COUNTER(state) {\n    state.main -= 1;\n  },\n  INCREME"
  },
  {
    "path": "src/renderer/store/modules/index.js",
    "chars": 385,
    "preview": "/**\n * The file enables `@/store/index.js` to import all vuex modules\n * in a one-shot manner. There should not be any r"
  },
  {
    "path": "src/renderer/utils/bus.js",
    "chars": 67,
    "preview": "// bus component\nimport Vue from 'vue';\n\nexport default new Vue();\n"
  },
  {
    "path": "src/renderer/utils/put_policy.js",
    "chars": 2926,
    "preview": "/**\n *  @module   : Module to generate put policy and upload token\n *  @author   : Gin (gin.lance.inside@hotmail.com)\n *"
  },
  {
    "path": "src/renderer/utils/qiniu.js",
    "chars": 5977,
    "preview": "// load Util class\nimport Util from './util';\n\n// commonJs load modules\nconst rp = require('request-promise');\n\n/**\n * Q"
  },
  {
    "path": "src/renderer/utils/util.js",
    "chars": 2278,
    "preview": "const url = require('url');\nconst crypto = require('crypto');\n\n/**\n * Util module to implement the safe strategy.\n */\nex"
  },
  {
    "path": "static/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "static/style/iconfont.css",
    "chars": 886,
    "preview": "\n@font-face {font-family: \"iconfont\";\n  src: url('iconfont.eot?t=1501386021427'); /* IE9*/\n  src: url('iconfont.eot?t=15"
  },
  {
    "path": "test/.eslintrc",
    "chars": 208,
    "preview": "{\n  \"env\": {\n    \"mocha\": true\n  },\n  \"globals\": {\n    \"assert\": true,\n    \"expect\": true,\n    \"should\": true,\n    \"__st"
  },
  {
    "path": "test/unit/index.js",
    "chars": 523,
    "preview": "import Vue from 'vue'\nVue.config.devtools = false\nVue.config.productionTip = false\n\n// require all test files (files tha"
  },
  {
    "path": "test/unit/karma.conf.js",
    "chars": 1493,
    "preview": "'use strict'\n\nconst path = require('path')\nconst merge = require('webpack-merge')\nconst webpack = require('webpack')\n\nco"
  },
  {
    "path": "test/unit/specs/LandingPage.spec.js",
    "chars": 387,
    "preview": "import Vue from 'vue';\nimport LandingPage from '@/components/LandingPage';\n\ndescribe('LandingPage.vue', () => {\n  it('sh"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the LanceGin/QBox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 49 files (122.3 KB), approximately 32.5k tokens, and a symbol index with 39 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!