Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
0c5f8e33
Commit
0c5f8e33
authored
Feb 01, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto update
parent
abba79e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
21 deletions
+57
-21
Gruntfile.js
Gruntfile.js
+27
-3
apps.js
apps.js
+20
-2
bundle/bundle.json
bundle/bundle.json
+0
-0
main.js
main.js
+9
-15
package.json
package.json
+1
-1
No files found.
Gruntfile.js
View file @
0c5f8e33
...
...
@@ -10,12 +10,12 @@ module.exports = (grunt) => {
break
;
case
'
win32
'
:
grunt
.
loadNpmTasks
(
'
grunt-electron-installer
'
);
release_task
=
[
'
electron:win32
'
,
'
create-windows-installer
'
];
release_task
=
[
'
electron:win32
'
,
'
c
opy:bundle
'
,
'
c
reate-windows-installer
'
];
break
;
}
grunt
.
initConfig
({
clean
:
[
"
build2
"
,
"
build3
"
,
"
build4
"
],
clean
:
[
"
build2
"
,
"
build3
"
],
copy
:
{
app
:
{
expand
:
true
,
...
...
@@ -33,6 +33,14 @@ module.exports = (grunt) => {
cwd
:
'
build1
'
,
src
:
[
'
node_modules/**
'
,
'
bin/**
'
],
dest
:
'
build2
'
},
'
bundle
'
:
{
expand
:
true
,
options
:
{
timestamp
:
true
},
src
:
[
'
build3/**
'
,
'
bundle/**
'
],
dest
:
'
build3-bundle
'
}
},
...
...
@@ -69,12 +77,28 @@ module.exports = (grunt) => {
noMsi
:
true
},
x64
:
{
appDirectory
:
'
build3/mycard-win32-x64
'
,
appDirectory
:
'
build3
-bundle
/mycard-win32-x64
'
,
outputDirectory
:
'
build4/win32-x64
'
,
authors
:
'
MyCard
'
,
exe
:
'
mycard.exe
'
,
setupIcon
:
'
resources/win/icon.ico
'
,
noMsi
:
true
},
'
bundle-ia32
'
:
{
appDirectory
:
'
build3-bundle/mycard-win32-ia32
'
,
outputDirectory
:
'
build4-bundle/win32-ia32
'
,
authors
:
'
MyCard
'
,
exe
:
'
mycard.exe
'
,
setupIcon
:
'
resources/win/icon.ico
'
,
noMsi
:
true
},
'
bundle-x64
'
:{
appDirectory
:
'
build3-bundle/mycard-win32-x64
'
,
outputDirectory
:
'
build4-bundle/win32-x64
'
,
authors
:
'
MyCard
'
,
exe
:
'
mycard.exe
'
,
setupIcon
:
'
resources/win/icon.ico
'
,
noMsi
:
true
}
},
appdmg
:
{
...
...
apps.js
View file @
0c5f8e33
...
...
@@ -11,6 +11,7 @@ const mkdirp = require('mkdirp');
const
EventEmitter
=
require
(
'
events
'
);
const
eventemitter
=
new
EventEmitter
();
const
autoUpdater
=
require
(
'
auto-updater
'
);
const
electron
=
require
(
'
electron
'
);
const
ipcMain
=
electron
.
ipcMain
;
const
app
=
electron
.
app
;
...
...
@@ -29,7 +30,7 @@ db.version = app.getVersion();
db
.
platform
=
process
.
platform
;
db
.
default_apps_path
=
path
.
join
(
data_path
,
'
apps
'
);
var
bundle
;
let
bundle
;
try
{
bundle
=
require
(
'
./bundle.json
'
)
}
catch
(
error
)
{
...
...
@@ -87,7 +88,7 @@ eventemitter.on('install', (app, options) => {
});
eventemitter
.
on
(
'
action
'
,
function
(
app_id
,
action
,
options
)
{
var
local
=
db
.
local
[
app_id
];
let
local
=
db
.
local
[
app_id
];
Object
.
assign
(
local
.
files
[
'
system.conf
'
].
content
,
options
);
fs
.
writeFile
(
path
.
join
(
local
.
path
,
'
system.conf
'
),
ini
.
stringify
(
local
.
files
[
'
system.conf
'
].
content
,
{
whitespace
:
true
}),
(
error
)
=>
{
if
(
error
)
return
console
.
log
(
error
);
...
...
@@ -109,6 +110,7 @@ eventemitter.on('action', function (app_id, action, options) {
window
.
restore
()
}
})
})
});
...
...
@@ -197,6 +199,22 @@ function start_server() {
}
save_db
();
});
autoUpdater
.
setFeedURL
(
'
https://mycard.moe/update
'
);
autoUpdater
.
checkForUpdates
();
/*autoUpdater.on('checking-for-update', ()=>{
console.log('checking-for-update')
});
autoUpdater.on('update-available', ()=>{
console.log('update-available')
});
autoUpdater.on('update-not-available', ()=>{
console.log('update-not-available')
});*/
autoUpdater
.
on
(
'
update-downloaded
'
,
()
=>
{
autoUpdater
.
quitAndInstall
()
})
}
function
load
(
app
,
local
,
callback
)
{
...
...
bundle.json
→
bundle
/bundle
.json
View file @
0c5f8e33
File moved
main.js
View file @
0c5f8e33
...
...
@@ -4,12 +4,12 @@ const electron = require('electron');
const
app
=
electron
.
app
;
// Module to control application life.
const
BrowserWindow
=
electron
.
BrowserWindow
;
// Module to create native browser window.
var
handleStartupEvent
=
function
()
{
let
handleStartupEvent
=
function
()
{
if
(
process
.
platform
!==
'
win32
'
)
{
return
false
;
}
var
squirrelCommand
=
process
.
argv
[
1
];
let
squirrelCommand
=
process
.
argv
[
1
];
switch
(
squirrelCommand
)
{
case
'
--squirrel-install
'
:
case
'
--squirrel-updated
'
:
...
...
@@ -35,14 +35,8 @@ var handleStartupEvent = function () {
}
};
let
key
=
new
reg
({
hive
:
reg
.
HKCU
,
key
:
'
\\
Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Explorer
\\
User Shell Folders
'
});
key
.
get
(
'
Desktop
'
,
(
error
,
item
)
=>
{
shortcuts
.
create
(
path
.
join
(
item
.
value
,
'
mycard.lnk
'
),
process
.
execPath
,
done
)
});
key
=
new
reg
({
hive
:
reg
.
HKCU
,
key
:
'
\\
Software
\\
Classes
\\
mycard
'
});
shortcuts
.
create
(
path
.
join
(
app
.
getPath
(
'
desktop
'
),
'
MyCard.lnk
'
),
process
.
execPath
,
done
);
let
key
=
new
reg
({
hive
:
reg
.
HKCU
,
key
:
'
\\
Software
\\
Classes
\\
mycard
'
});
key
.
set
(
'
URL Protocol
'
,
reg
.
REG_SZ
,
'
"
'
+
process
.
execPath
+
'
"
'
,
done
);
key
=
new
reg
({
hive
:
reg
.
HKCU
,
key
:
'
\\
Software
\\
Classes
\\
mycard
\\
shell
\\
open
\\
command
'
});
key
.
set
(
''
,
reg
.
REG_SZ
,
'
"
'
+
process
.
execPath
+
'
" "%i"
'
,
done
);
...
...
@@ -77,7 +71,7 @@ if (handleStartupEvent()) {
return
;
}
var
shouldQuit
=
app
.
makeSingleInstance
(
function
(
commandLine
,
workingDirectory
)
{
let
shouldQuit
=
app
.
makeSingleInstance
(
function
(
commandLine
,
workingDirectory
)
{
// Someone tried to run a second instance, we should focus our window.
if
(
mainWindow
)
{
if
(
mainWindow
.
isMinimized
())
mainWindow
.
restore
();
...
...
@@ -93,7 +87,7 @@ if (shouldQuit) {
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var
mainWindow
=
null
;
let
mainWindow
=
null
;
// Quit when all windows are closed.
app
.
on
(
'
window-all-closed
'
,
function
()
{
...
...
@@ -137,14 +131,14 @@ app.on('ready', function () {
mainWindow
.
webContents
.
on
(
'
dom-ready
'
,
()
=>
{
if
(
local
)
{
mainWindow
.
webContents
.
executeJavaScript
(
`
var
webview = document.getElementById('ygopro');
let
webview = document.getElementById('ygopro');
webview.src = 'http://local.mycard.moe:3000/'
`
)
}
if
(
dev
)
{
mainWindow
.
webContents
.
openDevTools
();
mainWindow
.
webContents
.
executeJavaScript
(
`
var
webview = document.getElementById('ygopro');
let
webview = document.getElementById('ygopro');
webview.addEventListener("dom-ready", function() {
webview.openDevTools();
})
...
...
@@ -164,7 +158,7 @@ app.on('ready', function () {
//debug
/*<webview id="ygopro" src="http://local.mycard.moe:3000/"></webview>
var
webview = document.getElementById(hash);
let
webview = document.getElementById(hash);
webview.addEventListener("dom-ready", function () {
webview.openDevTools();
});*/
...
...
package.json
View file @
0c5f8e33
{
"name"
:
"mycard"
,
"description"
:
"a game platform"
,
"version"
:
"2.0.
2
"
,
"version"
:
"2.0.
3
"
,
"main"
:
"main.js"
,
"license"
:
"UNLICENSED"
,
"repository"
:
"github:mycard/mycard"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment