Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
moecube
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
JoyJ
moecube
Commits
57e1550b
Commit
57e1550b
authored
Nov 04, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto update
parent
61a1858b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
21 deletions
+34
-21
.travis.yml
.travis.yml
+1
-1
index.js
index.js
+15
-19
update.html
update.html
+18
-1
No files found.
.travis.yml
View file @
57e1550b
...
@@ -42,7 +42,7 @@ script:
...
@@ -42,7 +42,7 @@ script:
deploy
:
deploy
:
provider
:
script
provider
:
script
script
:
bash -c 'ssh-keyscan wudizhanche.mycard.moe >> ~/.ssh/known_hosts; if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
scp
dist/mac/MyCard-$TRAVIS_TAG.dmg dist/mac/MyCard-$TRAVIS_TAG-mac.zip root@wudizhanche.mycard.moe:/data/uploads; else scp dist/mycard-$TRAVIS_TAG-x86_64.AppImage root@wudizhanche.mycard.moe:/data/uploads; fi'
script
:
bash -c 'ssh-keyscan wudizhanche.mycard.moe >> ~/.ssh/known_hosts; if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
env; scp -v
dist/mac/MyCard-$TRAVIS_TAG.dmg dist/mac/MyCard-$TRAVIS_TAG-mac.zip root@wudizhanche.mycard.moe:/data/uploads; else scp dist/mycard-$TRAVIS_TAG-x86_64.AppImage root@wudizhanche.mycard.moe:/data/uploads; fi'
skip_cleanup
:
true
skip_cleanup
:
true
on
:
on
:
tags
:
true
tags
:
true
\ No newline at end of file
index.js
View file @
57e1550b
'
use strict
'
;
'
use strict
'
;
const
electron
=
require
(
'
electron
'
);
const
{
ipcMain
,
app
,
BrowserWindow
}
=
require
(
'
electron
'
);
const
autoUpdater
=
require
(
"
electron-auto-updater
"
).
autoUpdater
;
const
{
autoUpdater
}
=
require
(
"
electron-auto-updater
"
)
;
if
(
process
.
platform
==
'
darwin
'
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
autoUpdater
.
setFeedURL
(
"
https://wudizhanche.mycard.moe/update
"
);
try
{
autoUpdater
.
setFeedURL
(
"
https://wudizhanche.mycard.moe/update
"
);
}
catch
(
err
)
{
}
}
}
autoUpdater
.
on
(
'
error
'
,
(
event
)
=>
console
.
log
(
'
error
'
,
event
));
autoUpdater
.
on
(
'
error
'
,
(
event
)
=>
console
.
log
(
'
error
'
,
event
));
autoUpdater
.
on
(
'
checking-for-update
'
,
(
event
)
=>
console
.
log
(
'
checking-for-update
'
,
event
));
autoUpdater
.
on
(
'
checking-for-update
'
,
(
event
)
=>
console
.
log
(
'
checking-for-update
'
,
event
));
autoUpdater
.
on
(
'
update-available
'
,
(
event
)
=>
console
.
log
(
'
update-available
'
,
event
));
autoUpdater
.
on
(
'
update-available
'
,
(
event
)
=>
console
.
log
(
'
update-available
'
,
event
));
autoUpdater
.
on
(
'
update-not-available
'
,
(
event
)
=>
console
.
log
(
'
update-not-available
'
,
event
));
autoUpdater
.
on
(
'
update-not-available
'
,
(
event
)
=>
console
.
log
(
'
update-not-available
'
,
event
));
autoUpdater
.
checkForUpdates
();
console
.
log
(
1
);
let
updateWindow
;
let
updateWindow
;
autoUpdater
.
on
(
'
update-downloaded
'
,
(
event
)
=>
{
autoUpdater
.
on
(
'
update-downloaded
'
,
(
event
)
=>
{
updateWindow
=
new
BrowserWindow
({
updateWindow
=
new
BrowserWindow
({
width
:
640
,
width
:
640
,
height
:
480
,
height
:
480
,
// frame: process.platform == 'darwin',
// titleBarStyle: process.platform == 'darwin' ? 'hidden' : null
});
});
// and load the index.html of the app.
updateWindow
.
loadURL
(
`file://
${
__dirname
}
/update.html`
);
updateWindow
.
loadURL
(
`file://
${
__dirname
}
/update.html`
);
// Open the DevTools.
// updateWindow.webContents.openDevTools();
// Emitted when the window is closed.
updateWindow
.
on
(
'
closed
'
,
function
()
{
updateWindow
.
on
(
'
closed
'
,
function
()
{
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
updateWindow
=
null
updateWindow
=
null
});
ipcMain
.
on
(
'
update
'
,
(
event
,
arg
)
=>
{
autoUpdater
.
quitAndInstall
()
})
})
});
});
const
app
=
electron
.
app
;
const
BrowserWindow
=
electron
.
BrowserWindow
;
const
child_process
=
require
(
'
child_process
'
);
const
child_process
=
require
(
'
child_process
'
);
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
...
@@ -179,7 +172,10 @@ function createWindow() {
...
@@ -179,7 +172,10 @@ function createWindow() {
// This method will be called when Electron has finished
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
// Some APIs can only be used after this event occurs.
app
.
on
(
'
ready
'
,
createWindow
);
app
.
on
(
'
ready
'
,
()
=>
{
autoUpdater
.
checkForUpdates
();
createWindow
()
});
// Quit when all windows are closed.
// Quit when all windows are closed.
app
.
on
(
'
window-all-closed
'
,
function
()
{
app
.
on
(
'
window-all-closed
'
,
function
()
{
...
...
update.html
View file @
57e1550b
update
<!DOCTYPE html>
\ No newline at end of file
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
更新
</title>
</head>
<body>
有新版本,点击更新
<button
id=
"update"
>
更新
</button>
如果自动更新失败,请至 https://mycard.moe 手动下载最新版本
<script>
const
{
ipcRenderer
}
=
require
(
'
electron
'
);
document
.
getElementById
(
'
update
'
).
addEventListener
(
'
click
'
,
()
=>
{
ipcRenderer
.
send
(
'
update
'
);
})
</script>
</body>
</html>
\ No newline at end of file
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