From d670e40311aed6e9a128c9e9a1ac4b273bfe07ec Mon Sep 17 00:00:00 2001 From: gnehs Date: Wed, 8 Aug 2018 17:07:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B3=BB=E7=B5=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 5 ++++- js/script.js | 27 ++++++++++++++++++++++++++- package.json | 4 ++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 83ed9531..89329415 100644 --- a/index.js +++ b/index.js @@ -84,8 +84,11 @@ app.get('/upgrade', (req, res) => { else { require('simple-git')() .pull((err, update) => { - if(update && update.summary.changes) { + if (update && update.summary.changes) { + res.send('upgrade') process.exit() + } else { + res.send('no update') } }); } diff --git a/js/script.js b/js/script.js index a23a23f0..384d5f9b 100644 --- a/js/script.js +++ b/js/script.js @@ -872,11 +872,36 @@ async function show_settings() { // PokaPlayer 詳細資料 var getinfo = await axios.get('/info/'); var checkupdate = await axios.get(`https://api.github.com/repos/gnehs/PokaPlayer/releases`); - var update = getinfo.data.version != checkupdate.data[0].tag_name ? `新版本已發佈,請立即更新 查看更新資訊` : `您的 PokaPlayer 已是最新版本` + var update = getinfo.data.version != checkupdate.data[0].tag_name ? `新版本已發佈,請立即更新 更新` : `您的 PokaPlayer 已是最新版本` var about = `PokaPlayer 是 Synology Audio Ststion 的新朋友! GitHub

版本 ${getinfo.data.version} / 開發者 ${getinfo.data.author} / ${update}

` $("#about").html(about) + + $("[data-upgrade]").click(function() { + mdui.dialog({ + title: '您確定要現在更新嗎', + content: '這將導致您在更新完畢前暫時無法使用 PokaPlayer', + buttons: [{ + text: '算ㄌ' + }, + { + text: '對啦', + onClick: async function(inst) { + mdui.alert('正在更新'); + var update = await axios.get('/upgrade/') + if (update.data == "upgrade") { + mdui.alert('重啟中'); + } else { + mdui.alert('更新完畢'); + } + } + } + ] + }); + }) + + } //- 播放音樂 diff --git a/package.json b/package.json index d0544e06..cfc07cde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pokaplayer", - "version": "0.4.3", + "version": "0.4.0", "description": "", "main": "index.js", "scripts": { @@ -31,4 +31,4 @@ "simple-git": "^1.96.0", "session-file-store": "^1.2.0" } -} +} \ No newline at end of file