Commit 17cf3999 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix, explore folder, setup gif, watcher, 2.0.6

parent 806e44e0
...@@ -84,7 +84,8 @@ module.exports = (grunt) => { ...@@ -84,7 +84,8 @@ module.exports = (grunt) => {
authors: 'MyCard', authors: 'MyCard',
exe: 'mycard.exe', exe: 'mycard.exe',
setupIcon: 'resources/win32/icon.ico', setupIcon: 'resources/win32/icon.ico',
noMsi: true noMsi: true,
loadingGif: 'resources/win32/setup.gif'
}, },
x64: { x64: {
appDirectory: 'build3/mycard-win32-x64', appDirectory: 'build3/mycard-win32-x64',
...@@ -92,7 +93,8 @@ module.exports = (grunt) => { ...@@ -92,7 +93,8 @@ module.exports = (grunt) => {
authors: 'MyCard', authors: 'MyCard',
exe: 'mycard.exe', exe: 'mycard.exe',
setupIcon: 'resources/win32/icon.ico', setupIcon: 'resources/win32/icon.ico',
noMsi: true noMsi: true,
loadingGif: 'resources/win32/setup.gif'
}, },
'bundle-ia32': { 'bundle-ia32': {
appDirectory: 'build3/mycard-win32-ia32', appDirectory: 'build3/mycard-win32-ia32',
...@@ -100,7 +102,8 @@ module.exports = (grunt) => { ...@@ -100,7 +102,8 @@ module.exports = (grunt) => {
authors: 'MyCard', authors: 'MyCard',
exe: 'mycard.exe', exe: 'mycard.exe',
setupIcon: 'resources/win32/icon.ico', setupIcon: 'resources/win32/icon.ico',
noMsi: true noMsi: true,
loadingGif: 'resources/win32/setup.gif'
}, },
'bundle-x64':{ 'bundle-x64':{
appDirectory: 'build3/mycard-win32-x64', appDirectory: 'build3/mycard-win32-x64',
...@@ -108,7 +111,8 @@ module.exports = (grunt) => { ...@@ -108,7 +111,8 @@ module.exports = (grunt) => {
authors: 'MyCard', authors: 'MyCard',
exe: 'mycard.exe', exe: 'mycard.exe',
setupIcon: 'resources/win32/icon.ico', setupIcon: 'resources/win32/icon.ico',
noMsi: true noMsi: true,
loadingGif: 'resources/win32/setup.gif'
} }
}, },
appdmg: { appdmg: {
......
...@@ -15,8 +15,11 @@ const autoUpdater = require('auto-updater'); ...@@ -15,8 +15,11 @@ const autoUpdater = require('auto-updater');
const electron = require('electron'); const electron = require('electron');
const ipcMain = electron.ipcMain; const ipcMain = electron.ipcMain;
const app = electron.app; const app = electron.app;
const shell = electron.shell;
const BrowserWindow = electron.BrowserWindow; const BrowserWindow = electron.BrowserWindow;
const watcher = {};
const data_path = app.getPath('userData'); const data_path = app.getPath('userData');
const db_path = path.join(data_path, 'db.json'); const db_path = path.join(data_path, 'db.json');
...@@ -119,6 +122,10 @@ eventemitter.on('delete', (app_id, file) => { ...@@ -119,6 +122,10 @@ eventemitter.on('delete', (app_id, file) => {
delete db.local[app_id].files[file]; delete db.local[app_id].files[file];
}); });
eventemitter.on('explore', (app_id) => {
electron.shell.showItemInFolder(path.join(db.local[app_id].path, 'deck'))
});
eventemitter.on('write', (app_id, file, data, merge) => { eventemitter.on('write', (app_id, file, data, merge) => {
let local = db.local[app_id]; let local = db.local[app_id];
if (file == 'system.conf') { if (file == 'system.conf') {
...@@ -145,6 +152,7 @@ for (let app_id in db.local) { ...@@ -145,6 +152,7 @@ for (let app_id in db.local) {
load(db.apps[app_id], db.local[app_id], done); load(db.apps[app_id], db.local[app_id], done);
} }
} }
done(); done();
function done() { function done() {
...@@ -208,7 +216,7 @@ function start_server() { ...@@ -208,7 +216,7 @@ function start_server() {
if (process.argv[1] == '--squirrel-firstrun') { if (process.argv[1] == '--squirrel-firstrun') {
setTimeout(()=> { setTimeout(()=> {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
}, 3000) }, 10000)
} else { } else {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
} }
...@@ -301,6 +309,16 @@ function load(app, local, callback) { ...@@ -301,6 +309,16 @@ function load(app, local, callback) {
}) })
} }
} }
if (!watcher[app.id]) {
fs.watch(db.local[app.id].path, {recursive: true}, (event, filename)=> {
console.log(event, filename)
load(db.apps[app.id], db.local[app.id], ()=> {
eventemitter.emit('update', app, local, event)
});
});
watcher[app.id] = true;
}
done() done()
} }
......
...@@ -133,4 +133,8 @@ body.maximized #maximize { ...@@ -133,4 +133,8 @@ body.maximized #maximize {
a { a {
cursor: default; cursor: default;
}
:not(.logged-in) > .require-login {
display: none;
} }
\ No newline at end of file
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
<nav> <nav>
<span id="brand">MyCard</span> <span id="brand">MyCard</span>
<ul> <ul>
<li id="nav-store"> <!--<li id="nav-store">
<a href="#store">商店</a> <a href="#store">商店</a>
</li> </li>-->
<li id="nav-ygopro" class="active"> <li id="nav-ygopro" class="active">
<a href="#ygopro">游戏</a> <a href="#ygopro">游戏</a>
</li> </li>
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
</li> </li>
</ul> </ul>
<div class="navbar-right"> <div class="navbar-right">
<div id="user" hidden> <div id="user">
<a href="#forum" class="profile"><img id="avatar"></a> <a href="#forum" class="require-login profile"><img id="avatar"></a>
<a href="#forum" class="profile item" id="username"></a> <a href="#forum" class="require-login profile item" id="username"></a>
<a href="#ygopro" id="logout" class="item">切换</a> <a href="#ygopro" id="logout" class="require-login item">切换账号</a>
<a href="#ygopro" id="refresh" class="item">刷新</a> <a href="#ygopro" id="refresh" class="item">刷新</a>
</div> </div>
<div id="window-buttons" hidden> <div id="window-buttons" hidden>
......
...@@ -62,7 +62,7 @@ document.getElementById("refresh").onclick = ()=> { ...@@ -62,7 +62,7 @@ document.getElementById("refresh").onclick = ()=> {
}) })
}; };
let elements = document.getElementsByClassName('profile'); /*let elements = document.getElementsByClassName('profile');
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
let element = elements.item(i); let element = elements.item(i);
element.onclick = function () { element.onclick = function () {
...@@ -72,11 +72,11 @@ for (let i = 0; i < elements.length; i++) { ...@@ -72,11 +72,11 @@ for (let i = 0; i < elements.length; i++) {
user_webview.src = user_url; user_webview.src = user_url;
} }
} }
} }*/
ipcRenderer.on('login', (event, user)=> { ipcRenderer.on('login', (event, user)=> {
console.log(event, user); console.log(event, user);
document.getElementById('avatar').src = user.avatar_url; document.getElementById('avatar').src = user.avatar_url;
document.getElementById('username').innerHTML = user.username; document.getElementById('username').innerHTML = user.username;
document.getElementById('user').removeAttribute('hidden'); document.getElementById('user').className = 'logged-in'
}); });
\ No newline at end of file
...@@ -36,6 +36,7 @@ let handleStartupEvent = function () { ...@@ -36,6 +36,7 @@ let handleStartupEvent = function () {
}; };
shortcuts.create(path.join(app.getPath('desktop'), 'MyCard.lnk'), process.execPath, done); shortcuts.create(path.join(app.getPath('desktop'), 'MyCard.lnk'), process.execPath, done);
shortcuts.create('%APPDATA%/Microsoft/Windows/Start Menu/Programs/MyCard.lnk', process.execPath, done);
let key = new reg({hive: reg.HKCU, key: '\\Software\\Classes\\mycard'}); let key = new reg({hive: reg.HKCU, key: '\\Software\\Classes\\mycard'});
key.set('URL Protocol', reg.REG_SZ, '"' + process.execPath + '"', done); key.set('URL Protocol', reg.REG_SZ, '"' + process.execPath + '"', done);
key = new reg({hive: reg.HKCU, key: '\\Software\\Classes\\mycard\\shell\\open\\command'}); key = new reg({hive: reg.HKCU, key: '\\Software\\Classes\\mycard\\shell\\open\\command'});
......
{ {
"name": "mycard", "name": "mycard",
"description": "a game platform", "description": "a game platform",
"version": "2.0.5", "version": "2.0.6",
"main": "main.js", "main": "main.js",
"license": "UNLICENSED", "license": "UNLICENSED",
"repository": "github:mycard/mycard", "repository": "github:mycard/mycard",
......
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