Commit a302c474 authored by antoor's avatar antoor

Revert "Update to v2.0.0"

This reverts commit 3069865d.
parent 3069865d
document/_book
screenshots
.DS_*
antData
......@@ -3,12 +3,6 @@
> 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT.
## 2016/05
### /03-30
**进行了大范围的代码重写以及新功能增加**
1. 插件市场包括下载管理等设计
2. 插件执行包括模块化等架构
3. 日志输出以及其他多出细节的调整
### /02
1. 移除`babel`依赖,采用原生ES6进行前端架构
2. 移除`document`以及`screenshots`目录,减少体积
......
## v2.0-beta
2.0测试版,请勿下载(下了也没用,运行不鸟 ^.^
从2.0开始,就算在开发者模式下也可以完全不需要安装其他环境啦!
而且启动速度是上一个版本的10倍!
......@@ -8,36 +8,22 @@
const electron = require('electron'),
app = electron.app,
path = require('path'),
BrowserWindow = electron.BrowserWindow;
app
.once('window-all-closed', app.quit)
.once('ready', () => {
/**
* 注册静态资源protocol
* - 可通过注册的协议访问资源文件,如ant-static://libs/jquery.jquery.js
*/
[
['static', '/static/', 13],
['views', '/views/', 12], //- 通过访问访问ant-views来访问views 文件
['src', '/source/', 10] //- 通过访问访问ant-src来访问source 文件
].map((_) => {
electron.protocol.registerFileProtocol(`ant-${_[0]}`, (req, cb) => {
cb({
path: path.join(__dirname, _[1], req.url.substr(_[2]))
});
});
});
// 初始化窗口
let mainWindow = new BrowserWindow({
width: 1040, height: 699,
minWidth: 888, minHeight: 555,
webgl: false, title: 'AntSword'
width: 1040,
height: 699,
minWidth: 888,
minHeight: 555,
webgl: false,
title: 'AntSword'
});
// 加载views
mainWindow.loadURL('ant-views://index.html');
mainWindow.loadURL(`file:\/\/${__dirname}/views/index.html`);
// 调整部分UI
const reloadUI = mainWindow.webContents.send.bind(
......@@ -47,23 +33,19 @@ app
// 窗口事件监听
mainWindow
.on('close', (event) => {
event.preventDefault();
app.exit(0);
})
.on('closed', () => { mainWindow = null })
.on('resize', reloadUI)
.on('maximize', reloadUI)
.on('unmaximize', reloadUI)
.on('enter-full-screen', reloadUI)
.on('leave-full-screen', reloadUI);
// 打开调试控制台
// mainWindow.webContents.openDevTools();
electron.Logger = require('./modules/logger')(mainWindow);
// 初始化模块
['menubar', 'request', 'database', 'cache', 'plugStore'].map((_) => {
['menubar', 'request', 'database', 'cache', 'update'].map((_) => {
new ( require(`./modules/${_}`) )(electron, app, mainWindow);
});
});
......@@ -14,26 +14,13 @@ const fs = require('fs'),
class Conf {
constructor() {
// 数据存储目录
let _oldPath = path.join(
// 获取数据存储目录
this.basePath = path.join(
process.env.HOME || process.env.LOCALAPPPATH || process.cwd() || '.',
'.antSword',
'shell.db'
'.antSword'
);
// 数据存储目录
this.basePath = path.join(
process.env.AS_WORKDIR,
'antData'
)
// 初始化目录
// 创建.antSword目录
!fs.existsSync(this.basePath) ? fs.mkdirSync(this.basePath) : null;
// 旧数据搬迁
if (fs.existsSync(_oldPath) && !fs.existsSync(this.dataPath)) {
fs.writeFileSync(
this.dataPath,
fs.readFileSync(_oldPath)
)
}
}
/**
......@@ -41,7 +28,7 @@ class Conf {
* @return {String} file-path
*/
get dataPath() {
return path.join(this.basePath, 'db.ant');
return path.join(this.basePath, 'shell.db');
}
/**
......@@ -55,28 +42,6 @@ class Conf {
return _;
}
/**
* 获取插件目录
* - 当前目录为下载的插件保存目录,而并非开发者的插件目录,同时开发者所设置的插件目录也不应为此
* @return {String} plug-path
*/
get plugPath() {
let _ = path.join(this.basePath, '/plugins/');
!fs.existsSync(_) ? fs.mkdirSync(_) : null;
return _;
}
/**
* 获取临时目录
* - 用户存储下载文件等缓存内容
* @return {String} temp-path
*/
get tmpPath() {
let _ = path.join(this.basePath, '/.temp/');
!fs.existsSync(_) ? fs.mkdirSync(_) : null;
return _;
}
/**
* 获取package.json配置信息
* @return {Object} [description]
......
......@@ -4,8 +4,6 @@
'use strict';
const Update = require('./update');
class Menubar {
constructor(electron, app, mainWindow) {
......@@ -50,15 +48,12 @@ class Menubar {
label: LANG['main']['aproxy'],
accelerator: 'Shift+CmdOrCtrl+A',
click: event.sender.send.bind(event.sender, 'menubar', 'settings-aproxy')
// }, {
// label: LANG['main']['update'],
// accelerator: 'Shift+CmdOrCtrl+U',
// click: event.sender.send.bind(event.sender, 'menubar', 'settings-update')
}, {
type: 'separator'
}, {
label: LANG['main']['update'],
enabled: false,
accelerator: 'Shift+CmdOrCtrl+U',
click: () => {
new Update();
}
}, {
label: LANG['main']['settings'],
accelerator: 'Shift+CmdOrCtrl+S',
......@@ -66,9 +61,9 @@ class Menubar {
}, {
type: 'separator'
}, {
label: LANG['main']['pluginStore'],
label: LANG['main']['plugin'],
accelerator: 'Shift+CmdOrCtrl+P',
click: event.sender.send.bind(event.sender, 'menubar', 'plugin-store')
click: event.sender.send.bind(event.sender, 'menubar', 'plugin')
}, {
type: 'separator'
}, {
......@@ -150,13 +145,7 @@ class Menubar {
{
label: LANG['debug']['restart'],
accelerator: 'Shift+CmdOrCtrl+R',
click: () => {
// 在有多个窗口的时候,不刷新
if (this.electron.BrowserWindow.getAllWindows().length > 1) {
return;
}
this.mainWindow.webContents.reload();//.bind(this.mainWindow.webContents)
}
click: this.mainWindow.webContents.reload.bind(this.mainWindow.webContents)
}, {
label: LANG['debug']['devtools'],
accelerator: 'Alt+CmdOrCtrl+J',
......
/**
* 应用商店后台模块
* - 用于进行下载、安装、卸载等后台操作
* create at: 2016/05/25
*/
let logger;
const fs = require('fs');
const path = require('path');
const CONF = require('./config');
const UNZIP = require('extract-zip');
class PlugStore {
constructor(electron, app, mainWindow) {
logger = new electron.Logger('PlugStore');
this.listenDownload(mainWindow);
electron.ipcMain
.on('store-uninstall', (event, plugName) => {
logger.warn('UnInstall', plugName);
// 删除目录
this.rmdir(
path.join(CONF.plugPath, `${plugName}-master`)
).then((ret) => {
event.returnValue = ret;
// 重新加载插件列表
mainWindow.webContents.send('reloadPlug', true);
});
})
.on('store-uninstall-dev', (event, plugPath) => {
logger.warn('UnInstall.DEV', plugPath);
// 删除目录
this.rmdir(plugPath).then((ret) => {
event.returnValue = ret;
// 重新加载插件列表
mainWindow.webContents.send('reloadPlug', true);
});
})
// 获取插件路径
.on('store-config-plugPath', (event) => {
event.returnValue = CONF.plugPath;
})
}
/**
* 监听下载
* @param {Object} mainWindow [description]
* @return {[type]} [description]
*/
listenDownload(mainWindow) {
mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
let fileName = item.getFilename().replace(/\-master\.zip$/,'');
let downLink = item.getURL();
logger.info('down-store-plug', downLink);
// 判断是否下载为插件
if (downLink.indexOf('github.com/asStore') > 0) {
// 1. 设置插件存储目录
let savePath = path.join(CONF.tmpPath, `${fileName}.zip`);
item.setSavePath(savePath);
webContents.send('store-download-progress', {
file: fileName,
type: 'init',
total: item.getTotalBytes()
});
// 2. 插件下载进度更新
item.on('updated', () => {
webContents.send('store-download-progress', {
file: fileName,
type: 'downloading',
size: item.getReceivedBytes()
});
});
// 3. 插件下载完毕
item.on('done', (e, state) => {
webContents.send('store-download-progress', {
file: fileName,
path: savePath,
type: 'downloaded',
state: state
});
if (state !== 'completed') { return };
// 解压安装插件
UNZIP(savePath, {
dir: CONF.plugPath
}, (err) => {
webContents.send('store-download-progress', {
type: 'installed',
file: fileName
});
logger.info('Installed', fileName);
// 重新加载插件列表
mainWindow.webContents.send('reloadPlug', true);
});
});
}
});
}
/**
* 删除目录
* @param {String} dir 目录
* @return {[type]} [description]
*/
rmdir(dir) {
return new Promise((res, rej) => {
let ret = true;
// 循环删除目录
const _rmdir = (_dir) => {
if (!fs.existsSync(_dir)) { return }
fs.readdirSync(_dir).map((_) => {
// 生成完整路径
let _path = path.join(dir, _);
// 如果是目录,则继续循环,否则删除
if (fs.lstatSync(_path).isDirectory()) {
return _rmdir(_path);
}
fs.unlinkSync(_path);
});
fs.rmdirSync(_dir);
}
try{
_rmdir(dir);
} catch (e) {
ret = e;
}
return res(ret);
});
}
}
module.exports = PlugStore;
/**
* HTTP后端数据发送处理函数
* 更新: 2016/05/07
* 更新: 2016/04/25
*/
'use strict';
const fs = require('fs'),
iconv = require('iconv-lite'),
// logger = require('log4js').getLogger('Request'),
// Logger = require('./logger'),
through = require('through'),
superagent = require('superagent'),
superagentProxy = require('superagent-proxy');
let logger;
// 请求UA
const USER_AGENT = 'antSword/v2.0';
const USER_AGENT = 'antSword/v1.3';
// 请求超时
const REQ_TIMEOUT = 10000;
const REQ_TIMEOUT = 5000;
// 代理配置
const APROXY_CONF = {
......@@ -230,7 +232,7 @@ class Request {
res.data += finalData;
});
res.on('end', () => {
logger.info(`end.size=${res.data.length}`, res.data);
logger.info('end::size=' + res.data.length, res.data.length < 10 ? res.data : '');
callback(null, new Buffer(res.data, 'binary'));
});
}
......
/**
* 中国蚁剑::更新程序
* 开写: 2016/05/31
*/
//
// 程序更新模块
//
/* 更新流程:
-------
1. 获取远程github上的package.json信息
2. 和本地版本进行判断,不一致则提示更新
3. 下载用户选择的更新源文件到临时目录`.antSword-{now}`
4. 替换程序中的`resources/app.asar`文件
5. 提示用户手动重启,关闭应用
*/
const config = require('./config');
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
'use strict';
const os = require('os'),
fs = require('fs'),
path = require('path'),
unzip = require('extract-zip'),
crypto = require('crypto'),
nugget = require('nugget'),
// logger = require('log4js').getLogger('Update'),
// Logger = require('./logger'),
// logger = null,
superagent = require('superagent');
let logger;
class Update {
constructor() {
this.listenHandler();
this.openWindow();
}
/**
* 事件监听器
* @return {[type]} [description]
*/
listenHandler() {
electron.ipcMain
.on('update-getVersion', (event) => {
event.returnValue = config.package['version']
constructor(electron) {
logger = new electron.Logger('Update');
const ipcMain = electron.ipcMain;
this.info = {};
ipcMain
.on('update-check', (event, arg) => {
this.check(arg['local_ver'], (hasUpdate, retVal) => {
logger.debug('check-result', hasUpdate, retVal);
event.sender.send('update-check', {
hasUpdate: hasUpdate,
retVal: retVal
});
});
})
.on('update-download', (event, source) => {
logger.debug('update-download', source);
const info = this.info['update'];
const downloadUrl = info['sources'][source];
this.download(downloadUrl, info['md5'], (done, retVal) => {
event.sender.send('update-download', {
done: done,
retVal: retVal
});
});
});
}
/**
* 打开更新窗口
* @return {[type]} [description]
*/
openWindow() {
let win = new BrowserWindow({
width: 400,
height: 250,
// height: 180,
// resizable: false,
minimizable: false,
maximizable: false
});
win.loadURL('ant-views://update.html');
win.webContents.openDevTools();
// 检查是否有更新
// 参数{localVer: 本地版本号, callback: 回调函数(是否有更新, 是?更新信息:错误信息)}
check(localVer, callback) {
logger.debug('check', localVer);
superagent
.get('https://raw.githubusercontent.com/antoor/antSword/master/package.json')
.timeout(9527)
.end((err, res) => {
if (err) { return callback(false, err.toString()) };
try {
const info = JSON.parse(res.text);
this.info = info;
callback(info['version'] !== localVer, info);
} catch (e) {
return callback(false, e.toString());
}
});
}
// 下载更新
// 参数{downloadUrl: 下载地址, md5: 校验MD5, callback: 回调(成功?(true, null):(false, err))}
download(downloadUrl, md5, callback) {
// 创建临时文件
const tmpDir = os.tmpDir();
const fileName = '.antSword-' + (+new Date);
const tmpFileName = path.join(tmpDir, fileName);
// 当前目录环境
const curDir = path.join(__dirname, '../../');
// 开始下载文件
nugget(
downloadUrl,
{
target: fileName,
dir: tmpDir,
resume: true,
verbose: true,
strictSSL: downloadUrl.startsWith('https')
},
(err) => {
if (err) { return callback(false, err.toString()) };
// 校验MD5
const _md5 = crypto.createHash('md5').update(fs.readFileSync(tmpFileName)).digest('hex');
if (_md5 !== md5) { return callback(false, { type: 'md5', err: _md5 }) };
// ZIP解压
unzip(tmpFileName, {
dir: tmpDir
}, (e) => {
if (e) { return (callback(false, { type: 'unzip', err: e })) };
// 删除旧asar
// fs.unlinkSync(path.join(curDir, 'app.asar'));
// 移动新asar
fs.rename(
path.join(tmpDir, 'antSword.update'),
path.join(curDir, 'app.asar'),
(_e) => {
_e ? callback(false, _e.toString()) : callback(true);
}
);
});
}
);
}
}
module.exports = Update;
//
// 程序更新模块
//
/* 更新流程:
-------
1. 获取远程github上的package.json信息
2. 和本地版本进行判断,不一致则提示更新
3. 下载用户选择的更新源文件到临时目录`.antSword-{now}`
4. 替换程序中的`resources/app.asar`文件
5. 提示用户手动重启,关闭应用
*/
'use strict';
const os = require('os'),
fs = require('fs'),
path = require('path'),
unzip = require('extract-zip'),
crypto = require('crypto'),
nugget = require('nugget'),
// logger = require('log4js').getLogger('Update'),
// Logger = require('./logger'),
// logger = null,
superagent = require('superagent');
let logger;
class Update {
constructor(electron) {
logger = new electron.Logger('Update');
const ipcMain = electron.ipcMain;
this.info = {};
ipcMain
.on('update-check', (event, arg) => {
this.check(arg['local_ver'], (hasUpdate, retVal) => {
logger.debug('check-result', hasUpdate, retVal);
event.sender.send('update-check', {
hasUpdate: hasUpdate,
retVal: retVal
});
});
})
.on('update-download', (event, source) => {
logger.debug('update-download', source);
const info = this.info['update'];
const downloadUrl = info['sources'][source];
this.download(downloadUrl, info['md5'], (done, retVal) => {
event.sender.send('update-download', {
done: done,
retVal: retVal
});
});
});
}
// 检查是否有更新
// 参数{localVer: 本地版本号, callback: 回调函数(是否有更新, 是?更新信息:错误信息)}
check(localVer, callback) {
logger.debug('check', localVer);
superagent
.get('https://raw.githubusercontent.com/antoor/antSword/master/package.json')
.timeout(9527)
.end((err, res) => {
if (err) { return callback(false, err.toString()) };
try {
const info = JSON.parse(res.text);
this.info = info;
callback(info['version'] !== localVer, info);
} catch (e) {
return callback(false, e.toString());
}
});
}
// 下载更新
// 参数{downloadUrl: 下载地址, md5: 校验MD5, callback: 回调(成功?(true, null):(false, err))}
download(downloadUrl, md5, callback) {
// 创建临时文件
const tmpDir = os.tmpDir();
const fileName = '.antSword-' + (+new Date);
const tmpFileName = path.join(tmpDir, fileName);
// 当前目录环境
const curDir = path.join(__dirname, '../../');
// 开始下载文件
nugget(
downloadUrl,
{
target: fileName,
dir: tmpDir,
resume: true,
verbose: true,
strictSSL: downloadUrl.startsWith('https')
},
(err) => {
if (err) { return callback(false, err.toString()) };
// 校验MD5
const _md5 = crypto.createHash('md5').update(fs.readFileSync(tmpFileName)).digest('hex');
if (_md5 !== md5) { return callback(false, { type: 'md5', err: _md5 }) };
// ZIP解压
unzip(tmpFileName, {
dir: tmpDir
}, (e) => {
if (e) { return (callback(false, { type: 'unzip', err: e })) };
// 删除旧asar
// fs.unlinkSync(path.join(curDir, 'app.asar'));
// 移动新asar
fs.rename(
path.join(tmpDir, 'antSword.update'),
path.join(curDir, 'app.asar'),
(_e) => {
_e ? callback(false, _e.toString()) : callback(true);
}
);
});
}
);
}
}
module.exports = Update;
/**
* 中国蚁剑::程序入口
* 创建:2015/12/20
* 更新:2016/05/02
* 更新:2016/04/16
* 作者:蚁逅 <https://github.com/antoor>
*/
'use strict';
const fs = require('fs'),
path = require('path'),
electron = require('electron'),
shell = electron.shell,
remote = electron.remote,
ipcRenderer = electron.ipcRenderer;
const electron = require('electron');
const shell = electron.shell;
const remote = electron.remote;
const ipcRenderer = electron.ipcRenderer;
// import Menubar from './base/menubar';
// import CacheManager from './base/cachemanager';
const Menubar = require('./base/menubar');
const CacheManager = require('./base/cachemanager');
const antSword = window.antSword = {
/**
* XSS过滤函数
* @param {String} html 过滤前字符串
* @param {Boolean} wrap 是否过滤换行
* @return {String} 过滤后的字符串
* @param {String} html 过滤前字符串
* @return {String} 过滤后的字符串
*/
noxss: (html = '', wrap = true) => {
let _html = String(html)
.replace(/&/g, "&amp;")
.replace(/>/g, "&gt;")
.replace(/</g, "&lt;")
.replace(/"/g, "&quot;");
if (wrap) {
_html = _html.replace(/\n/g, '<br/>');
}
return _html;
noxss: (html) => {
return String(html).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
},
/**
* 终端日志数据
......@@ -45,11 +36,6 @@ const antSword = window.antSword = {
* @type {Object}
*/
core: {},
/**
* 插件列表
* @type {Object}
*/
plugins: {},
/**
* 操作模块
* @type {Object}
......@@ -70,44 +56,6 @@ const antSword = window.antSword = {
};
// 设置
localStorage.setItem(key, value);
},
/**
* 重新加载插件(包含开发者&&本地插件库
* @return {[type]} [description]
*/
reloadPlug() {
antSword['plugins'] = {};
// 加载插件::本地
let pluginHome = ipcRenderer.sendSync('store-config-plugPath');
fs.readdirSync(pluginHome).map((_) => {
let pluginPath = path.join(pluginHome, _);
// 如果不是目录,则跳过
if (!fs.lstatSync(pluginPath).isDirectory()) { return }
// 存储路径&&package信息到全局变量antSword['plugins']
antSword['plugins'][_] = {
_id: _,
path: pluginPath,
info: JSON.parse(fs.readFileSync(path.join(pluginPath, 'package.json')))
}
});
// 加载插件::开发
let devPlugPath = antSword.storage('dev-plugPath');
if (
antSword.storage('isDev') === '1' &&
fs.existsSync(devPlugPath) &&
fs.lstatSync(devPlugPath).isDirectory()
) {
fs.readdirSync(devPlugPath).map((_) => {
let _path = path.join(devPlugPath, _);
// 如果不是目录,则跳过
if (!fs.lstatSync(_path).isDirectory()) { return }
antSword['plugins'][_] = {
_id: _,
path: _path,
info: JSON.parse(fs.readFileSync(path.join(_path, 'package.json')))
}
});
}
}
};
......@@ -141,13 +89,14 @@ ipcRenderer.send('aproxy', {
});
antSword['shell'] = shell;
antSword['remote'] = remote;
antSword['ipcRenderer'] = ipcRenderer;
antSword['CacheManager'] = CacheManager;
antSword['menubar'] = new Menubar();
antSword['package'] = require('../package');
// 加载模块列表
// antSword['tabbar'] = new dhtmlXTabBar(document.getElementById('container'));
// 更新:使用document.body作为容器,可自动适应UI
antSword['tabbar'] = new dhtmlXTabBar(document.body);
[
'shellmanager',
......@@ -162,28 +111,6 @@ $('#loading').remove();
document.title = antSword['language']['title'] || 'AntSword';
/**
* 日志组输出
* - 日志只会输出最多100个字符,如果想查看全部数据,则可以通过antSword.logs[id]进行查看
* @param {Object} opt 日志对象[0=日志,1=对象]
* @param {String} color 输出颜色
* @return {[type]} [description]
*/
const groupLog = (opt, color) => {
if (antSword.logs.length % 10 === 0) {
console.group(`LOGS: ${antSword.logs.length}+`);
}
let lineNum = antSword['logs'].push(opt[1]) - 1;
console.log(
`%c0x${lineNum < 10 ? '0' + lineNum : lineNum}\t${opt[0].substr(0, 100) + (opt[0].length > 100 ? '..' : '')}`,
`color:${color}`
);
if (antSword.logs.length % 10 === 0) {
console.groupEnd();
}
}
// 监听后端消息
ipcRenderer
/**
* 刷新UI(shellmanager侧边栏
......@@ -196,29 +123,20 @@ ipcRenderer
antSword.modules.shellmanager.category.cell.setWidth(222);
}, 555);
})
/**
* 重新加载本地插件
* @param {[type]} 'reloadPlug' [description]
* @param {[type]} ( [description]
* @return {[type]} [description]
*/
.on('reloadPlug', antSword.reloadPlug.bind(antSword))
/**
* 后端日志输出
* + 用于在前端控制台输出后端的日志
* - 可使用`antSword.logs[id]`来获取详细日志
*/
.on('logger-debug', (e, opt) => {
groupLog(opt, '#607D8B');
console.log(`%c${antSword['logs'].push(opt[1]) - 1}\t${opt[0]}`, 'color:#607D8B');
})
.on('logger-info', (e, opt) => {
groupLog(opt, '#4CAF50');
console.log(`%c${antSword['logs'].push(opt[1]) - 1}\t${opt[0]}`, 'color:#009688');
})
.on('logger-warn', (e, opt) => {
groupLog(opt, '#FF9800');
console.log(`%c${antSword['logs'].push(opt[1]) - 1}\t${opt[0]}`, 'color:#FF9800');
})
.on('logger-fatal', (e, opt) => {
groupLog(opt, '#E91E63');
console.log(`%c${antSword['logs'].push(opt[1]) - 1}\t${opt[0]}`, 'color:#E91E63');
});
antSword.reloadPlug();
module.exports = (pwd, data) => {
data[pwd] = new Buffer(data['_']).toString('base64');
delete data['_'];
return data;
}
......@@ -35,7 +35,7 @@ class PHP extends Base {
* @return {array} 编码器列表
*/
get encoders() {
return ['chr', 'base64', 'mybase64'];
return ['chr', 'base64'];
}
/**
......
/**
* 中国蚁剑::前端加载模块
* 开写: 2016/04/23
* 更新: 2016/05/10
* 更新: 2016/04/28
* 作者: 蚁逅 <https://github.com/antoor>
*/
'use strict';
// 添加源码目录到全局模块加载变量,以提供后边加载
// 加载jQuery
window.$ = window.jQuery = require('../static/libs/jquery/jquery.js');
const path = require('path');
const Module = require('module').Module;
Module.globalPaths.push(path.join(process.env.AS_WORKDIR, 'source'));
// 开始加载时间
let APP_START_TIME = +new Date;
window.addEventListener('load', () => {
$(document).ready(() => {
/**
* 时间格式化函数
* @param {String} format 格式化字符串,如yyyy/mm/dd hh:ii:ss
......@@ -73,57 +72,79 @@ window.addEventListener('load', () => {
}
// 开始加载css
loadCSS('ant-static://libs/bmenu/bmenu.css')
.then(() => loadCSS('ant-static://libs/toastr/toastr.min.css'))
.then(() => loadCSS('ant-static://libs/layer/src/skin/layer.css'))
.then(() => loadCSS('ant-static://libs/layer/src/skin/layer.ext.css'))
.then(() => loadCSS('ant-static://libs/laydate/need/laydate.css'))
.then(() => loadCSS('ant-static://libs/laydate/skins/default/laydate.css'))
.then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal.css'))
.then(() => loadCSS('ant-static://libs/font-awesome/css/font-awesome.min.css'))
.then(() => loadCSS('ant-static://libs/dhtmlx/codebase/dhtmlx.css'))
.then(() => loadCSS('ant-static://libs/dhtmlx/skins/mytheme/dhtmlx.css'))
.then(() => loadCSS('ant-static://css/index.css'));
loadCSS(
'../static/libs/bmenu/bmenu.css'
).then(() => {
return loadCSS('../static/libs/toastr/toastr.min.css');
}).then(() => {
return loadCSS('../static/libs/layer/src/skin/layer.css');
}).then(() => {
return loadCSS('../static/libs/layer/src/skin/layer.ext.css');
}).then(() => {
return loadCSS('../static/libs/laydate/need/laydate.css');
}).then(() => {
return loadCSS('../static/libs/laydate/skins/default/laydate.css');
}).then(() => {
return loadCSS('../static/libs/terminal/css/jquery.terminal.css');
}).then(() => {
return loadCSS('../static/libs/font-awesome/css/font-awesome.min.css');
}).then(() => {
return loadCSS('../static/libs/dhtmlx/codebase/dhtmlx.css');
}).then(() => {
return loadCSS('../static/libs/dhtmlx/skins/mytheme/dhtmlx.css');
}).then(() => {
return loadCSS('../static/css/index.css');
});
// 加载js资源
loadJS('ant-static://libs/jquery/jquery.js')
.then(() => loadJS('ant-static://libs/ace/ace.js'))
.then(() => loadJS('ant-static://libs/ace/ext-language_tools.js'))
.then(() => loadJS('ant-static://libs/bmenu/bmenu.js'))
.then(() => loadJS('ant-static://libs/toastr/toastr.js'))
.then(() => loadJS('ant-static://libs/layer/src/layer.js'))
.then(() => loadJS('ant-static://libs/laydate/laydate.js'))
.then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min.js'))
.then(() => loadJS('ant-static://libs/dhtmlx/codebase/dhtmlx.js'))
.then(() => {
/**
* 配置layer弹出层
* @param {[type]} {extend: 'extend/layer.ext.js'} [description]
* @return {[type]} [description]
*/
layer.config({extend: 'extend/layer.ext.js'});
// 加载程序入口
require('app.entry');
// LOGO
console.group('LOGO');
console.log(
`%c
_____ _ _____ _
| _ |___| |_| __|_ _ _ ___ ___ _| |
| | | _|__ | | | | . | _| . |
|__|__|_|_|_| |_____|_____|___|_| |___|%c
loadJS(
'../static/libs/ace/ace.js'
).then(() => {
return loadJS('../static/libs/ace/ext-language_tools.js');
}).then(() => {
return loadJS('../static/libs/bmenu/bmenu.js');
}).then(() => {
return loadJS('../static/libs/toastr/toastr.js');
}).then(() => {
return loadJS('../static/libs/layer/src/layer.js');
}).then(() => {
return loadJS('../static/libs/laydate/laydate.js');
}).then(() => {
return loadJS('../static/libs/terminal/js/jquery.terminal-min.js');
}).then(() => {
return loadJS('../static/libs/dhtmlx/codebase/dhtmlx.js');
}).then(() => {
/**
* 配置layer弹出层
* @param {[type]} {extend: 'extend/layer.ext.js'} [description]
* @return {[type]} [description]
*/
layer.config({extend: 'extend/layer.ext.js'});
// 加载babel引擎
// require('babel/register')();
// 添加require路径
require.main.paths.unshift(
path.join(process.env.AS_WORKDIR, 'source')
);
// 加载程序入口
require('./app.entry');
// LOGO
console.log(
`%c
_____ _ _____ _
| _ |___| |_| __|_ _ _ ___ ___ _| |
| | | _|__ | | | | . | _| . |
|__|__|_|_|_| |_____|_____|___|_| |___|%c
->| Ver: %c${antSword.package.version}%c
-+=>| Git: %c${antSword.package.repository['url']}%c
-*| End: %c${+new Date - APP_START_TIME}%c/ms
->| Ver: %c${antSword.package.version}%c
-+=>| Git: %c${antSword.package.repository['url']}%c
-*| End: %c${+new Date - APP_START_TIME}%c/ms
`,
'color: #F44336;', 'color: #9E9E9E;',
'color: #4CAF50;', 'color: #9E9E9E;',
'color: #2196F3;', 'color: #9E9E9E;',
'color: #FF9800;', 'color: #9E9E9E;'
);
APP_START_TIME = null;
console.groupEnd();
});
`,
'color: #F44336;', 'color: #9E9E9E;',
'color: #4CAF50;', 'color: #9E9E9E;',
'color: #2196F3;', 'color: #9E9E9E;',
'color: #FF9800;', 'color: #9E9E9E;'
);
});
});
/**
* 文件管理模板
* 更新:2016/05/14
* 更新:2016/04/13
* 作者:蚁逅 <https://github.com/antoor>
*/
'use strict';
// import Files from './files';
// import Tasks from './tasks';
// import Folder from './folder';
// import ENCODES from '../../base/encodes';
const Files = require('./files');
const Tasks = require('./tasks');
const Folder = require('./folder');
......@@ -13,7 +17,8 @@ const ENCODES = require('../../base/encodes');
const fs = require('fs');
const iconv = require('iconv-lite');
const crypto = require('crypto');
const dialog = antSword.remote.dialog;
const remote = require('remote');
const dialog = remote.require('dialog');
// 加载语言模板
const LANG = antSword['language']['filemanager'];
......
/**
* 插件中心
* 开写:2016/05/09
* 更新:-
* 作者:蚁逅 <https://github.com/antoor>
*/
//
// 插件中心
//
'use strict';
const path = global.require('path');
const LANG = antSword['language']['plugin'];
const LANG_T = antSword['language']['toastr'];
class Plugin {
constructor() {
// 注册菜单事件
antSword['menubar'].reg(
'plugin-store',
this.initWin.bind(this, 'ant-views://plugin.html')
);
this.win = null;
antSword['menubar'].reg('plugin', this.open.bind(this));
this.homepage = 'http://u.uyu.us/';
}
/**
* 初始化新窗口
* @param {String} url 要加载的URL
* @return {Object} BrowserWindow窗口对象
*/
initWin(url) {
if (this.win) {
return this.win.focus();
}
let win = new antSword['remote'].BrowserWindow({
width: 930,
height: 666,
minWidth: 888,
minHeight: 555,
show: false,
title: 'AntSword.Store'
open() {
const tabbar = antSword['tabbar'];
// 判断是否已经打开
if (tabbar.tabs('tab_plugin')) {
return tabbar.tabs('tab_plugin').setActive();
};
tabbar.addTab(
'tab_plugin',
'<i class="fa fa-cart-arrow-down"></i>',
null, null, true, true
);
const cell = tabbar.tabs('tab_plugin');
//
// @创建浏览器工具栏:后退、前进、刷新、主页、停止
//
const toolbar = cell.attachToolbar();
toolbar.loadStruct([
{ id: 'back', type: 'button', text: '', icon: 'chevron-left' },
{ id: 'forward', type: 'button', text: '', icon: 'chevron-right' },
{ id: 'refresh', type: 'button', text: '', icon: 'refresh' },
{ id: 'home', type: 'button', text: '', icon: 'home' },
{ id: 'stop', type: 'button', text: '', icon: 'remove' }
]);
// 开始加载web
cell.progressOn();
const frame = cell.attachURI(this.homepage);
frame.addEventListener('did-start-loading', cell.progressOn.bind(cell));
frame.addEventListener('did-finish-load', cell.progressOff.bind(cell));
frame.addEventListener('did-fail-load', (err) => {
cell.progressOff();
// cell.close();
let err_msg = `Code: ${err['errorCode']}`;
err_msg += err['errorDescription'] ? `<br/>Desc: ${err['errorDescription']}` : '';
return toastr.error(LANG['error'](err_msg), LANG_T['error']);
});
win.on('close', () => {
this.win = win = null;
// 工具栏点击事件
toolbar.attachEvent('onClick', (id) => {
switch(id) {
case 'back':
frame.goBack();
break;
case 'forward':
frame.goForward();
break;
case 'refresh':
frame.reloadIgnoringCache();
break;
case 'home':
frame.goToIndex(0);
break;
case 'stop':
frame.stop();
break;
}
});
win.loadURL(url);
win.show();
// win.openDevTools();
this.win = win;
}
}
}
// export default Plugin;
module.exports = Plugin;
......@@ -15,7 +15,7 @@ class About {
const cell = sidebar.cells('about');
cell.attachHTMLString(`
<div align="center" class="about">
<img src="ant-static://imgs/logo.png" />
<img src="../static/imgs/logo.png" />
<hr/>
<h2>${LANG['header']}<span> v${antSword['package']['version']}</span></h2>
<p>
......
......@@ -2,7 +2,9 @@
* 左侧shell数据管理模块
*/
const path = require('path');
// import Terminal from '../terminal/';
// import Database from '../database/';
// import FileManager from '../filemanager/';
const Terminal = require('../terminal/');
const Database = require('../database/');
const FileManager = require('../filemanager/');
......@@ -53,21 +55,20 @@ class List {
ids = [id];
}
// 获取选择数据信息
let infos = [];
if (ids.length >= 1) {
infos = antSword['ipcRenderer'].sendSync(
'shell-find',
{ _id: { $in: ids } }
)
}
// 获取选中的单条数据
let info = infos[0];
// let info = {};
// if (id && ids.length === 1) {
// info = antSword['ipcRenderer'].sendSync('shell-findOne', id);
// };
let info = {};
if (id && ids.length === 1) {
info = antSword['ipcRenderer'].sendSync('shell-findOne', id);
// info = {
// id: id,
// ip: grid.getRowAttribute(id, 'data')[1],
// url: grid.getRowAttribute(id, 'data')[0],
// pwd: grid.getRowAttribute(id, 'pwd'),
// type: grid.getRowAttribute(id, 'type'),
// encode: grid.getRowAttribute(id, 'encode') || 'utf-8',
// encoder: grid.getRowAttribute(id, 'encoder') || 'default'
// }
};
bmenu([
{ text: LANG['contextmenu']['terminal'], icon: 'fa fa-terminal', disabled: !id || ids.length !== 1, action: () => {
......@@ -80,81 +81,8 @@ class List {
new Database(info);
} },
{ divider: true },
// 加载插件列表
{ text: LANG['contextmenu']['plugin'], icon: 'fa fa-folder-o', disabled: !id, subMenu: (() => {
// 1. 遍历插件分类信息
let plugins = {
default: []
};
for (let _ in antSword['plugins']) {
let p = antSword['plugins'][_];
plugins[
p['info']['category'] || 'default'
] = plugins[
p['info']['category'] || 'default'
] || [];
plugins[
p['info']['category'] || 'default'
].push(p);
}
// 2. 解析分类数据
let pluginItems = [];
for (let _ in plugins) {
// 0x01 添加分类目录
pluginItems.push({
text: antSword.noxss(_ === 'default' ? LANG['contextmenu']['pluginDefault'] : _),
icon: 'fa fa-folder-open-o',
disabled: plugins[_].length === 0,
subMenu: ((plugs) => {
let plugItems = [];
// 0x02 添加目录数据
plugs.map((p) => {
plugItems.push({
text: antSword.noxss(p['info']['name']),
icon: `fa fa-${p['info']['icon'] || 'puzzle-piece'}`,
disabled: ids.length > 1 ? (() => {
let ret = false;
// 判断脚本是否支持,不支持则禁止
if (p['info']['scripts'] && p['info']['scripts'].length > 0) {
infos.map((_info) => {
if (p['info']['scripts'].indexOf(_info['type']) === -1) {
// 如果检测到不支持的脚本,则禁止
ret = true;
}
});
}
// 判断是否支持多目标执行
return ret || !p['info']['multiple'];
})() : info && (p['info']['scripts'] || []).indexOf(info['type']) === -1,
action: ((plug) => () => {
// 如果没有加载到内存,则加载
if (!antSword['plugins'][plug['_id']]['module']) {
antSword['plugins'][plug['_id']]['module'] = require(
path.join(plug['path'], plug['info']['main'] || 'index.js')
);
}
// 执行插件
new antSword['plugins'][plug['_id']]['module'](
infos.length === 1 && !plug['info']['multiple'] ? info : infos
);
})(p)
})
});
return plugItems;
})(plugins[_])
})
}
return pluginItems;
})() },
{
// text: LANG['contextmenu']['pluginManager'],
// icon: 'fa fa-th-large',
// action: antSword['menubar'].run.bind(antSword['menubar'], 'plugin-local')
// }, {
text: LANG['contextmenu']['pluginStore'],
icon: 'fa fa-cart-arrow-down',
action: antSword['menubar'].run.bind(antSword['menubar'], 'plugin-store')
},
{ text: LANG['contextmenu']['plugin'], icon: 'fa fa-puzzle-piece', disabled: !id || ids.length !== 1 || true, subMenu: [] },
{ text: LANG['contextmenu']['pluginCenter'], icon: 'fa fa-cart-arrow-down', action: antSword['menubar'].run.bind(antSword['menubar'], 'plugin') },
{ divider: true },
{ text: LANG['contextmenu']['add'], icon: 'fa fa-plus-circle', action: manager.addData.bind(manager) },
{ text: LANG['contextmenu']['edit'], icon: 'fa fa-edit', disabled: !id || ids.length !== 1, action: () => {
......
......@@ -136,15 +136,14 @@ class Terminal {
if (cmd === 'exit' || cmd === 'quit') { return this.cell.close() };
term.pause();
// 是否有缓存
// 最后想了想,这个命令执行结果的缓存还是暂时不需要了吧
// let cacheTag = 'command-' + new Buffer(this.path + cmd).toString('base64');
// let cacheCmd;
// if (cacheCmd = this.cache.get(cacheTag)) {
// term.echo(
// antSword.noxss(cacheCmd, false)
// );
// return term.resume();
// };
let cacheTag = 'command-' + new Buffer(this.path + cmd).toString('base64');
let cacheCmd;
if (cacheCmd = this.cache.get(cacheTag)) {
term.echo(
antSword.noxss(cacheCmd)
);
return term.resume();
};
// 开始执行命令
this.core.request(
......@@ -176,7 +175,7 @@ class Terminal {
});
if (output.length > 0) {
term.echo(
antSword.noxss(output, false)
antSword.noxss(output)
);
// 保存最大100kb数据
if (output.length < (1024 * 1024)) {
......@@ -184,8 +183,8 @@ class Terminal {
};
};
term.resume();
}).catch((_) => {
// term.error('ERR: ' + (_ instanceof Object) ? JSON.stringify(_) : String(_));
}).catch((e) => {
term.error('ERR: ' + (_ instanceof Object) ? JSON.stringify(_) : String(_));
term.resume();
});
}, {
......
## 中国蚁剑::UI框架库
> 用于在插件、扩展以及自身模块中调用。
**本UI框架基于`dhtmlx`进行二次封装API**
开发者可以采用原生框架API进行开发,也可以使用本UI框架进行开发。
原生API文档:[http://docs.dhtmlx.com/](http://docs.dhtmlx.com/)
/**
* UI::tabbar
* - 创建一个面板
* 开写:2016/05/03
* 更新:-
* 作者:蚁逅 <https://github.com/antoor>
*/
'use strict';
class Tabbar {
constructor(opts) {
// 生成一个随机ID,用于指定唯一的面板
let id = 'tabbar_' + (Math.random() * +new Date).toString(16).replace('.', '').substr(0,11);
let tabbar = antSword['tabbar'];
// 添加面板对象
tabbar.addTab(
id,
'<i class="fa fa-puzzle-piece"></i>',
null, null, true, true
);
this.cell = tabbar.tabs(id);
}
/**
* 面板获取焦点
* @return {[type]} [description]
* @return {Object} this
*/
active() {
this.cell.setActive();
return this;
}
/**
* 关闭面板
* @return {Object} this
*/
close() {
this.cell.close();
return this;
}
/**
* 设置面板标题
* @param {String} title = 'New Title' [description]
* @return {Object} this
*/
setTitle(title = 'New Title') {
this.cell.setText(`<i class="fa fa-puzzle-piece"></i> ${title}`);
return this;
}
/**
* 安全输出HTML
* - 采用`iframe`框架进行HTML输出,避免变量污染&&一些安全问题
* @param {String} html = "" [description]
* @return {Object} this
*/
safeHTML(html = "") {
let _html = new Buffer(html).toString('base64');
let _iframe = `
<iframe
src="data:text/html;base64,${_html}"
style="width:100%;height:100%;border:0;padding:0;margin:0;">
</iframe>
`;
this.cell.attachHTMLString(_iframe);
return this;
}
/**
* 显示加载中
* @param {Boolean} loading = true 是否显示/false=隐藏
* @return {Object} this
*/
showLoading(loading = true) {
this.cell[loading ? 'progressOn' : 'progressOff']();
return this;
}
}
module.exports = Tabbar;
/**
* UI::Window
* - 弹窗窗口
* 开写:2016/05/03
* 更新:-
* 作者:蚁逅 <https://github.com/antoor>
*/
'use strict';
class Window {
/**
* 初始化一个窗口对象
* @param {Object} opts 窗口设置(title,width,height
* @return {[type]} [description]
*/
constructor(opts) {
// 生成一个随机ID,用于指定唯一的窗口
let id = 'win_' + (Math.random() * +new Date).toString(16).replace('.', '').substr(0,11);
// 默认配置
let opt = $.extend({
title: id,
width: 500,
height: 400,
// 在那个dom内显示
view: document.body
}, opts);
// 创建窗口
let winObj = new dhtmlXWindows();
winObj.attachViewportTo(opt['view']);
let win = winObj.createWindow(
id, 0, 0,
opt['width'], opt['height']
);
win.setText(opt['title']);
win.centerOnScreen();
win.button('minmax').show();
win.button('minmax').enable();
this.win = win;
}
/**
* 关闭窗口
* @return {[type]} [description]
*/
close() {
this.win.close();
}
/**
* 设置标题
* @param {String} title = 'New Title' 新标题
*/
setTitle(title = 'New Title') {
this.win.setText(title);
}
}
module.exports = Window;
......@@ -11,7 +11,7 @@ html, body, #container, #loading {
position: fixed;
background-color: #FFF;
text-align: center;
background-image: url(ant-static://imgs/load.png);
background-image: url(../imgs/load.png);
background-repeat: no-repeat;
background-position: 50% 50%;
}
......@@ -203,39 +203,3 @@ html, body, #container, #loading {
.about a:hover {
color: #009688;
}
webview {
display:inline-flex;
width:100%;
height:100%;
}
webview.hide {
flex: 0 1;
width: 0px;
height: 0px;
}
/*滚动栏样式
::-webkit-scrollbar-track-piece {
background-color:#f5f5f5;
border-left:1px solid #d2d2d2;
}
::-webkit-scrollbar {
width:13px;
height:13px;
}
::-webkit-scrollbar-thumb {
background-color:#c2c2c2;
background-clip:padding-box;
border:1px solid #979797;
min-height:28px;
}
::-webkit-scrollbar-thumb:hover {
border:1px solid #636363;
background-color:#929292;
}
*/
/*
/*
* Context.js
* Copyright Jacob Kelley
* MIT License
......@@ -11,7 +11,7 @@
// 加载CSS
// $('head').append('<link href="/js/libs/bmenu/bmenu.css" rel="stylesheet">');
var context = context || (function () {
var options = {
fadeSpeed: 100,
filter: function ($obj) {
......@@ -23,9 +23,9 @@
};
function initialize(opts) {
options = $.extend({}, options, opts);
$(document).on('click', 'html', function () {
// $('._dropdown-context').fadeOut(options.fadeSpeed, function(){
// $('._dropdown-context').css({display:''}).find('.drop-left').removeClass('drop-left');
......@@ -48,7 +48,7 @@
$sub.addClass('drop-left');
}
});
}
// 更新设置
......@@ -120,16 +120,16 @@
}
function addContext(selector, data, event) {
var d = new Date(),
id = selector ? d.getTime() : 'none',
$menu = buildMenu(data, id);
$('#dropdown-none').remove();
$('body').append($menu);
function show(e) {
$('._dropdown-context:not(._dropdown-context-sub)').hide();
$dd = $('#dropdown-' + id);
if (typeof options.above == 'boolean' && options.above) {
$dd.addClass('_dropdown-context-up').css({
......@@ -140,12 +140,8 @@
$dd.removeClass('_dropdown-context-up');
var autoH = $dd.height() + 12;
if ((e.pageY + autoH) > $('html').height()) {
// 这里修改一下,防止菜单栏过上导致无法选择
var _top = e.pageY - 20 - autoH;
_top = _top < 0 ? 0 : _top;
$dd.addClass('_dropdown-context-up').css({
// top: e.pageY - 20 - autoH,
top: _top,
top: e.pageY - 20 - autoH,
left: e.pageX - 13
}).fadeIn(options.fadeSpeed);
} else {
......@@ -166,7 +162,7 @@
show(event);
}
}
function destroyContext(selector) {
$(document).off('contextmenu', selector).off('click', '.context-event');
}
......@@ -177,7 +173,7 @@
$('._dropdown-context').css({display:''}).find('.drop-left').removeClass('drop-left');
});
}
return {
init: initialize,
settings: updateOptions,
......@@ -197,4 +193,4 @@
ret.destroy = context.destroy;
// return ret;
window.bmenu = ret;
})();
})();
\ No newline at end of file
......@@ -14,27 +14,25 @@
(function( global, factory ) {
// 不使用module加载器,这样就可以直接在electron中引用jquery了
factory(global);
// if ( typeof module === "object" && typeof module.exports === "object" ) {
// // For CommonJS and CommonJS-like environments where a proper `window`
// // is present, execute the factory and get jQuery.
// // For environments that do not have a `window` with a `document`
// // (such as Node.js), expose a factory as module.exports.
// // This accentuates the need for the creation of a real `window`.
// // e.g. var jQuery = require("jquery")(window);
// // See ticket #14549 for more info.
// module.exports = global.document ?
// factory( global, true ) :
// function( w ) {
// if ( !w.document ) {
// throw new Error( "jQuery requires a window with a document" );
// }
// return factory( w );
// };
// } else {
// factory( global );
// }
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
......
/**
* ReactDOM v15.0.2
*
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
;(function(f) {
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f(require('react'));
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(['react'], f);
// <script>
} else {
var g;
if (typeof window !== "undefined") {
g = window;
} else if (typeof global !== "undefined") {
g = global;
} else if (typeof self !== "undefined") {
g = self;
} else {
// works providing we're not in "use strict";
// needed for Java 8 Nashorn
// see https://github.com/facebook/react/issues/3037
g = this;
}
g.ReactDOM = f(g.React);
}
})(function(React) {
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
});
/**
* ReactDOM v15.0.2
*
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOM=e(f.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED});
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#container {
display: flex;
align-items: center;
}
#left {
height: 100%;
padding: 10px;
}
#left > img {
height: 100%;
}
#right {
border-left: 1px solid rgba(158, 158, 158, 0.33);
padding-left: 10px;
}
#name {
font-size: 26px;
margin: 10px 0;
color: #009688;
font-family: sans-serif;
}
#version {
font-size: 14px;
font-family: sans-serif;
color: #9E9E9E;
}
#status {
font-size: 14px;
font-family: sans-serif;
color: #00BCD4;
margin: 5px 0;
}
'use strict';
const electron = require('electron');
const ipcRenderer = electron.ipcRenderer;
// 获取版本号
document.querySelector('#version').innerText = 'v' + ipcRenderer.sendSync('update-getVersion');
......@@ -3,8 +3,8 @@
<head>
<meta charset="utf-8"/>
<title>AntSword</title>
<link rel="stylesheet" href="ant-static://css/index.css"/>
<script src="ant-src://load.entry.js"></script>
<link rel="stylesheet" href="../static/css/index.css"/>
<script>require('../source/load.entry');</script>
</head>
<body>
<div id="loading"></div>
......
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>AntSword.Store</title>
<!-- <script src="http://localhost:8000/static/js/loader.js"></script> -->
<script src="https://asstore.github.io/v0.1/loader.js"></script>
<style>
html,body,#container,#loader{
margin: 0;padding: 0;width:100%;height:100%;
}
#loader {
display: flex;
justify-content: center;align-items: center;
}
::-webkit-scrollbar-track-piece {
background-color:#f5f5f5;
border-left:1px solid #d2d2d2;
}
::-webkit-scrollbar {
width:13px;
height:13px;
}
::-webkit-scrollbar-thumb {
background-color:#c2c2c2;
background-clip:padding-box;
border:1px solid #979797;
min-height:28px;
}
::-webkit-scrollbar-thumb:hover {
border:1px solid #636363;
background-color:#929292;
}
.cssload-loader{position:relative;width:62px;height:62px;border-radius:50%;perspective:780px}.cssload-inner{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:50%}.cssload-inner.cssload-one{left:0;top:0;animation:cssload-rotate-one 1.15s linear infinite;border-bottom:3px solid #000}.cssload-inner.cssload-two{right:0;top:0;animation:cssload-rotate-two 1.15s linear infinite;border-right:3px solid #000}.cssload-inner.cssload-three{right:0;bottom:0;animation:cssload-rotate-three 1.15s linear infinite;border-top:3px solid #000}@keyframes cssload-rotate-one{0%{transform:rotateX(35deg) rotateY(-45deg) rotateZ(0deg)}100%{transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg)}}@keyframes cssload-rotate-two{0%{transform:rotateX(50deg) rotateY(10deg) rotateZ(0deg)}100%{transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg)}}@keyframes cssload-rotate-three{0%{transform:rotateX(35deg) rotateY(55deg) rotateZ(0deg)}100%{transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg)}}</style>
</head>
<body>
<div id="container">
<div id="loader">
<div class="cssload-loader">
<div class="cssload-inner cssload-one"></div>
<div class="cssload-inner cssload-two"></div>
<div class="cssload-inner cssload-three"></div>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<title>Update</title>
<link rel="stylesheet" href="ant-static://update/style.css" />
</head>
<body>
<div id="container">
<div id="left">
<img src="ant-static://imgs/logo.png" />
</div>
<div id="right">
<div id="name">AntSword</div>
<div id="version">loading..</div>
<div id="status">Checking..</div>
</div>
</div>
</body>
<script src="ant-static://update/update.js"></script>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment