Skip to content

Commit

Permalink
Merge commit '5231cb5e9772b10e81209615d4a29ace4f2cafdf'
Browse files Browse the repository at this point in the history
* commit '5231cb5e9772b10e81209615d4a29ace4f2cafdf':
  現在會根據 debug 開關自動選擇分支了
  更換 README 截圖
  更換 navigo CDN 來源
  404 時導向首頁
  更改 logo
  • Loading branch information
lekoOwO committed Aug 12, 2018
2 parents c8ce3ad + 5231cb5 commit fbb887d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PokaPlayer 是 Synology Audio Ststion 的新朋友!

## 截圖

<img src="https://i.imgur.com/KnrvGup.jpg" width="500px">
<img src="https://user-images.githubusercontent.com/16719720/44003086-75cd161c-9e7f-11e8-8b56-b515612c2dd8.png" width="500px">

## 開始使用

Expand Down Expand Up @@ -46,4 +46,5 @@ PokaPlayer 是 Synology Audio Ststion 的新朋友!
Repo 內附的背景來自 [Free Set of 40+ Material Design Backgrounds](https://www.oxygenna.com/news/brand-new-set-of-40-material-design-backgrounds)

## 貢獻者

[@rexx0520](https://github.com/rexx0520)
Binary file modified img/PokaPlayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/PokaPlayer.xd
Binary file not shown.
32 changes: 28 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const config = require('./config.json'); // 設定檔
const package = require('./package.json'); // 設定檔
const schedule = require('node-schedule'); // 很會計時ㄉ朋友
const base64 = require('base-64');

//express
const express = require('express');
const FileStore = require('session-file-store')(require('express-session')); // session
Expand All @@ -15,10 +16,32 @@ const session = require('express-session')({
const helmet = require('helmet'); // 防範您的應用程式出現已知的 Web 漏洞
const bodyParser = require('body-parser'); // 讀入 post 請求
const app = express(); // Node.js Web 架構
const git = require('simple-git/promise')(__dirname);
const server = require('http').createServer(app),
io = require('socket.io').listen(server),
sharedsession = require("express-socket.io-session")

const git = require('simple-git/promise')(__dirname);

// 檢查 branch

git
.raw(['symbolic-ref', '--short', 'HEAD'])
.then(branch => {
if (branch != (config.PokaPlayer.debug ? 'dev' : 'master')) {
git
.fetch(["--all"])
.then(() => git.reset(["--hard", "origin/" + config.PokaPlayer.debug ? 'dev' : 'master']))
.then(() => git.checkout(config.PokaPlayer.debug ? 'dev' : 'master'))
.then(process.exit)
.catch(err => {
console.error('failed: ', err)
socket.emit('err', err.toString())
process.exit()
})
}
})


app.set('views', __dirname + '/views');
app.set('view engine', 'pug')
app.use(bodyParser.urlencoded({ extended: true }));
Expand Down Expand Up @@ -300,7 +323,8 @@ async function api(dsm, CGI_PATH, API_NAME, METHOD, VERSION = 1, PARAMS) {
});
});
}
app.use((req, res, next) => {
res.status(404).redirect("/")
});
// 報錯處理
process.on('uncaughtException', function(err) {
console.log(err);
});
process.on('uncaughtException', (err) => console.log(err));
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pokaplayer",
"version": "0.6.1",
"version": "0.6.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ html
script(src='//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js')
script(src='//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js')
script(src='//cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js')
script(src='//unpkg.com/navigo@6')
script(src='//cdn.jsdelivr.net/npm/navigo@7.1.2/lib/navigo.min.js')
script(src='/js/lyrics.min.js')
script(src='/js/base64.js')
script(src='/js/template.js')
Expand Down

0 comments on commit fbb887d

Please sign in to comment.